@tcn/ui 0.12.3 → 0.12.5
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/actions/index.d.ts +0 -2
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +6 -10
- package/dist/actions/index.js.map +1 -1
- package/dist/group.css +1 -0
- package/dist/inputs/color_input/color_input.js +2 -4
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_header.js +20 -22
- package/dist/inputs/date_picker/date_picker_header.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +2 -4
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.js +9 -11
- package/dist/inputs/date_picker/date_picker_time_selector.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js +5 -7
- package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +2 -4
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/index.d.ts +2 -0
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/index.js +24 -20
- package/dist/inputs/index.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_inline_values.js +7 -9
- package/dist/inputs/multiselect/multiselect_inline_values.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_values.js +2 -4
- package/dist/inputs/multiselect/multiselect_values.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js +2 -4
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -1
- package/dist/inputs/phone_number_input/sip_input.js +13 -15
- package/dist/inputs/phone_number_input/sip_input.js.map +1 -1
- package/dist/inputs/select/select.js +2 -4
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/{actions/button → inputs}/select_group/select_group.d.ts +1 -1
- package/dist/inputs/select_group/select_group.d.ts.map +1 -0
- package/dist/{actions/button → inputs}/select_group/select_group.js +3 -3
- package/dist/inputs/select_group/select_group.js.map +1 -0
- package/dist/inputs/select_group/single_select_group.d.ts.map +1 -0
- package/dist/inputs/select_group/single_select_group.js.map +1 -0
- package/dist/inputs/suggestions/suggestion_list.js +2 -4
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/layouts/group/group.d.ts +5 -0
- package/dist/layouts/group/group.d.ts.map +1 -0
- package/dist/layouts/group/group.js +26 -0
- package/dist/layouts/group/group.js.map +1 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +36 -32
- package/dist/layouts/index.js.map +1 -1
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +57 -63
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/select_group.css +1 -1
- package/dist/stacks/box/box.d.ts +5 -4
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/detect_resize_bounds.d.ts +15 -0
- package/dist/stacks/box/detect_resize_bounds.d.ts.map +1 -0
- package/dist/stacks/box/detect_resize_bounds.js +49 -0
- package/dist/stacks/box/detect_resize_bounds.js.map +1 -0
- package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
- package/dist/stacks/box/resize_handlers.js +51 -44
- package/dist/stacks/box/resize_handlers.js.map +1 -1
- package/dist/stacks/box/start_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/start_resize_handle.js +2 -1
- package/dist/stacks/box/start_resize_handle.js.map +1 -1
- package/dist/stacks/box/types.d.ts +17 -4
- package/dist/stacks/box/types.d.ts.map +1 -1
- package/dist/surfaces/alert/alert.d.ts +0 -2
- package/dist/surfaces/alert/alert.d.ts.map +1 -1
- package/dist/surfaces/alert/alert.js +5 -7
- package/dist/surfaces/alert/alert.js.map +1 -1
- package/dist/surfaces/confirm/confirm.d.ts +3 -3
- package/dist/surfaces/confirm/confirm.d.ts.map +1 -1
- package/dist/surfaces/confirm/confirm.js +46 -45
- package/dist/surfaces/confirm/confirm.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +22 -13
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.js +4 -2
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +21 -24
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/stories/button_showcase.d.ts.map +1 -1
- package/dist/themes/stylesheets/reset.css +1 -1
- package/dist/themes/stylesheets/reset.js +3 -3
- package/dist/themes/stylesheets/reset.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +30 -4
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/package.json +3 -2
- package/src/actions/index.ts +0 -8
- package/src/inputs/index.ts +9 -0
- package/src/{actions/button/__stories__ → inputs/select_group}/select_group.stories.tsx +5 -26
- package/src/{actions/button → inputs}/select_group/select_group.tsx +3 -3
- package/src/layouts/bar/bar.stories.tsx +61 -0
- package/src/layouts/group/group.module.css +8 -0
- package/src/layouts/group/group.tsx +23 -0
- package/src/layouts/index.ts +2 -0
- package/src/overlay/frame/frame.tsx +34 -51
- package/src/overlay/popper/__stories__/element_popper.stories.tsx +1 -1
- package/src/stacks/box/box.tsx +10 -16
- package/src/stacks/box/detect_resize_bounds.ts +84 -0
- package/src/stacks/box/resize_handlers.ts +27 -15
- package/src/stacks/box/start_resize_handle.tsx +6 -3
- package/src/stacks/box/types.ts +23 -25
- package/src/surfaces/alert/alert.tsx +0 -2
- package/src/surfaces/confirm/confirm.tsx +24 -9
- package/src/surfaces/modal/__stories__/modal.stories.tsx +70 -3
- package/src/surfaces/modal/modal.tsx +11 -2
- package/src/surfaces/window/window.stories.tsx +64 -8
- package/src/surfaces/window/window.tsx +6 -9
- package/src/themes/stories/button_showcase.tsx +19 -51
- package/src/themes/stylesheets/reset.css +3 -3
- package/src/themes/themes/ergo/ergo_theme.css +30 -4
- package/dist/actions/button/select_group/select_group.d.ts.map +0 -1
- package/dist/actions/button/select_group/select_group.js.map +0 -1
- package/dist/actions/button/select_group/single_select_group.d.ts.map +0 -1
- package/dist/actions/button/select_group/single_select_group.js.map +0 -1
- /package/dist/{actions/button → inputs}/select_group/single_select_group.d.ts +0 -0
- /package/dist/{actions/button → inputs}/select_group/single_select_group.js +0 -0
- /package/src/{actions/button → inputs}/select_group/select_group.module.css +0 -0
- /package/src/{actions/button → inputs}/select_group/single_select_group.tsx +0 -0
|
@@ -8,11 +8,12 @@ import { BodyText, Title } from '../../typography/index.js';
|
|
|
8
8
|
import styles from './confirm.module.css';
|
|
9
9
|
import { Box, type BoxProps } from '../../stacks/box/box.js';
|
|
10
10
|
|
|
11
|
-
export interface ConfirmProps
|
|
11
|
+
export interface ConfirmProps
|
|
12
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
12
13
|
open?: boolean;
|
|
13
14
|
graphic?: React.ReactNode;
|
|
14
|
-
title?:
|
|
15
|
-
description?:
|
|
15
|
+
title?: React.ReactNode;
|
|
16
|
+
description?: React.ReactNode;
|
|
16
17
|
actions?: React.ReactNode;
|
|
17
18
|
veilProps?: BoxProps;
|
|
18
19
|
}
|
|
@@ -54,6 +55,24 @@ export const Confirm = React.forwardRef(function Confirm(
|
|
|
54
55
|
setShake(true);
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
const descriptionElement =
|
|
59
|
+
typeof description === 'string' ? (
|
|
60
|
+
<BodyText className="tcn-confirm-description" hierarchy="tertiary">
|
|
61
|
+
{description}
|
|
62
|
+
</BodyText>
|
|
63
|
+
) : (
|
|
64
|
+
description
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const titleElement =
|
|
68
|
+
typeof title === 'string' ? (
|
|
69
|
+
<Title className="tcn-confirm-title" emphasis="strong" size="sm">
|
|
70
|
+
{title}
|
|
71
|
+
</Title>
|
|
72
|
+
) : (
|
|
73
|
+
title
|
|
74
|
+
);
|
|
75
|
+
|
|
57
76
|
return (
|
|
58
77
|
<>
|
|
59
78
|
{open && (
|
|
@@ -68,12 +87,8 @@ export const Confirm = React.forwardRef(function Confirm(
|
|
|
68
87
|
>
|
|
69
88
|
<VStack hAlign="center">
|
|
70
89
|
{graphic}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</Title>
|
|
74
|
-
<BodyText className="tcn-confirm-description" hierarchy="tertiary">
|
|
75
|
-
{description}
|
|
76
|
-
</BodyText>
|
|
90
|
+
{titleElement}
|
|
91
|
+
{descriptionElement}
|
|
77
92
|
<Spacer height="16px" />
|
|
78
93
|
<Box
|
|
79
94
|
className={clsx(styles.actions, 'tcn-confirm-actions')}
|
|
@@ -3,7 +3,7 @@ import { Button } from '../../../actions/index.js';
|
|
|
3
3
|
import { Footer, Header, UtilityBar, VBody } from '../../../layouts/index.js';
|
|
4
4
|
import { ZStack } from '../../../stacks/z_stack.js';
|
|
5
5
|
import { BodyText, Title } from '../../../typography/index.js';
|
|
6
|
-
import { Modal } from '../modal.js';
|
|
6
|
+
import { Modal, type ModalProps } from '../modal.js';
|
|
7
7
|
import { Spacer } from '../../../stacks/index.js';
|
|
8
8
|
import { CrossIcon } from '@tcn/icons/cross_icon.js';
|
|
9
9
|
import { BugIcon } from '@tcn/icons/bug_icon.js';
|
|
@@ -12,9 +12,61 @@ export default {
|
|
|
12
12
|
title: 'Surfaces/Modal',
|
|
13
13
|
component: Modal,
|
|
14
14
|
tags: ['autodocs'],
|
|
15
|
+
argTypes: {
|
|
16
|
+
draggable: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
},
|
|
19
|
+
veil: {
|
|
20
|
+
control: 'boolean',
|
|
21
|
+
},
|
|
22
|
+
resizable: {
|
|
23
|
+
control: 'boolean',
|
|
24
|
+
},
|
|
25
|
+
width: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
},
|
|
28
|
+
height: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
},
|
|
31
|
+
minWidth: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
},
|
|
34
|
+
minHeight: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
},
|
|
37
|
+
maxWidth: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
},
|
|
40
|
+
maxHeight: {
|
|
41
|
+
control: 'text',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
15
44
|
};
|
|
16
45
|
|
|
17
|
-
|
|
46
|
+
type ModalStoryProps = Pick<
|
|
47
|
+
ModalProps,
|
|
48
|
+
| 'resizable'
|
|
49
|
+
| 'draggable'
|
|
50
|
+
| 'veil'
|
|
51
|
+
| 'width'
|
|
52
|
+
| 'height'
|
|
53
|
+
| 'minWidth'
|
|
54
|
+
| 'minHeight'
|
|
55
|
+
| 'maxWidth'
|
|
56
|
+
| 'maxHeight'
|
|
57
|
+
>;
|
|
58
|
+
|
|
59
|
+
export const Baseline = ({
|
|
60
|
+
resizable,
|
|
61
|
+
draggable,
|
|
62
|
+
veil,
|
|
63
|
+
width = '400px',
|
|
64
|
+
height = '500px',
|
|
65
|
+
minWidth,
|
|
66
|
+
minHeight,
|
|
67
|
+
maxWidth,
|
|
68
|
+
maxHeight,
|
|
69
|
+
}: ModalStoryProps) => {
|
|
18
70
|
const [isOpen, setIsOpen] = useState(false);
|
|
19
71
|
|
|
20
72
|
function toggle() {
|
|
@@ -27,7 +79,20 @@ export const ModalStory = () => {
|
|
|
27
79
|
{isOpen ? 'Close' : 'Open'}
|
|
28
80
|
</Button>
|
|
29
81
|
|
|
30
|
-
<Modal
|
|
82
|
+
<Modal
|
|
83
|
+
isOpen={isOpen}
|
|
84
|
+
width={width}
|
|
85
|
+
height={height}
|
|
86
|
+
draggable={draggable}
|
|
87
|
+
veil={veil}
|
|
88
|
+
resizable={resizable}
|
|
89
|
+
minWidth={minWidth}
|
|
90
|
+
minHeight={minHeight}
|
|
91
|
+
maxWidth={maxWidth}
|
|
92
|
+
maxHeight={maxHeight}
|
|
93
|
+
>
|
|
94
|
+
{/* Add a drag handle around the areas of the modal you want to be draggable (usually the header) */}
|
|
95
|
+
{/* <DragHandle> */}
|
|
31
96
|
<Header>
|
|
32
97
|
<Title>Modal Title</Title>
|
|
33
98
|
<Spacer />
|
|
@@ -41,6 +106,8 @@ export const ModalStory = () => {
|
|
|
41
106
|
<CrossIcon />
|
|
42
107
|
</Button>
|
|
43
108
|
</Header>
|
|
109
|
+
{/* </DragHandle> */}
|
|
110
|
+
|
|
44
111
|
<UtilityBar>
|
|
45
112
|
<Title>Utility Bar</Title>
|
|
46
113
|
<Spacer />
|
|
@@ -9,15 +9,24 @@ import styles from './modal.module.css';
|
|
|
9
9
|
export type ModalProps = FrameProps;
|
|
10
10
|
|
|
11
11
|
export const Modal = React.forwardRef<HTMLElement, ModalProps>(function Modal(
|
|
12
|
-
{
|
|
12
|
+
{
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
isOpen,
|
|
16
|
+
veil = true,
|
|
17
|
+
resizable = false,
|
|
18
|
+
draggable = false,
|
|
19
|
+
...props
|
|
20
|
+
}: ModalProps,
|
|
13
21
|
ref
|
|
14
22
|
) {
|
|
15
23
|
return (
|
|
16
24
|
<Frame
|
|
17
25
|
ref={ref}
|
|
18
26
|
isOpen={isOpen}
|
|
19
|
-
draggable={draggable}
|
|
20
27
|
veil={veil}
|
|
28
|
+
draggable={draggable}
|
|
29
|
+
resizable={resizable}
|
|
21
30
|
className={clsx(styles['modal'], 'tcn-surface', 'tcn-modal', className)}
|
|
22
31
|
{...props}
|
|
23
32
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { Window } from './window.js';
|
|
2
|
+
import { Window, type WindowProps } from './window.js';
|
|
3
3
|
import { Footer, Header, UtilityBar, VBody } from '../../layouts/index.js';
|
|
4
4
|
import { BodyText, Title } from '../../typography/index.js';
|
|
5
5
|
import { Spacer } from '../../stacks/spacer.js';
|
|
@@ -13,9 +13,61 @@ export default {
|
|
|
13
13
|
title: 'Surfaces/Window',
|
|
14
14
|
component: Window,
|
|
15
15
|
tags: ['autodocs'],
|
|
16
|
+
argTypes: {
|
|
17
|
+
draggable: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
veil: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
},
|
|
23
|
+
resizable: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
},
|
|
26
|
+
width: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
},
|
|
29
|
+
height: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
},
|
|
32
|
+
minWidth: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
},
|
|
35
|
+
minHeight: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
},
|
|
38
|
+
maxWidth: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
},
|
|
41
|
+
maxHeight: {
|
|
42
|
+
control: 'text',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
16
45
|
};
|
|
17
46
|
|
|
18
|
-
|
|
47
|
+
type WindowStoryProps = Pick<
|
|
48
|
+
WindowProps,
|
|
49
|
+
| 'resizable'
|
|
50
|
+
| 'draggable'
|
|
51
|
+
| 'veil'
|
|
52
|
+
| 'width'
|
|
53
|
+
| 'height'
|
|
54
|
+
| 'minWidth'
|
|
55
|
+
| 'minHeight'
|
|
56
|
+
| 'maxWidth'
|
|
57
|
+
| 'maxHeight'
|
|
58
|
+
>;
|
|
59
|
+
|
|
60
|
+
export const Baseline = ({
|
|
61
|
+
resizable,
|
|
62
|
+
draggable,
|
|
63
|
+
veil,
|
|
64
|
+
width = '400px',
|
|
65
|
+
height = '400px',
|
|
66
|
+
minWidth = 'min-content',
|
|
67
|
+
minHeight = '30%',
|
|
68
|
+
maxWidth = 500,
|
|
69
|
+
maxHeight = '500px',
|
|
70
|
+
}: WindowStoryProps) => {
|
|
19
71
|
const [isOpen, setIsOpen] = useState(false);
|
|
20
72
|
|
|
21
73
|
function toggle() {
|
|
@@ -27,13 +79,17 @@ export const WindowStory = () => {
|
|
|
27
79
|
<Button onClick={toggle}>{isOpen ? 'Close' : 'Open'}</Button>
|
|
28
80
|
<Window
|
|
29
81
|
isOpen={isOpen}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
82
|
+
draggable={draggable}
|
|
83
|
+
veil={veil}
|
|
84
|
+
resizable={resizable}
|
|
85
|
+
width={width}
|
|
86
|
+
height={height}
|
|
87
|
+
minWidth={minWidth}
|
|
88
|
+
minHeight={minHeight}
|
|
89
|
+
maxWidth={maxWidth}
|
|
90
|
+
maxHeight={maxHeight}
|
|
36
91
|
>
|
|
92
|
+
{/* Place the drag handle around the areas of the window you want to be draggable (usually the header) */}
|
|
37
93
|
<DragHandle>
|
|
38
94
|
<Header>
|
|
39
95
|
<Title>Window Title</Title>
|
|
@@ -13,27 +13,24 @@ export const Window = React.forwardRef<HTMLElement, WindowProps>(function Window
|
|
|
13
13
|
children,
|
|
14
14
|
className,
|
|
15
15
|
isOpen,
|
|
16
|
-
draggable = true,
|
|
17
|
-
resizable = true,
|
|
18
16
|
veil = false,
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
draggable = true,
|
|
18
|
+
resizable = false,
|
|
21
19
|
...props
|
|
22
20
|
}: WindowProps,
|
|
23
21
|
ref
|
|
24
22
|
) {
|
|
25
23
|
return (
|
|
26
24
|
<Frame
|
|
25
|
+
ref={ref}
|
|
27
26
|
isOpen={isOpen}
|
|
28
|
-
draggable={draggable}
|
|
29
27
|
veil={veil}
|
|
28
|
+
draggable={draggable}
|
|
29
|
+
resizable={resizable}
|
|
30
30
|
className={clsx(styles['window'], 'tcn-surface', 'tcn-window', className)}
|
|
31
|
-
width={width}
|
|
32
|
-
height={height}
|
|
33
|
-
ref={ref}
|
|
34
31
|
{...props}
|
|
35
32
|
>
|
|
36
|
-
<Scaffold width="100%" height="100%"
|
|
33
|
+
<Scaffold className={'tcn-window-scaffold'} width="100%" height="100%">
|
|
37
34
|
{children}
|
|
38
35
|
</Scaffold>
|
|
39
36
|
</Frame>
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
1
|
import { CrossIcon } from '@tcn/icons/cross_icon.js';
|
|
3
2
|
import { PhoneIcon } from '@tcn/icons/phone_icon.js';
|
|
4
3
|
import { BluetoothIcon } from '@tcn/icons/bluetooth_icon.js';
|
|
5
|
-
import {
|
|
6
|
-
Button,
|
|
7
|
-
ButtonGroup,
|
|
8
|
-
SelectGroup,
|
|
9
|
-
SingleSelectGroup,
|
|
10
|
-
SlimButton,
|
|
11
|
-
} from '../../actions/index.js';
|
|
4
|
+
import { Button, ButtonGroup } from '../../actions/index.js';
|
|
12
5
|
import { HStack } from '../../stacks/h_stack.js';
|
|
13
6
|
import { VStack } from '../../stacks/v_stack.js';
|
|
14
7
|
import { Spacer } from '../../stacks/spacer.js';
|
|
@@ -17,12 +10,6 @@ import { FieldSet } from '../../form/field_set/field_set.js';
|
|
|
17
10
|
import { BodyText } from '../../typography/index.js';
|
|
18
11
|
|
|
19
12
|
export function ButtonShowcase() {
|
|
20
|
-
const [singleSelectedOptions, setSingleSelectedOptions] = useState<string>('option1');
|
|
21
|
-
const [multiselectOptions, setMultiselectOptions] = useState<string[]>([
|
|
22
|
-
'option1',
|
|
23
|
-
'option2',
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
13
|
return (
|
|
27
14
|
<FieldSet legend="Button Showcase">
|
|
28
15
|
{/* Basic Buttons */}
|
|
@@ -57,60 +44,41 @@ export function ButtonShowcase() {
|
|
|
57
44
|
</VStack>
|
|
58
45
|
</Field>
|
|
59
46
|
|
|
60
|
-
{/* Select Groups */}
|
|
61
|
-
<Field label="Select Groups">
|
|
62
|
-
<VStack width="400px" gap="20px" hAlign="center">
|
|
63
|
-
<SingleSelectGroup
|
|
64
|
-
value={singleSelectedOptions}
|
|
65
|
-
onChange={setSingleSelectedOptions}
|
|
66
|
-
>
|
|
67
|
-
<option value="option1">Option 1</option>
|
|
68
|
-
<option value="option2">Option 2</option>
|
|
69
|
-
<option value="option3">Option 3</option>
|
|
70
|
-
</SingleSelectGroup>
|
|
71
|
-
<SelectGroup value={multiselectOptions} onChange={setMultiselectOptions}>
|
|
72
|
-
<option value="option1">Option 1</option>
|
|
73
|
-
<option value="option2">Option 2</option>
|
|
74
|
-
<option value="option3">Option 3</option>
|
|
75
|
-
</SelectGroup>
|
|
76
|
-
</VStack>
|
|
77
|
-
</Field>
|
|
78
|
-
|
|
79
47
|
{/* Slim Buttons */}
|
|
80
48
|
<Field label="Slim Buttons">
|
|
81
49
|
<VStack width="400px" gap="20px" hAlign="center">
|
|
82
50
|
<HStack gap="8px" hAlign="center">
|
|
83
|
-
<
|
|
51
|
+
<Button utility size="sm" hierarchy="primary">
|
|
84
52
|
<CrossIcon size="sm" />
|
|
85
|
-
</
|
|
86
|
-
<
|
|
53
|
+
</Button>
|
|
54
|
+
<Button utility size="md" hierarchy="primary">
|
|
87
55
|
<CrossIcon size="md" />
|
|
88
|
-
</
|
|
89
|
-
<
|
|
56
|
+
</Button>
|
|
57
|
+
<Button utility size="lg" hierarchy="primary">
|
|
90
58
|
<CrossIcon size="lg" />
|
|
91
|
-
</
|
|
59
|
+
</Button>
|
|
92
60
|
</HStack>
|
|
93
61
|
<HStack gap="8px" hAlign="center">
|
|
94
|
-
<
|
|
62
|
+
<Button utility size="sm" hierarchy="secondary">
|
|
95
63
|
<PhoneIcon size="sm" />
|
|
96
|
-
</
|
|
97
|
-
<
|
|
64
|
+
</Button>
|
|
65
|
+
<Button utility size="md" hierarchy="secondary">
|
|
98
66
|
<PhoneIcon size="md" />
|
|
99
|
-
</
|
|
100
|
-
<
|
|
67
|
+
</Button>
|
|
68
|
+
<Button utility size="lg" hierarchy="secondary">
|
|
101
69
|
<PhoneIcon size="lg" />
|
|
102
|
-
</
|
|
70
|
+
</Button>
|
|
103
71
|
</HStack>
|
|
104
72
|
<HStack gap="8px" hAlign="center">
|
|
105
|
-
<
|
|
73
|
+
<Button utility size="sm" hierarchy="tertiary">
|
|
106
74
|
<BluetoothIcon size="sm" />
|
|
107
|
-
</
|
|
108
|
-
<
|
|
75
|
+
</Button>
|
|
76
|
+
<Button utility size="md" hierarchy="tertiary">
|
|
109
77
|
<BluetoothIcon size="md" />
|
|
110
|
-
</
|
|
111
|
-
<
|
|
78
|
+
</Button>
|
|
79
|
+
<Button utility size="lg" hierarchy="tertiary">
|
|
112
80
|
<BluetoothIcon size="lg" />
|
|
113
|
-
</
|
|
81
|
+
</Button>
|
|
114
82
|
</HStack>
|
|
115
83
|
</VStack>
|
|
116
84
|
</Field>
|
|
@@ -91,17 +91,17 @@
|
|
|
91
91
|
vertical-align: baseline;
|
|
92
92
|
}
|
|
93
93
|
/* HTML5 display-role reset for older browsers */
|
|
94
|
+
/* FIXME: sometimes reset breaks stacks display value (flex) */
|
|
95
|
+
/* header, section */
|
|
94
96
|
article,
|
|
95
97
|
aside,
|
|
96
98
|
details,
|
|
97
99
|
figcaption,
|
|
98
100
|
figure,
|
|
99
101
|
footer,
|
|
100
|
-
header,
|
|
101
102
|
hgroup,
|
|
102
103
|
menu,
|
|
103
|
-
nav
|
|
104
|
-
section {
|
|
104
|
+
nav {
|
|
105
105
|
display: block;
|
|
106
106
|
}
|
|
107
107
|
body {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
--font-size: 12px;
|
|
49
49
|
|
|
50
50
|
/* Spacing */
|
|
51
|
+
--gap-xs: 2px;
|
|
51
52
|
--gap-small: 4px;
|
|
52
53
|
--gap-medium: 8px;
|
|
53
54
|
--gap-large: 16px;
|
|
@@ -563,17 +564,21 @@
|
|
|
563
564
|
|
|
564
565
|
/* Inline */
|
|
565
566
|
.tcn-tabs-bar[data-variant="inline"] {
|
|
567
|
+
font-size: 12px;
|
|
566
568
|
min-width: min-content;
|
|
567
569
|
width: auto;
|
|
568
570
|
flex-grow: 0;
|
|
569
571
|
border-radius: var(--shape-radius-medium);
|
|
570
572
|
border: 1px solid var(--on-material);
|
|
573
|
+
padding-block: 1px;
|
|
574
|
+
padding-inline: 2px;
|
|
571
575
|
|
|
572
576
|
.tcn-tabs-list {
|
|
573
|
-
|
|
574
|
-
|
|
577
|
+
height: 20px;
|
|
578
|
+
gap: var(--gap-xs);
|
|
575
579
|
.tcn-tab-item {
|
|
576
580
|
border-radius: var(--shape-radius-medium);
|
|
581
|
+
min-height: 20px;
|
|
577
582
|
}
|
|
578
583
|
}
|
|
579
584
|
}
|
|
@@ -712,6 +717,9 @@
|
|
|
712
717
|
}
|
|
713
718
|
|
|
714
719
|
.tcn-rail {
|
|
720
|
+
:where(.tcn-rail-stack) {
|
|
721
|
+
gap: var(--gap-medium);
|
|
722
|
+
}
|
|
715
723
|
:where(.tcn-body) {
|
|
716
724
|
gap: var(--gap-medium);
|
|
717
725
|
}
|
|
@@ -856,9 +864,25 @@
|
|
|
856
864
|
background-color: var(--background-color-primary);
|
|
857
865
|
}
|
|
858
866
|
|
|
867
|
+
.tcn-bar {
|
|
868
|
+
gap: var(--gap-medium);
|
|
869
|
+
|
|
870
|
+
/* Add a divider between groups unless there is a spacer after a group */
|
|
871
|
+
:where(.tcn-group:not(:last-child):not(:has(+ .tcn-spacer)))::after {
|
|
872
|
+
content: "";
|
|
873
|
+
display: block;
|
|
874
|
+
min-width: 2px;
|
|
875
|
+
height: 18px;
|
|
876
|
+
background: var(--ergo-grey);
|
|
877
|
+
border-radius: var(--shape-radius-small);
|
|
878
|
+
align-self: center;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
859
882
|
/* PANEL */
|
|
860
883
|
.tcn-panel {
|
|
861
|
-
|
|
884
|
+
--material: var(--background-color-primary);
|
|
885
|
+
background-color: var(--material);
|
|
862
886
|
border-radius: var(--shape-radius-medium);
|
|
863
887
|
overflow: hidden;
|
|
864
888
|
}
|
|
@@ -1279,7 +1303,9 @@
|
|
|
1279
1303
|
.tcn-switch-wrapper,
|
|
1280
1304
|
.tcn-date-picker,
|
|
1281
1305
|
.tcn-date-picker-year-selector,
|
|
1282
|
-
.tcn-radio
|
|
1306
|
+
.tcn-radio,
|
|
1307
|
+
.tcn-suggestion-list-search-input,
|
|
1308
|
+
.tcn-suggestion-list {
|
|
1283
1309
|
--accent-color: var(--ergo-primary);
|
|
1284
1310
|
}
|
|
1285
1311
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select_group.d.ts","sourceRoot":"","sources":["../../../../src/actions/button/select_group/select_group.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AACnE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,qBAAqB,CAAC,mBAAmB,EAAE,KAAK,CAAC,EACjD,UAAU,CACX,GAAG;IACF,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,QAAQ,EACJ,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,GACrC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,WAAW,sGAsDtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select_group.js","sources":["../../../../src/actions/button/select_group/select_group.tsx"],"sourcesContent":["import { HStack } from '../../../stacks/h_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';\nimport { clsx } from 'clsx';\nimport React from 'react';\nimport { Button } from '../button/button.js';\nimport styles from './select_group.module.css';\n\nexport type SelectGroupChangeCallback = (values: string[]) => void;\nexport interface SelectGroupOwnProps {\n value: string[];\n disabled?: boolean;\n}\n\nexport type SelectGroupProps = Omit<\n WithDetailedHTMLProps<SelectGroupOwnProps, 'div'>,\n 'onChange'\n> & {\n onChange?: SelectGroupChangeCallback;\n children:\n | React.ReactElement<HTMLOptionElement>\n | React.ReactElement<HTMLOptionElement>[];\n};\n\nexport const SelectGroup = React.forwardRef(function ButtonGroup(\n { children, value, className, onChange, disabled = false, ...props }: SelectGroupProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const options: React.ReactElement<any>[] = Array.isArray(children)\n ? children\n : [children];\n\n const handleChange = (option: string, isSelected: boolean) => {\n if (disabled) return;\n const next = [...value];\n if (isSelected) {\n const index = value.indexOf(option);\n index > -1 && next.splice(index, 1);\n } else {\n next.push(option);\n }\n onChange?.(next);\n };\n\n return (\n <HStack\n ref={ref}\n as=\"div\"\n inline\n width=\"auto\"\n height=\"auto\"\n data-is-disabled={disabled}\n className={clsx(styles['select-group'], 'tcn-select-group', className)}\n {...props}\n >\n {options.map((option, i) => {\n const isSelected = value.includes(option.props.value);\n const select = () => {\n handleChange(option.props.value, isSelected);\n };\n\n return (\n <React.Fragment key={i}>\n <Button\n disabled={disabled || option.props.disabled}\n data-is-disabled={disabled || option.props.disabled}\n className={clsx(styles['select-group-option'], 'tcn-select-group-option')}\n hierarchy={isSelected ? 'primary' : 'secondary'}\n onClick={select}\n value={option.props.value}\n >\n {option.props.children}\n </Button>\n </React.Fragment>\n );\n })}\n </HStack>\n );\n});\n"],"names":["SelectGroup","React","children","value","className","onChange","disabled","props","ref","options","handleChange","option","isSelected","next","index","jsx","HStack","clsx","styles","i","select","Button"],"mappings":";;;;;4LAuBaA,IAAcC,EAAM,WAAW,SAC1C,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,GAAW,UAAAC,GAAU,UAAAC,IAAW,IAAO,GAAGC,EAAA,GAC7DC,GACA;AACA,QAAMC,IAAqC,MAAM,QAAQP,CAAQ,IAC7DA,IACA,CAACA,CAAQ,GAEPQ,IAAe,CAACC,GAAgBC,MAAwB;AAC5D,QAAIN,EAAU;AACd,UAAMO,IAAO,CAAC,GAAGV,CAAK;AACtB,QAAIS,GAAY;AACd,YAAME,IAAQX,EAAM,QAAQQ,CAAM;AAClC,MAAAG,IAAQ,MAAMD,EAAK,OAAOC,GAAO,CAAC;AAAA,IACpC;AACE,MAAAD,EAAK,KAAKF,CAAM;AAElB,IAAAN,IAAWQ,CAAI;AAAA,EACjB;AAEA,SACE,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAR;AAAA,MACA,IAAG;AAAA,MACH,QAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,oBAAkBF;AAAA,MAClB,WAAWW,EAAKC,EAAO,cAAc,GAAG,oBAAoBd,CAAS;AAAA,MACpE,GAAGG;AAAA,MAEH,UAAAE,EAAQ,IAAI,CAACE,GAAQQ,MAAM;AAC1B,cAAMP,IAAaT,EAAM,SAASQ,EAAO,MAAM,KAAK,GAC9CS,IAAS,MAAM;AACnB,UAAAV,EAAaC,EAAO,MAAM,OAAOC,CAAU;AAAA,QAC7C;AAEA,eACE,gBAAAG,EAACd,EAAM,UAAN,EACC,UAAA,gBAAAc;AAAA,UAACM;AAAA,UAAA;AAAA,YACC,UAAUf,KAAYK,EAAO,MAAM;AAAA,YACnC,oBAAkBL,KAAYK,EAAO,MAAM;AAAA,YAC3C,WAAWM,EAAKC,EAAO,qBAAqB,GAAG,yBAAyB;AAAA,YACxE,WAAWN,IAAa,YAAY;AAAA,YACpC,SAASQ;AAAA,YACT,OAAOT,EAAO,MAAM;AAAA,YAEnB,YAAO,MAAM;AAAA,UAAA;AAAA,QAAA,KATGQ,CAWrB;AAAA,MAEJ,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"single_select_group.d.ts","sourceRoot":"","sources":["../../../../src/actions/button/select_group/single_select_group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,gBAAgB,EAChB,OAAO,GAAG,UAAU,GAAG,mBAAmB,CAC3C,GACC,yBAAyB,CAAC;AAE5B,eAAO,MAAM,iBAAiB,4GAgC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"single_select_group.js","sources":["../../../../src/actions/button/select_group/single_select_group.tsx"],"sourcesContent":["import React from 'react';\nimport { SelectGroup, SelectGroupProps } from './select_group.js';\n\nexport interface SingleSelectGroupOwnProps {\n value: string;\n disabled?: boolean;\n onChange?: (value: string) => void;\n}\n\nexport type SingleSelectGroupProps = Omit<\n SelectGroupProps,\n 'value' | 'onChange' | 'enableMultiselect'\n> &\n SingleSelectGroupOwnProps;\n\nexport const SingleSelectGroup = React.forwardRef(function SingleSelectGroup(\n {\n children,\n value,\n className,\n onChange,\n disabled = false,\n ...props\n }: SingleSelectGroupProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const handleChange = (values: string[]) => {\n if (values.length === 0) {\n return;\n }\n // For single select, we take the last selected value or empty string if none selected\n const singleValue = values.length > 0 ? values[values.length - 1] : '';\n onChange?.(singleValue);\n };\n\n return (\n <SelectGroup\n ref={ref}\n value={value != null ? [value] : []}\n onChange={handleChange}\n disabled={disabled}\n className={className}\n {...props}\n >\n {children}\n </SelectGroup>\n );\n});\n"],"names":["SingleSelectGroup","React","children","value","className","onChange","disabled","props","ref","handleChange","values","singleValue","jsx","SelectGroup"],"mappings":";;;AAeO,MAAMA,IAAoBC,EAAM,WAAW,SAChD;AAAA,EACE,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAe,CAACC,MAAqB;AACzC,QAAIA,EAAO,WAAW;AACpB;AAGF,UAAMC,IAAcD,EAAO,SAAS,IAAIA,EAAOA,EAAO,SAAS,CAAC,IAAI;AACpE,IAAAL,IAAWM,CAAW;AAAA,EACxB;AAEA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAL;AAAA,MACA,OAAOL,KAAS,OAAO,CAACA,CAAK,IAAI,CAAA;AAAA,MACjC,UAAUM;AAAA,MACV,UAAAH;AAAA,MACA,WAAAF;AAAA,MACC,GAAGG;AAAA,MAEH,UAAAL;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|