@tcn/ui 0.15.0 → 0.17.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/card.css +1 -0
- package/dist/column.css +1 -1
- package/dist/containers.css +1 -1
- package/dist/containers.module-BmICKsOK.js +5 -0
- package/dist/containers.module-BmICKsOK.js.map +1 -0
- package/dist/form/field/field.js +11 -8
- package/dist/form/field/field.js.map +1 -1
- package/dist/inputs/color_input/color_picker.js +5 -2
- package/dist/inputs/color_input/color_picker.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +18 -15
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/date_picker/date_picker.js +13 -10
- package/dist/inputs/date_picker/date_picker.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +20 -17
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +5 -2
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/mask_input/key_capture_input.js +26 -23
- package/dist/inputs/mask_input/key_capture_input.js.map +1 -1
- package/dist/inputs/mask_input/mask_input.js +5 -2
- package/dist/inputs/mask_input/mask_input.js.map +1 -1
- package/dist/inputs/multiselect/multiselect.js +22 -19
- package/dist/inputs/multiselect/multiselect.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_context.js +7 -4
- package/dist/inputs/phone_number_input/phone_number_context.js.map +1 -1
- package/dist/inputs/select/select.js +5 -2
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/slider/slider.js +19 -16
- package/dist/inputs/slider/slider.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +5 -2
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +18 -15
- package/dist/inputs/switch/switch.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +15 -12
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/layouts/containers/columns/column.d.ts +6 -0
- package/dist/layouts/containers/columns/column.d.ts.map +1 -0
- package/dist/layouts/containers/columns/column.js +20 -0
- package/dist/layouts/containers/columns/column.js.map +1 -0
- package/dist/layouts/containers/columns/columns.d.ts +11 -0
- package/dist/layouts/containers/columns/columns.d.ts.map +1 -0
- package/dist/layouts/containers/columns/columns.js +34 -0
- package/dist/layouts/containers/columns/columns.js.map +1 -0
- package/dist/layouts/containers/rail.d.ts +2 -5
- package/dist/layouts/containers/rail.d.ts.map +1 -1
- package/dist/layouts/containers/rail.js +17 -55
- package/dist/layouts/containers/rail.js.map +1 -1
- package/dist/layouts/containers/rows/index.d.ts +3 -0
- package/dist/layouts/containers/rows/index.d.ts.map +1 -0
- package/dist/layouts/containers/rows/index.js +7 -0
- package/dist/layouts/containers/rows/index.js.map +1 -0
- package/dist/layouts/containers/rows/row.d.ts +6 -0
- package/dist/layouts/containers/rows/row.d.ts.map +1 -0
- package/dist/layouts/containers/rows/row.js +20 -0
- package/dist/layouts/containers/rows/row.js.map +1 -0
- package/dist/layouts/containers/rows/rows.d.ts +11 -0
- package/dist/layouts/containers/rows/rows.d.ts.map +1 -0
- package/dist/layouts/containers/rows/rows.js +34 -0
- package/dist/layouts/containers/rows/rows.js.map +1 -0
- package/dist/layouts/containers/scaffold.d.ts +2 -5
- package/dist/layouts/containers/scaffold.d.ts.map +1 -1
- package/dist/layouts/containers/scaffold.js +17 -55
- package/dist/layouts/containers/scaffold.js.map +1 -1
- package/dist/layouts/index.d.ts +4 -2
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +35 -31
- package/dist/layouts/index.js.map +1 -1
- package/dist/mobile/inputs/date_picker/mobile_date_picker_header.js +5 -2
- package/dist/mobile/inputs/date_picker/mobile_date_picker_header.js.map +1 -1
- package/dist/mobile/inputs/date_picker/mobile_date_picker_input.js +5 -2
- package/dist/mobile/inputs/date_picker/mobile_date_picker_input.js.map +1 -1
- package/dist/mobile/inputs/date_picker/mobile_date_picker_year_selector.js +8 -5
- package/dist/mobile/inputs/date_picker/mobile_date_picker_year_selector.js.map +1 -1
- package/dist/navigation/tabs/state/link/tab_link.js +9 -6
- package/dist/navigation/tabs/state/link/tab_link.js.map +1 -1
- package/dist/overlay/menu/menu.js +3 -0
- package/dist/overlay/menu/menu.js.map +1 -1
- package/dist/overlay/popper/context_popper.js +8 -5
- package/dist/overlay/popper/context_popper.js.map +1 -1
- package/dist/overlay/popper/element_popper.js +9 -6
- package/dist/overlay/popper/element_popper.js.map +1 -1
- package/dist/overlay/popper/legacy/popper.js +13 -10
- package/dist/overlay/popper/legacy/popper.js.map +1 -1
- package/dist/overlay/popper/preview_popper.js +10 -7
- package/dist/overlay/popper/preview_popper.js.map +1 -1
- package/dist/overlay/tethered/tethered.js +11 -8
- package/dist/overlay/tethered/tethered.js.map +1 -1
- package/dist/resizable.css +1 -0
- package/dist/resizable.module-I6iyBAvM.js +5 -0
- package/dist/resizable.module-I6iyBAvM.js.map +1 -0
- package/dist/resize_handle.css +1 -0
- package/dist/row.css +1 -0
- package/dist/stacks/box/box.js +12 -9
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/detect_resize_bounds.d.ts +1 -0
- package/dist/stacks/box/detect_resize_bounds.d.ts.map +1 -1
- package/dist/stacks/box/detect_resize_bounds.js +22 -20
- package/dist/stacks/box/detect_resize_bounds.js.map +1 -1
- package/dist/stacks/h_collapsible_box.js +17 -14
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +19 -16
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/surfaces/card/card.d.ts.map +1 -1
- package/dist/surfaces/card/card.js +14 -6
- package/dist/surfaces/card/card.js.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.js +6 -4
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +10 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/themes/theme.d.ts.map +1 -1
- package/dist/themes/theme.js +17 -22
- 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 +225 -27
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +39 -26
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/resize/context.d.ts +4 -0
- package/dist/utils/resize/context.d.ts.map +1 -0
- package/dist/utils/resize/context.js +10 -0
- package/dist/utils/resize/context.js.map +1 -0
- package/dist/utils/resize/handle_config.d.ts +32 -0
- package/dist/utils/resize/handle_config.d.ts.map +1 -0
- package/dist/utils/resize/handle_config.js +85 -0
- package/dist/utils/resize/handle_config.js.map +1 -0
- package/dist/utils/resize/index.d.ts +10 -0
- package/dist/utils/resize/index.d.ts.map +1 -0
- package/dist/utils/resize/index.js +16 -0
- package/dist/utils/resize/index.js.map +1 -0
- package/dist/utils/resize/resizable.d.ts +11 -0
- package/dist/utils/resize/resizable.d.ts.map +1 -0
- package/dist/utils/resize/resizable.js +52 -0
- package/dist/utils/resize/resizable.js.map +1 -0
- package/dist/utils/resize/resize_handle.d.ts +7 -0
- package/dist/utils/resize/resize_handle.d.ts.map +1 -0
- package/dist/utils/resize/resize_handle.js +100 -0
- package/dist/utils/resize/resize_handle.js.map +1 -0
- package/dist/utils/resize/resize_strategy.d.ts +47 -0
- package/dist/utils/resize/resize_strategy.d.ts.map +1 -0
- package/dist/utils/resize/resize_strategy.js +108 -0
- package/dist/utils/resize/resize_strategy.js.map +1 -0
- package/dist/utils/resize/types.d.ts +28 -0
- package/dist/utils/resize/types.d.ts.map +1 -0
- package/dist/utils/resize/types.js +2 -0
- package/dist/utils/resize/types.js.map +1 -0
- package/package.json +3 -3
- package/src/layouts/__stories__/columns.stories.tsx +77 -0
- package/src/layouts/__stories__/composed.stories.tsx +77 -8
- package/src/layouts/__stories__/rail.stories.tsx +4 -4
- package/src/layouts/__stories__/rows.stories.tsx +77 -0
- package/src/layouts/__stories__/utils.tsx +2 -84
- package/src/layouts/containers/columns/column.module.css +15 -0
- package/src/layouts/containers/columns/column.tsx +22 -0
- package/src/layouts/containers/columns/columns.tsx +42 -0
- package/src/layouts/containers/containers.module.css +27 -29
- package/src/layouts/containers/rail.tsx +9 -51
- package/src/layouts/containers/rows/index.ts +2 -0
- package/src/layouts/containers/rows/row.module.css +15 -0
- package/src/layouts/containers/rows/row.tsx +22 -0
- package/src/layouts/containers/rows/rows.tsx +42 -0
- package/src/layouts/containers/scaffold.tsx +9 -49
- package/src/layouts/index.ts +4 -2
- package/src/stacks/box/detect_resize_bounds.ts +5 -1
- package/src/surfaces/card/card.module.css +5 -0
- package/src/surfaces/card/card.stories.tsx +66 -8
- package/src/surfaces/card/card.tsx +6 -2
- package/src/surfaces/page/page.stories.tsx +109 -25
- package/src/surfaces/panel/__stories__/panel.stories.tsx +139 -1
- package/src/test-setup.ts +11 -0
- package/src/themes/theme.tsx +6 -16
- package/src/themes/themes/ergo/ergo_theme.css +223 -25
- package/src/utils/index.ts +2 -0
- package/src/utils/resize/__stories__/resizable.stories.tsx +214 -0
- package/src/utils/resize/__stories__/resizable_stories.module.css +47 -0
- package/src/utils/resize/__tests__/handle_config.test.ts +269 -0
- package/src/utils/resize/__tests__/resize_strategy.test.ts +163 -0
- package/src/utils/resize/context.ts +9 -0
- package/src/utils/resize/handle_config.ts +142 -0
- package/src/utils/resize/index.ts +37 -0
- package/src/utils/resize/resizable.module.css +5 -0
- package/src/utils/resize/resizable.tsx +97 -0
- package/src/utils/resize/resize_handle.module.css +146 -0
- package/src/utils/resize/resize_handle.tsx +165 -0
- package/src/utils/resize/resize_strategy.ts +190 -0
- package/src/utils/resize/types.ts +64 -0
- package/dist/containers.module-DlGySre0.js +0 -5
- package/dist/containers.module-DlGySre0.js.map +0 -1
- package/dist/layouts/column/column.d.ts +0 -10
- package/dist/layouts/column/column.d.ts.map +0 -1
- package/dist/layouts/column/column.js +0 -52
- package/dist/layouts/column/column.js.map +0 -1
- package/dist/layouts/containers/side/side.d.ts +0 -6
- package/dist/layouts/containers/side/side.d.ts.map +0 -1
- package/dist/layouts/containers/side/side.js +0 -22
- package/dist/layouts/containers/side/side.js.map +0 -1
- package/dist/side.css +0 -1
- package/src/layouts/column/column.module.css +0 -35
- package/src/layouts/column/column.tsx +0 -57
- package/src/layouts/containers/side/side.module.css +0 -7
- package/src/layouts/containers/side/side.tsx +0 -25
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row.js","sources":["../../../../src/layouts/containers/rows/row.tsx"],"sourcesContent":["import React from 'react';\nimport { clsx } from 'clsx';\nimport { HStack, type HStackProps } from '../../../stacks/h_stack.js';\nimport styles from './row.module.css';\n\nexport interface RowProps extends Omit<HStackProps, 'as'> {}\n\nexport const Row = React.forwardRef<HTMLElement, RowProps>(function Row(\n { children, className, ...props }: RowProps,\n ref\n) {\n return (\n <HStack\n ref={ref}\n as=\"section\"\n className={clsx('tcn-row', styles['row'], className)}\n {...props}\n >\n {children}\n </HStack>\n );\n});\n"],"names":["Row","React","children","className","props","ref","jsx","HStack","clsx","styles"],"mappings":";;;;0CAOaA,IAAMC,EAAM,WAAkC,SACzD,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAK,WAAWC,EAAO,KAAQN,CAAS;AAAA,MAClD,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ScaffoldProps } from '../scaffold.js';
|
|
3
|
+
export interface RowsOwnProps {
|
|
4
|
+
rowsMinHeight?: string | number;
|
|
5
|
+
rowsHeight?: string | number;
|
|
6
|
+
rowsMaxHeight?: string | number;
|
|
7
|
+
}
|
|
8
|
+
export interface RowsProps extends Omit<ScaffoldProps, 'as'>, RowsOwnProps {
|
|
9
|
+
}
|
|
10
|
+
export declare const Rows: React.ForwardRefExoticComponent<RowsProps & React.RefAttributes<HTMLElement>>;
|
|
11
|
+
//# sourceMappingURL=rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../../../src/layouts/containers/rows/rows.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG9D,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,YAAY;CAAG;AAE7E,eAAO,MAAM,IAAI,+EA4Bf,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import c from "react";
|
|
3
|
+
import { clsx as w } from "clsx";
|
|
4
|
+
import { Scaffold as p } from "../scaffold.js";
|
|
5
|
+
import { removeUndefinedProperties as h } from "../../../stacks/utils/remove_undefined_properties.js";
|
|
6
|
+
const _ = c.forwardRef(function({
|
|
7
|
+
children: o,
|
|
8
|
+
className: r,
|
|
9
|
+
rowsMinHeight: t,
|
|
10
|
+
rowsHeight: e,
|
|
11
|
+
rowsMaxHeight: s,
|
|
12
|
+
style: m,
|
|
13
|
+
...f
|
|
14
|
+
}, i) {
|
|
15
|
+
const n = h({
|
|
16
|
+
"--rows-min-height": t,
|
|
17
|
+
"--rows-height": e,
|
|
18
|
+
"--rows-max-height": s
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ a(
|
|
21
|
+
p,
|
|
22
|
+
{
|
|
23
|
+
ref: i,
|
|
24
|
+
className: w("tcn-rows", r),
|
|
25
|
+
style: { ...n, ...m },
|
|
26
|
+
...f,
|
|
27
|
+
children: o
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
_ as Rows
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.js","sources":["../../../../src/layouts/containers/rows/rows.tsx"],"sourcesContent":["import React from 'react';\nimport { clsx } from 'clsx';\nimport { Scaffold, type ScaffoldProps } from '../scaffold.js';\nimport { removeUndefinedProperties } from '../../../stacks/utils/remove_undefined_properties.js';\n\nexport interface RowsOwnProps {\n rowsMinHeight?: string | number;\n rowsHeight?: string | number;\n rowsMaxHeight?: string | number;\n}\n\nexport interface RowsProps extends Omit<ScaffoldProps, 'as'>, RowsOwnProps {}\n\nexport const Rows = React.forwardRef<HTMLElement, RowsProps>(function Rows(\n {\n children,\n className,\n rowsMinHeight,\n rowsHeight,\n rowsMaxHeight,\n style,\n ...props\n }: RowsProps,\n ref\n) {\n const rowVars = removeUndefinedProperties({\n '--rows-min-height': rowsMinHeight,\n '--rows-height': rowsHeight,\n '--rows-max-height': rowsMaxHeight,\n });\n\n return (\n <Scaffold\n ref={ref}\n className={clsx('tcn-rows', className)}\n style={{ ...rowVars, ...style }}\n {...props}\n >\n {children}\n </Scaffold>\n );\n});\n"],"names":["Rows","React","children","className","rowsMinHeight","rowsHeight","rowsMaxHeight","style","props","ref","rowVars","removeUndefinedProperties","jsx","Scaffold","clsx"],"mappings":";;;;;AAaO,MAAMA,IAAOC,EAAM,WAAmC,SAC3D;AAAA,EACE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAUC,EAA0B;AAAA,IACxC,qBAAqBP;AAAA,IACrB,iBAAiBC;AAAA,IACjB,qBAAqBC;AAAA,EAAA,CACtB;AAED,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAJ;AAAA,MACA,WAAWK,EAAK,YAAYX,CAAS;AAAA,MACrC,OAAO,EAAE,GAAGO,GAAS,GAAGH,EAAA;AAAA,MACvB,GAAGC;AAAA,MAEH,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface ScaffoldProps extends Omit<BoxProps, 'as'> {
|
|
5
|
-
vAlign?: Alignment;
|
|
6
|
-
hAlign?: Alignment;
|
|
2
|
+
import { VStackProps } from '../../stacks/v_stack.js';
|
|
3
|
+
export interface ScaffoldProps extends Omit<VStackProps, 'as'> {
|
|
7
4
|
}
|
|
8
5
|
export declare const Scaffold: React.ForwardRefExoticComponent<ScaffoldProps & React.RefAttributes<HTMLElement>>;
|
|
9
6
|
//# sourceMappingURL=scaffold.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/layouts/containers/scaffold.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/layouts/containers/scaffold.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGnE,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;CAAG;AAEjE,eAAO,MAAM,QAAQ,mFAsBnB,CAAC"}
|
|
@@ -1,67 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { clsx as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
width: d,
|
|
10
|
-
height: i,
|
|
11
|
-
minWidth: a,
|
|
12
|
-
maxWidth: o,
|
|
13
|
-
minHeight: c,
|
|
14
|
-
maxHeight: r,
|
|
15
|
-
hAlign: s = "start",
|
|
16
|
-
vAlign: f = "start",
|
|
17
|
-
className: p,
|
|
18
|
-
...k
|
|
19
|
-
}, n) {
|
|
20
|
-
return /* @__PURE__ */ e(
|
|
21
|
-
x,
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
import { clsx as e } from "clsx";
|
|
4
|
+
import { VStack as i } from "../../stacks/v_stack.js";
|
|
5
|
+
import { s as t } from "../../containers.module-BmICKsOK.js";
|
|
6
|
+
const R = n.forwardRef(function({ children: o, className: r, vAlign: f = "start", hAlign: a = "start", ...c }, s) {
|
|
7
|
+
return /* @__PURE__ */ m(
|
|
8
|
+
i,
|
|
22
9
|
{
|
|
23
|
-
ref:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
maxHeight: r,
|
|
30
|
-
"data-h-alignment": s,
|
|
31
|
-
"data-v-alignment": f,
|
|
32
|
-
className: l(
|
|
33
|
-
p,
|
|
10
|
+
ref: s,
|
|
11
|
+
as: "section",
|
|
12
|
+
vAlign: f,
|
|
13
|
+
hAlign: a,
|
|
14
|
+
className: e(
|
|
15
|
+
r,
|
|
34
16
|
t.scaffold,
|
|
35
17
|
t.container,
|
|
36
18
|
"tcn-container",
|
|
37
19
|
"tcn-scaffold"
|
|
38
20
|
),
|
|
39
|
-
...
|
|
40
|
-
children:
|
|
41
|
-
S,
|
|
42
|
-
{
|
|
43
|
-
as: "section",
|
|
44
|
-
minWidth: a,
|
|
45
|
-
maxWidth: o,
|
|
46
|
-
minHeight: c,
|
|
47
|
-
maxHeight: r,
|
|
48
|
-
hAlign: s,
|
|
49
|
-
vAlign: f,
|
|
50
|
-
ref: n,
|
|
51
|
-
className: l(
|
|
52
|
-
t["scaffold-stack"],
|
|
53
|
-
t["container-stack"],
|
|
54
|
-
"tcn-container-stack",
|
|
55
|
-
"tcn-scaffold-stack"
|
|
56
|
-
),
|
|
57
|
-
zIndex: 0,
|
|
58
|
-
children: m
|
|
59
|
-
}
|
|
60
|
-
)
|
|
21
|
+
...c,
|
|
22
|
+
children: o
|
|
61
23
|
}
|
|
62
24
|
);
|
|
63
25
|
});
|
|
64
26
|
export {
|
|
65
|
-
|
|
27
|
+
R as Scaffold
|
|
66
28
|
};
|
|
67
29
|
//# sourceMappingURL=scaffold.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sources":["../../../src/layouts/containers/scaffold.tsx"],"sourcesContent":["import React from 'react';\nimport { clsx } from 'clsx';\nimport {
|
|
1
|
+
{"version":3,"file":"scaffold.js","sources":["../../../src/layouts/containers/scaffold.tsx"],"sourcesContent":["import React from 'react';\nimport { clsx } from 'clsx';\nimport { VStack, type VStackProps } from '../../stacks/v_stack.js';\nimport styles from './containers.module.css';\n\nexport interface ScaffoldProps extends Omit<VStackProps, 'as'> {}\n\nexport const Scaffold = React.forwardRef<HTMLElement, ScaffoldProps>(function Scaffold(\n { children, className, vAlign = 'start', hAlign = 'start', ...props }: ScaffoldProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"section\"\n vAlign={vAlign}\n hAlign={hAlign}\n className={clsx(\n className,\n styles['scaffold'],\n styles['container'],\n 'tcn-container',\n 'tcn-scaffold'\n )}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["Scaffold","React","children","className","vAlign","hAlign","props","ref","jsx","VStack","clsx","styles"],"mappings":";;;;;AAOO,MAAMA,IAAWC,EAAM,WAAuC,SACnE,EAAE,UAAAC,GAAU,WAAAC,GAAW,QAAAC,IAAS,SAAS,QAAAC,IAAS,SAAS,GAAGC,EAAA,GAC9DC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,QAAAH;AAAA,MACA,QAAAC;AAAA,MACA,WAAWK;AAAA,QACTP;AAAA,QACAQ,EAAO;AAAA,QACPA,EAAO;AAAA,QACP;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAGL;AAAA,MAEH,UAAAJ;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
package/dist/layouts/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Column, type ColumnProps } from './containers/columns/column.js';
|
|
2
2
|
export * from './divider/divider.js';
|
|
3
3
|
export * from './grid/grid.js';
|
|
4
4
|
export * from './list/item.js';
|
|
@@ -16,6 +16,8 @@ export { Responsive, type ResponsiveProps } from './responsive/responsive.js';
|
|
|
16
16
|
export { Breakpoint, type BreakpointProps } from './responsive/breakpoint.js';
|
|
17
17
|
export { TTable, THead, TBody, TFoot, TR, TH, TD } from './table/table.js';
|
|
18
18
|
export { Rail, type RailProps } from './containers/rail.js';
|
|
19
|
-
export {
|
|
19
|
+
export { Columns, type ColumnsProps } from './containers/columns/columns.js';
|
|
20
|
+
export { Row, type RowProps } from './containers/rows/row.js';
|
|
21
|
+
export { Rows, type RowsProps } from './containers/rows/rows.js';
|
|
20
22
|
export { UtilityStrip, type UtilityStripProps, } from './containers/utility_strip/utility_strip.js';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layouts/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3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AE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,6CAA6C,CAAC"}
|
package/dist/layouts/index.js
CHANGED
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
import { Column as e } from "./
|
|
1
|
+
import { Column as e } from "./containers/columns/column.js";
|
|
2
2
|
import { Divider as p } from "./divider/divider.js";
|
|
3
|
-
import { Grid as
|
|
3
|
+
import { Grid as f } from "./grid/grid.js";
|
|
4
4
|
import { Item as i } from "./list/item.js";
|
|
5
5
|
import { List as d } from "./list/list.js";
|
|
6
|
-
import { SidebarEnd as
|
|
7
|
-
import { SidebarStart as
|
|
8
|
-
import { Scaffold as
|
|
9
|
-
import { Footer as
|
|
10
|
-
import { Header as
|
|
11
|
-
import { UtilityBar as
|
|
6
|
+
import { SidebarEnd as T } from "./sidebar_end/sidebar_end.js";
|
|
7
|
+
import { SidebarStart as S } from "./sidebar_start/sidebar_start.js";
|
|
8
|
+
import { Scaffold as R } from "./containers/scaffold.js";
|
|
9
|
+
import { Footer as H } from "./footer/footer.js";
|
|
10
|
+
import { Header as u } from "./header/header.js";
|
|
11
|
+
import { UtilityBar as D } from "./utility_bar/utility_bar.js";
|
|
12
12
|
import { Group as v } from "./group/group.js";
|
|
13
|
-
import { Bar as
|
|
14
|
-
import { Section as
|
|
15
|
-
import { Heading as
|
|
16
|
-
import { Detail as
|
|
17
|
-
import { Responsive as
|
|
18
|
-
import { Breakpoint as
|
|
13
|
+
import { Bar as C } from "./bar/bar.js";
|
|
14
|
+
import { Section as G } from "./section/section.js";
|
|
15
|
+
import { Heading as g } from "./section/heading.js";
|
|
16
|
+
import { Detail as E } from "./section/detail.js";
|
|
17
|
+
import { Responsive as L } from "./responsive/responsive.js";
|
|
18
|
+
import { Breakpoint as j } from "./responsive/breakpoint.js";
|
|
19
19
|
import { TBody as z, TD as A, TFoot as J, TH as K, THead as M, TR as N, TTable as O } from "./table/table.js";
|
|
20
20
|
import { Rail as Q } from "./containers/rail.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
21
|
+
import { Columns as W } from "./containers/columns/columns.js";
|
|
22
|
+
import { Row as Y } from "./containers/rows/row.js";
|
|
23
|
+
import { Rows as _ } from "./containers/rows/rows.js";
|
|
24
|
+
import { UtilityStrip as oo } from "./containers/utility_strip/utility_strip.js";
|
|
23
25
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
C as Bar,
|
|
27
|
+
j as Breakpoint,
|
|
26
28
|
e as Column,
|
|
27
|
-
|
|
29
|
+
W as Columns,
|
|
30
|
+
E as Detail,
|
|
28
31
|
p as Divider,
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
H as Footer,
|
|
33
|
+
f as Grid,
|
|
31
34
|
v as Group,
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
u as Header,
|
|
36
|
+
g as Heading,
|
|
34
37
|
i as Item,
|
|
35
38
|
d as List,
|
|
36
39
|
Q as Rail,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
L as Responsive,
|
|
41
|
+
Y as Row,
|
|
42
|
+
_ as Rows,
|
|
43
|
+
R as Scaffold,
|
|
44
|
+
G as Section,
|
|
45
|
+
T as SidebarEnd,
|
|
46
|
+
S as SidebarStart,
|
|
43
47
|
z as TBody,
|
|
44
48
|
A as TD,
|
|
45
49
|
J as TFoot,
|
|
@@ -47,7 +51,7 @@ export {
|
|
|
47
51
|
M as THead,
|
|
48
52
|
N as TR,
|
|
49
53
|
O as TTable,
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
D as UtilityBar,
|
|
55
|
+
oo as UtilityStrip
|
|
52
56
|
};
|
|
53
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -16,10 +16,13 @@ import "../../../utils/hooks/use_resize_observer.js";
|
|
|
16
16
|
import "../../../utils/dnd/context.js";
|
|
17
17
|
import { clsx as z } from "clsx";
|
|
18
18
|
import "../../../draggable.module-BgelQsuJ.js";
|
|
19
|
+
import "../../../utils/resize/context.js";
|
|
20
|
+
import "../../../resizable.module-I6iyBAvM.js";
|
|
21
|
+
import "../../../utils/resize/resize_handle.js";
|
|
19
22
|
import { ChevronLeftIcon as E } from "@tcn/icons/chevron_left_icon.js";
|
|
20
23
|
import { ChevronRightIcon as T } from "@tcn/icons/chevron_right_icon.js";
|
|
21
24
|
import '../../../mobile_date_picker_header.css';const W = "_mobile-date-picker-header_0678759", G = "_mobile-date-picker-overlay_d1d8dc4", J = "_mobile-month-list_1081f6a", Q = "_mobile-year-overlay_daba362", l = { "mobile-date-picker-header": W, "mobile-date-picker-overlay": G, "mobile-month-list": J, "mobile-year-overlay": Q };
|
|
22
|
-
function
|
|
25
|
+
function ve({
|
|
23
26
|
presenter: r,
|
|
24
27
|
countryCode: a,
|
|
25
28
|
selectMonthMessage: R = "Select Month",
|
|
@@ -158,6 +161,6 @@ function be({
|
|
|
158
161
|
] });
|
|
159
162
|
}
|
|
160
163
|
export {
|
|
161
|
-
|
|
164
|
+
ve as MobileDatePickerHeader
|
|
162
165
|
};
|
|
163
166
|
//# sourceMappingURL=mobile_date_picker_header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile_date_picker_header.js","sources":["../../../../src/mobile/inputs/date_picker/mobile_date_picker_header.tsx"],"sourcesContent":["import { useSignalValue } from '@tcn/state';\nimport { HStack } from '../../../stacks/h_stack.js';\nimport { VStack } from '../../../stacks/v_stack.js';\nimport { Spacer } from '../../../stacks/spacer.js';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { getMonthsOfYear } from '../../../utils/calendar/get_months_of_year.js';\nimport { DatePickerPresenter } from '../../../inputs/date_picker/date_picker_presenter.js';\nimport { MobileDatePickerYearSelector } from './mobile_date_picker_year_selector.js';\nimport { MobileButton } from '../../actions/button/mobile_button.js';\nimport { MobilePortal } from '../../portal/mobile_portal.js';\nimport { MobileOverlayHeader } from './mobile_overlay_header.js';\nimport { FocusRedirect } from '../../../utils/index.js';\nimport { ChevronLeftIcon } from '@tcn/icons/chevron_left_icon.js';\nimport { ChevronRightIcon } from '@tcn/icons/chevron_right_icon.js';\nimport { clsx } from 'clsx';\nimport styles from './mobile_date_picker_header.module.css';\n\nexport interface MobileDatePickerHeaderProps {\n presenter: DatePickerPresenter;\n countryCode: string;\n selectMonthMessage?: string;\n selectYearMessage?: string;\n}\n\nexport function MobileDatePickerHeader({\n presenter,\n countryCode,\n selectMonthMessage = 'Select Month',\n selectYearMessage = 'Select Year',\n}: MobileDatePickerHeaderProps) {\n const state = useSignalValue(presenter.stateBroadcast);\n const [monthOpen, setMonthOpen] = useState(false);\n const [yearOpen, setYearOpen] = useState(false);\n const monthButtonRef = useRef<HTMLButtonElement | null>(null);\n const yearButtonRef = useRef<HTMLButtonElement | null>(null);\n const monthListRef = useRef<HTMLDivElement | null>(null);\n\n const longMonths = useMemo(() => getMonthsOfYear(countryCode, 'long'), [countryCode]);\n const shortMonths = useMemo(() => getMonthsOfYear(countryCode, 'short'), [countryCode]);\n\n function selectMonth(value: string) {\n presenter.setVisibleMonth(Number(value));\n }\n\n function previous() {\n presenter.setVisibleMonth(state.visibleMonth - 1);\n }\n\n function next() {\n presenter.setVisibleMonth(state.visibleMonth + 1);\n }\n\n function openMonths() {\n setMonthOpen(true);\n }\n\n function closeMonths() {\n setMonthOpen(false);\n requestAnimationFrame(() => monthButtonRef.current?.focus());\n }\n\n function openYears() {\n setYearOpen(true);\n }\n\n function closeYears() {\n setYearOpen(false);\n requestAnimationFrame(() => yearButtonRef.current?.focus());\n }\n\n function handleMonthKeyDown(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeMonths();\n }\n }\n\n function handleYearKeyDown(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeYears();\n }\n }\n\n function handleMonthRedirect() {\n monthListRef.current?.focus();\n }\n\n return (\n <>\n <HStack\n className={clsx(\n styles['mobile-date-picker-header'],\n 'tcn-mobile-date-picker-header'\n )}\n minWidth=\"35px\"\n width=\"100%\"\n >\n <MobileButton\n disabled={!state.canNavigateToPreviousMonth}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={previous}\n >\n <ChevronLeftIcon flipOnRtl size=\"md\" />\n </MobileButton>\n <Spacer />\n <HStack hAlign=\"center\" gap=\"4px\" width=\"auto\">\n <MobileButton\n ref={monthButtonRef}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={openMonths}\n >\n {shortMonths[state.visibleMonth]}\n </MobileButton>\n <MobileButton\n ref={yearButtonRef}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={openYears}\n >\n {String(state.visibleYear)}\n </MobileButton>\n </HStack>\n <Spacer />\n <MobileButton\n disabled={!state.canNavigateToNextMonth}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={next}\n >\n <ChevronRightIcon flipOnRtl size=\"md\" />\n </MobileButton>\n </HStack>\n\n {monthOpen && (\n <MobilePortal>\n <VStack\n className={styles['mobile-date-picker-overlay']}\n onKeyDown={handleMonthKeyDown}\n >\n <MobileOverlayHeader title={selectMonthMessage} onClose={closeMonths} />\n <VStack\n ref={monthListRef}\n tabIndex={0}\n padding=\"16px\"\n gap=\"8px\"\n height=\"flex\"\n overflowY=\"auto\"\n className={styles['mobile-month-list']}\n >\n {longMonths.map((month, index) => (\n <MobileButton\n key={index}\n hierarchy={index === state.visibleMonth ? 'primary' : 'secondary'}\n width=\"100%\"\n onClick={() => {\n selectMonth(String(index));\n closeMonths();\n }}\n >\n {month}\n </MobileButton>\n ))}\n <FocusRedirect onRedirect={handleMonthRedirect} />\n </VStack>\n </VStack>\n </MobilePortal>\n )}\n\n {yearOpen && (\n <MobilePortal>\n <VStack className={styles['mobile-year-overlay']} onKeyDown={handleYearKeyDown}>\n <MobileOverlayHeader title={selectYearMessage} onClose={closeYears} />\n <MobileDatePickerYearSelector presenter={presenter} onClose={closeYears} />\n </VStack>\n </MobilePortal>\n )}\n </>\n );\n}\n"],"names":["MobileDatePickerHeader","presenter","countryCode","selectMonthMessage","selectYearMessage","state","useSignalValue","monthOpen","setMonthOpen","useState","yearOpen","setYearOpen","monthButtonRef","useRef","yearButtonRef","monthListRef","longMonths","useMemo","getMonthsOfYear","shortMonths","selectMonth","value","previous","next","openMonths","closeMonths","openYears","closeYears","handleMonthKeyDown","event","handleYearKeyDown","handleMonthRedirect","jsxs","Fragment","HStack","clsx","styles","jsx","MobileButton","ChevronLeftIcon","Spacer","ChevronRightIcon","MobilePortal","VStack","MobileOverlayHeader","month","index","FocusRedirect","MobileDatePickerYearSelector"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mobile_date_picker_header.js","sources":["../../../../src/mobile/inputs/date_picker/mobile_date_picker_header.tsx"],"sourcesContent":["import { useSignalValue } from '@tcn/state';\nimport { HStack } from '../../../stacks/h_stack.js';\nimport { VStack } from '../../../stacks/v_stack.js';\nimport { Spacer } from '../../../stacks/spacer.js';\nimport React, { useMemo, useRef, useState } from 'react';\nimport { getMonthsOfYear } from '../../../utils/calendar/get_months_of_year.js';\nimport { DatePickerPresenter } from '../../../inputs/date_picker/date_picker_presenter.js';\nimport { MobileDatePickerYearSelector } from './mobile_date_picker_year_selector.js';\nimport { MobileButton } from '../../actions/button/mobile_button.js';\nimport { MobilePortal } from '../../portal/mobile_portal.js';\nimport { MobileOverlayHeader } from './mobile_overlay_header.js';\nimport { FocusRedirect } from '../../../utils/index.js';\nimport { ChevronLeftIcon } from '@tcn/icons/chevron_left_icon.js';\nimport { ChevronRightIcon } from '@tcn/icons/chevron_right_icon.js';\nimport { clsx } from 'clsx';\nimport styles from './mobile_date_picker_header.module.css';\n\nexport interface MobileDatePickerHeaderProps {\n presenter: DatePickerPresenter;\n countryCode: string;\n selectMonthMessage?: string;\n selectYearMessage?: string;\n}\n\nexport function MobileDatePickerHeader({\n presenter,\n countryCode,\n selectMonthMessage = 'Select Month',\n selectYearMessage = 'Select Year',\n}: MobileDatePickerHeaderProps) {\n const state = useSignalValue(presenter.stateBroadcast);\n const [monthOpen, setMonthOpen] = useState(false);\n const [yearOpen, setYearOpen] = useState(false);\n const monthButtonRef = useRef<HTMLButtonElement | null>(null);\n const yearButtonRef = useRef<HTMLButtonElement | null>(null);\n const monthListRef = useRef<HTMLDivElement | null>(null);\n\n const longMonths = useMemo(() => getMonthsOfYear(countryCode, 'long'), [countryCode]);\n const shortMonths = useMemo(() => getMonthsOfYear(countryCode, 'short'), [countryCode]);\n\n function selectMonth(value: string) {\n presenter.setVisibleMonth(Number(value));\n }\n\n function previous() {\n presenter.setVisibleMonth(state.visibleMonth - 1);\n }\n\n function next() {\n presenter.setVisibleMonth(state.visibleMonth + 1);\n }\n\n function openMonths() {\n setMonthOpen(true);\n }\n\n function closeMonths() {\n setMonthOpen(false);\n requestAnimationFrame(() => monthButtonRef.current?.focus());\n }\n\n function openYears() {\n setYearOpen(true);\n }\n\n function closeYears() {\n setYearOpen(false);\n requestAnimationFrame(() => yearButtonRef.current?.focus());\n }\n\n function handleMonthKeyDown(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeMonths();\n }\n }\n\n function handleYearKeyDown(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeYears();\n }\n }\n\n function handleMonthRedirect() {\n monthListRef.current?.focus();\n }\n\n return (\n <>\n <HStack\n className={clsx(\n styles['mobile-date-picker-header'],\n 'tcn-mobile-date-picker-header'\n )}\n minWidth=\"35px\"\n width=\"100%\"\n >\n <MobileButton\n disabled={!state.canNavigateToPreviousMonth}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={previous}\n >\n <ChevronLeftIcon flipOnRtl size=\"md\" />\n </MobileButton>\n <Spacer />\n <HStack hAlign=\"center\" gap=\"4px\" width=\"auto\">\n <MobileButton\n ref={monthButtonRef}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={openMonths}\n >\n {shortMonths[state.visibleMonth]}\n </MobileButton>\n <MobileButton\n ref={yearButtonRef}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={openYears}\n >\n {String(state.visibleYear)}\n </MobileButton>\n </HStack>\n <Spacer />\n <MobileButton\n disabled={!state.canNavigateToNextMonth}\n hierarchy=\"tertiary\"\n width=\"auto\"\n onClick={next}\n >\n <ChevronRightIcon flipOnRtl size=\"md\" />\n </MobileButton>\n </HStack>\n\n {monthOpen && (\n <MobilePortal>\n <VStack\n className={styles['mobile-date-picker-overlay']}\n onKeyDown={handleMonthKeyDown}\n >\n <MobileOverlayHeader title={selectMonthMessage} onClose={closeMonths} />\n <VStack\n ref={monthListRef}\n tabIndex={0}\n padding=\"16px\"\n gap=\"8px\"\n height=\"flex\"\n overflowY=\"auto\"\n className={styles['mobile-month-list']}\n >\n {longMonths.map((month, index) => (\n <MobileButton\n key={index}\n hierarchy={index === state.visibleMonth ? 'primary' : 'secondary'}\n width=\"100%\"\n onClick={() => {\n selectMonth(String(index));\n closeMonths();\n }}\n >\n {month}\n </MobileButton>\n ))}\n <FocusRedirect onRedirect={handleMonthRedirect} />\n </VStack>\n </VStack>\n </MobilePortal>\n )}\n\n {yearOpen && (\n <MobilePortal>\n <VStack className={styles['mobile-year-overlay']} onKeyDown={handleYearKeyDown}>\n <MobileOverlayHeader title={selectYearMessage} onClose={closeYears} />\n <MobileDatePickerYearSelector presenter={presenter} onClose={closeYears} />\n </VStack>\n </MobilePortal>\n )}\n </>\n );\n}\n"],"names":["MobileDatePickerHeader","presenter","countryCode","selectMonthMessage","selectYearMessage","state","useSignalValue","monthOpen","setMonthOpen","useState","yearOpen","setYearOpen","monthButtonRef","useRef","yearButtonRef","monthListRef","longMonths","useMemo","getMonthsOfYear","shortMonths","selectMonth","value","previous","next","openMonths","closeMonths","openYears","closeYears","handleMonthKeyDown","event","handleYearKeyDown","handleMonthRedirect","jsxs","Fragment","HStack","clsx","styles","jsx","MobileButton","ChevronLeftIcon","Spacer","ChevronRightIcon","MobilePortal","VStack","MobileOverlayHeader","month","index","FocusRedirect","MobileDatePickerYearSelector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBO,SAASA,GAAuB;AAAA,EACrC,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,mBAAAC,IAAoB;AACtB,GAAgC;AAC9B,QAAMC,IAAQC,EAAeL,EAAU,cAAc,GAC/C,CAACM,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1C,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAK,GACxCG,IAAiBC,EAAiC,IAAI,GACtDC,IAAgBD,EAAiC,IAAI,GACrDE,IAAeF,EAA8B,IAAI,GAEjDG,IAAaC,EAAQ,MAAMC,EAAgBhB,GAAa,MAAM,GAAG,CAACA,CAAW,CAAC,GAC9EiB,IAAcF,EAAQ,MAAMC,EAAgBhB,GAAa,OAAO,GAAG,CAACA,CAAW,CAAC;AAEtF,WAASkB,EAAYC,GAAe;AAClC,IAAApB,EAAU,gBAAgB,OAAOoB,CAAK,CAAC;AAAA,EACzC;AAEA,WAASC,IAAW;AAClB,IAAArB,EAAU,gBAAgBI,EAAM,eAAe,CAAC;AAAA,EAClD;AAEA,WAASkB,IAAO;AACd,IAAAtB,EAAU,gBAAgBI,EAAM,eAAe,CAAC;AAAA,EAClD;AAEA,WAASmB,IAAa;AACpB,IAAAhB,EAAa,EAAI;AAAA,EACnB;AAEA,WAASiB,IAAc;AACrB,IAAAjB,EAAa,EAAK,GAClB,sBAAsB,MAAMI,EAAe,SAAS,MAAA,CAAO;AAAA,EAC7D;AAEA,WAASc,IAAY;AACnB,IAAAf,EAAY,EAA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gBAAAV,EAACW,GAAA,EAAO,WAAWP,EAAO,qBAAqB,GAAG,WAAWN,GAC3D,UAAA;AAAA,MAAA,gBAAAO,EAACO,GAAA,EAAoB,OAAOxC,GAAmB,SAASuB,GAAY;AAAA,MACpE,gBAAAU,EAACW,GAAA,EAA6B,WAAA/C,GAAsB,SAAS0B,EAAA,CAAY;AAAA,IAAA,EAAA,CAC3E,EAAA,CACF;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -13,8 +13,11 @@ import "../../../utils/hooks/use_resize_observer.js";
|
|
|
13
13
|
import "../../../utils/dnd/context.js";
|
|
14
14
|
import "clsx";
|
|
15
15
|
import "../../../draggable.module-BgelQsuJ.js";
|
|
16
|
+
import "../../../utils/resize/context.js";
|
|
17
|
+
import "../../../resizable.module-I6iyBAvM.js";
|
|
18
|
+
import "../../../utils/resize/resize_handle.js";
|
|
16
19
|
import { VStack as C } from "../../../stacks/v_stack.js";
|
|
17
|
-
import '../../../mobile_date_picker_input.css';const ue = "_mobile-date-picker-overlay_099a224", pe = "_mobile-time-picker-overlay_6622396", H = { "mobile-date-picker-overlay": ue, "mobile-time-picker-overlay": pe },
|
|
20
|
+
import '../../../mobile_date_picker_input.css';const ue = "_mobile-date-picker-overlay_099a224", pe = "_mobile-time-picker-overlay_6622396", H = { "mobile-date-picker-overlay": ue, "mobile-time-picker-overlay": pe }, qe = le.forwardRef(function({
|
|
18
21
|
value: i = /* @__PURE__ */ new Date(),
|
|
19
22
|
onChange: D,
|
|
20
23
|
onError: K,
|
|
@@ -185,6 +188,6 @@ import '../../../mobile_date_picker_input.css';const ue = "_mobile-date-picker-o
|
|
|
185
188
|
] });
|
|
186
189
|
});
|
|
187
190
|
export {
|
|
188
|
-
|
|
191
|
+
qe as MobileDatePickerInput
|
|
189
192
|
};
|
|
190
193
|
//# sourceMappingURL=mobile_date_picker_input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile_date_picker_input.js","sources":["../../../../src/mobile/inputs/date_picker/mobile_date_picker_input.tsx"],"sourcesContent":["import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { MobileButton } from '../../actions/button/mobile_button.js';\nimport { ButtonGroup } from '../../../actions/button/button_group/button_group.js';\nimport { MobilePortal } from '../../portal/mobile_portal.js';\nimport { MobileDatePicker } from './mobile_date_picker.js';\nimport { MobileDatePickerTimeSelector } from './mobile_date_picker_time_selector.js';\nimport { MobileOverlayHeader } from './mobile_overlay_header.js';\nimport { FocusRedirect } from '../../../utils/index.js';\nimport { VStack } from '../../../stacks/v_stack.js';\nimport type { DatePickerInputProps } from '../../../inputs/date_picker/date_picker_input.js';\nimport styles from './mobile_date_picker_input.module.css';\n\nexport interface MobileDatePickerInputProps extends DatePickerInputProps {\n selectTimeMessage?: string;\n selectMonthMessage?: string;\n selectYearMessage?: string;\n}\n\nexport const MobileDatePickerInput = React.forwardRef<\n HTMLButtonElement,\n MobileDatePickerInputProps\n>(function MobileDatePickerInput(\n {\n value = new Date(),\n onChange,\n onError,\n min = new Date('01/01/1924'),\n max = new Date('01/01/2124'),\n disabled,\n width = '100%',\n maxWidth,\n minWidth,\n showTime = false,\n timeIntervalInMinutes = 15,\n hierarchy = 'secondary',\n disabledDates,\n selectDateMessage = 'Select Date',\n selectTimeMessage = 'Select Time',\n selectMonthMessage,\n selectYearMessage,\n countryCode,\n renderActions,\n onTimeSelected,\n ...props\n },\n ref\n) {\n const [dateOpen, setDateOpen] = useState(false);\n const [timeOpen, setTimeOpen] = useState(false);\n const pickerRef = useRef<HTMLDivElement | null>(null);\n const timeRef = useRef<HTMLDivElement | null>(null);\n const dateButtonRef = useRef<HTMLButtonElement | null>(null);\n const timeButtonRef = useRef<HTMLButtonElement | null>(null);\n\n const setDateButtonRef = useCallback(\n (node: HTMLButtonElement | null) => {\n dateButtonRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref != null) {\n (ref as React.MutableRefObject<HTMLButtonElement | null>).current = node;\n }\n },\n [ref]\n );\n\n const dateFormatter = useMemo(() => {\n return new Intl.DateTimeFormat(countryCode, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n }, [countryCode]);\n\n const timeFormatter = useMemo(() => {\n return new Intl.DateTimeFormat(countryCode, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n });\n }, [countryCode]);\n\n const formattedDate = value != null ? dateFormatter.format(value) : selectDateMessage;\n const formattedTime = value != null ? timeFormatter.format(value) : selectTimeMessage;\n\n function openDatePicker() {\n setDateOpen(true);\n }\n\n function closeDatePicker() {\n setDateOpen(false);\n requestAnimationFrame(() => dateButtonRef.current?.focus());\n }\n\n function openTimePicker() {\n setTimeOpen(true);\n }\n\n function closeTimePicker() {\n setTimeOpen(false);\n requestAnimationFrame(() => timeButtonRef.current?.focus());\n }\n\n useLayoutEffect(() => {\n if (dateOpen) {\n requestAnimationFrame(() => pickerRef.current?.focus());\n }\n }, [dateOpen]);\n\n useLayoutEffect(() => {\n if (timeOpen) {\n requestAnimationFrame(() => timeRef.current?.focus());\n }\n }, [timeOpen]);\n\n function handleDateEscape(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeDatePicker();\n }\n }\n\n function handleTimeEscape(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeTimePicker();\n }\n }\n\n function handleDateRedirect() {\n pickerRef.current?.focus();\n }\n\n function handleTimeRedirect() {\n timeRef.current?.focus();\n }\n\n function dateSelected(date: Date | null) {\n onChange?.(date);\n closeDatePicker();\n }\n\n function timeSelected(hour: number, minutes: number, seconds: number) {\n if (value != null) {\n const updated = new Date(value);\n updated.setHours(hour, minutes, seconds);\n onChange?.(updated);\n }\n onTimeSelected?.(hour, minutes, seconds);\n closeTimePicker();\n }\n\n return (\n <>\n {showTime ? (\n <ButtonGroup hierarchy={hierarchy} width={width}>\n <MobileButton\n ref={setDateButtonRef}\n hAlign=\"start\"\n disabled={disabled}\n onClick={openDatePicker}\n width=\"flex\"\n {...props}\n >\n <span className=\"ellipsis\">{formattedDate}</span>\n </MobileButton>\n <MobileButton\n ref={timeButtonRef}\n hAlign=\"start\"\n disabled={disabled || value == null}\n onClick={openTimePicker}\n width=\"auto\"\n >\n <span className=\"ellipsis\">{formattedTime}</span>\n </MobileButton>\n </ButtonGroup>\n ) : (\n <MobileButton\n ref={setDateButtonRef}\n hAlign=\"start\"\n disabled={disabled}\n hierarchy={hierarchy}\n onClick={openDatePicker}\n width={width}\n maxWidth={maxWidth}\n {...props}\n >\n <span className=\"ellipsis\">{formattedDate}</span>\n </MobileButton>\n )}\n\n {dateOpen && (\n <MobilePortal>\n <VStack\n className={styles['mobile-date-picker-overlay']}\n onKeyDown={handleDateEscape}\n >\n <MobileOverlayHeader title={selectDateMessage} onClose={closeDatePicker} />\n <MobileDatePicker\n ref={pickerRef}\n value={value}\n onChange={dateSelected}\n min={min}\n max={max}\n onError={onError}\n disabled={disabled}\n disabledDates={disabledDates}\n countryCode={countryCode}\n renderActions={renderActions}\n selectMonthMessage={selectMonthMessage}\n selectYearMessage={selectYearMessage}\n />\n <FocusRedirect onRedirect={handleDateRedirect} />\n </VStack>\n </MobilePortal>\n )}\n\n {timeOpen && (\n <MobilePortal>\n <VStack\n className={styles['mobile-time-picker-overlay']}\n onKeyDown={handleTimeEscape}\n >\n <MobileOverlayHeader title={selectTimeMessage} onClose={closeTimePicker} />\n <MobileDatePickerTimeSelector\n ref={timeRef}\n origin={value}\n min={min}\n max={max}\n intervalInMinutes={timeIntervalInMinutes}\n disabled={disabled}\n onSelect={(hour, minutes, seconds) => {\n timeSelected(hour, minutes, seconds);\n }}\n />\n <FocusRedirect onRedirect={handleTimeRedirect} />\n </VStack>\n </MobilePortal>\n )}\n </>\n );\n});\n"],"names":["MobileDatePickerInput","React","value","onChange","onError","min","max","disabled","width","maxWidth","minWidth","showTime","timeIntervalInMinutes","hierarchy","disabledDates","selectDateMessage","selectTimeMessage","selectMonthMessage","selectYearMessage","countryCode","renderActions","onTimeSelected","props","ref","dateOpen","setDateOpen","useState","timeOpen","setTimeOpen","pickerRef","useRef","timeRef","dateButtonRef","timeButtonRef","setDateButtonRef","useCallback","node","dateFormatter","useMemo","timeFormatter","formattedDate","formattedTime","openDatePicker","closeDatePicker","openTimePicker","closeTimePicker","useLayoutEffect","handleDateEscape","event","handleTimeEscape","handleDateRedirect","handleTimeRedirect","dateSelected","date","timeSelected","hour","minutes","seconds","updated","jsxs","Fragment","ButtonGroup","jsx","MobileButton","MobilePortal","VStack","styles","MobileOverlayHeader","MobileDatePicker","FocusRedirect","MobileDatePickerTimeSelector"],"mappings":";;;;;;;;;;;;;;;;0KAkBaA,KAAwBC,GAAM,WAGzC,SACA;AAAA,EACE,OAAAC,wBAAY,KAAA;AAAA,EACZ,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,KAAAC,IAAM,oBAAI,KAAK,YAAY;AAAA,EAC3B,KAAAC,IAAM,oBAAI,KAAK,YAAY;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,uBAAAC,IAAwB;AAAA,EACxB,WAAAC,IAAY;AAAA,EACZ,eAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,mBAAAC,IAAoB;AAAA,EACpB,oBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAK,GACxC,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAK,GACxCG,IAAYC,EAA8B,IAAI,GAC9CC,IAAUD,EAA8B,IAAI,GAC5CE,IAAgBF,EAAiC,IAAI,GACrDG,IAAgBH,EAAiC,IAAI,GAErDI,IAAmBC;AAAA,IACvB,CAACC,MAAmC;AAClC,MAAAJ,EAAc,UAAUI,GACpB,OAAOb,KAAQ,aAC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,GAASC,MAAY;AACpC,gBAAAH,GAAaC,GAAMC,GAASC,CAAO;AAAA,cACrC;AAAA,YAAA;AAAA,UAAA;AAAA,UAEF,gBAAAK,EAACO,GAAA,EAAc,YAAYlB,GAAA,CAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACjD,CACF;AAAA,EAAA,GAEJ;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"mobile_date_picker_input.js","sources":["../../../../src/mobile/inputs/date_picker/mobile_date_picker_input.tsx"],"sourcesContent":["import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { MobileButton } from '../../actions/button/mobile_button.js';\nimport { ButtonGroup } from '../../../actions/button/button_group/button_group.js';\nimport { MobilePortal } from '../../portal/mobile_portal.js';\nimport { MobileDatePicker } from './mobile_date_picker.js';\nimport { MobileDatePickerTimeSelector } from './mobile_date_picker_time_selector.js';\nimport { MobileOverlayHeader } from './mobile_overlay_header.js';\nimport { FocusRedirect } from '../../../utils/index.js';\nimport { VStack } from '../../../stacks/v_stack.js';\nimport type { DatePickerInputProps } from '../../../inputs/date_picker/date_picker_input.js';\nimport styles from './mobile_date_picker_input.module.css';\n\nexport interface MobileDatePickerInputProps extends DatePickerInputProps {\n selectTimeMessage?: string;\n selectMonthMessage?: string;\n selectYearMessage?: string;\n}\n\nexport const MobileDatePickerInput = React.forwardRef<\n HTMLButtonElement,\n MobileDatePickerInputProps\n>(function MobileDatePickerInput(\n {\n value = new Date(),\n onChange,\n onError,\n min = new Date('01/01/1924'),\n max = new Date('01/01/2124'),\n disabled,\n width = '100%',\n maxWidth,\n minWidth,\n showTime = false,\n timeIntervalInMinutes = 15,\n hierarchy = 'secondary',\n disabledDates,\n selectDateMessage = 'Select Date',\n selectTimeMessage = 'Select Time',\n selectMonthMessage,\n selectYearMessage,\n countryCode,\n renderActions,\n onTimeSelected,\n ...props\n },\n ref\n) {\n const [dateOpen, setDateOpen] = useState(false);\n const [timeOpen, setTimeOpen] = useState(false);\n const pickerRef = useRef<HTMLDivElement | null>(null);\n const timeRef = useRef<HTMLDivElement | null>(null);\n const dateButtonRef = useRef<HTMLButtonElement | null>(null);\n const timeButtonRef = useRef<HTMLButtonElement | null>(null);\n\n const setDateButtonRef = useCallback(\n (node: HTMLButtonElement | null) => {\n dateButtonRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref != null) {\n (ref as React.MutableRefObject<HTMLButtonElement | null>).current = node;\n }\n },\n [ref]\n );\n\n const dateFormatter = useMemo(() => {\n return new Intl.DateTimeFormat(countryCode, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n }, [countryCode]);\n\n const timeFormatter = useMemo(() => {\n return new Intl.DateTimeFormat(countryCode, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n });\n }, [countryCode]);\n\n const formattedDate = value != null ? dateFormatter.format(value) : selectDateMessage;\n const formattedTime = value != null ? timeFormatter.format(value) : selectTimeMessage;\n\n function openDatePicker() {\n setDateOpen(true);\n }\n\n function closeDatePicker() {\n setDateOpen(false);\n requestAnimationFrame(() => dateButtonRef.current?.focus());\n }\n\n function openTimePicker() {\n setTimeOpen(true);\n }\n\n function closeTimePicker() {\n setTimeOpen(false);\n requestAnimationFrame(() => timeButtonRef.current?.focus());\n }\n\n useLayoutEffect(() => {\n if (dateOpen) {\n requestAnimationFrame(() => pickerRef.current?.focus());\n }\n }, [dateOpen]);\n\n useLayoutEffect(() => {\n if (timeOpen) {\n requestAnimationFrame(() => timeRef.current?.focus());\n }\n }, [timeOpen]);\n\n function handleDateEscape(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeDatePicker();\n }\n }\n\n function handleTimeEscape(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closeTimePicker();\n }\n }\n\n function handleDateRedirect() {\n pickerRef.current?.focus();\n }\n\n function handleTimeRedirect() {\n timeRef.current?.focus();\n }\n\n function dateSelected(date: Date | null) {\n onChange?.(date);\n closeDatePicker();\n }\n\n function timeSelected(hour: number, minutes: number, seconds: number) {\n if (value != null) {\n const updated = new Date(value);\n updated.setHours(hour, minutes, seconds);\n onChange?.(updated);\n }\n onTimeSelected?.(hour, minutes, seconds);\n closeTimePicker();\n }\n\n return (\n <>\n {showTime ? (\n <ButtonGroup hierarchy={hierarchy} width={width}>\n <MobileButton\n ref={setDateButtonRef}\n hAlign=\"start\"\n disabled={disabled}\n onClick={openDatePicker}\n width=\"flex\"\n {...props}\n >\n <span className=\"ellipsis\">{formattedDate}</span>\n </MobileButton>\n <MobileButton\n ref={timeButtonRef}\n hAlign=\"start\"\n disabled={disabled || value == null}\n onClick={openTimePicker}\n width=\"auto\"\n >\n <span className=\"ellipsis\">{formattedTime}</span>\n </MobileButton>\n </ButtonGroup>\n ) : (\n <MobileButton\n ref={setDateButtonRef}\n hAlign=\"start\"\n disabled={disabled}\n hierarchy={hierarchy}\n onClick={openDatePicker}\n width={width}\n maxWidth={maxWidth}\n {...props}\n >\n <span className=\"ellipsis\">{formattedDate}</span>\n </MobileButton>\n )}\n\n {dateOpen && (\n <MobilePortal>\n <VStack\n className={styles['mobile-date-picker-overlay']}\n onKeyDown={handleDateEscape}\n >\n <MobileOverlayHeader title={selectDateMessage} onClose={closeDatePicker} />\n <MobileDatePicker\n ref={pickerRef}\n value={value}\n onChange={dateSelected}\n min={min}\n max={max}\n onError={onError}\n disabled={disabled}\n disabledDates={disabledDates}\n countryCode={countryCode}\n renderActions={renderActions}\n selectMonthMessage={selectMonthMessage}\n selectYearMessage={selectYearMessage}\n />\n <FocusRedirect onRedirect={handleDateRedirect} />\n </VStack>\n </MobilePortal>\n )}\n\n {timeOpen && (\n <MobilePortal>\n <VStack\n className={styles['mobile-time-picker-overlay']}\n onKeyDown={handleTimeEscape}\n >\n <MobileOverlayHeader title={selectTimeMessage} onClose={closeTimePicker} />\n <MobileDatePickerTimeSelector\n ref={timeRef}\n origin={value}\n min={min}\n max={max}\n intervalInMinutes={timeIntervalInMinutes}\n disabled={disabled}\n onSelect={(hour, minutes, seconds) => {\n timeSelected(hour, minutes, seconds);\n }}\n />\n <FocusRedirect onRedirect={handleTimeRedirect} />\n </VStack>\n </MobilePortal>\n )}\n </>\n );\n});\n"],"names":["MobileDatePickerInput","React","value","onChange","onError","min","max","disabled","width","maxWidth","minWidth","showTime","timeIntervalInMinutes","hierarchy","disabledDates","selectDateMessage","selectTimeMessage","selectMonthMessage","selectYearMessage","countryCode","renderActions","onTimeSelected","props","ref","dateOpen","setDateOpen","useState","timeOpen","setTimeOpen","pickerRef","useRef","timeRef","dateButtonRef","timeButtonRef","setDateButtonRef","useCallback","node","dateFormatter","useMemo","timeFormatter","formattedDate","formattedTime","openDatePicker","closeDatePicker","openTimePicker","closeTimePicker","useLayoutEffect","handleDateEscape","event","handleTimeEscape","handleDateRedirect","handleTimeRedirect","dateSelected","date","timeSelected","hour","minutes","seconds","updated","jsxs","Fragment","ButtonGroup","jsx","MobileButton","MobilePortal","VStack","styles","MobileOverlayHeader","MobileDatePicker","FocusRedirect","MobileDatePickerTimeSelector"],"mappings":";;;;;;;;;;;;;;;;;;;0KAkBaA,KAAwBC,GAAM,WAGzC,SACA;AAAA,EACE,OAAAC,wBAAY,KAAA;AAAA,EACZ,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,KAAAC,IAAM,oBAAI,KAAK,YAAY;AAAA,EAC3B,KAAAC,IAAM,oBAAI,KAAK,YAAY;AAAA,EAC3B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,uBAAAC,IAAwB;AAAA,EACxB,WAAAC,IAAY;AAAA,EACZ,eAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,mBAAAC,IAAoB;AAAA,EACpB,oBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAA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C,WAAWjB;AAAA,QAEX,UAAA;AAAA,UAAA,gBAAAa,EAACK,GAAA,EAAoB,OAAOnD,GAAmB,SAAS6B,GAAiB;AAAA,UACzE,gBAAAiB;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,KAAKvC;AAAA,cACL,QAAQ7B;AAAA,cACR,KAAAG;AAAA,cACA,KAAAC;AAAA,cACA,mBAAmBM;AAAA,cACnB,UAAAL;AAAA,cACA,UAAU,CAACgD,GAAMC,GAASC,MAAY;AACpC,gBAAAH,GAAaC,GAAMC,GAASC,CAAO;AAAA,cACrC;AAAA,YAAA;AAAA,UAAA;AAAA,UAEF,gBAAAK,EAACO,GAAA,EAAc,YAAYlB,GAAA,CAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACjD,CACF;AAAA,EAAA,GAEJ;AAEJ,CAAC;"}
|
|
@@ -21,17 +21,20 @@ import "../../../utils/hooks/use_resize_observer.js";
|
|
|
21
21
|
import "../../../utils/dnd/context.js";
|
|
22
22
|
import { clsx as Y } from "clsx";
|
|
23
23
|
import "../../../draggable.module-BgelQsuJ.js";
|
|
24
|
+
import "../../../utils/resize/context.js";
|
|
25
|
+
import "../../../resizable.module-I6iyBAvM.js";
|
|
26
|
+
import "../../../utils/resize/resize_handle.js";
|
|
24
27
|
import '../../../mobile_date_picker_year_selector.css';const $ = "_mobile-year-selector_31f3a58", E = "_mobile-year-button_494c1af", g = { "mobile-year-selector": $, "mobile-year-button": E };
|
|
25
|
-
function
|
|
28
|
+
function ue({
|
|
26
29
|
presenter: n,
|
|
27
30
|
onClose: x
|
|
28
31
|
}) {
|
|
29
32
|
const { min: c, max: s, visibleYear: i, visibleMonth: F } = z(
|
|
30
33
|
n.stateBroadcast
|
|
31
|
-
), [a, m] = B(0), l = _(null), S = c == null ? -1 / 0 : c.getFullYear(), k = s == null ? 1 / 0 : s.getFullYear(), r = [],
|
|
34
|
+
), [a, m] = B(0), l = _(null), S = c == null ? -1 / 0 : c.getFullYear(), k = s == null ? 1 / 0 : s.getFullYear(), r = [], p = i % 20, f = i - p + a, w = f + 19;
|
|
32
35
|
for (let o = 0; o < 20; o++) {
|
|
33
36
|
const t = new Date(i, F, 1);
|
|
34
|
-
t.setFullYear(i -
|
|
37
|
+
t.setFullYear(i - p + o + a);
|
|
35
38
|
const u = t.getFullYear() > k || t.getFullYear() < S;
|
|
36
39
|
r.push(
|
|
37
40
|
/* @__PURE__ */ e(
|
|
@@ -91,7 +94,7 @@ function me({
|
|
|
91
94
|
selectable: !1,
|
|
92
95
|
emphasis: "faint",
|
|
93
96
|
hierarchy: "tertiary",
|
|
94
|
-
children: `${
|
|
97
|
+
children: `${f}-${w}`
|
|
95
98
|
}
|
|
96
99
|
),
|
|
97
100
|
/* @__PURE__ */ e(y, {}),
|
|
@@ -104,6 +107,6 @@ function me({
|
|
|
104
107
|
);
|
|
105
108
|
}
|
|
106
109
|
export {
|
|
107
|
-
|
|
110
|
+
ue as MobileDatePickerYearSelector
|
|
108
111
|
};
|
|
109
112
|
//# sourceMappingURL=mobile_date_picker_year_selector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile_date_picker_year_selector.js","sources":["../../../../src/mobile/inputs/date_picker/mobile_date_picker_year_selector.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { ChevronLeftIcon } from '@tcn/icons/chevron_left_icon.js';\nimport { ChevronRightIcon } from '@tcn/icons/chevron_right_icon.js';\nimport { useSignalValue } from '@tcn/state';\nimport { MobileButton } from '../../actions/button/mobile_button.js';\nimport { HStack } from '../../../stacks/h_stack.js';\nimport { Spacer } from '../../../stacks/spacer.js';\nimport { VStack } from '../../../stacks/v_stack.js';\nimport { BodyText, Headline } from '../../../typography/index.js';\nimport { DatePickerPresenter } from '../../../inputs/date_picker/date_picker_presenter.js';\nimport { FocusRedirect } from '../../../utils/index.js';\nimport { clsx } from 'clsx';\nimport styles from './mobile_date_picker_year_selector.module.css';\n\nexport interface MobileDatePickerYearSelectorProps {\n presenter: DatePickerPresenter;\n onClose: () => void;\n}\n\nexport function MobileDatePickerYearSelector({\n presenter,\n onClose,\n}: MobileDatePickerYearSelectorProps) {\n const { min, max, visibleYear, visibleMonth } = useSignalValue(\n presenter.stateBroadcast\n );\n\n const [offset, setOffset] = useState(0);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const minYear = min == null ? -Infinity : min.getFullYear();\n const maxYear = max == null ? Infinity : max.getFullYear();\n const years: React.ReactNode[] = [];\n const remainder = visibleYear % 20;\n const firstYear = visibleYear - remainder + offset;\n const lastYear = firstYear + 19;\n\n for (let x = 0; x < 20; x++) {\n const date = new Date(visibleYear, visibleMonth, 1);\n date.setFullYear(visibleYear - remainder + x + offset);\n\n const disabled = date.getFullYear() > maxYear || date.getFullYear() < minYear;\n\n years.push(\n <button\n key={x}\n disabled={disabled}\n className={clsx(styles['mobile-year-button'], 'tcn-date-picker-year-button')}\n data-is-disabled={String(disabled)}\n data-is-selected={String(date.getFullYear() === visibleYear)}\n onClick={() => {\n presenter.setVisibleYear(date.getFullYear());\n onClose();\n }}\n >\n <BodyText>{date.getFullYear()}</BodyText>\n </button>\n );\n }\n\n function focus() {\n containerRef.current?.focus();\n }\n\n useEffect(() => {\n containerRef.current?.focus();\n }, []);\n\n const rows = [\n years.slice(0, 4),\n years.slice(4, 8),\n years.slice(8, 12),\n years.slice(12, 16),\n years.slice(16, 20),\n ];\n\n function prev() {\n setOffset(offset - 20);\n }\n\n function next() {\n setOffset(offset + 20);\n }\n\n return (\n <VStack\n ref={containerRef}\n tabIndex={0}\n padding=\"8px\"\n width=\"100%\"\n className={clsx(\n styles['mobile-year-selector'],\n 'tcn-mobile-date-picker-year-selector'\n )}\n gap=\"4px\"\n >\n <HStack gap=\"4px\">\n <MobileButton onClick={prev} hierarchy=\"tertiary\" width=\"auto\">\n <ChevronLeftIcon flipOnRtl size=\"md\" />\n </MobileButton>\n <Spacer />\n <Headline\n selectable={false}\n emphasis=\"faint\"\n hierarchy=\"tertiary\"\n >{`${firstYear}-${lastYear}`}</Headline>\n <Spacer />\n <MobileButton hierarchy=\"tertiary\" width=\"auto\" onClick={next}>\n <ChevronRightIcon size=\"md\" />\n </MobileButton>\n </HStack>\n {rows.map((row, index) => (\n <HStack key={index} gap=\"4px\" width=\"100%\">\n {row}\n </HStack>\n ))}\n <FocusRedirect onRedirect={focus} />\n </VStack>\n );\n}\n"],"names":["MobileDatePickerYearSelector","presenter","onClose","min","max","visibleYear","visibleMonth","useSignalValue","offset","setOffset","useState","containerRef","useRef","minYear","maxYear","years","remainder","firstYear","lastYear","x","date","disabled","jsx","clsx","styles","BodyText","focus","useEffect","rows","prev","next","jsxs","VStack","HStack","MobileButton","ChevronLeftIcon","Spacer","Headline","ChevronRightIcon","row","index","FocusRedirect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mobile_date_picker_year_selector.js","sources":["../../../../src/mobile/inputs/date_picker/mobile_date_picker_year_selector.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { ChevronLeftIcon } from '@tcn/icons/chevron_left_icon.js';\nimport { ChevronRightIcon } from '@tcn/icons/chevron_right_icon.js';\nimport { useSignalValue } from '@tcn/state';\nimport { MobileButton } from '../../actions/button/mobile_button.js';\nimport { HStack } from '../../../stacks/h_stack.js';\nimport { Spacer } from '../../../stacks/spacer.js';\nimport { VStack } from '../../../stacks/v_stack.js';\nimport { BodyText, Headline } from '../../../typography/index.js';\nimport { DatePickerPresenter } from '../../../inputs/date_picker/date_picker_presenter.js';\nimport { FocusRedirect } from '../../../utils/index.js';\nimport { clsx } from 'clsx';\nimport styles from './mobile_date_picker_year_selector.module.css';\n\nexport interface MobileDatePickerYearSelectorProps {\n presenter: DatePickerPresenter;\n onClose: () => void;\n}\n\nexport function MobileDatePickerYearSelector({\n presenter,\n onClose,\n}: MobileDatePickerYearSelectorProps) {\n const { min, max, visibleYear, visibleMonth } = useSignalValue(\n presenter.stateBroadcast\n );\n\n const [offset, setOffset] = useState(0);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const minYear = min == null ? -Infinity : min.getFullYear();\n const maxYear = max == null ? Infinity : max.getFullYear();\n const years: React.ReactNode[] = [];\n const remainder = visibleYear % 20;\n const firstYear = visibleYear - remainder + offset;\n const lastYear = firstYear + 19;\n\n for (let x = 0; x < 20; x++) {\n const date = new Date(visibleYear, visibleMonth, 1);\n date.setFullYear(visibleYear - remainder + x + offset);\n\n const disabled = date.getFullYear() > maxYear || date.getFullYear() < minYear;\n\n years.push(\n <button\n key={x}\n disabled={disabled}\n className={clsx(styles['mobile-year-button'], 'tcn-date-picker-year-button')}\n data-is-disabled={String(disabled)}\n data-is-selected={String(date.getFullYear() === visibleYear)}\n onClick={() => {\n presenter.setVisibleYear(date.getFullYear());\n onClose();\n }}\n >\n <BodyText>{date.getFullYear()}</BodyText>\n </button>\n );\n }\n\n function focus() {\n containerRef.current?.focus();\n }\n\n useEffect(() => {\n containerRef.current?.focus();\n }, []);\n\n const rows = [\n years.slice(0, 4),\n years.slice(4, 8),\n years.slice(8, 12),\n years.slice(12, 16),\n years.slice(16, 20),\n ];\n\n function prev() {\n setOffset(offset - 20);\n }\n\n function next() {\n setOffset(offset + 20);\n }\n\n return (\n <VStack\n ref={containerRef}\n tabIndex={0}\n padding=\"8px\"\n width=\"100%\"\n className={clsx(\n styles['mobile-year-selector'],\n 'tcn-mobile-date-picker-year-selector'\n )}\n gap=\"4px\"\n >\n <HStack gap=\"4px\">\n <MobileButton onClick={prev} hierarchy=\"tertiary\" width=\"auto\">\n <ChevronLeftIcon flipOnRtl size=\"md\" />\n </MobileButton>\n <Spacer />\n <Headline\n selectable={false}\n emphasis=\"faint\"\n hierarchy=\"tertiary\"\n >{`${firstYear}-${lastYear}`}</Headline>\n <Spacer />\n <MobileButton hierarchy=\"tertiary\" width=\"auto\" onClick={next}>\n <ChevronRightIcon size=\"md\" />\n </MobileButton>\n </HStack>\n {rows.map((row, index) => (\n <HStack key={index} gap=\"4px\" width=\"100%\">\n {row}\n </HStack>\n ))}\n <FocusRedirect onRedirect={focus} />\n </VStack>\n );\n}\n"],"names":["MobileDatePickerYearSelector","presenter","onClose","min","max","visibleYear","visibleMonth","useSignalValue","offset","setOffset","useState","containerRef","useRef","minYear","maxYear","years","remainder","firstYear","lastYear","x","date","disabled","jsx","clsx","styles","BodyText","focus","useEffect","rows","prev","next","jsxs","VStack","HStack","MobileButton","ChevronLeftIcon","Spacer","Headline","ChevronRightIcon","row","index","FocusRedirect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAASA,GAA6B;AAAA,EAC3C,WAAAC;AAAA,EACA,SAAAC;AACF,GAAsC;AACpC,QAAM,EAAE,KAAAC,GAAK,KAAAC,GAAK,aAAAC,GAAa,cAAAC,MAAiBC;AAAA,IAC9CN,EAAU;AAAA,EAAA,GAGN,CAACO,GAAQC,CAAS,IAAIC,EAAS,CAAC,GAChCC,IAAeC,EAA8B,IAAI,GACjDC,IAAUV,KAAO,OAAO,SAAYA,EAAI,YAAA,GACxCW,IAAUV,KAAO,OAAO,QAAWA,EAAI,YAAA,GACvCW,IAA2B,CAAA,GAC3BC,IAAYX,IAAc,IAC1BY,IAAYZ,IAAcW,IAAYR,GACtCU,IAAWD,IAAY;AAE7B,WAASE,IAAI,GAAGA,IAAI,IAAIA,KAAK;AAC3B,UAAMC,IAAO,IAAI,KAAKf,GAAaC,GAAc,CAAC;AAClD,IAAAc,EAAK,YAAYf,IAAcW,IAAYG,IAAIX,CAAM;AAErD,UAAMa,IAAWD,EAAK,YAAA,IAAgBN,KAAWM,EAAK,gBAAgBP;AAEtE,IAAAE,EAAM;AAAA,MACJ,gBAAAO;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,UAAAD;AAAA,UACA,WAAWE,EAAKC,EAAO,oBAAoB,GAAG,6BAA6B;AAAA,UAC3E,oBAAkB,OAAOH,CAAQ;AAAA,UACjC,oBAAkB,OAAOD,EAAK,YAAA,MAAkBf,CAAW;AAAA,UAC3D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ACT,WAAU;AAAA,cACV,UAAA,GAAGpB,CAAS,IAAIC,CAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,4BACzBkB,GAAA,EAAO;AAAA,UACR,gBAAAd,EAACY,GAAA,EAAa,WAAU,YAAW,OAAM,QAAO,SAASJ,GACvD,UAAA,gBAAAR,EAACgB,GAAA,EAAiB,MAAK,KAAA,CAAK,EAAA,CAC9B;AAAA,QAAA,GACF;AAAA,QACCV,EAAK,IAAI,CAACW,GAAKC,MACd,gBAAAlB,EAACW,GAAA,EAAmB,KAAI,OAAM,OAAM,QACjC,UAAAM,EAAA,GADUC,CAEb,CACD;AAAA,QACD,gBAAAlB,EAACmB,GAAA,EAAc,YAAYf,EAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxC;"}
|
|
@@ -9,16 +9,19 @@ import "../../../../utils/hooks/use_resize_observer.js";
|
|
|
9
9
|
import "../../../../utils/dnd/context.js";
|
|
10
10
|
import "clsx";
|
|
11
11
|
import "../../../../draggable.module-BgelQsuJ.js";
|
|
12
|
+
import "../../../../utils/resize/context.js";
|
|
13
|
+
import "../../../../resizable.module-I6iyBAvM.js";
|
|
14
|
+
import "../../../../utils/resize/resize_handle.js";
|
|
12
15
|
import { useTabs as T } from "../context.js";
|
|
13
16
|
import { useTabLink as C } from "./use_tab_link.js";
|
|
14
|
-
const
|
|
15
|
-
({ children: m, value: t, onClick: o, minWidth: n, maxWidth:
|
|
16
|
-
const { ref: s, isMatch: r } = C(t), i = T(), c = I(s,
|
|
17
|
+
const H = x(
|
|
18
|
+
({ children: m, value: t, onClick: o, minWidth: n, maxWidth: p, id: M, ...e }, a) => {
|
|
19
|
+
const { ref: s, isMatch: r } = C(t), i = T(), c = I(s, a), d = W(
|
|
17
20
|
(b) => {
|
|
18
21
|
i.onChange?.(t), o?.(b);
|
|
19
22
|
},
|
|
20
23
|
[i, t, o]
|
|
21
|
-
), f = i.minItemWidth ?? n, h = i.maxItemWidth ??
|
|
24
|
+
), f = i.minItemWidth ?? n, h = i.maxItemWidth ?? p;
|
|
22
25
|
return /* @__PURE__ */ k(
|
|
23
26
|
l,
|
|
24
27
|
{
|
|
@@ -30,13 +33,13 @@ const D = x(
|
|
|
30
33
|
id: `tab-${t}`,
|
|
31
34
|
"aria-controls": `tabpanel-${t}`,
|
|
32
35
|
tabIndex: r ? 0 : -1,
|
|
33
|
-
...
|
|
36
|
+
...e,
|
|
34
37
|
children: m
|
|
35
38
|
}
|
|
36
39
|
);
|
|
37
40
|
}
|
|
38
41
|
);
|
|
39
42
|
export {
|
|
40
|
-
|
|
43
|
+
H as TabLink
|
|
41
44
|
};
|
|
42
45
|
//# sourceMappingURL=tab_link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab_link.js","sources":["../../../../../src/navigation/tabs/state/link/tab_link.tsx"],"sourcesContent":["import { forwardRef, useCallback, type PropsWithChildren } from 'react';\nimport { TabItem, type TabItemProps } from '../../primitives/tabs_list.js';\nimport { useForkRef } from '../../../../utils/index.js';\nimport { useTabs } from '../context.js';\nimport { useTabLink } from './use_tab_link.js';\n\nexport interface TabLinkOwnProps {\n value: string;\n}\n\nexport interface TabLinkProps\n extends Omit<TabItemProps, 'selected' | 'value'>,\n TabLinkOwnProps {}\n\nexport const TabLink = forwardRef<HTMLButtonElement, PropsWithChildren<TabLinkProps>>(\n ({ children, value, onClick, minWidth, maxWidth, id, ...props }, forwardedRef) => {\n const { ref: internalRef, isMatch } = useTabLink(value);\n const state = useTabs();\n const ref = useForkRef(internalRef, forwardedRef);\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n state.onChange?.(value);\n onClick?.(event);\n },\n [state, value, onClick]\n );\n\n const pickMinWidth = state.minItemWidth ?? minWidth;\n const pickMaxWidth = state.maxItemWidth ?? maxWidth;\n\n return (\n <TabItem\n ref={ref}\n selected={isMatch}\n onClick={handleClick}\n minWidth={pickMinWidth}\n maxWidth={pickMaxWidth}\n id={`tab-${value}`}\n aria-controls={`tabpanel-${value}`}\n tabIndex={isMatch ? 0 : -1}\n {...props}\n >\n {children}\n </TabItem>\n );\n }\n);\n"],"names":["TabLink","forwardRef","children","value","onClick","minWidth","maxWidth","id","props","forwardedRef","internalRef","isMatch","useTabLink","state","useTabs","ref","useForkRef","handleClick","useCallback","event","pickMinWidth","pickMaxWidth","jsx","TabItem"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tab_link.js","sources":["../../../../../src/navigation/tabs/state/link/tab_link.tsx"],"sourcesContent":["import { forwardRef, useCallback, type PropsWithChildren } from 'react';\nimport { TabItem, type TabItemProps } from '../../primitives/tabs_list.js';\nimport { useForkRef } from '../../../../utils/index.js';\nimport { useTabs } from '../context.js';\nimport { useTabLink } from './use_tab_link.js';\n\nexport interface TabLinkOwnProps {\n value: string;\n}\n\nexport interface TabLinkProps\n extends Omit<TabItemProps, 'selected' | 'value'>,\n TabLinkOwnProps {}\n\nexport const TabLink = forwardRef<HTMLButtonElement, PropsWithChildren<TabLinkProps>>(\n ({ children, value, onClick, minWidth, maxWidth, id, ...props }, forwardedRef) => {\n const { ref: internalRef, isMatch } = useTabLink(value);\n const state = useTabs();\n const ref = useForkRef(internalRef, forwardedRef);\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n state.onChange?.(value);\n onClick?.(event);\n },\n [state, value, onClick]\n );\n\n const pickMinWidth = state.minItemWidth ?? minWidth;\n const pickMaxWidth = state.maxItemWidth ?? maxWidth;\n\n return (\n <TabItem\n ref={ref}\n selected={isMatch}\n onClick={handleClick}\n minWidth={pickMinWidth}\n maxWidth={pickMaxWidth}\n id={`tab-${value}`}\n aria-controls={`tabpanel-${value}`}\n tabIndex={isMatch ? 0 : -1}\n {...props}\n >\n {children}\n </TabItem>\n );\n }\n);\n"],"names":["TabLink","forwardRef","children","value","onClick","minWidth","maxWidth","id","props","forwardedRef","internalRef","isMatch","useTabLink","state","useTabs","ref","useForkRef","handleClick","useCallback","event","pickMinWidth","pickMaxWidth","jsx","TabItem"],"mappings":";;;;;;;;;;;;;;;;AAcO,MAAMA,IAAUC;AAAA,EACrB,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,SAAAC,GAAS,UAAAC,GAAU,UAAAC,GAAU,IAAAC,GAAI,GAAGC,EAAA,GAASC,MAAiB;AAChF,UAAM,EAAE,KAAKC,GAAa,SAAAC,EAAA,IAAYC,EAAWT,CAAK,GAChDU,IAAQC,EAAA,GACRC,IAAMC,EAAWN,GAAaD,CAAY,GAE1CQ,IAAcC;AAAA,MAClB,CAACC,MAA+C;AAC9C,QAAAN,EAAM,WAAWV,CAAK,GACtBC,IAAUe,CAAK;AAAA,MACjB;AAAA,MACA,CAACN,GAAOV,GAAOC,CAAO;AAAA,IAAA,GAGlBgB,IAAeP,EAAM,gBAAgBR,GACrCgB,IAAeR,EAAM,gBAAgBP;AAE3C,WACE,gBAAAgB;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAR;AAAA,QACA,UAAUJ;AAAA,QACV,SAASM;AAAA,QACT,UAAUG;AAAA,QACV,UAAUC;AAAA,QACV,IAAI,OAAOlB,CAAK;AAAA,QAChB,iBAAe,YAAYA,CAAK;AAAA,QAChC,UAAUQ,IAAU,IAAI;AAAA,QACvB,GAAGH;AAAA,QAEH,UAAAN;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|