@mindlogic-ai/logician-ui 5.0.0-alpha.3 → 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/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/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 +65 -2
- 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
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { ArgTypes, Canvas, Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { En, Ko, LangToggle, Verdict } from '../../guidelines/_components/Lang';
|
|
4
|
+
import * as CheckboxStories from './Checkbox.stories';
|
|
5
|
+
|
|
6
|
+
<Meta of={CheckboxStories} name="Usage" />
|
|
7
|
+
|
|
8
|
+
<LangToggle />
|
|
9
|
+
|
|
10
|
+
<En>
|
|
11
|
+
|
|
12
|
+
# Checkbox
|
|
13
|
+
|
|
14
|
+
A box the user ticks to include an item or agree to something. Each checkbox
|
|
15
|
+
is independent of the others.
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
- Picking any number of items from a short list: notification channels,
|
|
20
|
+
table rows, members to invite.
|
|
21
|
+
- A single yes/no that takes effect when the form is submitted: agreeing to
|
|
22
|
+
terms, "include subgroups".
|
|
23
|
+
- A "select all" row over a list, with `indeterminate` when only some are
|
|
24
|
+
ticked.
|
|
25
|
+
|
|
26
|
+
## When not to use
|
|
27
|
+
|
|
28
|
+
- Exactly one option out of several → `Radio`, or `SelectField` for a long
|
|
29
|
+
list.
|
|
30
|
+
- A setting that reads as on or off, such as a feature toggle in a settings
|
|
31
|
+
row → `Switch`.
|
|
32
|
+
- An action that runs as soon as it is clicked → `Button`.
|
|
33
|
+
|
|
34
|
+
## Props
|
|
35
|
+
|
|
36
|
+
</En>
|
|
37
|
+
|
|
38
|
+
<Ko>
|
|
39
|
+
|
|
40
|
+
# Checkbox
|
|
41
|
+
|
|
42
|
+
항목을 포함하거나 무언가에 동의할 때 표시하는 상자입니다. 체크박스는 서로 영향을
|
|
43
|
+
주지 않습니다.
|
|
44
|
+
|
|
45
|
+
## 언제 쓰나요
|
|
46
|
+
|
|
47
|
+
- 짧은 목록에서 원하는 만큼 고를 때: 알림 받을 곳, 표의 행, 초대할 멤버.
|
|
48
|
+
- 폼을 제출할 때 반영되는 예/아니요 하나: 약관 동의, "하위 그룹 포함".
|
|
49
|
+
- 목록 위의 "전체 선택" 행. 일부만 선택됐다면 `indeterminate`를 씁니다.
|
|
50
|
+
|
|
51
|
+
## 언제 쓰지 않나요
|
|
52
|
+
|
|
53
|
+
- 여러 선택지 중 하나만 고른다면 `Radio`를, 목록이 길면 `SelectField`를 씁니다.
|
|
54
|
+
- 설정 목록의 기능 켜기처럼 켜짐과 꺼짐으로 읽히는 설정은 `Switch`를 씁니다.
|
|
55
|
+
- 누르자마자 실행되는 동작은 `Button`을 씁니다.
|
|
56
|
+
|
|
57
|
+
## 속성
|
|
58
|
+
|
|
59
|
+
</Ko>
|
|
60
|
+
|
|
61
|
+
<ArgTypes
|
|
62
|
+
of={CheckboxStories}
|
|
63
|
+
include={[
|
|
64
|
+
'checked',
|
|
65
|
+
'defaultChecked',
|
|
66
|
+
'onCheckedChange',
|
|
67
|
+
'disabled',
|
|
68
|
+
'invalid',
|
|
69
|
+
'size',
|
|
70
|
+
'inputRef',
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<En>
|
|
75
|
+
|
|
76
|
+
Compose it from parts: `<Checkbox>` (the root, rendered as a `<label>`),
|
|
77
|
+
`<Checkbox.Control />` (the box) and `<Checkbox.Label>`. Clicking the label
|
|
78
|
+
toggles the box. `checked` takes `true`, `false` or `'indeterminate'`; `size`
|
|
79
|
+
defaults to `sm`. The tick is drawn on after the box fills, and both happen at
|
|
80
|
+
once when the user prefers reduced motion.
|
|
81
|
+
|
|
82
|
+
## Do / Don't
|
|
83
|
+
|
|
84
|
+
</En>
|
|
85
|
+
|
|
86
|
+
<Ko>
|
|
87
|
+
|
|
88
|
+
부품을 조합해서 씁니다. `<Checkbox>`(루트, `<label>`로 그려짐), `<Checkbox.Control />`
|
|
89
|
+
(상자), `<Checkbox.Label>`입니다. 라벨을 눌러도 상자가 바뀝니다. `checked`에는
|
|
90
|
+
`true`, `false`, `'indeterminate'`를 넘기고, `size` 기본값은 `sm`입니다. 상자가 채워진
|
|
91
|
+
뒤 체크 표시가 그려지며, 사용자가 동작 줄이기를 설정했다면 한 번에 나타납니다.
|
|
92
|
+
|
|
93
|
+
## 이렇게 하세요 / 이렇게 하지 마세요
|
|
94
|
+
|
|
95
|
+
</Ko>
|
|
96
|
+
|
|
97
|
+
<Canvas of={CheckboxStories.DoLabelledList} />
|
|
98
|
+
<Verdict
|
|
99
|
+
kind="do"
|
|
100
|
+
en="Stack independent choices under a short heading, one per line, label to the right of the box."
|
|
101
|
+
ko="서로 상관없는 선택지는 짧은 제목 아래 한 줄에 하나씩, 상자 오른쪽에 라벨을 두고 쌓습니다."
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<Canvas of={CheckboxStories.DoSelectAll} />
|
|
105
|
+
<Verdict
|
|
106
|
+
kind="do"
|
|
107
|
+
en="Use indeterminate on the parent when only some children are ticked. Clicking it ticks or clears them all."
|
|
108
|
+
ko="하위 항목이 일부만 선택됐다면 상위 상자를 indeterminate로 둡니다. 상위 상자를 누르면 전부 선택하거나 전부 해제합니다."
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
<Canvas of={CheckboxStories.DontNegativeLabel} />
|
|
112
|
+
<Verdict
|
|
113
|
+
kind="dont"
|
|
114
|
+
en="Write the label as a negative. Ticking 'Don't send' makes the reader undo a double negative to know what they chose."
|
|
115
|
+
ko="라벨을 부정문으로 쓰지 마세요. '받지 않기'에 표시하면 이중 부정을 풀어야 무엇을 골랐는지 압니다."
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
<Canvas of={CheckboxStories.DoHiddenLabelInTable} />
|
|
119
|
+
<Verdict
|
|
120
|
+
kind="do"
|
|
121
|
+
en="When the row already shows what the box selects, keep a Checkbox.Label with srOnly so the box still has a name."
|
|
122
|
+
ko="무엇을 고르는지 행에 이미 보인다면 Checkbox.Label에 srOnly를 주어, 보이지 않아도 상자에 이름이 남게 합니다."
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<En>
|
|
126
|
+
|
|
127
|
+
## Content
|
|
128
|
+
|
|
129
|
+
- Phrase the label so that ticking it means yes: 마케팅 메일 받기, not 마케팅
|
|
130
|
+
메일 받지 않기.
|
|
131
|
+
- Keep labels short and parallel. If one needs explaining, put the
|
|
132
|
+
explanation in a second, muted line inside the label.
|
|
133
|
+
- A heading over a group says what the choices are about (알림 받을 곳).
|
|
134
|
+
|
|
135
|
+
## Accessibility
|
|
136
|
+
|
|
137
|
+
What Checkbox does for you:
|
|
138
|
+
|
|
139
|
+
- A native checkbox input sits inside the root, so Tab focuses it and Space
|
|
140
|
+
toggles it. The whole label is the click target.
|
|
141
|
+
- The keyboard focus ring (`focus.ring` on a `bg.canvas` gap) shows on the box
|
|
142
|
+
(WCAG 2.4.7). The unchecked border uses `border.control`, built for 3:1
|
|
143
|
+
against the page (WCAG 1.4.11).
|
|
144
|
+
- Checked and indeterminate are drawn with a mark as well as a fill, so the
|
|
145
|
+
state does not rely on colour alone (WCAG 1.4.1).
|
|
146
|
+
|
|
147
|
+
What you still have to do:
|
|
148
|
+
|
|
149
|
+
- **Always render `Checkbox.Label`**, with `srOnly` when it should not show.
|
|
150
|
+
Without it the box has no name (WCAG 4.1.2; KWCAG 5.3.4.1 레이블 제공).
|
|
151
|
+
- Give a group of checkboxes a visible heading so it is clear what the choices
|
|
152
|
+
are about (WCAG 1.3.1).
|
|
153
|
+
- If a choice is required (agreeing to terms), say so in the label or helper
|
|
154
|
+
text and show an error in words when it is missing (WCAG 3.3.1).
|
|
155
|
+
|
|
156
|
+
## Tokens
|
|
157
|
+
|
|
158
|
+
</En>
|
|
159
|
+
|
|
160
|
+
<Ko>
|
|
161
|
+
|
|
162
|
+
## 문구
|
|
163
|
+
|
|
164
|
+
- 표시하면 "예"가 되도록 씁니다. "마케팅 메일 받지 않기"가 아니라 "마케팅 메일
|
|
165
|
+
받기"입니다.
|
|
166
|
+
- 라벨은 짧고 같은 형식으로 씁니다. 설명이 필요하면 라벨 안에 흐린 글자로 한 줄을 더
|
|
167
|
+
둡니다.
|
|
168
|
+
- 묶음 위의 제목은 무엇에 관한 선택인지 알려 줍니다(알림 받을 곳).
|
|
169
|
+
|
|
170
|
+
## 접근성
|
|
171
|
+
|
|
172
|
+
Checkbox가 알아서 하는 일
|
|
173
|
+
|
|
174
|
+
- 루트 안에 네이티브 체크박스가 있어서 Tab으로 초점을 옮기고 Space로 바꿀 수
|
|
175
|
+
있습니다. 라벨 전체를 눌러도 됩니다.
|
|
176
|
+
- 키보드 초점 링(`bg.canvas` 간격 위의 `focus.ring`)이 상자에 보입니다(WCAG 2.4.7).
|
|
177
|
+
선택 전 테두리는 배경과 3:1이 되도록 만든 `border.control`을 씁니다(WCAG 1.4.11).
|
|
178
|
+
- 선택과 일부 선택 상태는 채움과 함께 표시로도 그려지므로 색에만 기대지 않습니다
|
|
179
|
+
(WCAG 1.4.1).
|
|
180
|
+
|
|
181
|
+
직접 챙겨야 하는 일
|
|
182
|
+
|
|
183
|
+
- **`Checkbox.Label`을 항상 그립니다.** 보이지 않아야 한다면 `srOnly`를 줍니다.
|
|
184
|
+
라벨이 없으면 상자에 이름이 없습니다(WCAG 4.1.2, KWCAG 5.3.4.1 레이블 제공).
|
|
185
|
+
- 체크박스 묶음에는 보이는 제목을 두어 무엇에 관한 선택인지 알 수 있게 합니다(WCAG
|
|
186
|
+
1.3.1).
|
|
187
|
+
- 약관 동의처럼 꼭 선택해야 한다면 라벨이나 도움말에 그렇게 적고, 빠졌을 때는 문구로
|
|
188
|
+
오류를 알립니다(WCAG 3.3.1).
|
|
189
|
+
|
|
190
|
+
## 토큰
|
|
191
|
+
|
|
192
|
+
</Ko>
|
|
193
|
+
|
|
194
|
+
<Canvas of={CheckboxStories.UsageTokens} sourceState="none" />
|
|
195
|
+
|
|
196
|
+
<En>
|
|
197
|
+
|
|
198
|
+
## Related
|
|
199
|
+
|
|
200
|
+
- **Radio**: one option out of several.
|
|
201
|
+
- **Switch**: a setting that is on or off.
|
|
202
|
+
- **Table**: row selection.
|
|
203
|
+
|
|
204
|
+
</En>
|
|
205
|
+
|
|
206
|
+
<Ko>
|
|
207
|
+
|
|
208
|
+
## 관련 컴포넌트
|
|
209
|
+
|
|
210
|
+
- **Radio**: 여러 선택지 중 하나.
|
|
211
|
+
- **Switch**: 켜짐과 꺼짐으로 읽히는 설정.
|
|
212
|
+
- **Table**: 행 선택.
|
|
213
|
+
|
|
214
|
+
</Ko>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { En, Ko, LangToggle } from '../../guidelines/_components/Lang';
|
|
4
|
+
import * as ChipStories from './Chip.stories';
|
|
5
|
+
|
|
6
|
+
<Meta of={ChipStories} name="Usage" />
|
|
7
|
+
|
|
8
|
+
<LangToggle />
|
|
9
|
+
|
|
10
|
+
<En>
|
|
11
|
+
|
|
12
|
+
# Chip (deprecated)
|
|
13
|
+
|
|
14
|
+
**Use `Tag`.** Since 5.0 `Chip` is a thin alias of `Tag` and it is removed in
|
|
15
|
+
6.0. It still renders so that unmigrated screens do not break, keeps the 4.x
|
|
16
|
+
pill shape so they do not shift, and warns once per `colorScheme` × `variant`
|
|
17
|
+
pair in development.
|
|
18
|
+
|
|
19
|
+
Everything about when and how to use it is on **Components/Tag/Usage**.
|
|
20
|
+
|
|
21
|
+
## Migrating
|
|
22
|
+
|
|
23
|
+
| 4.x `colorScheme` | 4.x `variant` | Renders as | Write instead |
|
|
24
|
+
| --- | --- | --- | --- |
|
|
25
|
+
| `primary` (default), `secondary`, `neutral` | `soft` (default) or `outline` | neutral | `<Tag>` |
|
|
26
|
+
| `primary`, `secondary`, `neutral` | `solid` | the selected look | `<Tag as="button" selected={…}>` for a filter chip |
|
|
27
|
+
| `danger`, `success`, `warning` | `soft` | that tone | `<Tag tone="…">`, or `Badge` if it is a status |
|
|
28
|
+
| `danger`, `success`, `warning` | `solid` | that tone (5.0 has no solid status fill) | Choose by hand |
|
|
29
|
+
| `danger`, `success`, `warning` | `outline` | neutral | Choose by hand |
|
|
30
|
+
|
|
31
|
+
"Choose by hand" pairs say so in the dev warning. A `solid` Chip gets the
|
|
32
|
+
selected *look* only: it does not become a toggle and has no `aria-pressed`
|
|
33
|
+
unless you pass `selected` yourself.
|
|
34
|
+
|
|
35
|
+
Two things change when you swap `Chip` for `Tag`:
|
|
36
|
+
|
|
37
|
+
- **Shape.** Tag uses the `md` radius and tighter padding. Chip's 32px pill
|
|
38
|
+
exists only for unmigrated screens.
|
|
39
|
+
- **Interactivity.** If the chip was clickable, render the Tag `as="button"`
|
|
40
|
+
so it is keyboard-operable (WCAG 2.1.1).
|
|
41
|
+
|
|
42
|
+
</En>
|
|
43
|
+
|
|
44
|
+
<Ko>
|
|
45
|
+
|
|
46
|
+
# Chip (지원 중단)
|
|
47
|
+
|
|
48
|
+
**`Tag`를 씁니다.** 5.0부터 `Chip`은 `Tag`의 얇은 별칭이며 6.0에서 사라집니다.
|
|
49
|
+
아직 옮기지 않은 화면이 깨지지 않도록 계속 그려지고, 화면이 밀리지 않도록 4.x의
|
|
50
|
+
알약 모양을 유지하며, 개발 환경에서 `colorScheme` × `variant` 조합마다 한 번씩 경고를
|
|
51
|
+
냅니다.
|
|
52
|
+
|
|
53
|
+
언제, 어떻게 쓰는지는 모두 **Components/Tag/Usage**에 있습니다.
|
|
54
|
+
|
|
55
|
+
## 옮기는 방법
|
|
56
|
+
|
|
57
|
+
| 4.x `colorScheme` | 4.x `variant` | 지금 그려지는 모양 | 바꿔 쓸 코드 |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| `primary`(기본), `secondary`, `neutral` | `soft`(기본) 또는 `outline` | neutral | `<Tag>` |
|
|
60
|
+
| `primary`, `secondary`, `neutral` | `solid` | 선택된 모양 | 필터 칩이라면 `<Tag as="button" selected={…}>` |
|
|
61
|
+
| `danger`, `success`, `warning` | `soft` | 해당 tone | `<Tag tone="…">`, 상태라면 `Badge` |
|
|
62
|
+
| `danger`, `success`, `warning` | `solid` | 해당 tone(5.0에는 진한 상태 바탕이 없음) | 직접 고릅니다 |
|
|
63
|
+
| `danger`, `success`, `warning` | `outline` | neutral | 직접 고릅니다 |
|
|
64
|
+
|
|
65
|
+
"직접 고릅니다"에 해당하는 조합은 개발 경고에도 그렇게 나옵니다. `solid` Chip은
|
|
66
|
+
선택된 *모양*만 얻습니다. `selected`를 직접 넘기지 않는 한 토글이 되지 않고
|
|
67
|
+
`aria-pressed`도 붙지 않습니다.
|
|
68
|
+
|
|
69
|
+
`Chip`을 `Tag`로 바꾸면 두 가지가 달라집니다.
|
|
70
|
+
|
|
71
|
+
- **모양.** Tag는 `md` 모서리와 더 좁은 여백을 씁니다. Chip의 32px 알약 모양은 아직
|
|
72
|
+
옮기지 않은 화면을 위해서만 남아 있습니다.
|
|
73
|
+
- **누를 수 있는지.** 누를 수 있던 칩이라면 Tag를 `as="button"`으로 그려야 키보드로도
|
|
74
|
+
쓸 수 있습니다(WCAG 2.1.1).
|
|
75
|
+
|
|
76
|
+
</Ko>
|
|
77
|
+
|
|
78
|
+
<Canvas of={ChipStories.LegacyMapping} />
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
+
import { T } from '../../guidelines/_components/Lang';
|
|
4
|
+
import { TokenTable } from '../../guidelines/_components/TokenTable';
|
|
5
|
+
import { Text } from '../Typography';
|
|
3
6
|
import { Code } from './Code';
|
|
4
7
|
import { BUNDLED_LANGUAGES } from './shikiAdapter';
|
|
5
8
|
|
|
@@ -211,3 +214,60 @@ export const CustomContainer: Story = {
|
|
|
211
214
|
};`,
|
|
212
215
|
},
|
|
213
216
|
};
|
|
217
|
+
|
|
218
|
+
// ───────────────────────── Usage-page specimens ─────────────────────────
|
|
219
|
+
// Pulled into `Code.usage.mdx` with <Canvas of={…} />. Hidden from the
|
|
220
|
+
// sidebar (`!dev`); `tags` is written out on each story because the indexer
|
|
221
|
+
// reads CSF statically.
|
|
222
|
+
|
|
223
|
+
export const DoLanguageAndCopy: Story = {
|
|
224
|
+
tags: ['!dev'],
|
|
225
|
+
parameters: { layout: 'padded' },
|
|
226
|
+
name: 'Usage / Do: a language and a copy button for a snippet',
|
|
227
|
+
args: {
|
|
228
|
+
language: 'bash',
|
|
229
|
+
onCopy: () => {},
|
|
230
|
+
children: `curl https://api.example.com/v1/chat/completions \\
|
|
231
|
+
-H "Authorization: Bearer $API_KEY" \\
|
|
232
|
+
-d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "안녕"}]}'`,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const DontBlockForIdentifier: Story = {
|
|
237
|
+
tags: ['!dev'],
|
|
238
|
+
parameters: { layout: 'padded' },
|
|
239
|
+
name: "Usage / Don't: a block for one word in a sentence",
|
|
240
|
+
render: () => (
|
|
241
|
+
<>
|
|
242
|
+
<Text mb={2}>요청 본문의 모델 이름 칸에는</Text>
|
|
243
|
+
<Code>model</Code>
|
|
244
|
+
<Text mt={2}>을 넣습니다.</Text>
|
|
245
|
+
</>
|
|
246
|
+
),
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export const UsageTokens: Story = {
|
|
250
|
+
tags: ['!dev'],
|
|
251
|
+
parameters: { layout: 'padded' },
|
|
252
|
+
name: 'Usage / Tokens',
|
|
253
|
+
render: () => (
|
|
254
|
+
<TokenTable
|
|
255
|
+
rows={[
|
|
256
|
+
{ token: 'border.default', use: <T en="Border" ko="테두리" /> },
|
|
257
|
+
{
|
|
258
|
+
token: 'bg.surface',
|
|
259
|
+
use: <T en="Header background" ko="머리 영역 배경" />,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
token: 'fg.default',
|
|
263
|
+
use: <T en="Language title" ko="언어 이름" />,
|
|
264
|
+
},
|
|
265
|
+
{ token: 'fg.muted', use: <T en="Copy icon" ko="복사 아이콘" /> },
|
|
266
|
+
{
|
|
267
|
+
token: 'success.fg',
|
|
268
|
+
use: <T en="Copied check" ko="복사 완료 표시" />,
|
|
269
|
+
},
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
272
|
+
),
|
|
273
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import { En, Ko, LangToggle, Verdict } from '../../guidelines/_components/Lang';
|
|
4
|
+
import * as CodeStories from './Code.stories';
|
|
5
|
+
|
|
6
|
+
<Meta of={CodeStories} name="Usage" />
|
|
7
|
+
|
|
8
|
+
<LangToggle />
|
|
9
|
+
|
|
10
|
+
<En>
|
|
11
|
+
|
|
12
|
+
# Code
|
|
13
|
+
|
|
14
|
+
A syntax-highlighted block of code (Shiki, `github-dark` token colours) with
|
|
15
|
+
an optional language header and copy button. `Markdown` uses it for fenced
|
|
16
|
+
code blocks.
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- A snippet the reader reads or copies: an API request, a config file, raw
|
|
21
|
+
JSON from an audit event.
|
|
22
|
+
- More than one line, or a line too long to sit inside a sentence.
|
|
23
|
+
|
|
24
|
+
## When not to use
|
|
25
|
+
|
|
26
|
+
- A name or value inside a sentence → `InlineCode`.
|
|
27
|
+
- A single line the user only needs to copy (an endpoint, a key) →
|
|
28
|
+
`CopyableCode`.
|
|
29
|
+
- The same example in several languages → `CodeTabs`.
|
|
30
|
+
|
|
31
|
+
## Options
|
|
32
|
+
|
|
33
|
+
| Prop | Means |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `language` | Highlighting language (`js` is read as `javascript`). With a language, the header shows its name. |
|
|
36
|
+
| `onCopy` | Turns the copy button on. The component writes to the clipboard; `onCopy` receives the copied text for side effects. |
|
|
37
|
+
| `hideHeader` | No header. If `onCopy` is set, the copy button floats in the top-right corner with a 복사 / 복사 완료 tooltip. |
|
|
38
|
+
| `showLineNumbers` | Line numbers in the gutter. |
|
|
39
|
+
| `containerProps` | Props for the CodeBlock root (margins, `maxH`, `className`). |
|
|
40
|
+
|
|
41
|
+
Without `language`, there is no header, and without `onCopy`, no copy button.
|
|
42
|
+
|
|
43
|
+
## Do / Don't
|
|
44
|
+
|
|
45
|
+
</En>
|
|
46
|
+
|
|
47
|
+
<Ko>
|
|
48
|
+
|
|
49
|
+
# Code
|
|
50
|
+
|
|
51
|
+
문법 강조(Shiki, `github-dark` 색)가 적용된 코드 블록입니다. 언어 이름이 있는 머리
|
|
52
|
+
영역과 복사 버튼을 켤 수 있습니다. `Markdown`의 코드 블록도 이 컴포넌트로 그립니다.
|
|
53
|
+
|
|
54
|
+
## 언제 쓰나요
|
|
55
|
+
|
|
56
|
+
- 읽거나 복사할 코드 조각: API 요청, 설정 파일, 감사 로그 이벤트의 원본 JSON.
|
|
57
|
+
- 두 줄 이상이거나, 문장 안에 넣기에는 너무 긴 한 줄.
|
|
58
|
+
|
|
59
|
+
## 언제 쓰지 않나요
|
|
60
|
+
|
|
61
|
+
- 문장 안의 이름이나 값은 `InlineCode`를 씁니다.
|
|
62
|
+
- 복사만 하면 되는 한 줄(엔드포인트, 키)은 `CopyableCode`를 씁니다.
|
|
63
|
+
- 같은 예제를 여러 언어로 보여 준다면 `CodeTabs`를 씁니다.
|
|
64
|
+
|
|
65
|
+
## 옵션
|
|
66
|
+
|
|
67
|
+
| 속성 | 뜻 |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `language` | 강조할 언어(`js`는 `javascript`로 읽음). 언어를 주면 머리 영역에 언어 이름이 나옵니다. |
|
|
70
|
+
| `onCopy` | 복사 버튼을 켭니다. 클립보드에는 컴포넌트가 직접 쓰고, `onCopy`는 복사한 글을 받아 부가 작업에 씁니다. |
|
|
71
|
+
| `hideHeader` | 머리 영역을 숨깁니다. `onCopy`가 있으면 복사 버튼이 오른쪽 위에 떠 있고 '복사' / '복사 완료' 툴팁이 붙습니다. |
|
|
72
|
+
| `showLineNumbers` | 줄 번호를 보여 줍니다. |
|
|
73
|
+
| `containerProps` | CodeBlock 루트에 넘길 속성(여백, `maxH`, `className`). |
|
|
74
|
+
|
|
75
|
+
`language`가 없으면 머리 영역이 없고, `onCopy`가 없으면 복사 버튼도 없습니다.
|
|
76
|
+
|
|
77
|
+
## 이렇게 하세요 / 이렇게 하지 마세요
|
|
78
|
+
|
|
79
|
+
</Ko>
|
|
80
|
+
|
|
81
|
+
<Canvas of={CodeStories.DoLanguageAndCopy} />
|
|
82
|
+
<Verdict
|
|
83
|
+
kind="do"
|
|
84
|
+
en="Set the language and turn on copy for anything the reader will paste into a terminal or file."
|
|
85
|
+
ko="터미널이나 파일에 붙여 넣을 코드에는 언어를 지정하고 복사 버튼을 켭니다."
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<Canvas of={CodeStories.DontBlockForIdentifier} />
|
|
89
|
+
<Verdict
|
|
90
|
+
kind="dont"
|
|
91
|
+
en="Break a sentence with a block for one word. Use InlineCode inside the sentence."
|
|
92
|
+
ko="한 단어 때문에 블록으로 문장을 끊지 마세요. 문장 안에 InlineCode를 씁니다."
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<En>
|
|
96
|
+
|
|
97
|
+
## Content
|
|
98
|
+
|
|
99
|
+
- Show code that runs as pasted. Mark placeholders clearly (`$API_KEY`,
|
|
100
|
+
`<chatbot_id>`) and never show a real secret.
|
|
101
|
+
- Keep examples short; link to full documentation for the rest.
|
|
102
|
+
- Explain the code in the text around it, not in long comments inside it.
|
|
103
|
+
|
|
104
|
+
## Accessibility
|
|
105
|
+
|
|
106
|
+
What Code does for you:
|
|
107
|
+
|
|
108
|
+
- The code is text, so it can be selected, copied and read by a screen
|
|
109
|
+
reader.
|
|
110
|
+
- The copy buttons are real buttons with names. The floating copy button
|
|
111
|
+
takes its name from the translated 복사 / 복사 완료 and has a focus ring
|
|
112
|
+
(WCAG 4.1.2, 2.4.7).
|
|
113
|
+
|
|
114
|
+
What you still have to do:
|
|
115
|
+
|
|
116
|
+
- The header copy button's name is the fixed English "Copy code". In a
|
|
117
|
+
Korean screen, consider `hideHeader` with `onCopy` (translated name), or
|
|
118
|
+
note it for a follow-up fix.
|
|
119
|
+
- Introduce the block in the text before it, so a screen reader user knows
|
|
120
|
+
what the code is for (WCAG 1.3.1).
|
|
121
|
+
- A long line scrolls sideways inside the block. Keep it readable at 320px
|
|
122
|
+
width by breaking long commands (WCAG 1.4.10).
|
|
123
|
+
|
|
124
|
+
## Tokens
|
|
125
|
+
|
|
126
|
+
Shiki's `github-dark` paints the code itself; these are the tokens the
|
|
127
|
+
component sets around it.
|
|
128
|
+
|
|
129
|
+
</En>
|
|
130
|
+
|
|
131
|
+
<Ko>
|
|
132
|
+
|
|
133
|
+
## 문구
|
|
134
|
+
|
|
135
|
+
- 붙여 넣으면 바로 동작하는 코드를 보여 줍니다. 바꿔 넣을 자리는 `$API_KEY`,
|
|
136
|
+
`<chatbot_id>`처럼 분명히 표시하고, 실제 비밀 값은 보여 주지 않습니다.
|
|
137
|
+
- 예제는 짧게 두고, 나머지는 전체 문서로 연결합니다.
|
|
138
|
+
- 설명은 코드 안의 긴 주석이 아니라 코드 앞뒤의 본문에 씁니다.
|
|
139
|
+
|
|
140
|
+
## 접근성
|
|
141
|
+
|
|
142
|
+
Code가 알아서 하는 일
|
|
143
|
+
|
|
144
|
+
- 코드는 글자이므로 선택하고 복사할 수 있고 화면 낭독기도 읽습니다.
|
|
145
|
+
- 복사 버튼은 이름이 있는 실제 버튼입니다. 떠 있는 복사 버튼은 번역된 '복사' /
|
|
146
|
+
'복사 완료'를 이름으로 쓰고 초점 링이 있습니다(WCAG 4.1.2, 2.4.7).
|
|
147
|
+
|
|
148
|
+
직접 챙겨야 하는 일
|
|
149
|
+
|
|
150
|
+
- 머리 영역의 복사 버튼 이름은 영어 "Copy code"로 고정되어 있습니다. 한국어 화면에서는
|
|
151
|
+
`hideHeader`와 `onCopy`를 함께 써서 번역된 이름을 쓰는 방법을 검토하거나, 후속 수정
|
|
152
|
+
거리로 남깁니다.
|
|
153
|
+
- 블록 앞 본문에서 이 코드가 무엇인지 먼저 알려, 화면 낭독기 사용자도 코드의 쓰임을
|
|
154
|
+
알 수 있게 합니다(WCAG 1.3.1).
|
|
155
|
+
- 긴 줄은 블록 안에서 가로로 스크롤됩니다. 긴 명령은 줄을 나눠 폭 320px에서도 읽을
|
|
156
|
+
수 있게 합니다(WCAG 1.4.10).
|
|
157
|
+
|
|
158
|
+
## 토큰
|
|
159
|
+
|
|
160
|
+
코드 자체의 색은 Shiki의 `github-dark`가 칠합니다. 아래는 컴포넌트가 그 둘레에 쓰는
|
|
161
|
+
토큰입니다.
|
|
162
|
+
|
|
163
|
+
</Ko>
|
|
164
|
+
|
|
165
|
+
<Canvas of={CodeStories.UsageTokens} sourceState="none" />
|
|
166
|
+
|
|
167
|
+
<En>
|
|
168
|
+
|
|
169
|
+
## Related
|
|
170
|
+
|
|
171
|
+
- **InlineCode**: code inside a sentence.
|
|
172
|
+
- **CopyableCode**: one line with a copy button.
|
|
173
|
+
- **CodeTabs**: the same example in several languages.
|
|
174
|
+
- **Markdown**: renders fenced code blocks with Code.
|
|
175
|
+
|
|
176
|
+
</En>
|
|
177
|
+
|
|
178
|
+
<Ko>
|
|
179
|
+
|
|
180
|
+
## 관련 컴포넌트
|
|
181
|
+
|
|
182
|
+
- **InlineCode**: 문장 안의 코드.
|
|
183
|
+
- **CopyableCode**: 복사 버튼이 달린 한 줄.
|
|
184
|
+
- **CodeTabs**: 같은 예제를 여러 언어로.
|
|
185
|
+
- **Markdown**: 코드 블록을 Code로 그립니다.
|
|
186
|
+
|
|
187
|
+
</Ko>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
+
import { T } from '../../guidelines/_components/Lang';
|
|
4
|
+
import { TokenTable } from '../../guidelines/_components/TokenTable';
|
|
3
5
|
import { CodeTabs } from './CodeTabs';
|
|
6
|
+
import { CODE_CHROME } from './CodeTabs.styles';
|
|
4
7
|
|
|
5
8
|
const meta = {
|
|
6
9
|
title: 'Components/CodeTabs',
|
|
@@ -50,3 +53,53 @@ export const WithCopyFunction: Story = {
|
|
|
50
53
|
},
|
|
51
54
|
},
|
|
52
55
|
};
|
|
56
|
+
|
|
57
|
+
// ───────────────────────── Usage-page specimens ─────────────────────────
|
|
58
|
+
// Pulled into `CodeTabs.usage.mdx` with <Canvas of={…} />. Hidden from the
|
|
59
|
+
// sidebar (`!dev`); `tags` is written out on each story because the indexer
|
|
60
|
+
// reads CSF statically.
|
|
61
|
+
|
|
62
|
+
export const DoSameCallPerLanguage: Story = {
|
|
63
|
+
tags: ['!dev'],
|
|
64
|
+
name: 'Usage / Do: one call, one tab per language',
|
|
65
|
+
args: { code: CODE_SAMPLES, onCopy: () => {} },
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const DontStepsAsTabs: Story = {
|
|
69
|
+
tags: ['!dev'],
|
|
70
|
+
name: "Usage / Don't: different steps behind language tabs",
|
|
71
|
+
args: {
|
|
72
|
+
code: {
|
|
73
|
+
bash: 'npm install openai',
|
|
74
|
+
javascript: "const client = new OpenAI({ apiKey: process.env.API_KEY });",
|
|
75
|
+
json: '{ "model": "gpt-4o", "stream": true }',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const CHROME_USE = {
|
|
81
|
+
bg: { en: 'Surface (tab bar and code)', ko: '바탕(탭 막대와 코드)' },
|
|
82
|
+
bgHover: { en: 'Tab and copy hover', ko: '탭과 복사 버튼 호버' },
|
|
83
|
+
bgActive: { en: 'Copy pressed', ko: '복사 버튼 누름' },
|
|
84
|
+
fg: {
|
|
85
|
+
en: 'Selected tab; unselected at 70%, divider at 15%',
|
|
86
|
+
ko: '선택된 탭. 선택 안 된 탭은 70%, 구분선은 15%',
|
|
87
|
+
},
|
|
88
|
+
} as const;
|
|
89
|
+
|
|
90
|
+
/** Read from `CODE_CHROME` in `CodeTabs.styles.ts`; alpha variants folded in. */
|
|
91
|
+
export const UsageTokens: Story = {
|
|
92
|
+
tags: ['!dev'],
|
|
93
|
+
name: 'Usage / Tokens',
|
|
94
|
+
args: { code: CODE_SAMPLES },
|
|
95
|
+
render: () => (
|
|
96
|
+
<TokenTable
|
|
97
|
+
rows={(Object.keys(CHROME_USE) as (keyof typeof CHROME_USE)[]).map(
|
|
98
|
+
(role) => ({
|
|
99
|
+
token: CODE_CHROME[role],
|
|
100
|
+
use: <T {...CHROME_USE[role]} />,
|
|
101
|
+
})
|
|
102
|
+
)}
|
|
103
|
+
/>
|
|
104
|
+
),
|
|
105
|
+
};
|