@mindlogic-ai/logician-ui 5.0.0-alpha.2 → 5.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +5 -3
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Badge/Badge.mjs +5 -3
- package/dist/components/Badge/Badge.mjs.map +1 -1
- package/dist/components/Badge/Badge.types.d.ts +7 -5
- package/dist/components/Badge/Badge.types.d.ts.map +1 -1
- package/dist/components/Banner/Banner.types.d.ts +24 -1
- package/dist/components/Banner/Banner.types.d.ts.map +1 -1
- package/dist/components/Card/Card.types.d.ts +12 -0
- package/dist/components/Card/Card.types.d.ts.map +1 -1
- package/dist/components/ColorMode/ColorModeToggle.d.ts +7 -2
- package/dist/components/ColorMode/ColorModeToggle.d.ts.map +1 -1
- package/dist/components/ColorMode/ColorModeToggle.js +8 -3
- package/dist/components/ColorMode/ColorModeToggle.js.map +1 -1
- package/dist/components/ColorMode/ColorModeToggle.mjs +8 -3
- package/dist/components/ColorMode/ColorModeToggle.mjs.map +1 -1
- package/dist/components/Confetti/Confetti.types.d.ts +5 -1
- package/dist/components/Confetti/Confetti.types.d.ts.map +1 -1
- package/dist/components/Confetti/confettiColors.d.ts +5 -5
- package/dist/components/Confetti/confettiColors.js +5 -5
- package/dist/components/Confetti/confettiColors.mjs +5 -5
- package/dist/components/ErrorFallback/ErrorFallback.types.d.ts +6 -0
- package/dist/components/ErrorFallback/ErrorFallback.types.d.ts.map +1 -1
- package/dist/components/Form/FormModalFooter/FormModalFooter.types.d.ts +4 -1
- package/dist/components/Form/FormModalFooter/FormModalFooter.types.d.ts.map +1 -1
- package/dist/components/LineGraph/LineGraph.d.ts.map +1 -1
- package/dist/components/LineGraph/LineGraph.js +4 -5
- package/dist/components/LineGraph/LineGraph.js.map +1 -1
- package/dist/components/LineGraph/LineGraph.mjs +5 -6
- package/dist/components/LineGraph/LineGraph.mjs.map +1 -1
- package/dist/components/LineGraph/LineGraph.types.d.ts +12 -2
- package/dist/components/LineGraph/LineGraph.types.d.ts.map +1 -1
- package/dist/components/LineGraph/seriesColors.d.ts +12 -8
- package/dist/components/LineGraph/seriesColors.d.ts.map +1 -1
- package/dist/components/LineGraph/seriesColors.js +8 -7
- package/dist/components/LineGraph/seriesColors.js.map +1 -1
- package/dist/components/LineGraph/seriesColors.mjs +8 -7
- package/dist/components/LineGraph/seriesColors.mjs.map +1 -1
- package/dist/components/Masonry/Masonry.types.d.ts +8 -3
- package/dist/components/Masonry/Masonry.types.d.ts.map +1 -1
- package/dist/components/Menu/MenuItem.types.d.ts +8 -0
- package/dist/components/Menu/MenuItem.types.d.ts.map +1 -1
- package/dist/components/Modal/ModalCloseButton.d.ts +1 -1
- package/dist/components/Modal/ModalCloseButton.js +1 -1
- package/dist/components/Modal/ModalCloseButton.mjs +1 -1
- package/dist/components/Pagination/Pagination.d.ts +11 -10
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.js +11 -10
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/Pagination.mjs +11 -10
- package/dist/components/Pagination/Pagination.mjs.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +9 -0
- package/dist/components/ProgressBar/ProgressBar.types.d.ts.map +1 -1
- package/dist/components/RadialProgress/RadialProgress.types.d.ts +21 -1
- package/dist/components/RadialProgress/RadialProgress.types.d.ts.map +1 -1
- package/dist/components/SeeMoreButton/SeeMoreButton.types.d.ts +8 -0
- package/dist/components/SeeMoreButton/SeeMoreButton.types.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +6 -7
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.mjs +6 -7
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/components/SegmentedProgressBar/SegmentedProgressBar.types.d.ts +2 -0
- package/dist/components/SegmentedProgressBar/SegmentedProgressBar.types.d.ts.map +1 -1
- package/dist/components/Toast/Toast.styles.d.ts +6 -2
- package/dist/components/Toast/Toast.styles.d.ts.map +1 -1
- package/dist/components/Toast/Toast.styles.js +18 -10
- package/dist/components/Toast/Toast.styles.js.map +1 -1
- package/dist/components/Toast/Toast.styles.mjs +18 -10
- package/dist/components/Toast/Toast.styles.mjs.map +1 -1
- package/dist/theme/colors.d.ts +2 -2
- package/dist/theme/colors.d.ts.map +1 -1
- package/dist/theme/colors.js +22 -2
- package/dist/theme/colors.js.map +1 -1
- package/dist/theme/colors.mjs +23 -3
- package/dist/theme/colors.mjs.map +1 -1
- package/dist/theme/palette.generated.d.ts +98 -0
- package/dist/theme/palette.generated.d.ts.map +1 -1
- package/dist/theme/palette.generated.js +99 -0
- package/dist/theme/palette.generated.js.map +1 -1
- package/dist/theme/palette.generated.mjs +99 -1
- package/dist/theme/palette.generated.mjs.map +1 -1
- package/dist/theme/paletteSwatches.d.ts +20 -0
- package/dist/theme/paletteSwatches.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +85 -0
- package/src/components/Accordion/Accordion.usage.mdx +200 -0
- package/src/components/Appear/Appear.usage.mdx +107 -0
- package/src/components/Avatar/Avatar.stories.tsx +71 -1
- package/src/components/Avatar/Avatar.usage.mdx +166 -0
- package/src/components/Badge/Badge.stories.tsx +193 -3
- package/src/components/Badge/Badge.tsx +5 -3
- package/src/components/Badge/Badge.types.ts +7 -5
- package/src/components/Badge/Badge.usage.mdx +265 -0
- package/src/components/Banner/Banner.stories.tsx +152 -2
- package/src/components/Banner/Banner.types.ts +30 -1
- package/src/components/Banner/Banner.usage.mdx +233 -0
- package/src/components/BottomSheet/BottomSheet.stories.tsx +168 -1
- package/src/components/BottomSheet/BottomSheet.usage.mdx +216 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +59 -0
- package/src/components/Breadcrumb/Breadcrumb.usage.mdx +181 -0
- package/src/components/Button/Button.stories.tsx +263 -3
- package/src/components/Button/Button.usage.mdx +342 -0
- package/src/components/Card/Card.stories.tsx +106 -0
- package/src/components/Card/Card.types.ts +12 -0
- package/src/components/Card/Card.usage.mdx +216 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +140 -13
- package/src/components/Checkbox/Checkbox.usage.mdx +214 -0
- package/src/components/Chip/Chip.usage.mdx +78 -0
- package/src/components/Code/Code.stories.tsx +60 -0
- package/src/components/Code/Code.usage.mdx +187 -0
- package/src/components/CodeTabs/CodeTabs.stories.tsx +53 -0
- package/src/components/CodeTabs/CodeTabs.usage.mdx +176 -0
- package/src/components/Collapsible/Collapsible.stories.tsx +58 -0
- package/src/components/Collapsible/Collapsible.usage.mdx +173 -0
- package/src/components/ColorMode/ColorMode.stories.tsx +50 -0
- package/src/components/ColorMode/ColorMode.usage.mdx +135 -0
- package/src/components/ColorMode/ColorModeToggle.tsx +10 -3
- package/src/components/Confetti/Confetti.types.ts +5 -1
- package/src/components/Confetti/Confetti.usage.mdx +111 -0
- package/src/components/Confetti/confettiColors.ts +5 -5
- package/src/components/Container/Container.stories.tsx +32 -0
- package/src/components/Container/Container.usage.mdx +130 -0
- package/src/components/CopyableCode/CopyableCode.stories.tsx +62 -0
- package/src/components/CopyableCode/CopyableCode.usage.mdx +168 -0
- package/src/components/CountBadge/CountBadge.stories.tsx +69 -0
- package/src/components/CountBadge/CountBadge.usage.mdx +215 -0
- package/src/components/CountUp/CountUp.usage.mdx +107 -0
- package/src/components/DatePicker/DatePicker.usage.mdx +177 -0
- package/src/components/DatePicker/RangeDatePicker.stories.tsx +87 -3
- package/src/components/ErrorFallback/ErrorFallback.types.ts +6 -0
- package/src/components/ErrorFallback/ErrorFallback.usage.mdx +127 -0
- package/src/components/ExpandableText/ExpandableText.stories.tsx +55 -0
- package/src/components/ExpandableText/ExpandableText.usage.mdx +176 -0
- package/src/components/FileInput/FileInput.stories.tsx +38 -1
- package/src/components/FileInput/FileInput.usage.mdx +178 -0
- package/src/components/FileItem/FileItem.stories.tsx +71 -0
- package/src/components/FileItem/FileItem.usage.mdx +180 -0
- package/src/components/FileList/FileList.stories.tsx +25 -0
- package/src/components/FileList/FileList.usage.mdx +165 -0
- package/src/components/FlyTo/FlyTo.usage.mdx +99 -0
- package/src/components/Form/Form.stories.tsx +149 -0
- package/src/components/Form/Form.usage.mdx +201 -0
- package/src/components/Form/FormModalFooter/FormModalFooter.types.ts +4 -1
- package/src/components/FormControl/FormControl.stories.tsx +35 -0
- package/src/components/FormControl/FormControl.usage.mdx +128 -0
- package/src/components/FormIntegration/FormIntegration.usage.mdx +158 -0
- package/src/components/FormLabel/FormLabel.stories.tsx +71 -0
- package/src/components/FormLabel/FormLabel.usage.mdx +125 -0
- package/src/components/Icon/Icon.stories.tsx +61 -1
- package/src/components/Icon/Icon.usage.mdx +158 -0
- package/src/components/IconButton/IconButton.stories.tsx +209 -5
- package/src/components/IconButton/IconButton.usage.mdx +273 -0
- package/src/components/InfoSprinkle/InfoSprinkle.stories.tsx +77 -1
- package/src/components/InfoSprinkle/InfoSprinkle.usage.mdx +189 -0
- package/src/components/InlineCode/InlineCode.stories.tsx +75 -0
- package/src/components/InlineCode/InlineCode.usage.mdx +142 -0
- package/src/components/Input/Input.stories.tsx +180 -0
- package/src/components/Input/Input.usage.mdx +278 -0
- package/src/components/LineGraph/LineGraph.stories.tsx +112 -0
- package/src/components/LineGraph/LineGraph.tsx +4 -5
- package/src/components/LineGraph/LineGraph.types.ts +12 -2
- package/src/components/LineGraph/LineGraph.usage.mdx +186 -0
- package/src/components/LineGraph/seriesColors.test.ts +11 -10
- package/src/components/LineGraph/seriesColors.ts +18 -16
- package/src/components/Loaders/Loaders.stories.tsx +93 -0
- package/src/components/Loaders/Loaders.usage.mdx +180 -0
- package/src/components/LogicianProvider/LogicianProvider.usage.mdx +98 -0
- package/src/components/Markdown/Markdown.stories.tsx +53 -0
- package/src/components/Markdown/Markdown.usage.mdx +182 -0
- package/src/components/Masonry/Masonry.stories.tsx +63 -1
- package/src/components/Masonry/Masonry.types.ts +8 -3
- package/src/components/Masonry/Masonry.usage.mdx +142 -0
- package/src/components/MaxLengthIndicator/MaxLengthIndicator.stories.tsx +57 -0
- package/src/components/MaxLengthIndicator/MaxLengthIndicator.usage.mdx +125 -0
- package/src/components/Menu/Menu.stories.tsx +146 -2
- package/src/components/Menu/Menu.usage.mdx +230 -0
- package/src/components/Menu/MenuItem.types.ts +8 -0
- package/src/components/Modal/Modal.stories.tsx +177 -1
- package/src/components/Modal/Modal.usage.mdx +262 -0
- package/src/components/Modal/ModalCloseButton.tsx +1 -1
- package/src/components/MonthPicker/MonthPicker.stories.tsx +30 -0
- package/src/components/MonthPicker/MonthPicker.usage.mdx +191 -0
- package/src/components/Pagination/Pagination.stories.tsx +90 -1
- package/src/components/Pagination/Pagination.tsx +11 -10
- package/src/components/Pagination/Pagination.usage.mdx +186 -0
- package/src/components/PasswordInput/PasswordInput.stories.tsx +51 -0
- package/src/components/PasswordInput/PasswordInput.usage.mdx +193 -0
- package/src/components/PinInput/PinInput.stories.tsx +91 -0
- package/src/components/PinInput/PinInput.usage.mdx +194 -0
- package/src/components/Popover/Popover.stories.tsx +104 -1
- package/src/components/Popover/Popover.usage.mdx +197 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +92 -1
- package/src/components/ProgressBar/ProgressBar.types.ts +9 -0
- package/src/components/ProgressBar/ProgressBar.usage.mdx +210 -0
- package/src/components/Pulse/Pulse.usage.mdx +102 -0
- package/src/components/RadialProgress/RadialProgress.stories.tsx +74 -1
- package/src/components/RadialProgress/RadialProgress.types.ts +21 -1
- package/src/components/RadialProgress/RadialProgress.usage.mdx +153 -0
- package/src/components/Radio/Radio.stories.tsx +119 -0
- package/src/components/Radio/Radio.usage.mdx +187 -0
- package/src/components/Reveal/Reveal.usage.mdx +105 -0
- package/src/components/ScaledContext/ScaledContext.usage.mdx +111 -0
- package/src/components/SeeMoreButton/SeeMoreButton.stories.tsx +146 -2
- package/src/components/SeeMoreButton/SeeMoreButton.types.ts +8 -0
- package/src/components/SeeMoreButton/SeeMoreButton.usage.mdx +213 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +69 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +6 -7
- package/src/components/SegmentedControl/SegmentedControl.usage.mdx +209 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBar.stories.tsx +54 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBar.types.ts +2 -0
- package/src/components/SegmentedProgressBar/SegmentedProgressBar.usage.mdx +145 -0
- package/src/components/Select/Select.stories.tsx +209 -1
- package/src/components/Select/Select.usage.mdx +278 -0
- package/src/components/Shake/Shake.usage.mdx +107 -0
- package/src/components/Slider/Slider.stories.tsx +116 -0
- package/src/components/Slider/Slider.usage.mdx +179 -0
- package/src/components/Spinner/Spinner.stories.tsx +64 -0
- package/src/components/Spinner/Spinner.usage.mdx +136 -0
- package/src/components/SwapTransition/SwapTransition.usage.mdx +102 -0
- package/src/components/Switch/Switch.stories.tsx +131 -6
- package/src/components/Switch/Switch.usage.mdx +199 -0
- package/src/components/Table/Table.stories.tsx +159 -1
- package/src/components/Table/Table.usage.mdx +235 -0
- package/src/components/Tabs/Tabs.stories.tsx +86 -0
- package/src/components/Tabs/Tabs.usage.mdx +219 -0
- package/src/components/Tag/Tag.stories.tsx +181 -4
- package/src/components/Tag/Tag.usage.mdx +257 -0
- package/src/components/Textarea/Textarea.stories.tsx +113 -0
- package/src/components/Textarea/Textarea.usage.mdx +186 -0
- package/src/components/Toast/Toast.stories.tsx +185 -3
- package/src/components/Toast/Toast.styles.ts +18 -10
- package/src/components/Toast/Toast.usage.mdx +265 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +86 -1
- package/src/components/Tooltip/Tooltip.usage.mdx +211 -0
- package/src/components/Tree/Tree.stories.tsx +89 -0
- package/src/components/Tree/Tree.usage.mdx +207 -0
- package/src/components/Typography/Typography.stories.tsx +117 -0
- package/src/components/Typography/Typography.usage.mdx +251 -0
- package/src/components/Workflow/Workflow.usage.mdx +199 -0
- package/src/components/noRawScales.test.ts +5 -1
- package/src/foundations/BrandColour.mdx +364 -0
- package/src/foundations/BrandColour.stories.tsx +334 -0
- package/src/guidelines/ComponentPageTemplate.mdx +84 -0
- package/src/guidelines/FeedbackActions.mdx +162 -23
- package/src/guidelines/_components/Lang.tsx +175 -0
- package/src/guidelines/_components/TokenTable.tsx +136 -0
- package/src/theme/BazePalette.stories.tsx +111 -1
- package/src/theme/Palette.stories.tsx +2 -2
- package/src/theme/SemanticTokens.mdx +75 -16
- package/src/theme/claude.md +15 -9
- package/src/theme/colors.ts +33 -3
- package/src/theme/contrast.test.ts +32 -0
- package/src/theme/palette.generated.ts +99 -0
- package/src/theme/paletteSwatches.ts +35 -0
|
@@ -12,7 +12,15 @@ export type SeeMoreButtonOwnProps = Omit<
|
|
|
12
12
|
ButtonOwnProps,
|
|
13
13
|
'variant' | 'isDestructive'
|
|
14
14
|
> & {
|
|
15
|
+
/**
|
|
16
|
+
* How many items the list shows now. Printed as the first number of
|
|
17
|
+
* `더보기 (currentCount/maxCount)`.
|
|
18
|
+
*/
|
|
15
19
|
currentCount: number;
|
|
20
|
+
/**
|
|
21
|
+
* How many items there are in total. The button does not disable or hide
|
|
22
|
+
* itself when `currentCount` reaches this; the caller does.
|
|
23
|
+
*/
|
|
16
24
|
maxCount: number;
|
|
17
25
|
};
|
|
18
26
|
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { En, Ko, LangToggle, Verdict } from '../../guidelines/_components/Lang';
|
|
4
|
+
import * as SeeMoreButtonStories from './SeeMoreButton.stories';
|
|
5
|
+
|
|
6
|
+
<Meta of={SeeMoreButtonStories} name="Usage" />
|
|
7
|
+
|
|
8
|
+
<LangToggle />
|
|
9
|
+
|
|
10
|
+
<En>
|
|
11
|
+
|
|
12
|
+
# SeeMoreButton
|
|
13
|
+
|
|
14
|
+
A full-width button at the end of a list that shows more of the same list in
|
|
15
|
+
place, and says how many are shown out of how many.
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
- A list that grows where it is when the reader asks: reviews, recommended
|
|
20
|
+
questions, search results in a dropdown. In FactChat the store's reviews,
|
|
21
|
+
recommended questions and chatbot search use it.
|
|
22
|
+
- When you know the total, so the count `(3/10)` is true.
|
|
23
|
+
|
|
24
|
+
## When not to use
|
|
25
|
+
|
|
26
|
+
- Opening the full list on another page → a link-shaped `Button`
|
|
27
|
+
(`as="a"`, `ghost`) such as 전체 보기, usually next to the section heading.
|
|
28
|
+
- Paging through a long, numbered result set → `Pagination`.
|
|
29
|
+
- Expanding one block of text → `ExpandableText`, which has its own
|
|
30
|
+
더보기 / 접기.
|
|
31
|
+
- Showing more attached files → `FileList` already renders its own control.
|
|
32
|
+
- You do not know the total → a `subtle` or `ghost` `Button` with your own
|
|
33
|
+
label, because SeeMoreButton always prints a count.
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
SeeMoreButton has no `variant`. It always renders the `ghost` Button recipe
|
|
38
|
+
with a top hairline, takes the full width of its container, and accepts
|
|
39
|
+
Button's other props (`onClick`, `disabled`, `loading`, `size` …).
|
|
40
|
+
|
|
41
|
+
</En>
|
|
42
|
+
|
|
43
|
+
<Ko>
|
|
44
|
+
|
|
45
|
+
# SeeMoreButton
|
|
46
|
+
|
|
47
|
+
목록 끝에 놓는 전체 너비 버튼입니다. 같은 목록을 그 자리에서 더 보여 주고, 전체 중
|
|
48
|
+
몇 개를 보여 주는지 알려 줍니다.
|
|
49
|
+
|
|
50
|
+
## 언제 쓰나요
|
|
51
|
+
|
|
52
|
+
- 읽는 사람이 원할 때 그 자리에서 늘어나는 목록: 리뷰, 추천 질문, 드롭다운 안의 검색
|
|
53
|
+
결과. FactChat에서는 스토어의 리뷰, 추천 질문, 챗봇 검색에 씁니다.
|
|
54
|
+
- 전체 개수를 알고 있어서 `(3/10)` 같은 개수가 사실일 때.
|
|
55
|
+
|
|
56
|
+
## 언제 쓰지 않나요
|
|
57
|
+
|
|
58
|
+
- 다른 화면에서 전체 목록을 연다면 링크 모양의 `Button`(`as="a"`, `ghost`)을 씁니다.
|
|
59
|
+
"전체 보기"처럼 쓰고, 보통 섹션 제목 옆에 둡니다.
|
|
60
|
+
- 번호가 매겨진 긴 결과를 넘겨 본다면 `Pagination`을 씁니다.
|
|
61
|
+
- 글 한 덩어리를 펼친다면 더보기 / 접기가 들어 있는 `ExpandableText`를 씁니다.
|
|
62
|
+
- 첨부 파일을 더 보여 준다면 `FileList`가 자체 컨트롤을 그립니다.
|
|
63
|
+
- 전체 개수를 모른다면 라벨을 직접 쓰는 `subtle`이나 `ghost` `Button`을 씁니다.
|
|
64
|
+
SeeMoreButton은 언제나 개수를 함께 표시하기 때문입니다.
|
|
65
|
+
|
|
66
|
+
## 속성
|
|
67
|
+
|
|
68
|
+
SeeMoreButton에는 `variant`가 없습니다. 언제나 위쪽 구분선을 더한 `ghost` Button
|
|
69
|
+
레시피로 그려지고, 담긴 영역의 너비를 다 차지하며, Button의 나머지 속성(`onClick`,
|
|
70
|
+
`disabled`, `loading`, `size` 등)을 받습니다.
|
|
71
|
+
|
|
72
|
+
</Ko>
|
|
73
|
+
|
|
74
|
+
<ArgTypes of={SeeMoreButtonStories} include={['currentCount', 'maxCount']} />
|
|
75
|
+
|
|
76
|
+
<En>
|
|
77
|
+
|
|
78
|
+
The component does not disable or hide itself when `currentCount` reaches
|
|
79
|
+
`maxCount`; that is up to you (see Do / Don't).
|
|
80
|
+
|
|
81
|
+
## Do / Don't
|
|
82
|
+
|
|
83
|
+
</En>
|
|
84
|
+
|
|
85
|
+
<Ko>
|
|
86
|
+
|
|
87
|
+
`currentCount`가 `maxCount`에 닿아도 컴포넌트가 스스로 비활성이 되거나 사라지지
|
|
88
|
+
않습니다. 그 처리는 호출하는 쪽에서 합니다(아래 예시 참고).
|
|
89
|
+
|
|
90
|
+
## 이렇게 하세요 / 이렇게 하지 마세요
|
|
91
|
+
|
|
92
|
+
</Ko>
|
|
93
|
+
|
|
94
|
+
<Canvas of={SeeMoreButtonStories.DoGrowTheList} />
|
|
95
|
+
<Verdict
|
|
96
|
+
kind="do"
|
|
97
|
+
en="Put it right under the list, let each click add items in place, and remove it once everything is shown. FactChat renders it only while there is a next page."
|
|
98
|
+
ko="목록 바로 아래에 두고, 누를 때마다 그 자리에 항목을 더하며, 모두 보여 준 뒤에는 버튼을 없앱니다. FactChat도 다음 페이지가 있을 때만 버튼을 그립니다."
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<Canvas of={SeeMoreButtonStories.DontNavigate} />
|
|
102
|
+
<Verdict
|
|
103
|
+
kind="dont"
|
|
104
|
+
en="Use it to send the reader to a different page with all 128 reviews. It promises more of this list, here."
|
|
105
|
+
ko="리뷰 128개가 있는 다른 화면으로 보내는 데 쓰지 마세요. 이 버튼은 지금 이 목록을 이 자리에서 더 보여 주겠다는 뜻입니다."
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<Canvas of={SeeMoreButtonStories.DoLinkToFullPage} />
|
|
109
|
+
<Verdict
|
|
110
|
+
kind="do"
|
|
111
|
+
en="To open the full list elsewhere, use a link-shaped ghost Button next to the heading."
|
|
112
|
+
ko="다른 화면에서 전체 목록을 연다면 제목 옆에 링크 모양의 ghost Button을 둡니다."
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<En>
|
|
116
|
+
|
|
117
|
+
## Content
|
|
118
|
+
|
|
119
|
+
- The label is fixed: `더보기 (currentCount/maxCount)` and a chevron.
|
|
120
|
+
Children are ignored. The text comes from the library's own `see_more`
|
|
121
|
+
string, which today always resolves to Korean, so an English screen still
|
|
122
|
+
shows 더보기.
|
|
123
|
+
- Keep the numbers honest. `maxCount` is the real total; if the server only
|
|
124
|
+
tells you "there is more", use a `Button` instead.
|
|
125
|
+
|
|
126
|
+
## Accessibility
|
|
127
|
+
|
|
128
|
+
What SeeMoreButton does for you:
|
|
129
|
+
|
|
130
|
+
- It is a Button: a native `<button>`, Tab and Enter / Space (WCAG 2.1.1), and
|
|
131
|
+
the keyboard focus ring (WCAG 2.4.7).
|
|
132
|
+
- The count is part of the visible label, so the accessible name is
|
|
133
|
+
"더보기 (3/10)" and matches what is on screen (WCAG 2.5.3).
|
|
134
|
+
|
|
135
|
+
What you still have to do:
|
|
136
|
+
|
|
137
|
+
- **Keep the keyboard user's place.** When the last click removes the button,
|
|
138
|
+
focus would fall back to the page. Move focus to the first newly shown item
|
|
139
|
+
(WCAG 2.4.3).
|
|
140
|
+
- **New items are not announced.** The component has no live region. If the
|
|
141
|
+
added items are not obvious from the focus move, announce the new count
|
|
142
|
+
yourself.
|
|
143
|
+
- **Loading.** While the next page loads, pass `loading` with a
|
|
144
|
+
`loadingText` (불러오는 중) so the button cannot be pressed twice and still
|
|
145
|
+
has words. Without `loadingText` the label is hidden behind the spinner.
|
|
146
|
+
|
|
147
|
+
## Tokens
|
|
148
|
+
|
|
149
|
+
The table is generated from `SeeMoreButton.styles.ts` and the ghost Button
|
|
150
|
+
recipe it renders.
|
|
151
|
+
|
|
152
|
+
</En>
|
|
153
|
+
|
|
154
|
+
<Ko>
|
|
155
|
+
|
|
156
|
+
## 문구
|
|
157
|
+
|
|
158
|
+
- 라벨은 정해져 있습니다. `더보기 (currentCount/maxCount)`와 아래 화살표이며,
|
|
159
|
+
children은 무시됩니다. 문구는 라이브러리의 `see_more` 문자열에서 오는데 지금은
|
|
160
|
+
언제나 한국어로 풀리므로, 영어 화면에도 "더보기"가 나옵니다.
|
|
161
|
+
- 숫자는 사실이어야 합니다. `maxCount`는 실제 전체 개수입니다. 서버가 "더 있다"는
|
|
162
|
+
것만 알려 준다면 `Button`을 씁니다.
|
|
163
|
+
|
|
164
|
+
## 접근성
|
|
165
|
+
|
|
166
|
+
SeeMoreButton이 알아서 하는 일
|
|
167
|
+
|
|
168
|
+
- Button 그대로입니다. 기본 `<button>`이며 Tab, Enter와 Space로 다루고(WCAG 2.1.1),
|
|
169
|
+
키보드 초점 링을 그립니다(WCAG 2.4.7).
|
|
170
|
+
- 개수가 보이는 라벨에 들어 있어서, 접근 가능한 이름이 화면에 보이는 그대로
|
|
171
|
+
"더보기 (3/10)"입니다(WCAG 2.5.3).
|
|
172
|
+
|
|
173
|
+
직접 챙겨야 하는 일
|
|
174
|
+
|
|
175
|
+
- **키보드 사용자의 위치를 지킵니다.** 마지막으로 눌렀을 때 버튼이 사라지면 초점이
|
|
176
|
+
페이지 처음으로 돌아갈 수 있습니다. 새로 나온 첫 항목으로 초점을 옮깁니다(WCAG
|
|
177
|
+
2.4.3).
|
|
178
|
+
- **새 항목은 알려 주지 않습니다.** 컴포넌트에 라이브 영역이 없습니다. 초점을 옮기는
|
|
179
|
+
것만으로 새 항목이 분명하지 않다면 늘어난 개수를 직접 알립니다.
|
|
180
|
+
- **불러오는 중.** 다음 페이지를 불러오는 동안 `loading`과 `loadingText`(불러오는 중)를
|
|
181
|
+
함께 주어 두 번 눌리지 않게 하고 글자도 남깁니다. `loadingText`가 없으면 라벨이
|
|
182
|
+
스피너 뒤로 숨습니다.
|
|
183
|
+
|
|
184
|
+
## 토큰
|
|
185
|
+
|
|
186
|
+
아래 표는 `SeeMoreButton.styles.ts`와 이 컴포넌트가 그리는 ghost Button 레시피에서
|
|
187
|
+
자동으로 만듭니다.
|
|
188
|
+
|
|
189
|
+
</Ko>
|
|
190
|
+
|
|
191
|
+
<Canvas of={SeeMoreButtonStories.UsageTokens} sourceState="none" />
|
|
192
|
+
|
|
193
|
+
<En>
|
|
194
|
+
|
|
195
|
+
## Related
|
|
196
|
+
|
|
197
|
+
- **Button**: a link-shaped `ghost` Button for 전체 보기, or your own label
|
|
198
|
+
when the total is unknown.
|
|
199
|
+
- **Pagination**: numbered pages.
|
|
200
|
+
- **ExpandableText**: 더보기 / 접기 for one block of text.
|
|
201
|
+
|
|
202
|
+
</En>
|
|
203
|
+
|
|
204
|
+
<Ko>
|
|
205
|
+
|
|
206
|
+
## 관련 컴포넌트
|
|
207
|
+
|
|
208
|
+
- **Button**: 전체 보기에 쓰는 링크 모양의 `ghost` Button, 또는 전체 개수를 모를 때
|
|
209
|
+
라벨을 직접 쓰는 버튼.
|
|
210
|
+
- **Pagination**: 번호가 있는 페이지.
|
|
211
|
+
- **ExpandableText**: 글 한 덩어리의 더보기 / 접기.
|
|
212
|
+
|
|
213
|
+
</Ko>
|
|
@@ -3,6 +3,8 @@ import { Meta, StoryObj } from '@storybook/react';
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { FiHome, FiSettings, FiUser } from 'react-icons/fi';
|
|
5
5
|
|
|
6
|
+
import { T } from '../../guidelines/_components/Lang';
|
|
7
|
+
import { TokenTable } from '../../guidelines/_components/TokenTable';
|
|
6
8
|
import { SegmentedControl } from './SegmentedControl';
|
|
7
9
|
|
|
8
10
|
const meta = {
|
|
@@ -202,3 +204,70 @@ export const WithCustomContent = {
|
|
|
202
204
|
],
|
|
203
205
|
},
|
|
204
206
|
};
|
|
207
|
+
|
|
208
|
+
// ───────────────────────── Usage-page specimens ─────────────────────────
|
|
209
|
+
// Pulled into `SegmentedControl.usage.mdx` with <Canvas of={…} />. Hidden from
|
|
210
|
+
// the sidebar (`!dev`).
|
|
211
|
+
|
|
212
|
+
export const DoChangeTheView: Story = {
|
|
213
|
+
tags: ['!dev'],
|
|
214
|
+
parameters: { layout: 'padded' },
|
|
215
|
+
name: 'Usage / Do: change how the same data is shown',
|
|
216
|
+
render: () => (
|
|
217
|
+
<VStack align="start" gap={3}>
|
|
218
|
+
<Text fontWeight="600">크레딧 사용량</Text>
|
|
219
|
+
<SegmentedControl
|
|
220
|
+
aria-label="집계 단위"
|
|
221
|
+
size="sm"
|
|
222
|
+
defaultValue="week"
|
|
223
|
+
options={[
|
|
224
|
+
{ label: '일', value: 'day' },
|
|
225
|
+
{ label: '주', value: 'week' },
|
|
226
|
+
{ label: '월', value: 'month' },
|
|
227
|
+
]}
|
|
228
|
+
/>
|
|
229
|
+
</VStack>
|
|
230
|
+
),
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const DontSectionsAsSegments: Story = {
|
|
234
|
+
tags: ['!dev'],
|
|
235
|
+
parameters: { layout: 'padded' },
|
|
236
|
+
name: "Usage / Don't: switch between unrelated sections",
|
|
237
|
+
render: () => (
|
|
238
|
+
<SegmentedControl
|
|
239
|
+
defaultValue="credit"
|
|
240
|
+
options={[
|
|
241
|
+
{ label: '크레딧', value: 'credit' },
|
|
242
|
+
{ label: '보안', value: 'security' },
|
|
243
|
+
{ label: '공지', value: 'notice' },
|
|
244
|
+
{ label: '멤버', value: 'members' },
|
|
245
|
+
{ label: '감사 로그', value: 'audit' },
|
|
246
|
+
]}
|
|
247
|
+
/>
|
|
248
|
+
),
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/** Tokens the track, thumb and labels read, as set in `SegmentedControl.tsx`. */
|
|
252
|
+
export const UsageTokens: Story = {
|
|
253
|
+
tags: ['!dev'],
|
|
254
|
+
parameters: { layout: 'padded' },
|
|
255
|
+
name: 'Usage / Tokens',
|
|
256
|
+
render: () => (
|
|
257
|
+
<TokenTable
|
|
258
|
+
rows={[
|
|
259
|
+
{ token: 'bg.subtle', use: <T en="Track" ko="트랙" /> },
|
|
260
|
+
{
|
|
261
|
+
token: 'border.default',
|
|
262
|
+
use: <T en="Track ring (light)" ko="트랙 테두리(라이트)" />,
|
|
263
|
+
},
|
|
264
|
+
{ token: 'bg.raised', use: <T en="Selected thumb" ko="선택된 칸" /> },
|
|
265
|
+
{ token: 'fg.muted', use: <T en="Label" ko="라벨" /> },
|
|
266
|
+
{
|
|
267
|
+
token: 'fg.default',
|
|
268
|
+
use: <T en="Selected label" ko="선택된 라벨" />,
|
|
269
|
+
},
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
272
|
+
),
|
|
273
|
+
};
|
|
@@ -67,18 +67,17 @@ export const SegmentedControl = forwardRef<
|
|
|
67
67
|
}
|
|
68
68
|
}}
|
|
69
69
|
size={size}
|
|
70
|
-
// Track is bg.subtle
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
// above the track in both modes
|
|
74
|
-
// darker than the track). The indicator also gains a shadow: an md drop
|
|
70
|
+
// Track is bg.subtle and the selected indicator rides on `bg.raised` — a
|
|
71
|
+
// raised neutral surface that resolves white in light and a lighter
|
|
72
|
+
// neutral than the track in dark, so the thumb reads as lifted
|
|
73
|
+
// above the track in both modes. The indicator also gains a shadow: an md drop
|
|
75
74
|
// shadow in light, and in dark — where a drop shadow is invisible on a
|
|
76
75
|
// dark canvas — a soft ambient shadow + a translucent-white hairline edge.
|
|
77
76
|
//
|
|
78
77
|
// The track itself only contrasts where the page wash is darker (light) or
|
|
79
78
|
// lighter (dark) than the fill. It vanishes when the page matches the
|
|
80
|
-
// track: a `bg.sunken` list/overview page
|
|
81
|
-
//
|
|
79
|
+
// track: a `bg.sunken` list/overview page has the same light value as
|
|
80
|
+
// the bg.subtle track — and a `bg.surface` card is lighter than the
|
|
82
81
|
// track in dark. In either case the control would read as floating text,
|
|
83
82
|
// so a hairline ring defines its bounds on *any* background: a neutral
|
|
84
83
|
// `border.default` ring in light, a translucent-white ring in dark. (The
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { En, Ko, LangToggle, Verdict } from '../../guidelines/_components/Lang';
|
|
4
|
+
import * as SegmentedControlStories from './SegmentedControl.stories';
|
|
5
|
+
|
|
6
|
+
<Meta of={SegmentedControlStories} name="Usage" />
|
|
7
|
+
|
|
8
|
+
<LangToggle />
|
|
9
|
+
|
|
10
|
+
<En>
|
|
11
|
+
|
|
12
|
+
# SegmentedControl
|
|
13
|
+
|
|
14
|
+
A row of two to five mutually exclusive options in one track. Choosing one
|
|
15
|
+
changes how the content next to it is shown, or which setting applies.
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
- To change the unit or view of the same data: 일 / 주 / 월, chart / table.
|
|
20
|
+
- To filter one list by a small, fixed set: all models, chat models, image
|
|
21
|
+
models.
|
|
22
|
+
- For a setting with a few named values that all fit on screen, such as
|
|
23
|
+
상위 설정 따름 / 허용 / 차단.
|
|
24
|
+
- To switch the language of a field being edited (한국어 / English).
|
|
25
|
+
|
|
26
|
+
## When not to use
|
|
27
|
+
|
|
28
|
+
- To switch between different sections with their own content → `Tabs`.
|
|
29
|
+
- For more than five options, or options that do not fit on one line →
|
|
30
|
+
`Select` or `Radio`.
|
|
31
|
+
- For on / off → `Switch`.
|
|
32
|
+
- For actions (저장, 삭제) → `Button`s. A segment holds a value; it does not
|
|
33
|
+
do something when pressed.
|
|
34
|
+
- To pick several at once → `Checkbox` or `Tag` with `selected`.
|
|
35
|
+
|
|
36
|
+
## Variants and what they mean
|
|
37
|
+
|
|
38
|
+
SegmentedControl has one look: the selected option sits on a raised thumb in a
|
|
39
|
+
`bg.subtle` track. `size` matches the height of the `Button` of the same size,
|
|
40
|
+
so a control and a button line up in one row.
|
|
41
|
+
|
|
42
|
+
</En>
|
|
43
|
+
|
|
44
|
+
<Ko>
|
|
45
|
+
|
|
46
|
+
# SegmentedControl
|
|
47
|
+
|
|
48
|
+
한 트랙 안에 둘에서 다섯 개의 선택지를 나란히 두고 하나만 고르게 합니다. 하나를 고르면
|
|
49
|
+
옆 내용을 보는 방식이나 적용되는 설정이 바뀝니다.
|
|
50
|
+
|
|
51
|
+
## 언제 쓰나요
|
|
52
|
+
|
|
53
|
+
- 같은 데이터의 단위나 보기를 바꿀 때: 일 / 주 / 월, 차트 / 표.
|
|
54
|
+
- 적고 정해진 기준으로 목록 하나를 거를 때: 전체 모델, 대화 모델, 이미지 모델.
|
|
55
|
+
- 이름 붙은 값 몇 개가 화면에 다 들어가는 설정: 상위 설정 따름 / 허용 / 차단.
|
|
56
|
+
- 편집 중인 입력란의 언어를 바꿀 때(한국어 / English).
|
|
57
|
+
|
|
58
|
+
## 언제 쓰지 않나요
|
|
59
|
+
|
|
60
|
+
- 내용이 따로 있는 서로 다른 구역을 오갈 때는 `Tabs`를 씁니다.
|
|
61
|
+
- 선택지가 다섯 개보다 많거나 한 줄에 들어가지 않으면 `Select`나 `Radio`를 씁니다.
|
|
62
|
+
- 켜고 끄는 것은 `Switch`를 씁니다.
|
|
63
|
+
- 저장, 삭제 같은 동작은 `Button`으로 둡니다. 세그먼트는 값을 고르는 것이지 누르면 무언가를
|
|
64
|
+
하는 것이 아닙니다.
|
|
65
|
+
- 여러 개를 함께 고르게 하려면 `Checkbox`나 `selected`를 쓰는 `Tag`를 씁니다.
|
|
66
|
+
|
|
67
|
+
## 변형과 뜻
|
|
68
|
+
|
|
69
|
+
SegmentedControl의 모양은 하나입니다. `bg.subtle` 트랙 위에 선택된 칸이 떠 있는 판으로
|
|
70
|
+
올라옵니다. `size`는 같은 크기의 `Button`과 높이가 같아서 한 줄에 나란히 두면 맞아떨어집니다.
|
|
71
|
+
|
|
72
|
+
</Ko>
|
|
73
|
+
|
|
74
|
+
<ArgTypes of={SegmentedControlStories} include={['options', 'value', 'defaultValue', 'onSelect', 'size']} />
|
|
75
|
+
|
|
76
|
+
<En>
|
|
77
|
+
|
|
78
|
+
| `size` | Height | Next to |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| `xs` | 32px | A `Button size="xs"`, a dense field header |
|
|
81
|
+
| `sm` | 36px | Settings rows and filters in admin tables |
|
|
82
|
+
| `md` (default) | 40px | Page-level view switches |
|
|
83
|
+
| `lg` | 44px | A `Button size="lg"` |
|
|
84
|
+
|
|
85
|
+
## Do / Don't
|
|
86
|
+
|
|
87
|
+
</En>
|
|
88
|
+
|
|
89
|
+
<Ko>
|
|
90
|
+
|
|
91
|
+
| `size` | 높이 | 함께 두는 것 |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `xs` | 32px | `Button size="xs"`, 촘촘한 입력란 머리 |
|
|
94
|
+
| `sm` | 36px | 관리 화면 표의 설정 줄과 필터 |
|
|
95
|
+
| `md` (기본) | 40px | 페이지 전체의 보기 전환 |
|
|
96
|
+
| `lg` | 44px | `Button size="lg"` |
|
|
97
|
+
|
|
98
|
+
## 이렇게 하세요 / 이렇게 하지 마세요
|
|
99
|
+
|
|
100
|
+
</Ko>
|
|
101
|
+
|
|
102
|
+
<Canvas of={SegmentedControlStories.DoChangeTheView} />
|
|
103
|
+
<Verdict
|
|
104
|
+
kind="do"
|
|
105
|
+
en="Use it to change the unit of the data beside it, and name the group with aria-label ('집계 단위')."
|
|
106
|
+
ko="옆 데이터의 단위를 바꾸는 데 쓰고, 묶음에 aria-label('집계 단위')로 이름을 붙입니다."
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<Canvas of={SegmentedControlStories.DontSectionsAsSegments} />
|
|
110
|
+
<Verdict
|
|
111
|
+
kind="dont"
|
|
112
|
+
en="Use it to switch between unrelated sections. That is Tabs: it gives each section a panel and the tab roles."
|
|
113
|
+
ko="서로 다른 구역을 오가는 데 쓰지 마세요. 그것은 Tabs의 일입니다. Tabs는 구역마다 패널과 탭 역할을 줍니다."
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<En>
|
|
117
|
+
|
|
118
|
+
## Content
|
|
119
|
+
|
|
120
|
+
- One or two words per option, nouns or short adjectives. No full stop.
|
|
121
|
+
- Keep options parallel: 일 / 주 / 월, not 일별 / 이번 주 / 월.
|
|
122
|
+
- Keep the order fixed across screens. When the same choice appears in several
|
|
123
|
+
places, users find it by position.
|
|
124
|
+
|
|
125
|
+
## Accessibility
|
|
126
|
+
|
|
127
|
+
What SegmentedControl does for you:
|
|
128
|
+
|
|
129
|
+
- It is a radio group: the root is `role="radiogroup"` and each option is a
|
|
130
|
+
radio with a hidden native input, so `Tab` reaches the group and the arrow
|
|
131
|
+
keys change the selection (WCAG 2.1.1, 4.1.2).
|
|
132
|
+
- The selected option is shown by the raised thumb and by a heavier, darker
|
|
133
|
+
label, not by colour alone (WCAG 1.4.1). The bold width is reserved in
|
|
134
|
+
advance, so the labels do not shift when the selection moves.
|
|
135
|
+
- A hairline ring keeps the track visible on any page colour.
|
|
136
|
+
|
|
137
|
+
What you still have to do:
|
|
138
|
+
|
|
139
|
+
- **Name the group.** Pass `aria-label` (or `aria-labelledby` pointing at the
|
|
140
|
+
visible label) on `SegmentedControl`. Without it, a screen reader announces
|
|
141
|
+
the options with no question.
|
|
142
|
+
- Give icon-only options a text alternative inside the label.
|
|
143
|
+
- A disabled option (`disabled: true` in `options`) cannot be chosen; say why
|
|
144
|
+
nearby if the reason is not obvious.
|
|
145
|
+
|
|
146
|
+
## Tokens
|
|
147
|
+
|
|
148
|
+
The table lists the tokens set in `SegmentedControl.tsx`. In dark mode the
|
|
149
|
+
ring and the thumb's edge are translucent white, not tokens.
|
|
150
|
+
|
|
151
|
+
</En>
|
|
152
|
+
|
|
153
|
+
<Ko>
|
|
154
|
+
|
|
155
|
+
## 문구
|
|
156
|
+
|
|
157
|
+
- 선택지마다 한두 단어의 명사나 짧은 형용사를 씁니다. 마침표를 찍지 않습니다.
|
|
158
|
+
- 선택지를 같은 꼴로 맞춥니다. "일별 / 이번 주 / 월"이 아니라 "일 / 주 / 월"처럼 씁니다.
|
|
159
|
+
- 화면이 달라도 순서를 바꾸지 않습니다. 같은 선택이 여러 곳에 나오면 사용자는 위치로
|
|
160
|
+
찾습니다.
|
|
161
|
+
|
|
162
|
+
## 접근성
|
|
163
|
+
|
|
164
|
+
SegmentedControl이 알아서 하는 일
|
|
165
|
+
|
|
166
|
+
- 라디오 묶음입니다. 루트는 `role="radiogroup"`이고 각 선택지는 숨은 기본 입력이 있는
|
|
167
|
+
라디오라서, `Tab`으로 묶음에 닿고 방향키로 선택을 바꿉니다(WCAG 2.1.1, 4.1.2).
|
|
168
|
+
- 선택된 칸은 떠 있는 판과 더 굵고 진한 라벨로 보이며, 색만으로 알리지 않습니다
|
|
169
|
+
(WCAG 1.4.1). 굵은 글자의 너비를 미리 잡아 두므로 선택이 옮겨 가도 라벨이 흔들리지
|
|
170
|
+
않습니다.
|
|
171
|
+
- 가는 테두리가 있어 어떤 페이지 색 위에서도 트랙이 보입니다.
|
|
172
|
+
|
|
173
|
+
직접 챙겨야 하는 일
|
|
174
|
+
|
|
175
|
+
- **묶음에 이름을 붙입니다.** `SegmentedControl`에 `aria-label`을 넘기거나, 보이는
|
|
176
|
+
라벨을 가리키는 `aria-labelledby`를 넘깁니다. 이름이 없으면 화면 낭독기는 무엇을 고르는지
|
|
177
|
+
모른 채 선택지만 읽습니다.
|
|
178
|
+
- 아이콘만 있는 선택지에는 라벨 안에 대체 텍스트를 넣습니다.
|
|
179
|
+
- 비활성 선택지(`options`의 `disabled: true`)는 고를 수 없습니다. 이유가 분명하지 않다면
|
|
180
|
+
가까이에 이유를 적습니다.
|
|
181
|
+
|
|
182
|
+
## 토큰
|
|
183
|
+
|
|
184
|
+
아래 표는 `SegmentedControl.tsx`에서 정한 토큰입니다. 다크 모드의 테두리와 판 가장자리는
|
|
185
|
+
토큰이 아니라 반투명한 흰색입니다.
|
|
186
|
+
|
|
187
|
+
</Ko>
|
|
188
|
+
|
|
189
|
+
<Canvas of={SegmentedControlStories.UsageTokens} sourceState="none" />
|
|
190
|
+
|
|
191
|
+
<En>
|
|
192
|
+
|
|
193
|
+
## Related
|
|
194
|
+
|
|
195
|
+
- **Tabs**: different sections with their own content.
|
|
196
|
+
- **Select** / **Radio**: more options, or options in a form.
|
|
197
|
+
- **Switch**: on / off.
|
|
198
|
+
|
|
199
|
+
</En>
|
|
200
|
+
|
|
201
|
+
<Ko>
|
|
202
|
+
|
|
203
|
+
## 관련 컴포넌트
|
|
204
|
+
|
|
205
|
+
- **Tabs**: 내용이 따로 있는 서로 다른 구역.
|
|
206
|
+
- **Select** / **Radio**: 선택지가 많거나 양식 안의 선택지.
|
|
207
|
+
- **Switch**: 켜기 / 끄기.
|
|
208
|
+
|
|
209
|
+
</Ko>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Box, Flex, Text, VStack } from '@chakra-ui/react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
|
|
4
|
+
import { T } from '../../guidelines/_components/Lang';
|
|
5
|
+
import { TokenTable } from '../../guidelines/_components/TokenTable';
|
|
4
6
|
import { ProgressSegment, SegmentedProgressBar } from './';
|
|
5
7
|
|
|
6
8
|
const meta = {
|
|
@@ -274,3 +276,55 @@ export const CustomColors: Story = {
|
|
|
274
276
|
</VStack>
|
|
275
277
|
),
|
|
276
278
|
};
|
|
279
|
+
|
|
280
|
+
// ───────────────────────── Usage-page specimens ─────────────────────────
|
|
281
|
+
// Pulled into `SegmentedProgressBar.usage.mdx` with <Canvas of={…} />. Hidden
|
|
282
|
+
// from the sidebar (`!dev`).
|
|
283
|
+
|
|
284
|
+
export const DoCountsInText: Story = {
|
|
285
|
+
tags: ['!dev'],
|
|
286
|
+
parameters: { layout: 'padded' },
|
|
287
|
+
name: 'Usage / Do: counts in words next to the bar',
|
|
288
|
+
render: () => (
|
|
289
|
+
<Box width="400px">
|
|
290
|
+
<SegmentedProgressBar max={100} height="8px" aria-hidden>
|
|
291
|
+
<ProgressSegment value={42} filledTrackColor="success.solid" />
|
|
292
|
+
<ProgressSegment value={3} filledTrackColor="danger.solid" />
|
|
293
|
+
</SegmentedProgressBar>
|
|
294
|
+
<Flex gap={4} mt={2} textStyle="subtext" color="fg.muted">
|
|
295
|
+
<Text>보냄 42</Text>
|
|
296
|
+
<Text color="danger.fg">실패 3</Text>
|
|
297
|
+
<Text>남음 55</Text>
|
|
298
|
+
</Flex>
|
|
299
|
+
</Box>
|
|
300
|
+
),
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export const DontColourOnly: Story = {
|
|
304
|
+
tags: ['!dev'],
|
|
305
|
+
parameters: { layout: 'padded' },
|
|
306
|
+
name: "Usage / Don't: segments with no words",
|
|
307
|
+
render: () => (
|
|
308
|
+
<Box width="400px">
|
|
309
|
+
<SegmentedProgressBar max={100} height="8px">
|
|
310
|
+
<ProgressSegment value={42} filledTrackColor="success.solid" />
|
|
311
|
+
<ProgressSegment value={3} filledTrackColor="danger.solid" />
|
|
312
|
+
</SegmentedProgressBar>
|
|
313
|
+
</Box>
|
|
314
|
+
),
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
/** Tokens the bar reads, from `SegmentedProgressBar.tsx` and the theme. */
|
|
318
|
+
export const UsageTokens: Story = {
|
|
319
|
+
tags: ['!dev'],
|
|
320
|
+
parameters: { layout: 'padded' },
|
|
321
|
+
name: 'Usage / Tokens',
|
|
322
|
+
render: () => (
|
|
323
|
+
<TokenTable
|
|
324
|
+
rows={[
|
|
325
|
+
{ token: 'bg.track', use: <T en="remainder behind the segments" ko="세그먼트 뒤의 남은 부분" /> },
|
|
326
|
+
{ token: 'primary.main', use: <T en="segment fill (default)" ko="세그먼트 채움(기본)" /> },
|
|
327
|
+
]}
|
|
328
|
+
/>
|
|
329
|
+
),
|
|
330
|
+
};
|
|
@@ -3,9 +3,11 @@ import { BoxProps } from '@chakra-ui/react';
|
|
|
3
3
|
import { ProgressBarProps } from '../ProgressBar/ProgressBar.types';
|
|
4
4
|
|
|
5
5
|
export type SegmentedProgressBarProps = BoxProps & {
|
|
6
|
+
/** The whole; each segment's width is `value / max`. */
|
|
6
7
|
max: number;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export type ProgressSegmentProps = ProgressBarProps & {
|
|
11
|
+
/** This part's amount, in the same unit as the bar's `max`. */
|
|
10
12
|
value: number;
|
|
11
13
|
};
|