@vibe/core 4.2.5 → 4.3.0-alpha-9bd83.0
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/metadata/accessibility/Accordion.md +10 -0
- package/dist/metadata/accessibility/AlertBanner.md +9 -0
- package/dist/metadata/accessibility/Avatar.md +12 -0
- package/dist/metadata/accessibility/AvatarGroup.md +6 -0
- package/dist/metadata/accessibility/BreadcrumbsBar.md +10 -0
- package/dist/metadata/accessibility/Button.md +13 -0
- package/dist/metadata/accessibility/ButtonGroup.md +9 -0
- package/dist/metadata/accessibility/Checkbox.md +13 -0
- package/dist/metadata/accessibility/Chips.md +10 -0
- package/dist/metadata/accessibility/Combobox.md +6 -0
- package/dist/metadata/accessibility/DropdownBasicDropdown.md +10 -0
- package/dist/metadata/accessibility/IconButton.md +26 -0
- package/dist/metadata/accessibility/Info.md +12 -0
- package/dist/metadata/accessibility/Link.md +8 -0
- package/dist/metadata/accessibility/List.md +11 -0
- package/dist/metadata/accessibility/Menu.md +10 -0
- package/dist/metadata/accessibility/MenuButton.md +6 -0
- package/dist/metadata/accessibility/MenuItem.md +8 -0
- package/dist/metadata/accessibility/Modal.md +35 -0
- package/dist/metadata/accessibility/NumberField.md +9 -0
- package/dist/metadata/accessibility/RadioButton.md +11 -0
- package/dist/metadata/accessibility/Search.md +10 -0
- package/dist/metadata/accessibility/Tabs.md +10 -0
- package/dist/metadata/accessibility/TextArea.md +17 -0
- package/dist/metadata/accessibility/TextField.md +16 -0
- package/dist/metadata/accessibility/Toast.md +4 -0
- package/dist/metadata/accessibility/Toggle.md +7 -0
- package/dist/metadata/accessibility/Tooltip.md +11 -0
- package/dist/metadata/components.json +20940 -0
- package/dist/metadata/examples/Accordion.md +136 -0
- package/dist/metadata/examples/AlertBanner.md +85 -0
- package/dist/metadata/examples/AttentionBox.md +267 -0
- package/dist/metadata/examples/Avatar.md +118 -0
- package/dist/metadata/examples/AvatarGroup.md +390 -0
- package/dist/metadata/examples/Badge.md +59 -0
- package/dist/metadata/examples/BaseInput.md +2 -0
- package/dist/metadata/examples/BaseList.md +342 -0
- package/dist/metadata/examples/Box.md +208 -0
- package/dist/metadata/examples/BreadcrumbItem.md +54 -0
- package/dist/metadata/examples/BreadcrumbsBar.md +64 -0
- package/dist/metadata/examples/Button.md +174 -0
- package/dist/metadata/examples/ButtonGroup.md +180 -0
- package/dist/metadata/examples/Checkbox.md +24 -0
- package/dist/metadata/examples/Chips.md +192 -0
- package/dist/metadata/examples/Clickable.md +31 -0
- package/dist/metadata/examples/ColorPicker.md +2 -0
- package/dist/metadata/examples/Combobox.md +438 -0
- package/dist/metadata/examples/Counter.md +188 -0
- package/dist/metadata/examples/DatePicker.md +43 -0
- package/dist/metadata/examples/Dialog.md +521 -0
- package/dist/metadata/examples/DialogContentContainer.md +18 -0
- package/dist/metadata/examples/Divider.md +50 -0
- package/dist/metadata/examples/DropdownBasicDropdown.md +479 -0
- package/dist/metadata/examples/DropdownBoxMode.md +218 -0
- package/dist/metadata/examples/EditableHeading.md +33 -0
- package/dist/metadata/examples/EditableText.md +36 -0
- package/dist/metadata/examples/EmptyState.md +192 -0
- package/dist/metadata/examples/ExpandCollapse.md +77 -0
- package/dist/metadata/examples/Flex.md +916 -0
- package/dist/metadata/examples/Heading.md +124 -0
- package/dist/metadata/examples/HiddenText.md +8 -0
- package/dist/metadata/examples/Icon.md +67 -0
- package/dist/metadata/examples/IconButton.md +141 -0
- package/dist/metadata/examples/Info.md +80 -0
- package/dist/metadata/examples/Label.md +109 -0
- package/dist/metadata/examples/Link.md +52 -0
- package/dist/metadata/examples/List.md +125 -0
- package/dist/metadata/examples/ListItem.md +42 -0
- package/dist/metadata/examples/Loader.md +148 -0
- package/dist/metadata/examples/Menu.md +141 -0
- package/dist/metadata/examples/MenuButton.md +127 -0
- package/dist/metadata/examples/MenuDivider.md +35 -0
- package/dist/metadata/examples/MenuGridItem.md +65 -0
- package/dist/metadata/examples/MenuItem.md +98 -0
- package/dist/metadata/examples/MenuItemButton.md +42 -0
- package/dist/metadata/examples/MenuTitle.md +25 -0
- package/dist/metadata/examples/ModalBasicLayout.md +400 -0
- package/dist/metadata/examples/ModalMediaLayout.md +240 -0
- package/dist/metadata/examples/ModalSideBySideLayout.md +313 -0
- package/dist/metadata/examples/MultiStepIndicator.md +189 -0
- package/dist/metadata/examples/NumberField.md +68 -0
- package/dist/metadata/examples/ProgressBar.md +152 -0
- package/dist/metadata/examples/RadioButton.md +41 -0
- package/dist/metadata/examples/Search.md +24 -0
- package/dist/metadata/examples/Skeleton.md +161 -0
- package/dist/metadata/examples/Slider.md +109 -0
- package/dist/metadata/examples/SplitButton.md +120 -0
- package/dist/metadata/examples/Steps.md +106 -0
- package/dist/metadata/examples/Table.md +449 -0
- package/dist/metadata/examples/Tabs.md +241 -0
- package/dist/metadata/examples/Text.md +188 -0
- package/dist/metadata/examples/TextArea.md +28 -0
- package/dist/metadata/examples/TextField.md +119 -0
- package/dist/metadata/examples/TextWithHighlight.md +2 -0
- package/dist/metadata/examples/ThemeProvider.md +47 -0
- package/dist/metadata/examples/Tipseen.md +111 -0
- package/dist/metadata/examples/Toast.md +127 -0
- package/dist/metadata/examples/Toggle.md +38 -0
- package/dist/metadata/examples/Tooltip.md +53 -0
- package/dist/metadata/examples/VirtualizedGrid.md +54 -0
- package/dist/metadata/examples/VirtualizedList.md +50 -0
- package/dist/metadata/examples/useGridKeyboardNavigationContext.md +61 -0
- package/dist/mocked_classnames/scripts/build-all-metadata.d.ts +1 -0
- package/dist/mocked_classnames/scripts/extract-accessibility.d.ts +4 -0
- package/dist/mocked_classnames/scripts/extract-examples.d.ts +3 -0
- package/dist/scripts/build-all-metadata.d.ts +1 -0
- package/dist/scripts/extract-accessibility.d.ts +4 -0
- package/dist/scripts/extract-examples.d.ts +3 -0
- package/package.json +12 -10
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Button kinds
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<>
|
|
7
|
+
<Button id="button-kinds-primary" aria-label="Primary button">
|
|
8
|
+
Primary
|
|
9
|
+
</Button>
|
|
10
|
+
<Button id="button-kinds-secondary" aria-label="Secondary button" kind="secondary">
|
|
11
|
+
Secondary
|
|
12
|
+
</Button>
|
|
13
|
+
<Button id="button-kinds-tertiary" aria-label="Tertiary button" kind="tertiary">
|
|
14
|
+
Tertiary
|
|
15
|
+
</Button>
|
|
16
|
+
</>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Sizes
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<>
|
|
23
|
+
<Button id="sizes-large" aria-label="Large button" size="large">
|
|
24
|
+
Large
|
|
25
|
+
</Button>
|
|
26
|
+
<Button id="sizes-medium" aria-label="Medium button" size="medium">
|
|
27
|
+
Medium
|
|
28
|
+
</Button>
|
|
29
|
+
<Button id="sizes-small" aria-label="Small button" size="small">
|
|
30
|
+
Small
|
|
31
|
+
</Button>
|
|
32
|
+
</>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Disabled
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<>
|
|
39
|
+
<Button id="disabled-primary" aria-label="Primary button disabled" disabled>
|
|
40
|
+
Primary
|
|
41
|
+
</Button>
|
|
42
|
+
<Button id="disabled-secondary" aria-label="Secondary button disabled" kind="secondary" disabled>
|
|
43
|
+
Secondary
|
|
44
|
+
</Button>
|
|
45
|
+
<Button id="disabled-tertiary" aria-label="Tertiary button disabled" kind="tertiary" disabled>
|
|
46
|
+
Tertiary
|
|
47
|
+
</Button>
|
|
48
|
+
</>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## States
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<>
|
|
55
|
+
<Button id="state-regular" aria-label="Regular button">
|
|
56
|
+
Regular
|
|
57
|
+
</Button>
|
|
58
|
+
<Button id="state-active" aria-label="Active button" active>
|
|
59
|
+
Active
|
|
60
|
+
</Button>
|
|
61
|
+
</>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Positive and Negative
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<>
|
|
68
|
+
<Button id="color-positive" aria-label="Positive button" color="positive">
|
|
69
|
+
Positive
|
|
70
|
+
</Button>
|
|
71
|
+
<Button id="color-negative" aria-label="Negative button" color="negative">
|
|
72
|
+
Negative
|
|
73
|
+
</Button>
|
|
74
|
+
</>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Icons
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<>
|
|
81
|
+
<Button id="icons-right" rightIcon={Calendar} aria-label="Open calendar on the right icon button">
|
|
82
|
+
Right icon
|
|
83
|
+
</Button>
|
|
84
|
+
<Button id="icons-left" leftIcon={Calendar} aria-label="Open calendar on the left icon button">
|
|
85
|
+
Left icon
|
|
86
|
+
</Button>
|
|
87
|
+
</>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Loading state
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
const [loading, setLoading] = useState(false);
|
|
94
|
+
const onClick = useCallback(() => {
|
|
95
|
+
setLoading(true);
|
|
96
|
+
}, [setLoading]);
|
|
97
|
+
return <Button id="loading-state-button" aria-label="Start loading" loading={loading} onClick={onClick}>
|
|
98
|
+
Click here for loading
|
|
99
|
+
</Button>;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Success state
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
const [success, setSuccess] = useState(false);
|
|
106
|
+
const onClick = useCallback(() => {
|
|
107
|
+
setSuccess(true);
|
|
108
|
+
}, [setSuccess]);
|
|
109
|
+
return <Button id="success-state-button" aria-label="Trigger success" success={success} onClick={onClick} successIcon={Check} successText="Success">
|
|
110
|
+
Click here for success
|
|
111
|
+
</Button>;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## On color states
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
<>
|
|
118
|
+
<div style={{
|
|
119
|
+
display: "flex",
|
|
120
|
+
flexDirection: "column",
|
|
121
|
+
gap: "8px"
|
|
122
|
+
}}>
|
|
123
|
+
<Text type="text1">Regular</Text>
|
|
124
|
+
<div style={{
|
|
125
|
+
backgroundColor: "var(--sb-primary-color)",
|
|
126
|
+
padding: "16px"
|
|
127
|
+
}}>
|
|
128
|
+
<Button id="on-color-primary" aria-label="Primary on color" color="on-primary-color" marginRight>
|
|
129
|
+
Primary on color
|
|
130
|
+
</Button>
|
|
131
|
+
<Button id="on-color-secondary" aria-label="Secondary on color" color="on-primary-color" kind="secondary" marginRight>
|
|
132
|
+
Secondary on color
|
|
133
|
+
</Button>
|
|
134
|
+
<Button id="on-color-tertiary" aria-label="Tertiary on color" color="on-primary-color" kind="tertiary">
|
|
135
|
+
Tertiary on color
|
|
136
|
+
</Button>
|
|
137
|
+
</div>
|
|
138
|
+
<br />
|
|
139
|
+
<Text type="text1" style={{
|
|
140
|
+
marginBottom: "var(--sb-spacing-small)"
|
|
141
|
+
}}>
|
|
142
|
+
Disabled
|
|
143
|
+
</Text>
|
|
144
|
+
<div style={{
|
|
145
|
+
backgroundColor: "var(--sb-primary-color)",
|
|
146
|
+
padding: "16px"
|
|
147
|
+
}}>
|
|
148
|
+
<Button id="on-color-primary-disabled" aria-label="Primary on color disabled" color="on-primary-color" disabled marginRight>
|
|
149
|
+
Primary on color
|
|
150
|
+
</Button>
|
|
151
|
+
<Button id="on-color-secondary-disabled" aria-label="Secondary on color disabled" color="on-primary-color" disabled marginRight kind="secondary">
|
|
152
|
+
Secondary on color
|
|
153
|
+
</Button>
|
|
154
|
+
<Button id="on-color-tertiary-disabled" aria-label="Tertiary on color disabled" color="on-primary-color" disabled kind="tertiary">
|
|
155
|
+
Tertiary on color
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Adjacent buttons
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
<div>
|
|
166
|
+
<Button id="decrease-zoom-button" kind="secondary" size="small" aria-label="Decrease zoom level" rightFlat>
|
|
167
|
+
<Remove />
|
|
168
|
+
</Button>
|
|
169
|
+
<Button id="increase-zoom-button" kind="secondary" size="small" aria-label="Increase zoom level" leftFlat>
|
|
170
|
+
<Add />
|
|
171
|
+
</Button>
|
|
172
|
+
</div>
|
|
173
|
+
```
|
|
174
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<div style={{
|
|
7
|
+
width: args.fullWidth ? "100%" : "fit-content"
|
|
8
|
+
}}>
|
|
9
|
+
<ButtonGroup {...args} />
|
|
10
|
+
</div>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Default
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<ButtonGroup id="default-button-group" groupAriaLabel="Default button group" value={1} options={[{
|
|
17
|
+
value: 1,
|
|
18
|
+
text: "Alpha"
|
|
19
|
+
}, {
|
|
20
|
+
value: 2,
|
|
21
|
+
text: "Beta"
|
|
22
|
+
}, {
|
|
23
|
+
value: 3,
|
|
24
|
+
text: "Gamma"
|
|
25
|
+
}, {
|
|
26
|
+
value: 4,
|
|
27
|
+
text: "Delta"
|
|
28
|
+
}]} />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Tertiary
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
<ButtonGroup id="tertiary-button-group" groupAriaLabel="Tertiary button group" value={1} kind="tertiary" options={[{
|
|
35
|
+
value: 1,
|
|
36
|
+
text: "Alpha"
|
|
37
|
+
}, {
|
|
38
|
+
value: 2,
|
|
39
|
+
text: "Beta"
|
|
40
|
+
}, {
|
|
41
|
+
value: 3,
|
|
42
|
+
text: "Gamma"
|
|
43
|
+
}, {
|
|
44
|
+
value: 4,
|
|
45
|
+
text: "Delta"
|
|
46
|
+
}]} />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Disabled
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<ButtonGroup id="disabled-button-group" disabled groupAriaLabel="Disabled button group" options={[{
|
|
53
|
+
value: 1,
|
|
54
|
+
text: "Alpha"
|
|
55
|
+
}, {
|
|
56
|
+
value: 2,
|
|
57
|
+
text: "Beta"
|
|
58
|
+
}, {
|
|
59
|
+
value: 3,
|
|
60
|
+
text: "Gamma"
|
|
61
|
+
}, {
|
|
62
|
+
value: 4,
|
|
63
|
+
text: "Delta"
|
|
64
|
+
}]} />
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Disabled - Singe Button
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<ButtonGroup id="disabled-single-button-group" groupAriaLabel="Button group with disabled option" options={[{
|
|
71
|
+
value: 1,
|
|
72
|
+
text: "Alpha"
|
|
73
|
+
}, {
|
|
74
|
+
value: 2,
|
|
75
|
+
text: "Beta"
|
|
76
|
+
}, {
|
|
77
|
+
value: 3,
|
|
78
|
+
text: "Gamma"
|
|
79
|
+
}, {
|
|
80
|
+
value: 4,
|
|
81
|
+
text: "Delta",
|
|
82
|
+
disabled: true,
|
|
83
|
+
tooltipContent: "I'm the worst variant ever"
|
|
84
|
+
}]} />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Size
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
<Flex gap={60}>
|
|
91
|
+
<Flex direction="column" gap={16} align="start">
|
|
92
|
+
<Text type="text1">Medium</Text>
|
|
93
|
+
<ButtonGroup id="size-medium-button-group" groupAriaLabel="Medium size button group" size="medium" value={1} options={[{
|
|
94
|
+
value: 1,
|
|
95
|
+
text: "Alpha"
|
|
96
|
+
}, {
|
|
97
|
+
value: 2,
|
|
98
|
+
text: "Beta"
|
|
99
|
+
}, {
|
|
100
|
+
value: 3,
|
|
101
|
+
text: "Gamma"
|
|
102
|
+
}, {
|
|
103
|
+
value: 4,
|
|
104
|
+
text: "Delta"
|
|
105
|
+
}]} />
|
|
106
|
+
</Flex>
|
|
107
|
+
<Flex direction="column" gap={16} align="start">
|
|
108
|
+
<Text type="text1">Small</Text>
|
|
109
|
+
<ButtonGroup id="size-small-button-group" groupAriaLabel="Small size button group" size="small" value={1} options={[{
|
|
110
|
+
value: 1,
|
|
111
|
+
text: "Alpha"
|
|
112
|
+
}, {
|
|
113
|
+
value: 2,
|
|
114
|
+
text: "Beta"
|
|
115
|
+
}, {
|
|
116
|
+
value: 3,
|
|
117
|
+
text: "Gamma"
|
|
118
|
+
}, {
|
|
119
|
+
value: 4,
|
|
120
|
+
text: "Delta"
|
|
121
|
+
}]} />
|
|
122
|
+
</Flex>
|
|
123
|
+
</Flex>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Button group in settings
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<Flex direction="column" gap={16} align="start">
|
|
130
|
+
<Text type="text1">Function</Text>
|
|
131
|
+
<ButtonGroup id="settings-button-group" groupAriaLabel="Function selection button group" size="small" value={1} options={[{
|
|
132
|
+
value: 1,
|
|
133
|
+
text: "Sum"
|
|
134
|
+
}, {
|
|
135
|
+
value: 2,
|
|
136
|
+
text: "Average"
|
|
137
|
+
}, {
|
|
138
|
+
value: 3,
|
|
139
|
+
text: "Median"
|
|
140
|
+
}, {
|
|
141
|
+
value: 4,
|
|
142
|
+
text: "Min"
|
|
143
|
+
}]} />
|
|
144
|
+
</Flex>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Button group as toggle
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<ButtonGroup id="toggle-button-group" groupAriaLabel="View toggle button group" value={1} options={[{
|
|
151
|
+
value: 1,
|
|
152
|
+
text: "Grid"
|
|
153
|
+
}, {
|
|
154
|
+
value: 2,
|
|
155
|
+
text: "List"
|
|
156
|
+
}]} />
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Full width button group
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
<div style={{
|
|
163
|
+
width: "100%"
|
|
164
|
+
}}>
|
|
165
|
+
<ButtonGroup id="full-width-button-group" groupAriaLabel="Full width button group" fullWidth value={1} options={[{
|
|
166
|
+
value: 1,
|
|
167
|
+
text: "Grid"
|
|
168
|
+
}, {
|
|
169
|
+
value: 2,
|
|
170
|
+
text: "List"
|
|
171
|
+
}, {
|
|
172
|
+
value: 3,
|
|
173
|
+
text: "Table"
|
|
174
|
+
}, {
|
|
175
|
+
value: 4,
|
|
176
|
+
text: "Masonry"
|
|
177
|
+
}]} />
|
|
178
|
+
</div>
|
|
179
|
+
```
|
|
180
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## States
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<>
|
|
7
|
+
<Checkbox label="Regular" id="checkbox-2" aria-label="Regular checkbox" />
|
|
8
|
+
<Checkbox label="Selected" checked id="checkbox-3" aria-label="Selected checkbox" />
|
|
9
|
+
<Checkbox label="Indeterminate" indeterminate id="checkbox-4" aria-label="Indeterminate checkbox" />
|
|
10
|
+
<Checkbox label="Disabled" disabled id="checkbox-5" aria-label="Disabled checkbox" />
|
|
11
|
+
<Checkbox label="Disabled checked" disabled checked id="checkbox-6" aria-label="Disabled checked checkbox" />
|
|
12
|
+
<Checkbox label="Disabled indeterminate" disabled indeterminate id="checkbox-7" aria-label="Disabled indeterminate checkbox" />
|
|
13
|
+
</>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Single checkbox
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
<Checkbox id="single-checkbox" aria-label="Agree to terms and privacy policy" checked label={<>
|
|
20
|
+
I agree to the <Link href={"#"} text="Terms of Service" inlineText></Link> and{" "}
|
|
21
|
+
<Link href={"#"} text="Privacy Policy" inlineText></Link>.
|
|
22
|
+
</>} />
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Chips with read only state
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Chips id="readonly-chip" aria-label="Read only chip" label="Read only chip" readOnly />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Chips with icons
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Flex gap="medium">
|
|
13
|
+
<Chips id="chip-left-icon" aria-label="Chip with left email icon" label="Chip with left icon" leftIcon={Email} />
|
|
14
|
+
<Chips id="chip-right-icon" aria-label="Chip with right email icon" label="Chip with right icon" rightIcon={Email} />
|
|
15
|
+
</Flex>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Chips with avatars
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<Flex gap="medium">
|
|
22
|
+
<Chips id="chip-left-avatar" aria-label="Chip with left avatar" label="Chip with left avatar" leftAvatar={person1} />
|
|
23
|
+
<Chips id="chip-right-avatar" aria-label="Chip with right avatar" label="Chip with right avatar" rightAvatar={person1} />
|
|
24
|
+
</Flex>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Themes
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<>
|
|
31
|
+
<Chips id="theme-long" aria-label="Long chip" label="This is a long chip" />
|
|
32
|
+
<Chips id="theme-positive" aria-label="Positive chip" label="Chip positive" color="positive" />
|
|
33
|
+
<Chips id="theme-negative" aria-label="Negative chip" label="Chip negative" color="negative" />
|
|
34
|
+
<Chips id="theme-warning" aria-label="Warning chip" label="Chip warning" color="warning" />
|
|
35
|
+
<Chips id="theme-neutral" aria-label="Neutral chip" label="Chip neutral" color="neutral" />
|
|
36
|
+
<Chips id="theme-disabled" aria-label="Disabled chip" label="Disabled" disabled />
|
|
37
|
+
</>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Clickable
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
return <Flex direction="row" gap="medium" align="start">
|
|
44
|
+
<Chips id="clickable-default" aria-label="Clickable default chip" label="Clickable default chip" readOnly onClick={() => {}} />
|
|
45
|
+
<Chips id="clickable-removable" aria-label="Clickable removable chip" label="Clickable removable chip" onClick={() => {}} />
|
|
46
|
+
</Flex>;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Chips palette
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
const excludedColors = ["dark_indigo", "blackish"];
|
|
53
|
+
const stateColors = ["positive", "negative", "primary", "warning", "neutral"];
|
|
54
|
+
const allColors = [...ColorUtils.contentColors.filter((c: string) => !excludedColors.includes(c)), ...stateColors];
|
|
55
|
+
const allowedColorsChunks = _chunk(allColors, 7);
|
|
56
|
+
return <Flex style={{
|
|
57
|
+
width: "100%",
|
|
58
|
+
height: 300
|
|
59
|
+
}} align="stretch">
|
|
60
|
+
{allowedColorsChunks.map((colorChunk: any) => {
|
|
61
|
+
return <Flex direction="column" key={colorChunk} justify="space-between" align="stretch">
|
|
62
|
+
{colorChunk.map((colorName: any) => <Chips label={colorName} key={colorName} color={colorName} readOnly allowTextSelection />)}
|
|
63
|
+
</Flex>;
|
|
64
|
+
})}
|
|
65
|
+
</Flex>;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## On color
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Flex style={{
|
|
72
|
+
width: "100%"
|
|
73
|
+
}} align="stretch" justify="start">
|
|
74
|
+
<Flex align="center" justify="center" style={{
|
|
75
|
+
background: "var(--sb-primary-selected-color)",
|
|
76
|
+
width: "124px",
|
|
77
|
+
height: "64px",
|
|
78
|
+
margin: "var(--sb-spacing-small)",
|
|
79
|
+
borderRadius: "var(--sb-border-radius-small)"
|
|
80
|
+
}}>
|
|
81
|
+
<Chips label="On selected" showBorder readOnly />
|
|
82
|
+
</Flex>
|
|
83
|
+
<Flex align="center" justify="center" style={{
|
|
84
|
+
background: "var(--positive-color-selected)",
|
|
85
|
+
width: "124px",
|
|
86
|
+
height: "64px",
|
|
87
|
+
margin: "var(--sb-spacing-small)",
|
|
88
|
+
borderRadius: "var(--sb-border-radius-small)"
|
|
89
|
+
}}>
|
|
90
|
+
<Chips label="On positive" showBorder color="positive" readOnly />
|
|
91
|
+
</Flex>
|
|
92
|
+
<Flex align="center" justify="center" style={{
|
|
93
|
+
background: "var(--sb-negative-color-selected)",
|
|
94
|
+
width: "124px",
|
|
95
|
+
height: "64px",
|
|
96
|
+
margin: "var(--sb-spacing-small)",
|
|
97
|
+
borderRadius: "var(--sb-border-radius-small)"
|
|
98
|
+
}}>
|
|
99
|
+
<Chips label="On negative" showBorder color="negative" readOnly />
|
|
100
|
+
</Flex>
|
|
101
|
+
<Flex align="center" justify="center" style={{
|
|
102
|
+
background: "var(--ui-background-color)",
|
|
103
|
+
width: "124px",
|
|
104
|
+
height: "64px",
|
|
105
|
+
margin: "var(--sb-spacing-small)",
|
|
106
|
+
borderRadius: "var(--sb-border-radius-small)"
|
|
107
|
+
}}>
|
|
108
|
+
<Chips label="On neutral" showBorder color="neutral" readOnly />
|
|
109
|
+
</Flex>
|
|
110
|
+
</Flex>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Colorful chips for different content
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
<Flex>
|
|
117
|
+
<DialogContentContainer>
|
|
118
|
+
<Flex direction="column" align="start" gap="medium" style={{
|
|
119
|
+
padding: "var(--space-8)"
|
|
120
|
+
}}>
|
|
121
|
+
<div>
|
|
122
|
+
<Chips label="January" color="positive" />
|
|
123
|
+
</div>
|
|
124
|
+
<Search />
|
|
125
|
+
<div>
|
|
126
|
+
<Chips label="August" readOnly color="lipstick" />
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<Chips label="April" readOnly color="bubble" />
|
|
130
|
+
</div>
|
|
131
|
+
<div>
|
|
132
|
+
<Chips label="March" readOnly color="egg_yolk" />
|
|
133
|
+
</div>
|
|
134
|
+
</Flex>
|
|
135
|
+
</DialogContentContainer>
|
|
136
|
+
</Flex>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Chips in a person picker combo box
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
<Flex>
|
|
143
|
+
<DialogContentContainer>
|
|
144
|
+
<Flex direction="column" align="start" gap="medium" style={{
|
|
145
|
+
padding: "var(--space-8)"
|
|
146
|
+
}}>
|
|
147
|
+
<Search placeholder="Search names, positions, or a team" />
|
|
148
|
+
<Flex align="center" justify="center">
|
|
149
|
+
<Chips label="Julia Martinez" leftAvatar={person1} />
|
|
150
|
+
<Chips label="Juan Rodriguez" leftAvatar={person3} />
|
|
151
|
+
</Flex>
|
|
152
|
+
<Text style={{
|
|
153
|
+
paddingInlineStart: "var(--space-4)",
|
|
154
|
+
marginTop: "var(--space-4)"
|
|
155
|
+
}}>
|
|
156
|
+
Suggested people
|
|
157
|
+
</Text>
|
|
158
|
+
<Flex direction="column" align="start" gap="medium">
|
|
159
|
+
<Flex align="center" justify="center" key="cont-1" gap="small">
|
|
160
|
+
<Avatar size="small" src={person1} type="img" />
|
|
161
|
+
<Flex gap="xs">
|
|
162
|
+
<Text>May Kishon </Text>
|
|
163
|
+
<Text color="secondary">(UX/UI Product Designer)</Text>
|
|
164
|
+
</Flex>
|
|
165
|
+
</Flex>
|
|
166
|
+
<Flex align="center" justify="center" key="cont-2" gap="small">
|
|
167
|
+
<Avatar size="small" backgroundColor="dark_purple" text="LC" type="text" />
|
|
168
|
+
<Flex gap="xs">
|
|
169
|
+
<Text>Liron Cohen</Text>
|
|
170
|
+
<Text color="secondary">(Customer Experience)</Text>
|
|
171
|
+
</Flex>
|
|
172
|
+
</Flex>
|
|
173
|
+
<Flex align="center" justify="center" key="cont-3" gap="small">
|
|
174
|
+
<Avatar size="small" text="AL" type="text" />
|
|
175
|
+
<Flex gap="xs">
|
|
176
|
+
<Text>Amanda Lawrence</Text>
|
|
177
|
+
<Text color="secondary">(Customer Experience Designer)</Text>
|
|
178
|
+
</Flex>
|
|
179
|
+
</Flex>
|
|
180
|
+
<Flex align="center" justify="center" key="cont-4" gap="small">
|
|
181
|
+
<Avatar size="small" text="DY" type="text" backgroundColor="peach" />
|
|
182
|
+
<Flex gap="xs">
|
|
183
|
+
<Text>Dor Yehuda</Text>
|
|
184
|
+
<Text color="secondary">(Customer Experience Designer)</Text>
|
|
185
|
+
</Flex>
|
|
186
|
+
</Flex>
|
|
187
|
+
</Flex>
|
|
188
|
+
</Flex>
|
|
189
|
+
</DialogContentContainer>
|
|
190
|
+
</Flex>
|
|
191
|
+
```
|
|
192
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const clickableTemplate = (args: ClickableProps) => {
|
|
7
|
+
return <Clickable onClick={() => alert("clicked")} {...args}>
|
|
8
|
+
<Box border padding="small" rounded="small">
|
|
9
|
+
I act like a button
|
|
10
|
+
</Box>
|
|
11
|
+
</Clickable>;
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## States
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
<Flex gap="medium">
|
|
19
|
+
<Clickable onClick={() => alert("clicked")} aria-label="clickable button">
|
|
20
|
+
<Box border padding="small" rounded="small">
|
|
21
|
+
Regular clickable element
|
|
22
|
+
</Box>
|
|
23
|
+
</Clickable>
|
|
24
|
+
<Clickable onClick={() => alert("clicked")} disabled aria-label="disabled clickable button">
|
|
25
|
+
<Box border backgroundColor="greyBackgroundColor" padding="small" rounded="small">
|
|
26
|
+
Disabled clickable element
|
|
27
|
+
</Box>
|
|
28
|
+
</Clickable>
|
|
29
|
+
</Flex>
|
|
30
|
+
```
|
|
31
|
+
|