Skip to content

Commit e9d1c66

Browse files
authored
Merge pull request #2937 from SUI-Components/fix/export-atomToastPositions
fix atomToastPositions export
2 parents 6296c1a + 58a72cb commit e9d1c66

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

components/atom/toast/src/config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,14 @@ export const AUTO_CLOSE_TIMES = {
1212
} as const
1313

1414
export type AutoCloseTime = typeof AUTO_CLOSE_TIMES[keyof typeof AUTO_CLOSE_TIMES]
15-
export type Position = 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right'
15+
16+
export const POSITIONS = {
17+
topLeft: 'top-left',
18+
top: 'top',
19+
topRight: 'top-right',
20+
bottomLeft: 'bottom-left',
21+
bottom: 'bottom',
22+
bottomRight: 'bottom-right'
23+
} as const
24+
25+
export type Position = typeof POSITIONS[keyof typeof POSITIONS]

components/atom/toast/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {type PropsWithChildren, useCallback, useEffect, useRef, useState} from '
33

44
import cx from 'classnames'
55

6-
import {type AutoCloseTime, type Position, AUTO_CLOSE_TIMES, BASE_CLASS} from './config'
6+
import {type AutoCloseTime, type Position, AUTO_CLOSE_TIMES, BASE_CLASS, POSITIONS} from './config'
77
import {EFFECT_DELAY} from './config'
88

99
export interface AtomToastProps {
@@ -119,6 +119,6 @@ const AtomToast = ({
119119

120120
AtomToast.displayName = 'AtomToast'
121121

122-
export {AUTO_CLOSE_TIMES as atomToastAutoCloseTimes}
122+
export {POSITIONS as atomToastPositions, AUTO_CLOSE_TIMES as atomToastAutoCloseTimes}
123123

124124
export default AtomToast

components/atom/toast/test/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ describe(json.name, () => {
2222
it('library should include defined exported elements', () => {
2323
// Given
2424
const library = pkg
25-
const libraryExportedMembers = ['atomToastAutoCloseTimes', 'default']
25+
const libraryExportedMembers = ['atomToastAutoCloseTimes', 'atomToastPositions', 'default']
2626

2727
// When
28-
const {atomToastAutoCloseTimes, default: AtomToast, ...others} = library
28+
const {atomToastAutoCloseTimes, atomToastPositions, default: AtomToast, ...others} = library
2929

3030
// Then
3131
expect(Object.keys(library).length).to.equal(libraryExportedMembers.length)

0 commit comments

Comments
 (0)