@tcn/ui 0.3.0 → 0.3.1
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/Color-ASIRERSW-B4GaVKuQ.js +990 -0
- package/dist/Color-ASIRERSW-B4GaVKuQ.js.map +1 -0
- package/dist/WithTooltip-IO6J4KBT-B1oq93K5.js +1485 -0
- package/dist/WithTooltip-IO6J4KBT-B1oq93K5.js.map +1 -0
- package/dist/actions/__docs__/components/gallery.d.ts +8 -0
- package/dist/actions/__docs__/components/gallery.d.ts.map +1 -0
- package/dist/actions/__docs__/components/gallery.js +20 -0
- package/dist/actions/__docs__/components/gallery.js.map +1 -0
- package/dist/actions/__docs__/components/showcase.d.ts +27 -0
- package/dist/actions/__docs__/components/showcase.d.ts.map +1 -0
- package/dist/actions/__docs__/components/showcase.js +15 -0
- package/dist/actions/__docs__/components/showcase.js.map +1 -0
- package/dist/actions/button/base_button/base_button.d.ts +2 -0
- package/dist/actions/button/base_button/base_button.d.ts.map +1 -1
- package/dist/actions/button/base_button/base_button.js +18 -16
- package/dist/actions/button/base_button/base_button.js.map +1 -1
- package/dist/actions/button/button/button.js +6 -6
- package/dist/actions/button/button_group/button_group.js +1 -1
- package/dist/actions/button/select_group/select_group.js +13 -13
- package/dist/actions/button/select_group/single_select_group.js +6 -6
- package/dist/actions/button/slim_button/slim_button.js +2 -2
- package/dist/actions/types.d.ts +2 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/types.js +2 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/feedback/loading/loading.js +12 -12
- package/dist/feedback/loading/loading.js.map +1 -1
- package/dist/feedback/progress/progress_bar.js +1 -1
- package/dist/form/field/common/field_control/field_control.js +8 -8
- package/dist/form/field/common/status_input/status_input.js +6 -6
- package/dist/form/field/field.js +5 -5
- package/dist/form/field/h_field/h_field.js +11 -11
- package/dist/form/field/v_field/v_field.js +10 -10
- package/dist/form/field_set/field_set.js +3 -3
- package/dist/formatter-QJ4M4OGQ-DaIl2Wi_.js +6 -0
- package/dist/formatter-QJ4M4OGQ-DaIl2Wi_.js.map +1 -0
- package/dist/gallery.css +1 -0
- package/dist/inputs/checkbox/checkbox.js +11 -11
- package/dist/inputs/color_input/color_picker.js +5 -5
- package/dist/inputs/combo_box/combo_box.js +16 -16
- package/dist/inputs/date_picker/date_picker.js +18 -18
- package/dist/inputs/date_picker/date_picker_body.js +2 -2
- package/dist/inputs/date_picker/date_picker_input.js +18 -18
- package/dist/inputs/input/input.js +5 -5
- package/dist/inputs/mask_input/key_capture_input.js +7 -7
- package/dist/inputs/mask_input/mask_input.js +4 -4
- package/dist/inputs/multi_combo_box/multi_combo_box.js +17 -17
- package/dist/inputs/multiselect/multiselect.js +13 -13
- package/dist/inputs/multiselect/multiselect_row.js +8 -8
- package/dist/inputs/phone_number_input/phone_number_input.js +11 -11
- package/dist/inputs/radio/radio.js +10 -10
- package/dist/inputs/radio/radio_row.js +3 -3
- package/dist/inputs/select/select.js +14 -14
- package/dist/inputs/slider/slider.js +10 -10
- package/dist/inputs/switch/switch.js +4 -4
- package/dist/inputs/textarea/textarea.js +7 -7
- package/dist/inputs/unit_input/unit_input.js +4 -4
- package/dist/layouts/body/h_body.js +7 -7
- package/dist/layouts/body/v_body.js +6 -6
- package/dist/layouts/column/column.js +17 -17
- package/dist/layouts/footer/footer.js +7 -7
- package/dist/layouts/grid/grid.js +24 -24
- package/dist/layouts/header/header.js +2 -2
- package/dist/layouts/list/item.js +2 -2
- package/dist/layouts/list/list.js +7 -7
- package/dist/layouts/list/section_header.js +6 -6
- package/dist/layouts/scaffold/scaffold.js +16 -16
- package/dist/layouts/sidebar_end/sidebar_end.js +14 -14
- package/dist/layouts/sidebar_start/sidebar_start.js +10 -10
- package/dist/layouts/utility_bar/utility_bar.js +10 -10
- package/dist/overlay/frame/frame.js +4 -4
- package/dist/overlay/menu/menu.js +34 -34
- package/dist/overlay/portal/portal_platform_context.js +4 -4
- package/dist/showcase-WfP6kBEb.js +58401 -0
- package/dist/showcase-WfP6kBEb.js.map +1 -0
- package/dist/showcase.css +1 -0
- package/dist/stacks/box/box.js +23 -23
- package/dist/stacks/h_collapsible_box.js +2 -2
- package/dist/stacks/h_stack.js +41 -41
- package/dist/stacks/spacer.js +11 -11
- package/dist/stacks/story_components/circle.js +10 -10
- package/dist/stacks/story_components/picture_placeholder.js +9 -9
- package/dist/stacks/story_components/rect.js +7 -7
- package/dist/stacks/story_components/style_box.js +4 -4
- package/dist/stacks/utils/use_is_collapsed.js +6 -6
- package/dist/stacks/v_collapsible_box.js +2 -2
- package/dist/stacks/v_stack.js +42 -42
- package/dist/stacks/z_stack.js +39 -39
- package/dist/surfaces/alert/alert.js +4 -4
- package/dist/surfaces/card/card.js +4 -4
- package/dist/surfaces/confirm/confirm.js +9 -9
- package/dist/surfaces/drawers/drawer_start/drawer_start.js +2 -2
- package/dist/surfaces/drawers/drawer_top/drawer_top.js +2 -2
- package/dist/surfaces/modal/modal.js +5 -5
- package/dist/surfaces/page/h_page.js +7 -7
- package/dist/surfaces/page/v_page.js +5 -5
- package/dist/surfaces/panel/h_panel.js +14 -14
- package/dist/surfaces/panel/v_panel.js +9 -9
- package/dist/surfaces/pop_confirm/pop_confirm.js +6 -6
- package/dist/surfaces/popconfirm/pop_confirm.js +8 -8
- package/dist/surfaces/tooltip/tooltip.js +8 -8
- package/dist/surfaces/window/window.js +9 -9
- package/dist/syntaxhighlighter-IQDEPFLK-BX_eF8__.js +3777 -0
- package/dist/syntaxhighlighter-IQDEPFLK-BX_eF8__.js.map +1 -0
- package/dist/themes/themes/ergo/ergo_theme.js +33 -1
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/tokens/badge/badge.js +9 -9
- package/dist/tokens/bubble/bubble.js +8 -8
- package/dist/tokens/chip/chip.js +3 -3
- package/dist/utils/click_away_listener.js +10 -10
- package/dist/utils/click_away_listener.js.map +1 -1
- package/dist/utils/dnd/draggable/draggable.js +4 -4
- package/dist/utils/dnd/handle.js +8 -8
- package/dist/utils/focus_redirect.js +5 -5
- package/dist/utils/hooks/make_context_hook.js +4 -4
- package/dist/utils/hooks/use_media_query.js +2 -2
- package/dist/utils/hooks/use_media_query.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/__docs__/actions.mdx +131 -0
- package/src/actions/__docs__/actions.stories.tsx +309 -0
- package/src/actions/__docs__/components/gallery.module.css +6 -0
- package/src/actions/__docs__/components/gallery.tsx +28 -0
- package/src/actions/__docs__/components/showcase.module.css +55 -0
- package/src/actions/__docs__/components/showcase.tsx +121 -0
- package/src/actions/button/base_button/base_button.tsx +5 -1
- package/src/actions/types.ts +6 -0
- package/src/themes/themes/ergo/ergo_theme.css +33 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { HStack } from '../../stacks/h_stack.js';
|
|
3
|
+
import { VStack } from '../../stacks/v_stack.js';
|
|
4
|
+
import { Spacer } from '../../stacks/spacer.js';
|
|
5
|
+
import { Button } from '../button/button/button.js';
|
|
6
|
+
import { SlimButton } from '../button/slim_button/slim_button.js';
|
|
7
|
+
import { SearchIcon } from '@tcn/icons/search_icon.js';
|
|
8
|
+
import { PlusIcon } from '@tcn/icons/plus_icon.js';
|
|
9
|
+
import { CrossIcon } from '@tcn/icons/cross_icon.js';
|
|
10
|
+
import type { ActionSeverity } from '../types.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* These stories are used exclusively by the MDX documentation.
|
|
14
|
+
* They are hidden from the Storybook sidebar using tags.
|
|
15
|
+
*/
|
|
16
|
+
const meta: Meta<typeof Button> = {
|
|
17
|
+
title: 'Catalog/Actions',
|
|
18
|
+
component: Button,
|
|
19
|
+
parameters: {
|
|
20
|
+
docs: {
|
|
21
|
+
story: { exclude: ['style'] },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// Hide these stories from the sidebar - they're only for MDX docs
|
|
26
|
+
tags: ['!autodocs', '!dev'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof Button>;
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Utility Code
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
const tcnBrandedColors = [
|
|
37
|
+
{
|
|
38
|
+
name: 'Integrated Infrastructure',
|
|
39
|
+
action: '27, 15%, 43%',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Omnichannel Communications',
|
|
43
|
+
action: '197, 34%, 40%',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Workforce Engagement',
|
|
47
|
+
action: '23, 65%, 42%',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Integration and Automation',
|
|
51
|
+
action: '139, 21%, 39%',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Compliance and Data Management',
|
|
55
|
+
action: '49, 50%, 34%',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Intelligence, Reporting, and Analytics',
|
|
59
|
+
action: '214, 14%, 45%',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const severityOptions: { name: string; severity: ActionSeverity }[] = [
|
|
64
|
+
{
|
|
65
|
+
name: 'Dangerous',
|
|
66
|
+
severity: 'dangerous',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Cautious',
|
|
70
|
+
severity: 'cautious',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Neutral',
|
|
74
|
+
severity: 'neutral',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Suggested',
|
|
78
|
+
severity: 'suggested',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Encouraged',
|
|
82
|
+
severity: 'encouraged',
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
// ============================================================================
|
|
87
|
+
// HIERARCHY EXAMPLES
|
|
88
|
+
// ============================================================================
|
|
89
|
+
|
|
90
|
+
export const HierarchyShowcase: Story = {
|
|
91
|
+
render: () => (
|
|
92
|
+
<HStack gap="12px" vAlign="center">
|
|
93
|
+
<Button hierarchy="tertiary">Tertiary</Button>
|
|
94
|
+
<Button hierarchy="secondary">Secondary</Button>
|
|
95
|
+
<Button hierarchy="primary">Primary</Button>
|
|
96
|
+
</HStack>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// SIZE EXAMPLES
|
|
102
|
+
// ============================================================================
|
|
103
|
+
|
|
104
|
+
export const SizeShowcase: Story = {
|
|
105
|
+
render: () => (
|
|
106
|
+
<HStack gap="12px" vAlign="center">
|
|
107
|
+
<Button size="sm">Small</Button>
|
|
108
|
+
<Button size="md">Medium</Button>
|
|
109
|
+
<Button size="lg">Large</Button>
|
|
110
|
+
</HStack>
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// ============================================================================
|
|
115
|
+
// DISABLED EXAMPLES
|
|
116
|
+
// ============================================================================
|
|
117
|
+
|
|
118
|
+
export const DisabledShowcase: Story = {
|
|
119
|
+
render: () => (
|
|
120
|
+
<HStack gap="12px" vAlign="center">
|
|
121
|
+
<VStack gap="12px" vAlign="center" width="200px">
|
|
122
|
+
<Button hierarchy="tertiary" disabled width="100%">
|
|
123
|
+
Tertiary Disabled
|
|
124
|
+
</Button>
|
|
125
|
+
<Button hierarchy="secondary" disabled width="100%">
|
|
126
|
+
Secondary Disabled
|
|
127
|
+
</Button>
|
|
128
|
+
<Button hierarchy="primary" disabled width="100%">
|
|
129
|
+
Primary Disabled
|
|
130
|
+
</Button>
|
|
131
|
+
</VStack>
|
|
132
|
+
</HStack>
|
|
133
|
+
),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// ============================================================================
|
|
137
|
+
// WITH ICONS
|
|
138
|
+
// ============================================================================
|
|
139
|
+
|
|
140
|
+
export const IconShowcase: Story = {
|
|
141
|
+
render: () => (
|
|
142
|
+
<VStack gap="12px" vAlign="center">
|
|
143
|
+
<HStack gap="12px" vAlign="center">
|
|
144
|
+
<Button hierarchy="tertiary">
|
|
145
|
+
Cancel
|
|
146
|
+
<Spacer width="6px" />
|
|
147
|
+
<CrossIcon size="sm" />
|
|
148
|
+
</Button>
|
|
149
|
+
<Button hierarchy="secondary">
|
|
150
|
+
Search
|
|
151
|
+
<Spacer width="6px" />
|
|
152
|
+
<SearchIcon size="sm" />
|
|
153
|
+
</Button>
|
|
154
|
+
<Button hierarchy="primary">
|
|
155
|
+
Add
|
|
156
|
+
<Spacer width="6px" />
|
|
157
|
+
<PlusIcon size="sm" />
|
|
158
|
+
</Button>
|
|
159
|
+
</HStack>
|
|
160
|
+
<HStack gap="12px" vAlign="center">
|
|
161
|
+
<Button hierarchy="tertiary">
|
|
162
|
+
<CrossIcon size="sm" />
|
|
163
|
+
<Spacer width="6px" />
|
|
164
|
+
Cancel
|
|
165
|
+
</Button>
|
|
166
|
+
<Button hierarchy="secondary">
|
|
167
|
+
<SearchIcon size="sm" />
|
|
168
|
+
<Spacer width="6px" />
|
|
169
|
+
Search
|
|
170
|
+
</Button>
|
|
171
|
+
<Button hierarchy="primary">
|
|
172
|
+
<PlusIcon size="sm" />
|
|
173
|
+
<Spacer width="6px" />
|
|
174
|
+
Add
|
|
175
|
+
</Button>
|
|
176
|
+
</HStack>
|
|
177
|
+
</VStack>
|
|
178
|
+
),
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// ============================================================================
|
|
182
|
+
// CUSTOM COLORS
|
|
183
|
+
// ============================================================================
|
|
184
|
+
|
|
185
|
+
export const ColorShowcase: Story = {
|
|
186
|
+
render: () => (
|
|
187
|
+
<HStack vAlign="center" gap="12px">
|
|
188
|
+
<VStack gap="12px" vAlign="center" width="200px">
|
|
189
|
+
{tcnBrandedColors.map(({ name, action }) => (
|
|
190
|
+
<Button key={name} hierarchy="primary" color={action} width="100%">
|
|
191
|
+
{name}
|
|
192
|
+
</Button>
|
|
193
|
+
))}
|
|
194
|
+
</VStack>
|
|
195
|
+
</HStack>
|
|
196
|
+
),
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// ============================================================================
|
|
200
|
+
// FULL WIDTH
|
|
201
|
+
// ============================================================================
|
|
202
|
+
|
|
203
|
+
export const FullWidth: Story = {
|
|
204
|
+
render: () => (
|
|
205
|
+
<HStack vAlign="center">
|
|
206
|
+
<VStack gap="12px" vAlign="center" width="200px">
|
|
207
|
+
<Button hierarchy="tertiary" width="100%">
|
|
208
|
+
Full Width Tertiary
|
|
209
|
+
</Button>
|
|
210
|
+
<Button hierarchy="secondary" width="100%">
|
|
211
|
+
Full Width Secondary
|
|
212
|
+
</Button>
|
|
213
|
+
<Button hierarchy="primary" width="100%">
|
|
214
|
+
Full Width Primary
|
|
215
|
+
</Button>
|
|
216
|
+
</VStack>
|
|
217
|
+
</HStack>
|
|
218
|
+
),
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const SeverityShowcase: Story = {
|
|
222
|
+
render: () => (
|
|
223
|
+
<HStack vAlign="center">
|
|
224
|
+
<VStack gap="12px" vAlign="center" width="200px">
|
|
225
|
+
{severityOptions.map(({ name, severity }) => (
|
|
226
|
+
<Button key={name} hierarchy="primary" severity={severity} width="100%">
|
|
227
|
+
{name}
|
|
228
|
+
</Button>
|
|
229
|
+
))}
|
|
230
|
+
</VStack>
|
|
231
|
+
</HStack>
|
|
232
|
+
),
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// ============================================================================
|
|
236
|
+
// SLIM BUTTON EXAMPLES
|
|
237
|
+
// ============================================================================
|
|
238
|
+
|
|
239
|
+
export const SlimButtonHierarchy: Story = {
|
|
240
|
+
render: () => (
|
|
241
|
+
<HStack gap="12px" vAlign="center">
|
|
242
|
+
<SlimButton hierarchy="tertiary">
|
|
243
|
+
<CrossIcon />
|
|
244
|
+
</SlimButton>
|
|
245
|
+
<SlimButton hierarchy="secondary">
|
|
246
|
+
<SearchIcon />
|
|
247
|
+
</SlimButton>
|
|
248
|
+
<SlimButton hierarchy="primary">
|
|
249
|
+
<PlusIcon />
|
|
250
|
+
</SlimButton>
|
|
251
|
+
</HStack>
|
|
252
|
+
),
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const SlimButtonSizes: Story = {
|
|
256
|
+
render: () => (
|
|
257
|
+
<HStack gap="12px" vAlign="center">
|
|
258
|
+
<SlimButton size="sm" hierarchy="primary">
|
|
259
|
+
<PlusIcon />
|
|
260
|
+
</SlimButton>
|
|
261
|
+
<SlimButton size="md" hierarchy="primary">
|
|
262
|
+
<PlusIcon />
|
|
263
|
+
</SlimButton>
|
|
264
|
+
<SlimButton size="lg" hierarchy="primary">
|
|
265
|
+
<PlusIcon />
|
|
266
|
+
</SlimButton>
|
|
267
|
+
</HStack>
|
|
268
|
+
),
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export const SlimButtonDisabled: Story = {
|
|
272
|
+
render: () => (
|
|
273
|
+
<HStack gap="12px" vAlign="center">
|
|
274
|
+
<SlimButton hierarchy="tertiary" disabled>
|
|
275
|
+
<CrossIcon />
|
|
276
|
+
</SlimButton>
|
|
277
|
+
<SlimButton hierarchy="secondary" disabled>
|
|
278
|
+
<SearchIcon />
|
|
279
|
+
</SlimButton>
|
|
280
|
+
<SlimButton hierarchy="primary" disabled>
|
|
281
|
+
<PlusIcon />
|
|
282
|
+
</SlimButton>
|
|
283
|
+
</HStack>
|
|
284
|
+
),
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const SlimButtonColors: Story = {
|
|
288
|
+
render: () => (
|
|
289
|
+
<HStack gap="12px" vAlign="center">
|
|
290
|
+
{tcnBrandedColors.map(({ name, action }) => (
|
|
291
|
+
<SlimButton key={name} hierarchy="primary" color={action}>
|
|
292
|
+
<SearchIcon />
|
|
293
|
+
</SlimButton>
|
|
294
|
+
))}
|
|
295
|
+
</HStack>
|
|
296
|
+
),
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const SlimButtonSeverity: Story = {
|
|
300
|
+
render: () => (
|
|
301
|
+
<HStack gap="12px" vAlign="center">
|
|
302
|
+
{severityOptions.map(({ name, severity }) => (
|
|
303
|
+
<SlimButton key={name} hierarchy="primary" severity={severity}>
|
|
304
|
+
<CrossIcon />
|
|
305
|
+
</SlimButton>
|
|
306
|
+
))}
|
|
307
|
+
</HStack>
|
|
308
|
+
),
|
|
309
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './gallery.module.css';
|
|
3
|
+
|
|
4
|
+
export interface GalleryProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
minColumnWidth?: string;
|
|
7
|
+
maxGalleryWidth?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Gallery: React.FC<GalleryProps> = ({
|
|
11
|
+
children,
|
|
12
|
+
minColumnWidth = '300px',
|
|
13
|
+
maxGalleryWidth = '1200px',
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<section
|
|
17
|
+
className={styles.container}
|
|
18
|
+
style={
|
|
19
|
+
{
|
|
20
|
+
'--min-column-width': minColumnWidth,
|
|
21
|
+
'--max-gallery-width': maxGalleryWidth,
|
|
22
|
+
} as React.CSSProperties
|
|
23
|
+
}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</section>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.showcase {
|
|
2
|
+
border: 1px solid var(--docs-border-color, #e5e7eb);
|
|
3
|
+
background-color: var(--docs-card-bg, #fff);
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
height: fit-content;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.toolbar {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
padding: 8px 16px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.header {
|
|
17
|
+
min-height: 48px;
|
|
18
|
+
background-color: var(--docs-header-bg, #fafafa);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title {
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
color: var(--docs-text-color, #1f2937);
|
|
25
|
+
margin: 0px !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.subtitle {
|
|
29
|
+
background-color: var(--docs-header-bg, #fafafa);
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.documentation {
|
|
34
|
+
color: var(--docs-text-muted, #6b7280);
|
|
35
|
+
padding: 0px 16px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.description {
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
color: var(--docs-text-muted, #6b7280);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.content {
|
|
44
|
+
min-height: 200px;
|
|
45
|
+
background-color: red;
|
|
46
|
+
width: 100%;
|
|
47
|
+
border: none !important;
|
|
48
|
+
box-shadow: none !important;
|
|
49
|
+
margin: 0px !important;
|
|
50
|
+
border-radius: 0px !important;
|
|
51
|
+
|
|
52
|
+
:global(.docs-story) {
|
|
53
|
+
min-height: 200px !important;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Canvas } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { HStack } from '../../../stacks/index.js';
|
|
4
|
+
import styles from './showcase.module.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
export interface ShowcaseProps {
|
|
8
|
+
/** Title displayed at the top of the card */
|
|
9
|
+
title?: string;
|
|
10
|
+
// A concise description of the showcase
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
/** The story to render */
|
|
13
|
+
of: any;
|
|
14
|
+
/** Width of the card */
|
|
15
|
+
minWidth?: string;
|
|
16
|
+
maxWidth?: string;
|
|
17
|
+
// Addition documentation for the showcase
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Example card component for MDX documentation.
|
|
23
|
+
* Displays as a cohesive card with header, content, and footer.
|
|
24
|
+
*/
|
|
25
|
+
export const Showcase: React.FC<ShowcaseProps> = ({
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
of,
|
|
29
|
+
minWidth = '300px',
|
|
30
|
+
maxWidth = '600px',
|
|
31
|
+
children,
|
|
32
|
+
}: ShowcaseProps) => (
|
|
33
|
+
<div
|
|
34
|
+
style={{
|
|
35
|
+
minWidth,
|
|
36
|
+
maxWidth,
|
|
37
|
+
height: 'fit-content',
|
|
38
|
+
}}
|
|
39
|
+
className={styles.showcase}
|
|
40
|
+
>
|
|
41
|
+
<HStack className={clsx(styles.header, styles.toolbar)}>
|
|
42
|
+
<h4 className={styles.title}>{title}</h4>
|
|
43
|
+
</HStack>
|
|
44
|
+
<HStack className={clsx(styles.subtitle, styles.toolbar)} vAlign="start">
|
|
45
|
+
<div className={styles.description}>{description}</div>
|
|
46
|
+
</HStack>
|
|
47
|
+
<HStack className={clsx(styles.subtitle, styles.toolbar)} vAlign="start">
|
|
48
|
+
<div className={styles.documentation}>{children}</div>
|
|
49
|
+
</HStack>
|
|
50
|
+
<Canvas
|
|
51
|
+
className={styles.content}
|
|
52
|
+
layout="centered"
|
|
53
|
+
of={of}
|
|
54
|
+
sourceState={'hidden'}
|
|
55
|
+
story={{
|
|
56
|
+
inline: true,
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Section component - displays examples in a flex row that wraps.
|
|
64
|
+
*/
|
|
65
|
+
export const Section = ({
|
|
66
|
+
title,
|
|
67
|
+
description,
|
|
68
|
+
children,
|
|
69
|
+
maxWidth = '100%',
|
|
70
|
+
}: {
|
|
71
|
+
title: string;
|
|
72
|
+
description?: React.ReactNode;
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
maxWidth?: string;
|
|
75
|
+
}) => {
|
|
76
|
+
return (
|
|
77
|
+
<section
|
|
78
|
+
style={{
|
|
79
|
+
maxWidth,
|
|
80
|
+
marginBottom: '48px',
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
{/* Section Header */}
|
|
84
|
+
<div style={{ marginBottom: '24px' }}>
|
|
85
|
+
<h2
|
|
86
|
+
style={{
|
|
87
|
+
margin: '0 0 8px 0',
|
|
88
|
+
fontSize: '20px',
|
|
89
|
+
fontWeight: 600,
|
|
90
|
+
color: 'var(--docs-text-color, #1f2937)',
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
{title}
|
|
94
|
+
</h2>
|
|
95
|
+
{description && (
|
|
96
|
+
<p
|
|
97
|
+
style={{
|
|
98
|
+
margin: 0,
|
|
99
|
+
fontSize: '14px',
|
|
100
|
+
color: 'var(--docs-text-muted, #6b7280)',
|
|
101
|
+
lineHeight: 1.6,
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{description}
|
|
105
|
+
</p>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
{/* Cards Grid - Flex row with wrap */}
|
|
110
|
+
<div
|
|
111
|
+
style={{
|
|
112
|
+
display: 'flex',
|
|
113
|
+
flexWrap: 'wrap',
|
|
114
|
+
gap: '20px',
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{children}
|
|
118
|
+
</div>
|
|
119
|
+
</section>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -5,11 +5,13 @@ import { HStack } from '../../../stacks/h_stack.js';
|
|
|
5
5
|
import type { HStackOwnProps } from '../../../stacks/h_stack.js';
|
|
6
6
|
import styles from './base_button.module.css';
|
|
7
7
|
import type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';
|
|
8
|
+
import type { ActionSeverity } from '../../types.js';
|
|
8
9
|
|
|
9
10
|
export interface BaseButtonOwnProps {
|
|
10
11
|
hierarchy?: Hierarchy;
|
|
11
12
|
size?: Size;
|
|
12
13
|
color?: string;
|
|
14
|
+
severity?: ActionSeverity;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export type BaseButtonWithStackProps = BaseButtonOwnProps &
|
|
@@ -27,6 +29,7 @@ export const BaseButton = React.forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
27
29
|
style,
|
|
28
30
|
color,
|
|
29
31
|
hierarchy = 'secondary',
|
|
32
|
+
severity = 'neutral',
|
|
30
33
|
size = 'md',
|
|
31
34
|
onTouchStart,
|
|
32
35
|
onContextMenu,
|
|
@@ -55,7 +58,7 @@ export const BaseButton = React.forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
if (color) {
|
|
58
|
-
finalStyle['--
|
|
61
|
+
finalStyle['--interactive-color'] = color;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
return (
|
|
@@ -65,6 +68,7 @@ export const BaseButton = React.forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
65
68
|
inline
|
|
66
69
|
vAlign="center"
|
|
67
70
|
hAlign="center"
|
|
71
|
+
data-severity={severity}
|
|
68
72
|
data-hierarchy={hierarchy}
|
|
69
73
|
data-size={size}
|
|
70
74
|
data-is-disabled={Boolean(props.disabled)}
|
|
@@ -205,6 +205,12 @@ legend {
|
|
|
205
205
|
--on-action: 0, 0%, 100%;
|
|
206
206
|
--material: 0, 0%, 100%;
|
|
207
207
|
--on-material: 213, 35.6%, 34.7%;
|
|
208
|
+
|
|
209
|
+
--action-dangerous: 0, 90%, 50%;
|
|
210
|
+
--action-cautious: 53, 90%, 60%;
|
|
211
|
+
--action-neutral: var(--action);
|
|
212
|
+
--action-suggested: 202, 90%, 40%;
|
|
213
|
+
--action-encouraged: 120, 90%, 40%;
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
* {
|
|
@@ -221,7 +227,7 @@ legend {
|
|
|
221
227
|
background 0.1s,
|
|
222
228
|
color 0.1s;
|
|
223
229
|
|
|
224
|
-
--act: hsl(var(--action));
|
|
230
|
+
--act: hsl(var(--interactive-color, var(--action)));
|
|
225
231
|
--on-act: hsl(var(--on-action));
|
|
226
232
|
/* Could use hsl here if we made three color variables for each of the hsl values */
|
|
227
233
|
--act-down: color-mix(in srgb, var(--act), black 8%);
|
|
@@ -314,6 +320,32 @@ legend {
|
|
|
314
320
|
}
|
|
315
321
|
|
|
316
322
|
/* Button */
|
|
323
|
+
|
|
324
|
+
.tcn-base-button {
|
|
325
|
+
--action: var(var(--button-color), var(--action));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.tcn-base-button[data-severity="dangerous"] {
|
|
329
|
+
--action: var(--action-dangerous);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.tcn-base-button[data-severity="cautious"] {
|
|
333
|
+
--action: var(--action-cautious);
|
|
334
|
+
--on-action: var(--on-material);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* .tcn-base-button[data-severity="neutral"] {
|
|
338
|
+
--action: var(--action-neutral);
|
|
339
|
+
} */
|
|
340
|
+
|
|
341
|
+
.tcn-base-button[data-severity="suggested"] {
|
|
342
|
+
--action: var(--action-suggested);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.tcn-base-button[data-severity="encouraged"] {
|
|
346
|
+
--action: var(--action-encouraged);
|
|
347
|
+
}
|
|
348
|
+
|
|
317
349
|
.tcn-button {
|
|
318
350
|
border-radius: 4px;
|
|
319
351
|
}
|