@tcn/ui 0.3.3 → 0.4.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/Color-6BZIO3FS-CWWwv-fq.js +1004 -0
- package/dist/Color-6BZIO3FS-CWWwv-fq.js.map +1 -0
- package/dist/{WithTooltip-IO6J4KBT-B1oq93K5.js → WithTooltip-65CFNBJE-DvcUZizH.js} +4 -4
- package/dist/WithTooltip-65CFNBJE-DvcUZizH.js.map +1 -0
- package/dist/actions/__docs__/components/showcase.d.ts.map +1 -1
- package/dist/actions/__docs__/components/showcase.js +1 -1
- package/dist/actions/button/base_button/base_button.d.ts +2 -4
- package/dist/actions/button/base_button/base_button.d.ts.map +1 -1
- package/dist/actions/button/base_button/base_button.js +35 -35
- package/dist/actions/button/base_button/base_button.js.map +1 -1
- package/dist/actions/button/button/button.d.ts +7 -1
- package/dist/actions/button/button/button.d.ts.map +1 -1
- package/dist/actions/button/button/button.js +9 -7
- package/dist/actions/button/button/button.js.map +1 -1
- package/dist/actions/button/slim_button/slim_button.d.ts +6 -1
- package/dist/actions/button/slim_button/slim_button.d.ts.map +1 -1
- package/dist/actions/button/slim_button/slim_button.js +13 -14
- package/dist/actions/button/slim_button/slim_button.js.map +1 -1
- package/dist/actions/toggle/toggle.d.ts +9 -0
- package/dist/actions/toggle/toggle.d.ts.map +1 -0
- package/dist/actions/toggle/toggle.js +21 -0
- package/dist/actions/toggle/toggle.js.map +1 -0
- package/dist/feedback/lazy/lazy.js +3 -3
- package/dist/formatter-EIJCOSYU-D6nmx63h.js +6 -0
- package/dist/formatter-EIJCOSYU-D6nmx63h.js.map +1 -0
- package/dist/inputs/mask_input/mask.d.ts.map +1 -1
- package/dist/inputs/mask_input/mask.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_inline_values.js +3 -2
- package/dist/inputs/multiselect/multiselect_inline_values.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_values.js +3 -2
- package/dist/inputs/multiselect/multiselect_values.js.map +1 -1
- package/dist/layouts/index.d.ts +2 -1
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +20 -18
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/row/row.d.ts +4 -0
- package/dist/layouts/row/row.d.ts.map +1 -0
- package/dist/layouts/row/row.js +11 -0
- package/dist/layouts/row/row.js.map +1 -0
- package/dist/layouts/section/heading.d.ts +7 -0
- package/dist/layouts/section/heading.d.ts.map +1 -0
- package/dist/layouts/section/heading.js +9 -0
- package/dist/layouts/section/heading.js.map +1 -0
- package/dist/layouts/section/section.d.ts +4 -0
- package/dist/layouts/section/section.d.ts.map +1 -0
- package/dist/layouts/section/section.js +22 -0
- package/dist/layouts/section/section.js.map +1 -0
- package/dist/navigation/tabs/primitives/tabs_list.d.ts.map +1 -1
- package/dist/navigation/tabs/primitives/tabs_list.js +17 -24
- package/dist/navigation/tabs/primitives/tabs_list.js.map +1 -1
- package/dist/overlay/carrot/base_carrot.d.ts +8 -0
- package/dist/overlay/carrot/base_carrot.d.ts.map +1 -0
- package/dist/overlay/carrot/base_carrot.js +21 -0
- package/dist/overlay/carrot/base_carrot.js.map +1 -0
- package/dist/row.css +1 -0
- package/dist/section.css +1 -0
- package/dist/section.module-0wyGkhDg.js +5 -0
- package/dist/section.module-0wyGkhDg.js.map +1 -0
- package/dist/{showcase-WfP6kBEb.js → showcase-DK557szS.js} +18018 -16269
- package/dist/showcase-DK557szS.js.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js +4 -3
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/{syntaxhighlighter-IQDEPFLK-BX_eF8__.js → syntaxhighlighter-ED5Y7EFY-DaMS-2cF.js} +54 -54
- package/dist/syntaxhighlighter-ED5Y7EFY-DaMS-2cF.js.map +1 -0
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +403 -263
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/themes/themes/windows_98/windows_98.css +1 -1
- package/dist/themes/themes/windows_98/windows_98_theme.js +108 -1
- package/dist/themes/themes/windows_98/windows_98_theme.js.map +1 -1
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +5 -1
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/key/key.d.ts +3 -0
- package/dist/tokens/key/key.d.ts.map +1 -0
- package/dist/tokens/key/key.js +8 -0
- package/dist/tokens/key/key.js.map +1 -0
- package/dist/tokens/value/value.d.ts +3 -0
- package/dist/tokens/value/value.d.ts.map +1 -0
- package/dist/tokens/value/value.js +8 -0
- package/dist/tokens/value/value.js.map +1 -0
- package/package.json +1 -1
- package/src/actions/__docs__/actions.mdx +159 -34
- package/src/actions/__docs__/actions.stories.tsx +416 -101
- package/src/actions/__docs__/components/showcase.tsx +10 -6
- package/src/actions/button/__stories__/button.stories.tsx +10 -0
- package/src/actions/button/__stories__/toggle.stories.tsx +177 -0
- package/src/actions/button/base_button/base_button.tsx +8 -10
- package/src/actions/button/button/button.tsx +11 -2
- package/src/actions/button/slim_button/slim_button.tsx +20 -13
- package/src/actions/toggle/toggle.tsx +26 -0
- package/src/inputs/mask_input/mask.ts +7 -1
- package/src/layouts/index.ts +3 -2
- package/src/layouts/row/row.module.css +5 -0
- package/src/layouts/row/row.tsx +15 -0
- package/src/layouts/section/__stories__/section.stories.module.css +6 -0
- package/src/layouts/section/__stories__/section.stories.tsx +152 -0
- package/src/layouts/section/heading.tsx +16 -0
- package/src/layouts/section/section.module.css +41 -0
- package/src/layouts/section/section.tsx +21 -0
- package/src/navigation/tabs/primitives/tabs_list.tsx +5 -6
- package/src/overlay/carrot/base_carrot.tsx +24 -0
- package/src/overlay/carrot/carrot.stories.tsx +54 -0
- package/src/surfaces/card/card.stories.tsx +14 -14
- package/src/surfaces/modal/__stories__/modal.stories.tsx +16 -7
- package/src/surfaces/window/window.stories.tsx +16 -10
- package/src/themes/themes/ergo/__stories__/components/material_picker/sb_inverted_materials.module.css +4 -4
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.module.css +3 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +5 -2
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +2 -2
- package/src/themes/themes/ergo/__stories__/sb_materials.module.css +31 -26
- package/src/themes/themes/ergo/ergo_theme.css +400 -260
- package/src/themes/themes/windows_98/windows_98.css +108 -1
- package/src/tokens/index.ts +2 -0
- package/src/tokens/key/key.tsx +10 -0
- package/src/tokens/value/value.tsx +10 -0
- package/tsconfig.json +6 -0
- package/dist/Color-ASIRERSW-B4GaVKuQ.js +0 -990
- package/dist/Color-ASIRERSW-B4GaVKuQ.js.map +0 -1
- package/dist/WithTooltip-IO6J4KBT-B1oq93K5.js.map +0 -1
- package/dist/formatter-QJ4M4OGQ-DaIl2Wi_.js +0 -6
- package/dist/formatter-QJ4M4OGQ-DaIl2Wi_.js.map +0 -1
- package/dist/layouts/list/section_header.d.ts +0 -6
- package/dist/layouts/list/section_header.d.ts.map +0 -1
- package/dist/layouts/list/section_header.js +0 -22
- package/dist/layouts/list/section_header.js.map +0 -1
- package/dist/showcase-WfP6kBEb.js.map +0 -1
- package/dist/syntaxhighlighter-IQDEPFLK-BX_eF8__.js.map +0 -1
- package/src/layouts/list/section_header.module.css +0 -20
- package/src/layouts/list/section_header.tsx +0 -21
|
@@ -14,6 +14,7 @@ const meta: Meta<ButtonProps> = {
|
|
|
14
14
|
disabled: false,
|
|
15
15
|
children: 'Click Me',
|
|
16
16
|
size: 'md',
|
|
17
|
+
utility: false,
|
|
17
18
|
},
|
|
18
19
|
argTypes: {
|
|
19
20
|
hierarchy: {
|
|
@@ -28,6 +29,7 @@ const meta: Meta<ButtonProps> = {
|
|
|
28
29
|
height: { control: 'text' },
|
|
29
30
|
maxHeight: { control: 'text' },
|
|
30
31
|
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
32
|
+
utility: { control: 'boolean' },
|
|
31
33
|
},
|
|
32
34
|
};
|
|
33
35
|
|
|
@@ -99,6 +101,14 @@ export const WithIcon: Story = {
|
|
|
99
101
|
},
|
|
100
102
|
};
|
|
101
103
|
|
|
104
|
+
// As Utility Button
|
|
105
|
+
export const UtilityButton: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
utility: true,
|
|
108
|
+
children: <SearchIcon />,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
102
112
|
// Dynamic Styles
|
|
103
113
|
export const DynamicStyles: Story = {
|
|
104
114
|
args: {
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// Toggle.stories.tsx
|
|
2
|
+
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
import { SearchIcon } from '@tcn/icons/search_icon.js';
|
|
5
|
+
import { Spacer } from '../../../stacks/spacer.js';
|
|
6
|
+
import { Toggle, ToggleProps } from '../../toggle/toggle.js';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
type SBToggleStoryProps = Pick<
|
|
10
|
+
ToggleProps,
|
|
11
|
+
| 'disabled'
|
|
12
|
+
| 'size'
|
|
13
|
+
| 'color'
|
|
14
|
+
| 'minWidth'
|
|
15
|
+
| 'width'
|
|
16
|
+
| 'maxWidth'
|
|
17
|
+
| 'minHeight'
|
|
18
|
+
| 'height'
|
|
19
|
+
| 'maxHeight'
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
const ToggleStoryComponent: React.FC<SBToggleStoryProps> = args => {
|
|
23
|
+
const [selected, setSelected] = useState(false);
|
|
24
|
+
return (
|
|
25
|
+
<Toggle selected={selected} onClick={() => setSelected(!selected)} {...args}>
|
|
26
|
+
Caps Lock
|
|
27
|
+
</Toggle>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const meta: Meta<SBToggleStoryProps> = {
|
|
32
|
+
title: 'Actions/Toggle',
|
|
33
|
+
component: ToggleStoryComponent,
|
|
34
|
+
tags: ['autodocs'],
|
|
35
|
+
args: {
|
|
36
|
+
disabled: false,
|
|
37
|
+
size: 'md',
|
|
38
|
+
},
|
|
39
|
+
argTypes: {
|
|
40
|
+
color: { control: 'color' },
|
|
41
|
+
minWidth: { control: 'text' },
|
|
42
|
+
width: { control: 'text' },
|
|
43
|
+
maxWidth: { control: 'text' },
|
|
44
|
+
minHeight: { control: 'text' },
|
|
45
|
+
height: { control: 'text' },
|
|
46
|
+
maxHeight: { control: 'text' },
|
|
47
|
+
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<ToggleProps>;
|
|
54
|
+
|
|
55
|
+
// Default Toggle
|
|
56
|
+
export const Baseline: Story = {};
|
|
57
|
+
|
|
58
|
+
export const Selected: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
selected: true,
|
|
61
|
+
children: 'Toggle Title',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Unselected: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
selected: false,
|
|
68
|
+
children: 'Toggle Title',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Disabled States
|
|
73
|
+
export const Disabled: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
disabled: true,
|
|
76
|
+
children: 'Toggle Title',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Custom Dimensions
|
|
81
|
+
export const CustomDimensions: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
minWidth: '120px',
|
|
84
|
+
minHeight: '50px',
|
|
85
|
+
width: '150px',
|
|
86
|
+
height: '60px',
|
|
87
|
+
children: 'Custom Size',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Custom Dimensions
|
|
92
|
+
export const MaxWidth: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
maxWidth: '120px',
|
|
95
|
+
children: 'Really Long Toggle Text With A ReallyLongWordIncluded',
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// With Icon
|
|
100
|
+
export const WithIcon: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
children: (
|
|
103
|
+
<>
|
|
104
|
+
<span>Search</span>
|
|
105
|
+
<Spacer width="8px" />
|
|
106
|
+
<SearchIcon size="lg" />
|
|
107
|
+
</>
|
|
108
|
+
),
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Icon Only (Utility)
|
|
113
|
+
export const Icon: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
util: true,
|
|
116
|
+
children: <SearchIcon size="lg" />,
|
|
117
|
+
} as ToggleProps,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Dynamic Styles
|
|
121
|
+
export const DynamicStyles: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
color: '#00ff3c',
|
|
124
|
+
children: 'Dynamic Colors',
|
|
125
|
+
selected: true,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// Dynamic Styles via Variables
|
|
130
|
+
export const ToggleCSSVariables: Story = {
|
|
131
|
+
args: {
|
|
132
|
+
children: 'Toggle With Action Style',
|
|
133
|
+
},
|
|
134
|
+
argTypes: {
|
|
135
|
+
className: {
|
|
136
|
+
control: 'select',
|
|
137
|
+
options: ['action-primary', 'action-secondary', 'action-tertiary'],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Long Text
|
|
143
|
+
export const LongText: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
children:
|
|
146
|
+
'This is a very long toggle text to demonstrate how the toggle behaves with long content.',
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const DarkBackground: Story = {
|
|
151
|
+
args: {},
|
|
152
|
+
argTypes: {
|
|
153
|
+
className: {
|
|
154
|
+
control: 'select',
|
|
155
|
+
options: ['action-primary', 'action-secondary', 'action-tertiary'],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
decorators: [
|
|
159
|
+
Story => (
|
|
160
|
+
<div
|
|
161
|
+
style={
|
|
162
|
+
{
|
|
163
|
+
backgroundColor: '#2F3437',
|
|
164
|
+
'--surface-color': '#2F3437',
|
|
165
|
+
padding: '20px',
|
|
166
|
+
display: 'flex',
|
|
167
|
+
justifyContent: 'center',
|
|
168
|
+
alignItems: 'center',
|
|
169
|
+
minHeight: '100px',
|
|
170
|
+
} as any
|
|
171
|
+
}
|
|
172
|
+
>
|
|
173
|
+
<Story />
|
|
174
|
+
</div>
|
|
175
|
+
),
|
|
176
|
+
],
|
|
177
|
+
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Size } from '../../../utils/index.js';
|
|
4
4
|
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';
|
|
9
8
|
|
|
10
9
|
export interface BaseButtonOwnProps {
|
|
11
|
-
hierarchy?: Hierarchy;
|
|
12
10
|
size?: Size;
|
|
13
11
|
color?: string;
|
|
14
|
-
|
|
12
|
+
utility?: boolean;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export type BaseButtonWithStackProps = BaseButtonOwnProps &
|
|
@@ -28,9 +26,9 @@ export const BaseButton = React.forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
28
26
|
className,
|
|
29
27
|
style,
|
|
30
28
|
color,
|
|
31
|
-
hierarchy = 'secondary',
|
|
32
|
-
severity = 'neutral',
|
|
33
29
|
size = 'md',
|
|
30
|
+
utility = false,
|
|
31
|
+
disabled = false,
|
|
34
32
|
onTouchStart,
|
|
35
33
|
onContextMenu,
|
|
36
34
|
...props
|
|
@@ -53,7 +51,7 @@ export const BaseButton = React.forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
53
51
|
onContextMenu(event);
|
|
54
52
|
};
|
|
55
53
|
|
|
56
|
-
const finalStyle: React.CSSProperties = {
|
|
54
|
+
const finalStyle: React.CSSProperties & Record<string, any> = {
|
|
57
55
|
...style,
|
|
58
56
|
};
|
|
59
57
|
|
|
@@ -69,10 +67,10 @@ export const BaseButton = React.forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
69
67
|
inline
|
|
70
68
|
vAlign="center"
|
|
71
69
|
hAlign="center"
|
|
72
|
-
data-severity={severity}
|
|
73
|
-
data-hierarchy={hierarchy}
|
|
74
70
|
data-size={size}
|
|
75
|
-
data-is-
|
|
71
|
+
data-is-utility={utility}
|
|
72
|
+
aria-disabled={disabled}
|
|
73
|
+
data-is-disabled={disabled}
|
|
76
74
|
className={clsx(
|
|
77
75
|
styles['base-button'],
|
|
78
76
|
'tcn-interactive',
|
|
@@ -2,17 +2,26 @@ import React from 'react';
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { BaseButton, type BaseButtonProps } from '../base_button/base_button.js';
|
|
4
4
|
import styles from './button.module.css';
|
|
5
|
+
import type { ActionSeverity } from '../../types.js';
|
|
6
|
+
import type { Hierarchy } from '../../../utils/index.js';
|
|
5
7
|
|
|
6
|
-
export interface
|
|
8
|
+
export interface ButtonOwnProps {
|
|
9
|
+
severity?: ActionSeverity;
|
|
10
|
+
hierarchy?: Hierarchy;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ButtonProps extends BaseButtonProps, ButtonOwnProps {}
|
|
7
14
|
|
|
8
15
|
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
9
|
-
{ children, className, ...props },
|
|
16
|
+
{ children, className, severity = 'neutral', hierarchy = 'secondary', ...props },
|
|
10
17
|
ref
|
|
11
18
|
) {
|
|
12
19
|
return (
|
|
13
20
|
<BaseButton
|
|
14
21
|
ref={ref}
|
|
15
22
|
className={clsx(styles.button, 'tcn-button', className)}
|
|
23
|
+
data-severity={severity}
|
|
24
|
+
data-hierarchy={hierarchy}
|
|
16
25
|
{...props}
|
|
17
26
|
>
|
|
18
27
|
{typeof children === 'string' ? (
|
|
@@ -4,16 +4,23 @@ import { clsx } from 'clsx';
|
|
|
4
4
|
// Styles
|
|
5
5
|
import styles from './slim_button.module.css';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated - use Button instead (utility=true)
|
|
9
|
+
* @param props - ButtonProps
|
|
10
|
+
* @returns SlimButton
|
|
11
|
+
*/
|
|
12
|
+
export const SlimButton = React.forwardRef<
|
|
13
|
+
HTMLButtonElement,
|
|
14
|
+
Omit<ButtonProps, 'utility'>
|
|
15
|
+
>(({ children, className, ...props }, ref) => {
|
|
16
|
+
return (
|
|
17
|
+
<Button
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={clsx(styles['slim-button'], 'tcn-slim-button', className)}
|
|
20
|
+
utility={true}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</Button>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { BaseButton, type BaseButtonProps } from '../button/base_button/base_button.js';
|
|
4
|
+
|
|
5
|
+
export interface ToggleOwnProps {
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ToggleProps extends BaseButtonProps, ToggleOwnProps {}
|
|
10
|
+
|
|
11
|
+
export const Toggle = React.forwardRef<HTMLButtonElement, ToggleProps>(function Toggle(
|
|
12
|
+
{ selected = false, children, className, ...props },
|
|
13
|
+
ref
|
|
14
|
+
) {
|
|
15
|
+
return (
|
|
16
|
+
<BaseButton
|
|
17
|
+
aria-pressed={selected}
|
|
18
|
+
data-is-selected={selected}
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={clsx('tcn-toggle', className)}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</BaseButton>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
@@ -7,7 +7,13 @@ import { MaskConfig } from './mask_config.js';
|
|
|
7
7
|
import { MaskCursor } from './mask_cursor.js';
|
|
8
8
|
import { NumericCharacter } from './numeric_character.js';
|
|
9
9
|
|
|
10
|
-
const characterMap
|
|
10
|
+
const characterMap: Record<
|
|
11
|
+
string,
|
|
12
|
+
| typeof AlphaCharacter
|
|
13
|
+
| typeof NumericCharacter
|
|
14
|
+
| typeof AlphaNumericCharacter
|
|
15
|
+
| typeof LanguageCharacter
|
|
16
|
+
> = {
|
|
11
17
|
a: AlphaCharacter,
|
|
12
18
|
'9': NumericCharacter,
|
|
13
19
|
'*': AlphaNumericCharacter,
|
package/src/layouts/index.ts
CHANGED
|
@@ -3,13 +3,14 @@ export * from './divider/divider.js';
|
|
|
3
3
|
export * from './grid/grid.js';
|
|
4
4
|
export * from './list/item.js';
|
|
5
5
|
export * from './list/list.js';
|
|
6
|
-
export * from './list/section_header.js';
|
|
7
6
|
export * from './sidebar_end/sidebar_end.js';
|
|
8
7
|
export * from './sidebar_start/sidebar_start.js';
|
|
9
|
-
|
|
8
|
+
|
|
10
9
|
export { Scaffold, type ScaffoldProps } from './scaffold/scaffold.js';
|
|
11
10
|
export { HBody, type HBodyProps } from './body/h_body.js';
|
|
12
11
|
export { VBody, type VBodyProps } from './body/v_body.js';
|
|
13
12
|
export { Footer, type FooterProps } from './footer/footer.js';
|
|
14
13
|
export { Header, type HeaderProps } from './header/header.js';
|
|
15
14
|
export { UtilityBar, type UtilityBarProps } from './utility_bar/utility_bar.js';
|
|
15
|
+
export { Row } from './row/row.js';
|
|
16
|
+
export { Section } from './section/section.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HStackProps, HStack } from '../../stacks/h_stack.js';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import styles from './row.module.css';
|
|
5
|
+
|
|
6
|
+
export const Row = React.forwardRef<HTMLDivElement, HStackProps>(function Row(
|
|
7
|
+
{ children, className, as = 'div', ...props },
|
|
8
|
+
ref
|
|
9
|
+
) {
|
|
10
|
+
return (
|
|
11
|
+
<HStack ref={ref} className={clsx(className, styles.row, 'tcn-row')} {...props}>
|
|
12
|
+
{children}
|
|
13
|
+
</HStack>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Key } from '../../../tokens/key/key.js';
|
|
2
|
+
import { Value } from '../../../tokens/value/value.js';
|
|
3
|
+
import { Row } from '../../row/row.js';
|
|
4
|
+
import { Section } from '../section.js';
|
|
5
|
+
import styles from './section.stories.module.css';
|
|
6
|
+
import { Heading } from '../heading.js';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Layouts/Section',
|
|
10
|
+
component: Section,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Default = () => {
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<div className={styles['stories-container']}>
|
|
18
|
+
<Section>
|
|
19
|
+
<Heading>Section 1</Heading>
|
|
20
|
+
<Rows />
|
|
21
|
+
<Section>
|
|
22
|
+
<Heading>Subsection 1 - 1</Heading>
|
|
23
|
+
<Rows />
|
|
24
|
+
<Section>
|
|
25
|
+
<Heading>Subsection 1 - 1 - 1</Heading>
|
|
26
|
+
<Rows />
|
|
27
|
+
</Section>
|
|
28
|
+
<Section>
|
|
29
|
+
<Heading>Subsection 1 - 1 - 2</Heading>
|
|
30
|
+
<Rows />
|
|
31
|
+
</Section>
|
|
32
|
+
<Section>
|
|
33
|
+
<Heading>Subsection 1 - 1 - 3</Heading>
|
|
34
|
+
<Rows />
|
|
35
|
+
</Section>
|
|
36
|
+
</Section>
|
|
37
|
+
<Section>
|
|
38
|
+
<Heading>Subsection 1 - 2</Heading>
|
|
39
|
+
<Rows />
|
|
40
|
+
<Section>
|
|
41
|
+
<Heading>Subsection 1 - 2 - 1</Heading>
|
|
42
|
+
<Rows />
|
|
43
|
+
</Section>
|
|
44
|
+
<Section>
|
|
45
|
+
<Heading>Subsection 1 - 2 - 2</Heading>
|
|
46
|
+
<Rows />
|
|
47
|
+
</Section>
|
|
48
|
+
<Section>
|
|
49
|
+
<Heading>Subsection 1 - 2 - 3</Heading>
|
|
50
|
+
<Rows />
|
|
51
|
+
</Section>
|
|
52
|
+
</Section>
|
|
53
|
+
<Section>
|
|
54
|
+
<Heading>Subsection 1 - 3</Heading>
|
|
55
|
+
<Rows />
|
|
56
|
+
<Section>
|
|
57
|
+
<Heading>Subsection 1 - 3 - 1</Heading>
|
|
58
|
+
<Rows />
|
|
59
|
+
</Section>
|
|
60
|
+
<Section>
|
|
61
|
+
<Heading>Subsection 1 - 3 - 2</Heading>
|
|
62
|
+
<Rows />
|
|
63
|
+
</Section>
|
|
64
|
+
<Section>
|
|
65
|
+
<Heading>Subsection 1 - 3 - 3</Heading>
|
|
66
|
+
<Rows />
|
|
67
|
+
<Section>
|
|
68
|
+
<Heading>Subsection 1 - 3 - 3 - 1</Heading>
|
|
69
|
+
<Rows />
|
|
70
|
+
</Section>
|
|
71
|
+
</Section>
|
|
72
|
+
</Section>
|
|
73
|
+
</Section>
|
|
74
|
+
</div>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const Rows = () => {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Row>
|
|
83
|
+
<Key>Key</Key>
|
|
84
|
+
<Value>Value</Value>
|
|
85
|
+
</Row>
|
|
86
|
+
<Row>
|
|
87
|
+
<Key>Key</Key>
|
|
88
|
+
<Value>Value</Value>
|
|
89
|
+
</Row>
|
|
90
|
+
<Row>
|
|
91
|
+
<Key>Key</Key>
|
|
92
|
+
<Value>Value</Value>
|
|
93
|
+
</Row>
|
|
94
|
+
<Row>
|
|
95
|
+
<Key>Key</Key>
|
|
96
|
+
<Value>Value</Value>
|
|
97
|
+
</Row>
|
|
98
|
+
<Row>
|
|
99
|
+
<Key>Key</Key>
|
|
100
|
+
<Value>Value</Value>
|
|
101
|
+
</Row>
|
|
102
|
+
<Row>
|
|
103
|
+
<Key>Key</Key>
|
|
104
|
+
<Value>Value</Value>
|
|
105
|
+
</Row>
|
|
106
|
+
<Row>
|
|
107
|
+
<Key>Key</Key>
|
|
108
|
+
<Value>Value</Value>
|
|
109
|
+
</Row>
|
|
110
|
+
<Row>
|
|
111
|
+
<Key>Key</Key>
|
|
112
|
+
<Value>Value</Value>
|
|
113
|
+
</Row>
|
|
114
|
+
<Row>
|
|
115
|
+
<Key>Key</Key>
|
|
116
|
+
<Value>Value</Value>
|
|
117
|
+
</Row>
|
|
118
|
+
<Row>
|
|
119
|
+
<Key>Key</Key>
|
|
120
|
+
<Value>Value</Value>
|
|
121
|
+
</Row>
|
|
122
|
+
<Row>
|
|
123
|
+
<Key>Key</Key>
|
|
124
|
+
<Value>Value</Value>
|
|
125
|
+
</Row>
|
|
126
|
+
<Row>
|
|
127
|
+
<Key>Key</Key>
|
|
128
|
+
<Value>Value</Value>
|
|
129
|
+
</Row>
|
|
130
|
+
<Row>
|
|
131
|
+
<Key>Key</Key>
|
|
132
|
+
<Value>Value</Value>
|
|
133
|
+
</Row>
|
|
134
|
+
<Row>
|
|
135
|
+
<Key>Key</Key>
|
|
136
|
+
<Value>Value</Value>
|
|
137
|
+
</Row>
|
|
138
|
+
<Row>
|
|
139
|
+
<Key>Key</Key>
|
|
140
|
+
<Value>Value</Value>
|
|
141
|
+
</Row>
|
|
142
|
+
<Row>
|
|
143
|
+
<Key>Key</Key>
|
|
144
|
+
<Value>Value</Value>
|
|
145
|
+
</Row>
|
|
146
|
+
<Row>
|
|
147
|
+
<Key>Key</Key>
|
|
148
|
+
<Value>Value</Value>
|
|
149
|
+
</Row>
|
|
150
|
+
</>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
3
|
+
import styles from './section.module.css';
|
|
4
|
+
|
|
5
|
+
export interface HeadingOwnProps extends HStackProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Heading = ({ children, className, ...props }: HeadingOwnProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<HStack className={clsx(className, styles.heading, 'tcn-heading')} {...props}>
|
|
13
|
+
{children}
|
|
14
|
+
</HStack>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@layer tcn-system {
|
|
2
|
+
:where(.section) {
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:where(.heading) {
|
|
7
|
+
position: sticky;
|
|
8
|
+
height: 23px;
|
|
9
|
+
z-index: 4;
|
|
10
|
+
padding-inline-end: 8px;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:where(.section > .heading) {
|
|
15
|
+
top: 0;
|
|
16
|
+
padding-inline: 8px 8px;
|
|
17
|
+
z-index: 3;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:where(.section > .section > .heading) {
|
|
21
|
+
top: 30px;
|
|
22
|
+
padding-inline: 12px 8px;
|
|
23
|
+
z-index: 2;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:where(.section > .section > .section > .heading) {
|
|
27
|
+
top: 60px;
|
|
28
|
+
padding-inline: 16px 8px;
|
|
29
|
+
z-index: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:where(.section > .section > .section > .section > .heading) {
|
|
33
|
+
top: 90px;
|
|
34
|
+
padding-inline: 20px 8px;
|
|
35
|
+
z-index: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.section > :not(.heading, .section) {
|
|
39
|
+
padding-inline-end: 8px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { VStack, type VStackProps } from '../../stacks/v_stack.js';
|
|
4
|
+
import styles from './section.module.css';
|
|
5
|
+
|
|
6
|
+
export const Section = React.forwardRef<HTMLDivElement, VStackProps>(function Section(
|
|
7
|
+
{ children, className, as = 'section', style, ...props },
|
|
8
|
+
ref
|
|
9
|
+
) {
|
|
10
|
+
return (
|
|
11
|
+
<VStack
|
|
12
|
+
as={as}
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={clsx(className, 'tcn-surface', styles.section, 'tcn-section')}
|
|
15
|
+
style={style}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
{children}
|
|
19
|
+
</VStack>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { forwardRef, type FC, type PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type BaseButtonProps } from '../../../actions/index.js';
|
|
3
3
|
import { HStack, type HStackProps } from '../../../stacks/h_stack.js';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
+
import { Toggle } from '../../../actions/toggle/toggle.js';
|
|
5
6
|
|
|
6
7
|
export type TabsListProps = HStackProps;
|
|
7
8
|
|
|
@@ -26,17 +27,15 @@ export interface TabItemProps extends Omit<BaseButtonProps, 'hierarchy'> {
|
|
|
26
27
|
export const TabItem = forwardRef<HTMLButtonElement, PropsWithChildren<TabItemProps>>(
|
|
27
28
|
({ children, className, role = 'tab', selected = false, ...props }, ref) => {
|
|
28
29
|
return (
|
|
29
|
-
<
|
|
30
|
+
<Toggle
|
|
30
31
|
ref={ref}
|
|
31
32
|
role={role}
|
|
32
33
|
className={clsx(className, 'tcn-interactive', 'tcn-tab-item')}
|
|
33
|
-
|
|
34
|
-
data-is-selected={selected}
|
|
35
|
-
aria-selected={selected}
|
|
34
|
+
selected={selected}
|
|
36
35
|
{...props}
|
|
37
36
|
>
|
|
38
37
|
{children}
|
|
39
|
-
</
|
|
38
|
+
</Toggle>
|
|
40
39
|
);
|
|
41
40
|
}
|
|
42
41
|
);
|