@tcn/ui 0.9.0 → 0.11.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/bar.css +1 -0
- package/dist/body.css +1 -1
- package/dist/body.module-BbFZ7KNP.js +5 -0
- package/dist/body.module-BbFZ7KNP.js.map +1 -0
- package/dist/divider.css +1 -1
- package/dist/footer.css +1 -1
- package/dist/form/field/h_field/h_field.d.ts.map +1 -1
- package/dist/form/field/h_field/h_field.js +33 -35
- package/dist/form/field/h_field/h_field.js.map +1 -1
- package/dist/form/field/v_field/v_field.d.ts.map +1 -1
- package/dist/form/field/v_field/v_field.js +34 -36
- package/dist/form/field/v_field/v_field.js.map +1 -1
- package/dist/frame.css +1 -1
- package/dist/inputs/color_input/color_input.d.ts.map +1 -1
- package/dist/inputs/color_input/color_input.js +47 -46
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.d.ts.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +61 -58
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/index.d.ts +1 -0
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/index.js +34 -31
- package/dist/inputs/index.js.map +1 -1
- package/dist/inputs/input/input.js +9 -9
- package/dist/inputs/input/input.js.map +1 -1
- package/dist/inputs/input_group/input_group.d.ts +5 -0
- package/dist/inputs/input_group/input_group.d.ts.map +1 -0
- package/dist/inputs/input_group/input_group.js +20 -0
- package/dist/inputs/input_group/input_group.js.map +1 -0
- package/dist/inputs/phone_number_input/countries_phone_information.d.ts +2 -2
- package/dist/inputs/phone_number_input/countries_phone_information.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/countries_phone_information.js +5 -353
- package/dist/inputs/phone_number_input/countries_phone_information.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_context.d.ts +24 -0
- package/dist/inputs/phone_number_input/phone_number_context.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_context.js +23 -0
- package/dist/inputs/phone_number_input/phone_number_context.js.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.d.ts +19 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.js +77 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.js.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +16 -14
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +104 -274
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input_adapter.d.ts +6 -0
- package/dist/inputs/phone_number_input/phone_number_input_adapter.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js +95 -0
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -0
- package/dist/inputs/phone_number_input/sip_input.d.ts +12 -0
- package/dist/inputs/phone_number_input/sip_input.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/sip_input.js +111 -0
- package/dist/inputs/phone_number_input/sip_input.js.map +1 -0
- package/dist/inputs/select/select.d.ts.map +1 -1
- package/dist/inputs/select/select.js +3 -2
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts +4 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +120 -111
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/textarea/textarea.js +8 -8
- package/dist/inputs/textarea/textarea.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.d.ts.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +39 -39
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/layouts/bar/bar.d.ts +5 -0
- package/dist/layouts/bar/bar.d.ts.map +1 -0
- package/dist/layouts/bar/bar.js +20 -0
- package/dist/layouts/bar/bar.js.map +1 -0
- package/dist/layouts/body/body.d.ts +2 -2
- package/dist/layouts/body/body.d.ts.map +1 -1
- package/dist/layouts/body/body.js +12 -12
- package/dist/layouts/body/body.js.map +1 -1
- package/dist/layouts/body/h_body.d.ts.map +1 -1
- package/dist/layouts/body/h_body.js +18 -12
- package/dist/layouts/body/h_body.js.map +1 -1
- package/dist/layouts/body/v_body.d.ts.map +1 -1
- package/dist/layouts/body/v_body.js +16 -10
- package/dist/layouts/body/v_body.js.map +1 -1
- package/dist/layouts/footer/footer.d.ts +2 -3
- package/dist/layouts/footer/footer.d.ts.map +1 -1
- package/dist/layouts/footer/footer.js +7 -7
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/header/header.d.ts +2 -2
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js +13 -21
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +0 -1
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +17 -19
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/rail/rail.js +41 -41
- package/dist/layouts/rail/rail.js.map +1 -1
- package/dist/layouts/rail/side/side.d.ts.map +1 -1
- package/dist/layouts/rail/side/side.js +1 -1
- package/dist/layouts/rail/side/side.js.map +1 -1
- package/dist/layouts/rail/utility_strip/utility_strip.d.ts.map +1 -1
- package/dist/layouts/rail/utility_strip/utility_strip.js +21 -17
- package/dist/layouts/rail/utility_strip/utility_strip.js.map +1 -1
- package/dist/layouts/scaffold/scaffold.js +32 -32
- package/dist/layouts/scaffold/scaffold.js.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts +2 -2
- package/dist/layouts/utility_bar/utility_bar.d.ts.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.js +17 -19
- package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
- package/dist/overlay/frame/frame.d.ts +8 -4
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +87 -23
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -1
- package/dist/overlay/popper/legacy/popper.d.ts.map +1 -1
- package/dist/overlay/popper/legacy/popper.js +52 -50
- package/dist/overlay/popper/legacy/popper.js.map +1 -1
- package/dist/panel.css +1 -0
- package/dist/phone_number_input.css +1 -1
- package/dist/rail.css +1 -1
- package/dist/scaffold.css +1 -1
- package/dist/side.css +1 -1
- package/dist/stacks/box/bottom_resize_handle.d.ts +2 -2
- package/dist/stacks/box/bottom_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/bottom_resize_handle.js +12 -10
- package/dist/stacks/box/bottom_resize_handle.js.map +1 -1
- package/dist/stacks/box/box.d.ts +4 -4
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js +26 -26
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/end_resize_handle.d.ts +2 -2
- package/dist/stacks/box/end_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/end_resize_handle.js +6 -5
- package/dist/stacks/box/end_resize_handle.js.map +1 -1
- package/dist/stacks/box/left_resize_handle.d.ts +2 -2
- package/dist/stacks/box/left_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/left_resize_handle.js +10 -9
- package/dist/stacks/box/left_resize_handle.js.map +1 -1
- package/dist/stacks/box/resize_handlers.d.ts +2 -2
- package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
- package/dist/stacks/box/resize_handlers.js +32 -32
- package/dist/stacks/box/resize_handlers.js.map +1 -1
- package/dist/stacks/box/right_resize_handle.d.ts +2 -2
- package/dist/stacks/box/right_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/right_resize_handle.js +6 -5
- package/dist/stacks/box/right_resize_handle.js.map +1 -1
- package/dist/stacks/box/start_resize_handle.d.ts +2 -2
- package/dist/stacks/box/start_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/start_resize_handle.js +6 -6
- package/dist/stacks/box/start_resize_handle.js.map +1 -1
- package/dist/stacks/box/top_resize_handle.d.ts +2 -2
- package/dist/stacks/box/top_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/top_resize_handle.js +6 -5
- package/dist/stacks/box/top_resize_handle.js.map +1 -1
- package/dist/stacks/h_collapsible_box.d.ts.map +1 -1
- package/dist/stacks/h_collapsible_box.js +25 -25
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +25 -25
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/suggestion_list.css +1 -1
- package/dist/surfaces/index.d.ts +1 -2
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +18 -20
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/panel/panel.d.ts +5 -0
- package/dist/surfaces/panel/panel.d.ts.map +1 -0
- package/dist/surfaces/panel/panel.js +19 -0
- package/dist/surfaces/panel/panel.js.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js +2 -3
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/surfaces/window/window.d.ts +1 -1
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +20 -10
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/stylesheets/reset.css +1 -1
- package/dist/themes/stylesheets/reset.js +8 -1
- package/dist/themes/stylesheets/reset.js.map +1 -1
- package/dist/themes/theme.d.ts +2 -1
- package/dist/themes/theme.d.ts.map +1 -1
- package/dist/themes/theme.js +16 -9
- package/dist/themes/theme.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +210 -18
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/typography/body_text/body_text.d.ts.map +1 -1
- package/dist/typography/body_text/body_text.js +12 -10
- package/dist/typography/body_text/body_text.js.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.js +22 -19
- package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -1
- package/package.json +4 -2
- package/src/form/field/h_field/h_field.tsx +0 -4
- package/src/form/field/v_field/v_field.stories.tsx +8 -0
- package/src/form/field/v_field/v_field.tsx +1 -4
- package/src/form/field_set/field_set.stories.tsx +2 -1
- package/src/inputs/__docs__/inputs.mdx +81 -0
- package/src/inputs/__docs__/inputs.stories.tsx +268 -0
- package/src/inputs/color_input/color_input.tsx +17 -17
- package/src/inputs/combo_box/combo_box.tsx +17 -13
- package/src/inputs/index.ts +2 -0
- package/src/inputs/input/input.tsx +1 -1
- package/src/inputs/input_group/input_group.tsx +26 -0
- package/src/inputs/phone_number_input/countries_phone_information.ts +6 -353
- package/src/inputs/phone_number_input/phone_number_context.tsx +32 -0
- package/src/inputs/phone_number_input/phone_number_country_select_adapter.tsx +126 -0
- package/src/inputs/phone_number_input/phone_number_input.module.css +5 -63
- package/src/inputs/phone_number_input/phone_number_input.stories.tsx +180 -150
- package/src/inputs/phone_number_input/phone_number_input.tsx +133 -400
- package/src/inputs/phone_number_input/phone_number_input_adapter.tsx +123 -0
- package/src/inputs/phone_number_input/sip_input.tsx +147 -0
- package/src/inputs/select/select.tsx +13 -14
- package/src/inputs/suggestions/suggestion_list.module.css +1 -0
- package/src/inputs/suggestions/suggestion_list.stories.tsx +12 -8
- package/src/inputs/suggestions/suggestion_list.tsx +24 -3
- package/src/inputs/textarea/textarea.tsx +1 -1
- package/src/inputs/unit_input/unit_input.tsx +17 -17
- package/src/layouts/__stories__/composed.stories.tsx +0 -55
- package/src/layouts/__stories__/rail.stories.tsx +78 -0
- package/src/layouts/__stories__/scaffold.stories.tsx +90 -0
- package/src/layouts/__stories__/utils/content.tsx +27 -0
- package/src/layouts/__stories__/utils/layout_theme.css +88 -0
- package/src/layouts/__stories__/utils/layout_theme_provider.tsx +11 -0
- package/src/layouts/__stories__/utils.tsx +6 -6
- package/src/layouts/{utility_bar/utility_bar.module.css → bar/bar.module.css} +2 -1
- package/src/layouts/bar/bar.tsx +23 -0
- package/src/layouts/body/body.module.css +9 -4
- package/src/layouts/body/body.tsx +7 -6
- package/src/layouts/body/h_body.module.css +1 -2
- package/src/layouts/body/h_body.tsx +9 -4
- package/src/layouts/body/v_body.tsx +9 -4
- package/src/layouts/divider/divider.module.css +1 -1
- package/src/layouts/footer/footer.module.css +0 -3
- package/src/layouts/footer/footer.tsx +5 -6
- package/src/layouts/header/header.tsx +6 -15
- package/src/layouts/index.ts +0 -1
- package/src/layouts/rail/rail.module.css +9 -5
- package/src/layouts/rail/rail.tsx +1 -1
- package/src/layouts/rail/side/side.module.css +0 -1
- package/src/layouts/rail/side/side.tsx +1 -2
- package/src/layouts/rail/utility_strip/utility_strip.module.css +5 -0
- package/src/layouts/rail/utility_strip/utility_strip.tsx +4 -1
- package/src/layouts/scaffold/scaffold.module.css +10 -7
- package/src/layouts/scaffold/scaffold.tsx +1 -1
- package/src/layouts/utility_bar/utility_bar.tsx +6 -9
- package/src/overlay/frame/frame.module.css +2 -4
- package/src/overlay/frame/frame.stories.tsx +13 -10
- package/src/overlay/frame/frame.tsx +124 -16
- package/src/overlay/popper/base/dismissal_decorator.tsx +1 -1
- package/src/overlay/popper/legacy/popper.tsx +5 -1
- package/src/stacks/box/bottom_resize_handle.tsx +12 -5
- package/src/stacks/box/box.tsx +18 -14
- package/src/stacks/box/end_resize_handle.tsx +11 -6
- package/src/stacks/box/left_resize_handle.tsx +9 -3
- package/src/stacks/box/resize_handlers.ts +27 -13
- package/src/stacks/box/right_resize_handle.tsx +9 -3
- package/src/stacks/box/start_resize_handle.tsx +9 -4
- package/src/stacks/box/top_resize_handle.tsx +10 -4
- package/src/stacks/collapsible_box.stories.tsx +11 -11
- package/src/stacks/h_collapsible_box.tsx +5 -5
- package/src/stacks/v_collapsible_box.tsx +4 -4
- package/src/surfaces/index.ts +1 -2
- package/src/surfaces/panel/__stories__/panel.stories.tsx +12 -12
- package/src/surfaces/panel/__stories__/panel_stories.module.css +3 -3
- package/src/surfaces/panel/panel.module.css +1 -6
- package/src/surfaces/panel/panel.tsx +22 -0
- package/src/surfaces/window/window.tsx +14 -4
- package/src/themes/stories/controls_fieldset.tsx +1 -1
- package/src/themes/stylesheets/reset.css +8 -1
- package/src/themes/theme.tsx +6 -2
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +15 -16
- package/src/themes/themes/ergo/ergo_theme.css +210 -18
- package/src/typography/body_text/body_text.tsx +2 -0
- package/src/utils/dnd/__stories__/draggable.stories.tsx +14 -8
- package/src/utils/dnd/hooks/use_drag_container.ts +13 -3
- package/dist/h_body.css +0 -1
- package/dist/h_panel.css +0 -1
- package/dist/header.css +0 -1
- package/dist/layouts/rail/main/main.d.ts +0 -6
- package/dist/layouts/rail/main/main.d.ts.map +0 -1
- package/dist/layouts/rail/main/main.js +0 -21
- package/dist/layouts/rail/main/main.js.map +0 -1
- package/dist/main.css +0 -1
- package/dist/surfaces/panel/h_panel.d.ts +0 -9
- package/dist/surfaces/panel/h_panel.d.ts.map +0 -1
- package/dist/surfaces/panel/h_panel.js +0 -60
- package/dist/surfaces/panel/h_panel.js.map +0 -1
- package/dist/surfaces/panel/v_panel.d.ts +0 -5
- package/dist/surfaces/panel/v_panel.d.ts.map +0 -1
- package/dist/surfaces/panel/v_panel.js +0 -19
- package/dist/surfaces/panel/v_panel.js.map +0 -1
- package/dist/utility_bar.css +0 -1
- package/dist/v_body.css +0 -1
- package/src/inputs/phone_number_input/__tests__/utils.test.ts +0 -52
- package/src/layouts/header/header.module.css +0 -8
- package/src/layouts/rail/__stories__/rail.stories.tsx +0 -64
- package/src/layouts/rail/__stories__/rail_stories.module.css +0 -25
- package/src/layouts/rail/main/main.module.css +0 -7
- package/src/layouts/rail/main/main.tsx +0 -26
- package/src/layouts/scaffold/__stories__/scaffold.stories.tsx +0 -53
- package/src/layouts/scaffold/__stories__/scaffold_stories.module.css +0 -31
- package/src/surfaces/panel/h_panel.tsx +0 -65
- package/src/surfaces/panel/v_panel.tsx +0 -20
|
@@ -6,7 +6,7 @@ import { Heading, Section, VBody } from '../../../layouts/index.js';
|
|
|
6
6
|
import { UtilityBar } from '../../../layouts/utility_bar/utility_bar.js';
|
|
7
7
|
import { Box, HStack, Spacer } from '../../../stacks/index.js';
|
|
8
8
|
import { Title } from '../../../typography/title/title.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Panel } from '../panel.js';
|
|
10
10
|
// Styles
|
|
11
11
|
import styles from './panel_stories.module.css';
|
|
12
12
|
import { TTable, TBody, TD, TH, THead, TR } from '../../../layouts/table/table.js';
|
|
@@ -23,7 +23,7 @@ import { BodyText } from '../../../typography/index.js';
|
|
|
23
23
|
|
|
24
24
|
export default {
|
|
25
25
|
title: 'Surfaces/Panel',
|
|
26
|
-
component:
|
|
26
|
+
component: Panel,
|
|
27
27
|
tags: ['autodocs'],
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -71,8 +71,8 @@ const UtilGroupExample = () => {
|
|
|
71
71
|
|
|
72
72
|
export const Default = () => {
|
|
73
73
|
return (
|
|
74
|
-
<
|
|
75
|
-
<
|
|
74
|
+
<Box className={styles['stories-container']}>
|
|
75
|
+
<Panel maxHeight="600px">
|
|
76
76
|
<Header>
|
|
77
77
|
<Title emphasis="strong">Panel Primary Header</Title>
|
|
78
78
|
<Spacer />
|
|
@@ -109,16 +109,16 @@ export const Default = () => {
|
|
|
109
109
|
<Button hierarchy="secondary">Secondary</Button>
|
|
110
110
|
<Button hierarchy="primary">Primary</Button>
|
|
111
111
|
</Footer>
|
|
112
|
-
</
|
|
113
|
-
</
|
|
112
|
+
</Panel>
|
|
113
|
+
</Box>
|
|
114
114
|
);
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
export const WithTable = () => {
|
|
118
118
|
return (
|
|
119
|
-
<
|
|
119
|
+
<Box className={styles['stories-container']}>
|
|
120
120
|
<HStack gap="16px" maxHeight="600px" height="100%" maxWidth="1440px">
|
|
121
|
-
<
|
|
121
|
+
<Panel minWidth="300px">
|
|
122
122
|
<Header>
|
|
123
123
|
<Title emphasis="strong">Table Title</Title>
|
|
124
124
|
<Spacer />
|
|
@@ -190,8 +190,8 @@ export const WithTable = () => {
|
|
|
190
190
|
</Button>
|
|
191
191
|
</HStack>
|
|
192
192
|
</Footer>
|
|
193
|
-
</
|
|
194
|
-
<
|
|
193
|
+
</Panel>
|
|
194
|
+
<Panel maxHeight="600px" width="300px" minWidth="300px">
|
|
195
195
|
<Header>
|
|
196
196
|
<Title emphasis="strong">John Doe</Title>
|
|
197
197
|
<Spacer />
|
|
@@ -210,8 +210,8 @@ export const WithTable = () => {
|
|
|
210
210
|
<BodyText>Email: john.doe@example.com</BodyText>
|
|
211
211
|
</Section>
|
|
212
212
|
</VBody>
|
|
213
|
-
</
|
|
213
|
+
</Panel>
|
|
214
214
|
</HStack>
|
|
215
|
-
</
|
|
215
|
+
</Box>
|
|
216
216
|
);
|
|
217
217
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
import styles from './panel.module.css';
|
|
6
|
+
|
|
7
|
+
export type PanelProps = ScaffoldProps;
|
|
8
|
+
|
|
9
|
+
export const Panel = React.forwardRef<HTMLElement, PanelProps>(function Panel(
|
|
10
|
+
{ children, className, ...props }: PanelProps,
|
|
11
|
+
ref
|
|
12
|
+
) {
|
|
13
|
+
return (
|
|
14
|
+
<Scaffold
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={clsx(styles['panel'], 'tcn-surface', 'tcn-panel', className)}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</Scaffold>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Frame, type FrameOwnProps } from '../../overlay/frame/frame.js';
|
|
4
3
|
import { Scaffold, type ScaffoldProps } from '../../layouts/scaffold/scaffold.js';
|
|
4
|
+
import { Frame, type FrameOwnProps } from '../../overlay/frame/frame.js';
|
|
5
5
|
|
|
6
6
|
// Styles
|
|
7
7
|
import styles from './window.module.css';
|
|
@@ -9,7 +9,17 @@ import styles from './window.module.css';
|
|
|
9
9
|
export type WindowProps = FrameOwnProps & ScaffoldProps;
|
|
10
10
|
|
|
11
11
|
export const Window = React.forwardRef<HTMLElement, WindowProps>(function Window(
|
|
12
|
-
{
|
|
12
|
+
{
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
isOpen,
|
|
16
|
+
draggable = true,
|
|
17
|
+
resizable = true,
|
|
18
|
+
veil = false,
|
|
19
|
+
width,
|
|
20
|
+
height,
|
|
21
|
+
...props
|
|
22
|
+
}: WindowProps,
|
|
13
23
|
ref
|
|
14
24
|
) {
|
|
15
25
|
return (
|
|
@@ -18,8 +28,8 @@ export const Window = React.forwardRef<HTMLElement, WindowProps>(function Window
|
|
|
18
28
|
draggable={draggable}
|
|
19
29
|
veil={veil}
|
|
20
30
|
className={clsx(styles['window'], 'tcn-surface', 'tcn-window', className)}
|
|
21
|
-
width=
|
|
22
|
-
height=
|
|
31
|
+
width={width}
|
|
32
|
+
height={height}
|
|
23
33
|
>
|
|
24
34
|
<Scaffold ref={ref} {...props}>
|
|
25
35
|
{children}
|
|
@@ -30,7 +30,7 @@ export function ControlsFieldSet() {
|
|
|
30
30
|
const [datePickerValueWithTime, setDatePickerValueWithTime] = useState<Date | null>(
|
|
31
31
|
null
|
|
32
32
|
);
|
|
33
|
-
const [phoneNumberValue, setPhoneNumberValue] = useState<string>(
|
|
33
|
+
const [phoneNumberValue, setPhoneNumberValue] = useState<string | undefined>(undefined);
|
|
34
34
|
|
|
35
35
|
// Additional input state
|
|
36
36
|
const [checkboxValue, setCheckboxValue] = useState<boolean>(false);
|
|
@@ -81,7 +81,8 @@
|
|
|
81
81
|
mark,
|
|
82
82
|
audio,
|
|
83
83
|
button,
|
|
84
|
-
video
|
|
84
|
+
video,
|
|
85
|
+
dialog {
|
|
85
86
|
margin: 0;
|
|
86
87
|
padding: 0;
|
|
87
88
|
border: 0;
|
|
@@ -134,4 +135,10 @@
|
|
|
134
135
|
font: inherit;
|
|
135
136
|
color: inherit;
|
|
136
137
|
}
|
|
138
|
+
dialog {
|
|
139
|
+
max-width: none;
|
|
140
|
+
max-height: none;
|
|
141
|
+
background: transparent;
|
|
142
|
+
color: inherit;
|
|
143
|
+
}
|
|
137
144
|
}
|
package/src/themes/theme.tsx
CHANGED
|
@@ -10,9 +10,10 @@ import layers from '../css/layers.css?raw';
|
|
|
10
10
|
export interface ThemeProps extends BoxProps {
|
|
11
11
|
styleSheets: CSSStyleSheet[];
|
|
12
12
|
children: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export function Theme({ styleSheets, children, ...boxProps }: ThemeProps) {
|
|
16
|
+
export function Theme({ styleSheets, children, className, ...boxProps }: ThemeProps) {
|
|
16
17
|
useLayoutEffect(() => {
|
|
17
18
|
document.adoptedStyleSheets = styleSheets;
|
|
18
19
|
}, [styleSheets]);
|
|
@@ -33,7 +34,10 @@ export function Theme({ styleSheets, children, ...boxProps }: ThemeProps) {
|
|
|
33
34
|
}, []);
|
|
34
35
|
|
|
35
36
|
return (
|
|
36
|
-
<Box
|
|
37
|
+
<Box
|
|
38
|
+
className={clsx('tcn-theme-root', styles['tcn-theme-provider'], className)}
|
|
39
|
+
{...boxProps}
|
|
40
|
+
>
|
|
37
41
|
{children}
|
|
38
42
|
</Box>
|
|
39
43
|
);
|
|
@@ -3,10 +3,9 @@ import { VStack } from '../../../../stacks/v_stack.js';
|
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { PlusIcon } from '@tcn/icons/plus_icon.js';
|
|
5
5
|
import { Divider, Footer, Header, VBody } from '../../../../layouts/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { Panel } from '../../../../surfaces/index.js';
|
|
7
7
|
import { Button } from '../../../../actions/button/button/button.js';
|
|
8
8
|
import { Spacer } from '../../../../stacks/spacer.js';
|
|
9
|
-
import { SlimButton } from '../../../../actions/button/slim_button/slim_button.js';
|
|
10
9
|
import { SB_TonePicker } from './components/tone_picker/sb_tone_picker.js';
|
|
11
10
|
import { formatHSLString, getContrastText, parseHSL } from './utils.js';
|
|
12
11
|
import { SB_MaterialPicker } from './components/material_picker/sb_material_picker.js';
|
|
@@ -86,7 +85,7 @@ export const DynamicSurface = (args: {
|
|
|
86
85
|
<Title>Ergo Theme: Materials and Surfaces</Title>
|
|
87
86
|
</Header>
|
|
88
87
|
<SB_MaterialPicker handleSurfaceClick={handleSurfaceClick} />
|
|
89
|
-
<
|
|
88
|
+
<Panel
|
|
90
89
|
minHeight="200px"
|
|
91
90
|
maxHeight="700px"
|
|
92
91
|
height="100%"
|
|
@@ -95,30 +94,30 @@ export const DynamicSurface = (args: {
|
|
|
95
94
|
<Header>
|
|
96
95
|
Enabled Utilities
|
|
97
96
|
<Spacer />
|
|
98
|
-
<
|
|
97
|
+
<Button utility hierarchy="tertiary">
|
|
99
98
|
<PlusIcon />
|
|
100
|
-
</
|
|
101
|
-
<
|
|
99
|
+
</Button>
|
|
100
|
+
<Button utility hierarchy="secondary">
|
|
102
101
|
<PlusIcon />
|
|
103
|
-
</
|
|
102
|
+
</Button>
|
|
104
103
|
<Divider vertical length="md" />
|
|
105
|
-
<
|
|
104
|
+
<Button utility hierarchy="primary">
|
|
106
105
|
<PlusIcon />
|
|
107
|
-
</
|
|
106
|
+
</Button>
|
|
108
107
|
</Header>
|
|
109
108
|
<Header>
|
|
110
109
|
Disabled Utilities
|
|
111
110
|
<Spacer />
|
|
112
|
-
<
|
|
111
|
+
<Button utility hierarchy="tertiary" disabled>
|
|
113
112
|
<PlusIcon />
|
|
114
|
-
</
|
|
115
|
-
<
|
|
113
|
+
</Button>
|
|
114
|
+
<Button utility hierarchy="secondary" disabled>
|
|
116
115
|
<PlusIcon />
|
|
117
|
-
</
|
|
116
|
+
</Button>
|
|
118
117
|
<Divider vertical length="md" />
|
|
119
|
-
<
|
|
118
|
+
<Button utility hierarchy="primary" disabled>
|
|
120
119
|
<PlusIcon />
|
|
121
|
-
</
|
|
120
|
+
</Button>
|
|
122
121
|
</Header>
|
|
123
122
|
<VBody>
|
|
124
123
|
<SB_TonePicker />
|
|
@@ -143,7 +142,7 @@ export const DynamicSurface = (args: {
|
|
|
143
142
|
<Button hierarchy="secondary">Secondary</Button>
|
|
144
143
|
<Button hierarchy="primary">Primary</Button>
|
|
145
144
|
</Footer>
|
|
146
|
-
</
|
|
145
|
+
</Panel>
|
|
147
146
|
<Header></Header>
|
|
148
147
|
</VStack>
|
|
149
148
|
);
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
--bar-lg: 40px;
|
|
64
64
|
--bar-xl: 48px;
|
|
65
65
|
|
|
66
|
+
--action-sm: 20px;
|
|
67
|
+
--action-md: 24px;
|
|
68
|
+
--action-lg: 32px;
|
|
69
|
+
|
|
66
70
|
/* Status Colors */
|
|
67
71
|
--status-color-disabled: var(--ergo-grey-light);
|
|
68
72
|
--status-color-info: var(--ergo-status-blue);
|
|
@@ -187,7 +191,6 @@
|
|
|
187
191
|
* Primarily manages button dimensions and sizing ratios.
|
|
188
192
|
*/
|
|
189
193
|
.tcn-base-button {
|
|
190
|
-
/* TODO: btn size should look for "--tcn-action-size" variable before defaulting. */
|
|
191
194
|
--btn-size-base: 26px;
|
|
192
195
|
--btn-pad-base: 12px;
|
|
193
196
|
|
|
@@ -307,21 +310,23 @@
|
|
|
307
310
|
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.12);
|
|
308
311
|
|
|
309
312
|
/* Increases the clickable area by 2px on hover to avoid click events not firing due to the button transform y - or slight mouse wiggles */
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
313
|
+
:not(.tcn-select) {
|
|
314
|
+
&::before,
|
|
315
|
+
&::after {
|
|
316
|
+
content: "";
|
|
317
|
+
position: absolute;
|
|
318
|
+
left: 0;
|
|
319
|
+
right: 0;
|
|
320
|
+
height: 4px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&::before {
|
|
324
|
+
top: -2px;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
&::after {
|
|
328
|
+
bottom: -2px;
|
|
329
|
+
}
|
|
325
330
|
}
|
|
326
331
|
}
|
|
327
332
|
|
|
@@ -579,6 +584,18 @@
|
|
|
579
584
|
color: var(--on-material);
|
|
580
585
|
}
|
|
581
586
|
|
|
587
|
+
/* Divider: use material-line; emphasis variants for strong/faint */
|
|
588
|
+
.tcn-divider-line,
|
|
589
|
+
.tcn-divider-line[data-emphasis="normal"] {
|
|
590
|
+
background: var(--material-line);
|
|
591
|
+
}
|
|
592
|
+
.tcn-divider-line[data-emphasis="strong"] {
|
|
593
|
+
background: color-mix(in srgb, var(--material-line) 80%, black 20%);
|
|
594
|
+
}
|
|
595
|
+
.tcn-divider-line[data-emphasis="faint"] {
|
|
596
|
+
background: color-mix(in srgb, var(--material-line) 80%, white 20%);
|
|
597
|
+
}
|
|
598
|
+
|
|
582
599
|
/* ===== SURFACES ===== */
|
|
583
600
|
.tcn-draggable[data-is-draggable="true"] {
|
|
584
601
|
.tcn-drag-handle {
|
|
@@ -586,8 +603,8 @@
|
|
|
586
603
|
}
|
|
587
604
|
}
|
|
588
605
|
|
|
589
|
-
.tcn-frame
|
|
590
|
-
|
|
606
|
+
.tcn-frame-dialog {
|
|
607
|
+
border: inherit;
|
|
591
608
|
}
|
|
592
609
|
|
|
593
610
|
.tcn-tooltip {
|
|
@@ -606,7 +623,22 @@
|
|
|
606
623
|
border-radius: var(--shape-radius-medium);
|
|
607
624
|
}
|
|
608
625
|
}
|
|
626
|
+
/* Rail: */
|
|
627
|
+
.tcn-utility-strip {
|
|
628
|
+
min-width: var(--bar-md);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.tcn-utility-strip,
|
|
632
|
+
.tcn-side {
|
|
633
|
+
padding-block: var(--padding-medium);
|
|
634
|
+
gap: var(--gap-medium);
|
|
635
|
+
}
|
|
609
636
|
|
|
637
|
+
.tcn-rail {
|
|
638
|
+
:where(.tcn-body) {
|
|
639
|
+
gap: var(--gap-medium);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
610
642
|
/* Scaffold: */
|
|
611
643
|
.tcn-footer,
|
|
612
644
|
.tcn-header,
|
|
@@ -998,4 +1030,164 @@
|
|
|
998
1030
|
color: var(--on-material);
|
|
999
1031
|
}
|
|
1000
1032
|
}
|
|
1033
|
+
|
|
1034
|
+
/* ===== INPUTS ===== */
|
|
1035
|
+
.tcn-control {
|
|
1036
|
+
--act: var(--action);
|
|
1037
|
+
--mat: var(--material);
|
|
1038
|
+
--act-raised: color-mix(in srgb, var(--mat), var(--act) 12%);
|
|
1039
|
+
|
|
1040
|
+
font-size: 12px;
|
|
1041
|
+
border: 1px solid var(--ergo-grey);
|
|
1042
|
+
box-sizing: border-box;
|
|
1043
|
+
min-height: var(--action-md);
|
|
1044
|
+
border-radius: var(--shape-radius-medium);
|
|
1045
|
+
padding-inline: 4px;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
.tcn-control[data-is-disabled="false"]:hover {
|
|
1049
|
+
background: var(--act-raised);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
.tcn-control:focus-visible {
|
|
1053
|
+
outline: 2px solid var(--ergo-primary);
|
|
1054
|
+
outline-offset: 2px;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
.tcn-control:focus {
|
|
1058
|
+
border: 1px solid var(--act);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
.tcn-control::placeholder {
|
|
1062
|
+
color: var(--ergo-grey);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
.tcn-control[data-is-disabled="true"] {
|
|
1066
|
+
cursor: not-allowed;
|
|
1067
|
+
background: var(--material-disabled);
|
|
1068
|
+
color: var(--on-material-disabled);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
.tcn-control[data-is-disabled="true"]::placeholder {
|
|
1072
|
+
color: var(--on-material-disabled);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.tcn-input {
|
|
1076
|
+
height: auto;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.tcn-textarea,
|
|
1080
|
+
.tcn-input {
|
|
1081
|
+
cursor: text;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
.tcn-input-group {
|
|
1085
|
+
border-radius: var(--shape-radius-medium);
|
|
1086
|
+
|
|
1087
|
+
&:focus-within {
|
|
1088
|
+
outline: 2px solid var(--ergo-primary);
|
|
1089
|
+
outline-offset: 2px;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
.tcn-input-group-slot {
|
|
1093
|
+
z-index: 1;
|
|
1094
|
+
border-radius: 0;
|
|
1095
|
+
height: auto;
|
|
1096
|
+
min-height: var(--action-md);
|
|
1097
|
+
padding-block: 0;
|
|
1098
|
+
&:focus,
|
|
1099
|
+
&:focus-visible {
|
|
1100
|
+
z-index: 3;
|
|
1101
|
+
outline: none;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.tcn-input-group-slot:first-child {
|
|
1106
|
+
border-top-left-radius: var(--shape-radius-medium);
|
|
1107
|
+
border-bottom-left-radius: var(--shape-radius-medium);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
.tcn-input-group-slot:not(:last-child) {
|
|
1111
|
+
margin-right: -1px;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.tcn-input-group-slot:last-child {
|
|
1115
|
+
border-top-right-radius: var(--shape-radius-medium);
|
|
1116
|
+
border-bottom-right-radius: var(--shape-radius-medium);
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
.tcn-select,
|
|
1120
|
+
.tcn-button,
|
|
1121
|
+
.tcn-button[data-hierarchy] {
|
|
1122
|
+
border: 1px solid var(--ergo-grey);
|
|
1123
|
+
height: auto;
|
|
1124
|
+
min-height: var(--action-md);
|
|
1125
|
+
min-width: var(--action-md);
|
|
1126
|
+
box-sizing: border-box;
|
|
1127
|
+
&:hover,
|
|
1128
|
+
&[data-hover] {
|
|
1129
|
+
transform: none;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
.tcn-select:focus-visible,
|
|
1134
|
+
.tcn-button:focus-visible,
|
|
1135
|
+
.tcn-button[data-hierarchy]:focus-visible {
|
|
1136
|
+
border-color: var(--ergo-primary);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.tcn-slider[data-is-disabled="true"] {
|
|
1141
|
+
&::-webkit-slider-runnable-track {
|
|
1142
|
+
background: var(--ergo-grey-light);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
&::-webkit-slider-thumb {
|
|
1146
|
+
background-color: var(--ergo-white);
|
|
1147
|
+
border: 1px solid var(--ergo-grey-light);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
.tcn-checkbox {
|
|
1152
|
+
border-color: var(--ergo-primary);
|
|
1153
|
+
|
|
1154
|
+
&:focus-visible,
|
|
1155
|
+
&:focus {
|
|
1156
|
+
outline: 2px solid var(--ergo-primary);
|
|
1157
|
+
outline-offset: 2px;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
&[data-is-disabled="true"] {
|
|
1161
|
+
cursor: not-allowed;
|
|
1162
|
+
border-color: var(--material-disabled);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
&[data-checked="true"][data-is-disabled="true"] {
|
|
1166
|
+
background-color: var(--ergo-grey-light);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
&[data-checked="false"][data-is-disabled="true"] {
|
|
1170
|
+
background: var(--material);
|
|
1171
|
+
border-color: var(--ergo-grey-light);
|
|
1172
|
+
color: var(--ergo-grey-light);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
.tcn-switch-wrapper[data-focused="true"][data-is-checked="false"],
|
|
1177
|
+
.tcn-switch-wrapper[data-focused="true"][data-is-checked="true"] {
|
|
1178
|
+
outline: 2px solid var(--ergo-primary);
|
|
1179
|
+
outline-offset: 2px;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/* Quick fix to use some of the default module styles.*/
|
|
1183
|
+
.tcn-input,
|
|
1184
|
+
.tcn-select,
|
|
1185
|
+
.tcn-slider,
|
|
1186
|
+
.tcn-checkbox,
|
|
1187
|
+
.tcn-switch-wrapper,
|
|
1188
|
+
.tcn-date-picker,
|
|
1189
|
+
.tcn-date-picker-year-selector,
|
|
1190
|
+
.tcn-radio {
|
|
1191
|
+
--accent-color: var(--ergo-primary);
|
|
1192
|
+
}
|
|
1001
1193
|
}
|
|
@@ -36,6 +36,7 @@ export const BodyText = React.forwardRef<HTMLDivElement, BodyTextProps>(function
|
|
|
36
36
|
pad,
|
|
37
37
|
selectable = true,
|
|
38
38
|
breakWords = false,
|
|
39
|
+
...props
|
|
39
40
|
}: BodyTextProps,
|
|
40
41
|
ref
|
|
41
42
|
) {
|
|
@@ -73,6 +74,7 @@ export const BodyText = React.forwardRef<HTMLDivElement, BodyTextProps>(function
|
|
|
73
74
|
style={style}
|
|
74
75
|
data-size={size}
|
|
75
76
|
data-word-break={breakWords}
|
|
77
|
+
{...props}
|
|
76
78
|
>
|
|
77
79
|
{children}
|
|
78
80
|
</div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useDragContainer } from '../context.js';
|
|
3
|
-
import { VStack } from '../../../stacks/v_stack.js';
|
|
4
|
-
import { DragHandle } from '../handle.js';
|
|
1
|
+
import { Button } from '../../../actions/button/button/button.js';
|
|
5
2
|
import { Box } from '../../../stacks/box/box.js';
|
|
3
|
+
import { VStack } from '../../../stacks/v_stack.js';
|
|
4
|
+
import { ZStack } from '../../../stacks/z_stack.js';
|
|
6
5
|
import { BodyText } from '../../../typography/index.js';
|
|
7
|
-
import {
|
|
6
|
+
import { useDragContainer } from '../context.js';
|
|
7
|
+
import { Draggable } from '../draggable/draggable.js';
|
|
8
|
+
import { DragHandle } from '../handle.js';
|
|
8
9
|
import styles from './draggable_stories.module.css';
|
|
9
10
|
|
|
10
11
|
export default {
|
|
@@ -60,13 +61,18 @@ function ResetPositionButton() {
|
|
|
60
61
|
|
|
61
62
|
export const WithSetPosition = () => {
|
|
62
63
|
return (
|
|
63
|
-
<
|
|
64
|
+
<ZStack minHeight="600px" height="100%" width="100%">
|
|
64
65
|
<BodyText>
|
|
65
66
|
Drag the box, then click "Reset position" to move it back to (0, 0).
|
|
66
67
|
Dragging again should start from the new position.
|
|
67
68
|
</BodyText>
|
|
68
69
|
<Draggable>
|
|
69
|
-
<Box
|
|
70
|
+
<Box
|
|
71
|
+
as="dialog"
|
|
72
|
+
width="400px"
|
|
73
|
+
height="300px"
|
|
74
|
+
className={styles['handle-container']}
|
|
75
|
+
>
|
|
70
76
|
<VStack gap="8px" padding="8px">
|
|
71
77
|
<DragHandle>
|
|
72
78
|
<Box className={styles.handle} width="120px" padding="8px">
|
|
@@ -77,6 +83,6 @@ export const WithSetPosition = () => {
|
|
|
77
83
|
</VStack>
|
|
78
84
|
</Box>
|
|
79
85
|
</Draggable>
|
|
80
|
-
</
|
|
86
|
+
</ZStack>
|
|
81
87
|
);
|
|
82
88
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useRef, useState } from 'react';
|
|
2
|
-
import { useDraggable } from './use_draggable.js';
|
|
3
2
|
import type { Position } from '../../index.js';
|
|
4
3
|
import type { DragContainer } from '../types.js';
|
|
4
|
+
import { useDraggable } from './use_draggable.js';
|
|
5
5
|
|
|
6
6
|
export interface UseDragContainerOptions {
|
|
7
7
|
initialPosition?: Position;
|
|
@@ -10,7 +10,14 @@ export interface UseDragContainerOptions {
|
|
|
10
10
|
export function useMakeDragContainer(options: UseDragContainerOptions): DragContainer {
|
|
11
11
|
const [handles, setHandles] = useState<React.RefObject<HTMLElement>[]>([]);
|
|
12
12
|
const positionRef = useRef<Position>(options.initialPosition ?? { x: 0, y: 0 });
|
|
13
|
+
/**
|
|
14
|
+
* The value that triggers re-renders. It’s updated in dragCallback so the UI
|
|
15
|
+
* moves while dragging, and it’s what the hook returns so the consumer can
|
|
16
|
+
* render the element at that position
|
|
17
|
+
* (e.g. style={{ left: position.x, top: position.y }}).
|
|
18
|
+
*/
|
|
13
19
|
const [position, setPosition] = useState(positionRef.current);
|
|
20
|
+
|
|
14
21
|
const [isDragging, setIsDragging] = useState(false);
|
|
15
22
|
|
|
16
23
|
useDraggable({
|
|
@@ -24,9 +31,12 @@ export function useMakeDragContainer(options: UseDragContainerOptions): DragCont
|
|
|
24
31
|
y: positionRef.current.y + deltaY,
|
|
25
32
|
});
|
|
26
33
|
},
|
|
27
|
-
endDragCallback: () => {
|
|
34
|
+
endDragCallback: (deltaX, deltaY) => {
|
|
35
|
+
positionRef.current = {
|
|
36
|
+
x: positionRef.current.x + deltaX,
|
|
37
|
+
y: positionRef.current.y + deltaY,
|
|
38
|
+
};
|
|
28
39
|
setIsDragging(false);
|
|
29
|
-
positionRef.current = position;
|
|
30
40
|
},
|
|
31
41
|
});
|
|
32
42
|
|
package/dist/h_body.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._h-body_d56f4f1){min-width:0;flex-grow:1;height:100%}}
|
package/dist/h_panel.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._panel-stack_f1896f3){width:100%;height:100%;overflow:auto}}
|
package/dist/header.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._header_3155fa4){width:100%;min-height:0;padding:var(--padding) var(--padding-large);gap:var(--gap)}}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { HStackProps } from '../../../stacks/h_stack.js';
|
|
3
|
-
export interface MainProps extends Omit<HStackProps, 'as'> {
|
|
4
|
-
}
|
|
5
|
-
export declare const Main: React.ForwardRefExoticComponent<MainProps & React.RefAttributes<HTMLElement>>;
|
|
6
|
-
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/layouts/rail/main/main.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKtE,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;CAAG;AAG7D,eAAO,MAAM,IAAI,+EAef,CAAC"}
|