@tcn/ui 0.16.0 → 0.18.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/actions/index.d.ts +0 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +6 -8
- package/dist/actions/index.js.map +1 -1
- 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/draggable.css +1 -1
- package/dist/draggable.module-DFYR5n3n.js +5 -0
- package/dist/draggable.module-DFYR5n3n.js.map +1 -0
- package/dist/field_set.css +1 -1
- package/dist/field_set.module-BpJTFCi4.js +5 -0
- package/dist/field_set.module-BpJTFCi4.js.map +1 -0
- package/dist/form/field/field.js +17 -13
- package/dist/form/field/field.js.map +1 -1
- package/dist/form/field_set/field_set.d.ts +6 -10
- package/dist/form/field_set/field_set.d.ts.map +1 -1
- package/dist/form/field_set/field_set.js +33 -61
- package/dist/form/field_set/field_set.js.map +1 -1
- package/dist/form/field_set/legend.d.ts +20 -0
- package/dist/form/field_set/legend.d.ts.map +1 -0
- package/dist/form/field_set/legend.js +28 -0
- package/dist/form/field_set/legend.js.map +1 -0
- package/dist/form/index.d.ts +2 -1
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +24 -22
- package/dist/form/index.js.map +1 -1
- package/dist/inputs/color_input/color_input.js +2 -3
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/color_input/color_picker.js +11 -7
- package/dist/inputs/color_input/color_picker.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +24 -20
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/date_picker/date_picker.js +19 -15
- package/dist/inputs/date_picker/date_picker.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_header.d.ts.map +1 -1
- package/dist/inputs/date_picker/date_picker_header.js +15 -14
- package/dist/inputs/date_picker/date_picker_header.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +26 -23
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.js +2 -3
- package/dist/inputs/date_picker/date_picker_time_selector.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js +2 -3
- package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +24 -21
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/mask_input/key_capture_input.js +35 -31
- package/dist/inputs/mask_input/key_capture_input.js.map +1 -1
- package/dist/inputs/mask_input/mask_input.js +18 -14
- package/dist/inputs/mask_input/mask_input.js.map +1 -1
- package/dist/inputs/multiselect/multiselect.js +28 -24
- package/dist/inputs/multiselect/multiselect.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_inline_values.d.ts.map +1 -1
- package/dist/inputs/multiselect/multiselect_inline_values.js +15 -15
- package/dist/inputs/multiselect/multiselect_inline_values.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_values.js +16 -17
- package/dist/inputs/multiselect/multiselect_values.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_context.js +13 -9
- package/dist/inputs/phone_number_input/phone_number_context.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js +2 -3
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -1
- package/dist/inputs/phone_number_input/sip_input.js +8 -9
- package/dist/inputs/phone_number_input/sip_input.js.map +1 -1
- package/dist/inputs/select/select.js +11 -8
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/slider/slider.js +28 -24
- package/dist/inputs/slider/slider.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +11 -8
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +29 -25
- package/dist/inputs/switch/switch.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +21 -17
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/layouts/containers/columns/columns.d.ts +6 -1
- package/dist/layouts/containers/columns/columns.d.ts.map +1 -1
- package/dist/layouts/containers/columns/columns.js +30 -7
- package/dist/layouts/containers/columns/columns.js.map +1 -1
- 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 +2 -0
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +26 -22
- package/dist/layouts/index.js.map +1 -1
- package/dist/mobile/inputs/date_picker/mobile_date_picker_header.js +11 -7
- 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 +11 -7
- 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 +14 -10
- package/dist/mobile/inputs/date_picker/mobile_date_picker_year_selector.js.map +1 -1
- package/dist/multiselect_values.css +1 -1
- package/dist/navigation/tabs/state/link/tab_link.js +15 -11
- package/dist/navigation/tabs/state/link/tab_link.js.map +1 -1
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +117 -76
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/overlay/menu/menu.js +21 -17
- package/dist/overlay/menu/menu.js.map +1 -1
- package/dist/overlay/popper/base/dismissal_decorator.js +3 -3
- package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -1
- package/dist/overlay/popper/context_popper.js +14 -10
- package/dist/overlay/popper/context_popper.js.map +1 -1
- package/dist/overlay/popper/element_popper.js +15 -11
- package/dist/overlay/popper/element_popper.js.map +1 -1
- package/dist/overlay/popper/legacy/popper.js +32 -28
- package/dist/overlay/popper/legacy/popper.js.map +1 -1
- package/dist/overlay/popper/preview_popper.js +16 -12
- package/dist/overlay/popper/preview_popper.js.map +1 -1
- package/dist/overlay/tethered/tethered.js +17 -13
- package/dist/overlay/tethered/tethered.js.map +1 -1
- package/dist/resizable.css +1 -0
- package/dist/resizable.module-ur5FBfxo.js +5 -0
- package/dist/resizable.module-ur5FBfxo.js.map +1 -0
- package/dist/resize_handle.css +1 -0
- package/dist/row.css +1 -0
- package/dist/stacks/box/box.d.ts +14 -0
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js +104 -102
- 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/box/end_resize_handle.js +5 -5
- package/dist/stacks/box/end_resize_handle.js.map +1 -1
- package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
- package/dist/stacks/box/resize_handlers.js +12 -12
- package/dist/stacks/box/resize_handlers.js.map +1 -1
- package/dist/stacks/box/start_resize_handle.js +7 -7
- package/dist/stacks/box/start_resize_handle.js.map +1 -1
- package/dist/stacks/box/types.d.ts +3 -2
- package/dist/stacks/box/types.d.ts.map +1 -1
- package/dist/stacks/h_collapsible_box.js +24 -20
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +26 -22
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/surfaces/alert/alert.js +7 -8
- package/dist/surfaces/alert/alert.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 +4 -2
- 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/stories/button_showcase.d.ts.map +1 -1
- package/dist/themes/stories/controls_fieldset.d.ts.map +1 -1
- package/dist/themes/stories/menu_showcase.d.ts.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +653 -431
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/themes/themes/ergo/parts/actions.css +1 -0
- package/dist/themes/themes/ergo/parts/base.css +1 -0
- package/dist/themes/themes/ergo/parts/form.css +1 -0
- package/dist/themes/themes/ergo/parts/inputs.css +1 -0
- package/dist/themes/themes/ergo/parts/navigation.css +1 -0
- package/dist/themes/themes/windows_98/windows_98.css +1 -1
- package/dist/themes/themes/windows_98/windows_98_theme.js +32 -43
- package/dist/themes/themes/windows_98/windows_98_theme.js.map +1 -1
- package/dist/utils/decorators/clone_with_decorator.d.ts +21 -0
- package/dist/utils/decorators/clone_with_decorator.d.ts.map +1 -0
- package/dist/utils/decorators/clone_with_decorator.js +16 -0
- package/dist/utils/decorators/clone_with_decorator.js.map +1 -0
- package/dist/utils/decorators/draggable/context.d.ts.map +1 -0
- package/dist/utils/decorators/draggable/context.js.map +1 -0
- package/dist/utils/{dnd/handle.d.ts → decorators/draggable/drag_handle.d.ts} +1 -1
- package/dist/utils/decorators/draggable/drag_handle.d.ts.map +1 -0
- package/dist/utils/{dnd/handle.js → decorators/draggable/drag_handle.js} +2 -2
- package/dist/utils/decorators/draggable/drag_handle.js.map +1 -0
- package/dist/utils/decorators/draggable/draggable.d.ts.map +1 -0
- package/dist/utils/{dnd → decorators}/draggable/draggable.js +3 -3
- package/dist/utils/decorators/draggable/draggable.js.map +1 -0
- package/dist/utils/decorators/draggable/index.d.ts +11 -0
- package/dist/utils/decorators/draggable/index.d.ts.map +1 -0
- package/dist/utils/decorators/draggable/index.js +14 -0
- package/dist/utils/decorators/draggable/index.js.map +1 -0
- package/dist/utils/{dnd → decorators/draggable}/types.d.ts +1 -1
- package/dist/utils/decorators/draggable/types.d.ts.map +1 -0
- package/dist/utils/{dnd/hooks → decorators/draggable}/use_drag_container.d.ts +2 -2
- package/dist/utils/decorators/draggable/use_drag_container.d.ts.map +1 -0
- package/dist/utils/decorators/draggable/use_drag_container.js.map +1 -0
- package/dist/utils/decorators/draggable/use_draggable.d.ts.map +1 -0
- package/dist/utils/decorators/draggable/use_draggable.js.map +1 -0
- package/dist/utils/decorators/index.d.ts +3 -0
- package/dist/utils/decorators/index.d.ts.map +1 -0
- package/dist/utils/decorators/index.js +27 -0
- package/dist/utils/decorators/index.js.map +1 -0
- package/dist/utils/decorators/resizable/context.d.ts +4 -0
- package/dist/utils/decorators/resizable/context.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/context.js +10 -0
- package/dist/utils/decorators/resizable/context.js.map +1 -0
- package/dist/utils/decorators/resizable/handle_config.d.ts +32 -0
- package/dist/utils/decorators/resizable/handle_config.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/handle_config.js +62 -0
- package/dist/utils/decorators/resizable/handle_config.js.map +1 -0
- package/dist/utils/decorators/resizable/index.d.ts +10 -0
- package/dist/utils/decorators/resizable/index.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/index.js +16 -0
- package/dist/utils/decorators/resizable/index.js.map +1 -0
- package/dist/utils/decorators/resizable/resizable.d.ts +11 -0
- package/dist/utils/decorators/resizable/resizable.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/resizable.js +52 -0
- package/dist/utils/decorators/resizable/resizable.js.map +1 -0
- package/dist/utils/decorators/resizable/resize_handle.d.ts +7 -0
- package/dist/utils/decorators/resizable/resize_handle.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/resize_handle.js +100 -0
- package/dist/utils/decorators/resizable/resize_handle.js.map +1 -0
- package/dist/utils/decorators/resizable/resize_strategy.d.ts +47 -0
- package/dist/utils/decorators/resizable/resize_strategy.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/resize_strategy.js +108 -0
- package/dist/utils/decorators/resizable/resize_strategy.js.map +1 -0
- package/dist/utils/decorators/resizable/types.d.ts +28 -0
- package/dist/utils/decorators/resizable/types.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/types.js +2 -0
- package/dist/utils/decorators/resizable/types.js.map +1 -0
- package/dist/utils/hooks/labelled_by_context.d.ts +21 -0
- package/dist/utils/hooks/labelled_by_context.d.ts.map +1 -0
- package/dist/utils/hooks/labelled_by_context.js +12 -0
- package/dist/utils/hooks/labelled_by_context.js.map +1 -0
- package/dist/utils/index.d.ts +8 -7
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +45 -28
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/listeners/click_away_listener.d.ts.map +1 -0
- package/dist/utils/{click_away_listener.js → listeners/click_away_listener.js} +1 -1
- package/dist/utils/listeners/click_away_listener.js.map +1 -0
- package/dist/utils/listeners/focus_redirect.d.ts.map +1 -0
- package/dist/utils/listeners/focus_redirect.js.map +1 -0
- package/dist/utils/listeners/index.d.ts +4 -0
- package/dist/utils/listeners/index.d.ts.map +1 -0
- package/dist/utils/listeners/index.js +10 -0
- package/dist/utils/listeners/index.js.map +1 -0
- package/dist/utils/listeners/mouse_leave_region.d.ts.map +1 -0
- package/dist/utils/listeners/mouse_leave_region.js.map +1 -0
- package/dist/utils/listeners/scroll_away_listener.d.ts.map +1 -0
- package/dist/utils/{scroll_away_listener.js → listeners/scroll_away_listener.js} +1 -1
- package/dist/utils/listeners/scroll_away_listener.js.map +1 -0
- package/dist/utils/system/index.d.ts +2 -0
- package/dist/utils/system/index.d.ts.map +1 -0
- package/dist/utils/system/index.js +2 -0
- package/dist/utils/system/index.js.map +1 -0
- package/dist/utils/system/variations.d.ts.map +1 -0
- package/dist/utils/system/variations.js +2 -0
- package/dist/utils/system/variations.js.map +1 -0
- package/dist/utils/types/sides.d.ts +3 -0
- package/dist/utils/types/sides.d.ts.map +1 -0
- package/package.json +3 -9
- package/src/actions/button/__stories__/button_group.stories.tsx +23 -24
- package/src/actions/index.ts +0 -1
- package/src/form/field/field.stories.tsx +2 -2
- package/src/form/field/h_field/h_field.stories.tsx +1 -1
- package/src/form/field/v_field/v_field.stories.tsx +1 -1
- package/src/form/field_set/field_set.module.css +0 -14
- package/src/form/field_set/field_set.stories.tsx +101 -1
- package/src/form/field_set/field_set.tsx +43 -57
- package/src/form/field_set/legend.tsx +44 -0
- package/src/form/index.ts +6 -1
- package/src/inputs/date_picker/date_picker_header.tsx +7 -5
- package/src/inputs/date_picker/date_picker_year_selector.tsx +5 -5
- package/src/inputs/multiselect/multiselect_inline_values.tsx +4 -3
- package/src/inputs/multiselect/multiselect_values.module.css +1 -0
- package/src/inputs/multiselect/multiselect_values.tsx +4 -4
- package/src/layouts/__stories__/columns.stories.tsx +31 -0
- package/src/layouts/__stories__/composed.stories.tsx +77 -8
- 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 +3 -2
- package/src/layouts/containers/columns/columns.tsx +29 -3
- 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 +2 -0
- package/src/overlay/frame/frame.stories.tsx +2 -1
- package/src/overlay/frame/frame.tsx +68 -20
- package/src/overlay/popper/base/dismissal_decorator.tsx +3 -3
- package/src/overlay/slide/slide.stories.tsx +1 -1
- package/src/stacks/box/box.tsx +29 -4
- package/src/stacks/box/detect_resize_bounds.ts +5 -1
- package/src/stacks/box/end_resize_handle.tsx +1 -1
- package/src/stacks/box/resize_handlers.ts +1 -1
- package/src/stacks/box/start_resize_handle.tsx +1 -1
- package/src/stacks/box/types.ts +3 -2
- package/src/stacks/collapsible_box.stories.tsx +5 -5
- package/src/stacks/demo.stories.tsx +7 -7
- 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 +84 -4
- package/src/surfaces/panel/__stories__/panel.stories.tsx +84 -9
- package/src/surfaces/window/window.stories.tsx +1 -1
- package/src/test-setup.ts +11 -0
- package/src/themes/stories/button_showcase.tsx +3 -1
- package/src/themes/stories/controls_fieldset.tsx +3 -1
- package/src/themes/stories/menu_showcase.tsx +3 -1
- package/src/themes/theme.tsx +6 -16
- package/src/themes/themes/ergo/INTERACTIVE.md +89 -0
- package/src/themes/themes/ergo/ROADMAP.md +116 -0
- package/src/themes/themes/ergo/ergo_theme.css +219 -734
- package/src/themes/themes/ergo/ergo_theme.ts +15 -1
- package/src/themes/themes/ergo/parts/actions.css +287 -0
- package/src/themes/themes/ergo/parts/base.css +62 -0
- package/src/themes/themes/ergo/parts/form.css +23 -0
- package/src/themes/themes/ergo/parts/inputs.css +252 -0
- package/src/themes/themes/ergo/parts/navigation.css +104 -0
- package/src/themes/themes/windows_98/windows_98.css +32 -43
- package/src/tokens/chip/chip.stories.tsx +5 -5
- package/src/utils/decorators/DECORATOR_PATTERN.md +86 -0
- package/src/utils/decorators/clone_with_decorator.ts +47 -0
- package/src/utils/{dnd → decorators/draggable}/__stories__/draggable.stories.tsx +7 -7
- package/src/utils/{dnd → decorators/draggable}/__stories__/use_draggable.stories.tsx +2 -2
- package/src/utils/{dnd/handle.tsx → decorators/draggable/drag_handle.tsx} +1 -1
- package/src/utils/{dnd → decorators}/draggable/draggable.tsx +2 -2
- package/src/utils/decorators/draggable/index.ts +15 -0
- package/src/utils/{dnd → decorators/draggable}/types.ts +1 -1
- package/src/utils/{dnd/hooks → decorators/draggable}/use_drag_container.ts +2 -2
- package/src/utils/decorators/index.ts +2 -0
- package/src/utils/decorators/resizable/__stories__/resizable.stories.tsx +214 -0
- package/src/utils/decorators/resizable/__stories__/resizable_stories.module.css +47 -0
- package/src/utils/decorators/resizable/__tests__/handle_config.test.ts +191 -0
- package/src/utils/decorators/resizable/__tests__/resize_strategy.test.ts +163 -0
- package/src/utils/decorators/resizable/context.ts +9 -0
- package/src/utils/decorators/resizable/handle_config.ts +118 -0
- package/src/utils/decorators/resizable/index.ts +37 -0
- package/src/utils/decorators/resizable/resizable.module.css +5 -0
- package/src/utils/decorators/resizable/resizable.tsx +97 -0
- package/src/utils/decorators/resizable/resize_handle.module.css +106 -0
- package/src/utils/decorators/resizable/resize_handle.tsx +165 -0
- package/src/utils/decorators/resizable/resize_strategy.ts +190 -0
- package/src/utils/decorators/resizable/types.ts +58 -0
- package/src/utils/hooks/labelled_by_context.ts +27 -0
- package/src/utils/index.ts +9 -7
- package/src/utils/{click_away_listener.tsx → listeners/click_away_listener.tsx} +1 -1
- package/src/utils/listeners/index.ts +3 -0
- package/src/utils/{scroll_away_listener.tsx → listeners/scroll_away_listener.tsx} +1 -1
- package/src/utils/system/index.ts +1 -0
- package/src/utils/types/sides.ts +2 -0
- package/dist/actions/button/slim_button/slim_button.d.ts +0 -9
- package/dist/actions/button/slim_button/slim_button.d.ts.map +0 -1
- package/dist/actions/button/slim_button/slim_button.js +0 -18
- package/dist/actions/button/slim_button/slim_button.js.map +0 -1
- package/dist/containers.module-DlGySre0.js +0 -5
- package/dist/containers.module-DlGySre0.js.map +0 -1
- package/dist/draggable.module-BgelQsuJ.js +0 -5
- package/dist/draggable.module-BgelQsuJ.js.map +0 -1
- package/dist/frame.css +0 -1
- package/dist/left_resize_handle.css +0 -1
- package/dist/right_resize_handle.css +0 -1
- package/dist/slim_button.css +0 -1
- package/dist/stacks/box/left_resize_handle.d.ts +0 -4
- package/dist/stacks/box/left_resize_handle.d.ts.map +0 -1
- package/dist/stacks/box/left_resize_handle.js +0 -36
- package/dist/stacks/box/left_resize_handle.js.map +0 -1
- package/dist/stacks/box/right_resize_handle.d.ts +0 -4
- package/dist/stacks/box/right_resize_handle.d.ts.map +0 -1
- package/dist/stacks/box/right_resize_handle.js +0 -36
- package/dist/stacks/box/right_resize_handle.js.map +0 -1
- package/dist/utils/click_away_listener.d.ts.map +0 -1
- package/dist/utils/click_away_listener.js.map +0 -1
- package/dist/utils/dnd/context.d.ts.map +0 -1
- package/dist/utils/dnd/context.js.map +0 -1
- package/dist/utils/dnd/draggable/draggable.d.ts.map +0 -1
- package/dist/utils/dnd/draggable/draggable.js.map +0 -1
- package/dist/utils/dnd/handle.d.ts.map +0 -1
- package/dist/utils/dnd/handle.js.map +0 -1
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +0 -1
- package/dist/utils/dnd/hooks/use_drag_container.js.map +0 -1
- package/dist/utils/dnd/hooks/use_draggable.d.ts.map +0 -1
- package/dist/utils/dnd/hooks/use_draggable.js.map +0 -1
- package/dist/utils/dnd/types.d.ts.map +0 -1
- package/dist/utils/focus_redirect.d.ts.map +0 -1
- package/dist/utils/focus_redirect.js.map +0 -1
- package/dist/utils/mouse_leave_region.d.ts.map +0 -1
- package/dist/utils/mouse_leave_region.js.map +0 -1
- package/dist/utils/scroll_away_listener.d.ts.map +0 -1
- package/dist/utils/scroll_away_listener.js.map +0 -1
- package/dist/utils/types/variations.d.ts.map +0 -1
- package/src/actions/button/__stories__/slim_button.stories.tsx +0 -274
- package/src/actions/button/slim_button/slim_button.module.css +0 -9
- package/src/actions/button/slim_button/slim_button.tsx +0 -26
- package/src/overlay/frame/frame.module.css +0 -5
- package/src/stacks/box/left_resize_handle.module.css +0 -12
- package/src/stacks/box/left_resize_handle.tsx +0 -39
- package/src/stacks/box/right_resize_handle.module.css +0 -12
- package/src/stacks/box/right_resize_handle.tsx +0 -38
- /package/dist/utils/{dnd → decorators/draggable}/context.d.ts +0 -0
- /package/dist/utils/{dnd → decorators/draggable}/context.js +0 -0
- /package/dist/utils/{dnd → decorators}/draggable/draggable.d.ts +0 -0
- /package/dist/utils/{dnd → decorators/draggable}/types.js +0 -0
- /package/dist/utils/{dnd → decorators/draggable}/types.js.map +0 -0
- /package/dist/utils/{dnd/hooks → decorators/draggable}/use_drag_container.js +0 -0
- /package/dist/utils/{dnd/hooks → decorators/draggable}/use_draggable.d.ts +0 -0
- /package/dist/utils/{dnd/hooks → decorators/draggable}/use_draggable.js +0 -0
- /package/dist/utils/{click_away_listener.d.ts → listeners/click_away_listener.d.ts} +0 -0
- /package/dist/utils/{focus_redirect.d.ts → listeners/focus_redirect.d.ts} +0 -0
- /package/dist/utils/{focus_redirect.js → listeners/focus_redirect.js} +0 -0
- /package/dist/utils/{mouse_leave_region.d.ts → listeners/mouse_leave_region.d.ts} +0 -0
- /package/dist/utils/{mouse_leave_region.js → listeners/mouse_leave_region.js} +0 -0
- /package/dist/utils/{scroll_away_listener.d.ts → listeners/scroll_away_listener.d.ts} +0 -0
- /package/dist/utils/{types → system}/variations.d.ts +0 -0
- /package/src/utils/{dnd → decorators/draggable}/__stories__/draggable_stories.module.css +0 -0
- /package/src/utils/{dnd → decorators/draggable}/context.ts +0 -0
- /package/src/utils/{dnd → decorators}/draggable/draggable.module.css +0 -0
- /package/src/utils/{dnd/hooks → decorators/draggable}/use_draggable.ts +0 -0
- /package/src/utils/{click_away_listener.stories.tsx → listeners/click_away_listener.stories.tsx} +0 -0
- /package/src/utils/{focus_redirect.tsx → listeners/focus_redirect.tsx} +0 -0
- /package/src/utils/{mouse_leave_region.tsx → listeners/mouse_leave_region.tsx} +0 -0
- /package/src/utils/{scroll_away_listener.stories.tsx → listeners/scroll_away_listener.stories.tsx} +0 -0
- /package/src/utils/{types → system}/variations.ts +0 -0
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { jsxs as D, Fragment as L, jsx as C } from "react/jsx-runtime";
|
|
2
|
-
import "../../utils/click_away_listener.js";
|
|
3
|
-
import "../../utils/focus_redirect.js";
|
|
4
|
-
import "../../utils/scroll_away_listener.js";
|
|
2
|
+
import "../../utils/listeners/click_away_listener.js";
|
|
3
|
+
import "../../utils/listeners/focus_redirect.js";
|
|
4
|
+
import "../../utils/listeners/scroll_away_listener.js";
|
|
5
5
|
import N, { useRef as c, useState as f } from "react";
|
|
6
6
|
import { useForkRef as z } from "../../utils/hooks/use_fork_ref.js";
|
|
7
7
|
import "../../utils/hooks/use_resize_observer.js";
|
|
8
|
-
import "../../utils/
|
|
8
|
+
import "../../utils/hooks/labelled_by_context.js";
|
|
9
|
+
import "../../utils/decorators/draggable/context.js";
|
|
9
10
|
import { clsx as G } from "clsx";
|
|
10
|
-
import "../../draggable.module-
|
|
11
|
+
import "../../draggable.module-DFYR5n3n.js";
|
|
12
|
+
import "../../utils/decorators/resizable/context.js";
|
|
13
|
+
import "../../resizable.module-ur5FBfxo.js";
|
|
14
|
+
import "../../utils/decorators/resizable/resize_handle.js";
|
|
11
15
|
import { SuggestionList as H } from "../suggestions/suggestion_list.js";
|
|
12
16
|
import { Input as J } from "../input/input.js";
|
|
13
|
-
const
|
|
17
|
+
const ie = N.forwardRef(function({
|
|
14
18
|
onOptionSelect: m,
|
|
15
19
|
children: O = [],
|
|
16
20
|
onKeyDown: r,
|
|
@@ -23,41 +27,41 @@ const oe = N.forwardRef(function({
|
|
|
23
27
|
onMouseUp: h,
|
|
24
28
|
...i
|
|
25
29
|
}, A) {
|
|
26
|
-
const E = c(!1), [F, d] = f(o), S = c(o),
|
|
30
|
+
const E = c(!1), [F, d] = f(o), S = c(o), t = c(!1), [V, y] = f(null), a = c(null), [R, x] = f(!1), I = z(A, a);
|
|
27
31
|
function l() {
|
|
28
32
|
x(!0);
|
|
29
33
|
}
|
|
30
34
|
function u() {
|
|
31
|
-
|
|
35
|
+
t.current = !1, d(""), x(!1);
|
|
32
36
|
}
|
|
33
|
-
function M(e,
|
|
34
|
-
|
|
37
|
+
function M(e, n, w) {
|
|
38
|
+
t.current = !0;
|
|
35
39
|
const s = a.current;
|
|
36
40
|
requestAnimationFrame(() => {
|
|
37
|
-
s != null && (s.value = e, s.focus(), s.setSelectionRange(
|
|
41
|
+
s != null && (s.value = e, s.focus(), s.setSelectionRange(n, w));
|
|
38
42
|
}), i.onChange && i.onChange(e), u();
|
|
39
43
|
}
|
|
40
44
|
function j(e) {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
45
|
+
t.current = !0;
|
|
46
|
+
const n = a.current;
|
|
47
|
+
n?.focus(), u(), m && m(e);
|
|
44
48
|
}
|
|
45
49
|
function B(e) {
|
|
46
|
-
if (S.current = e.currentTarget.value,
|
|
47
|
-
|
|
50
|
+
if (S.current = e.currentTarget.value, t.current) {
|
|
51
|
+
t.current = !1, r && r(e);
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
54
|
r && r(e);
|
|
51
55
|
}
|
|
52
56
|
function U(e) {
|
|
53
|
-
const
|
|
54
|
-
d(e.currentTarget.value),
|
|
57
|
+
const n = e.key;
|
|
58
|
+
d(e.currentTarget.value), n === "Enter" && (R ? u() : (l(), e.preventDefault())), S.current !== e.currentTarget.value && l(), p && p(e);
|
|
55
59
|
}
|
|
56
60
|
function _(e) {
|
|
57
61
|
y(e.currentTarget), E.current = document.activeElement === e.currentTarget, g && g(e);
|
|
58
62
|
}
|
|
59
63
|
function q(e) {
|
|
60
|
-
|
|
64
|
+
t.current && (t.current = !1, u()), l(), h && h(e);
|
|
61
65
|
}
|
|
62
66
|
return /* @__PURE__ */ D(L, { children: [
|
|
63
67
|
/* @__PURE__ */ C(
|
|
@@ -91,6 +95,6 @@ const oe = N.forwardRef(function({
|
|
|
91
95
|
] });
|
|
92
96
|
});
|
|
93
97
|
export {
|
|
94
|
-
|
|
98
|
+
ie as ComboBox
|
|
95
99
|
};
|
|
96
100
|
//# sourceMappingURL=combo_box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo_box.js","sources":["../../../src/inputs/combo_box/combo_box.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport { clsx } from 'clsx';\nimport React, { useRef, useState } from 'react';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { Input, InputProps } from '../input/input.js';\nimport { OptionProps } from '../options/option.js';\n\nexport interface ComboBoxProps extends InputProps {\n children?: React.ReactElement<OptionProps>[] | React.ReactElement<OptionProps>;\n onOptionSelect?: (value: string) => void;\n noOptionMatchedMessage?: React.ReactNode;\n trimCustomInput?: boolean;\n}\n\nexport const ComboBox = React.forwardRef(function ComboBox(\n {\n onOptionSelect: onSuggestionSelect,\n children = [],\n onKeyDown,\n onKeyUp,\n value,\n noOptionMatchedMessage,\n trimCustomInput = false,\n className,\n onMouseDown,\n onMouseUp,\n ...props\n }: ComboBoxProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const isAlreadyFocusedRef = useRef(false);\n const [searchValue, setSearchValue] = useState(value);\n const valueRef = useRef(value);\n const isClosingRef = useRef(false);\n const [anchorElement, setAnchorElement] = useState<HTMLInputElement | null>(null);\n const internalInputRef = useRef<HTMLInputElement | null>(null);\n const [isSuggestionsOpen, setIsSuggestionsOpen] = useState(false);\n const forkedRef = useForkRef(ref, internalInputRef);\n\n function openSuggestions() {\n setIsSuggestionsOpen(true);\n }\n\n function closeSuggestions() {\n isClosingRef.current = false;\n setSearchValue('');\n setIsSuggestionsOpen(false);\n }\n\n function handleClose(\n value: string,\n selectionStart: number | null,\n selectionEnd: number | null\n ) {\n isClosingRef.current = true;\n const input = internalInputRef.current;\n\n requestAnimationFrame(() => {\n if (input != null) {\n input.value = value;\n input.focus();\n input.setSelectionRange(selectionStart, selectionEnd);\n }\n });\n props.onChange && props.onChange(value);\n closeSuggestions();\n }\n\n function handleSelection(value: string) {\n isClosingRef.current = true;\n const input = internalInputRef.current;\n\n if (input != null) {\n input.focus();\n }\n\n closeSuggestions();\n onSuggestionSelect && onSuggestionSelect(value);\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n valueRef.current = event.currentTarget.value;\n\n if (isClosingRef.current) {\n isClosingRef.current = false;\n onKeyDown && onKeyDown(event);\n return;\n }\n\n onKeyDown && onKeyDown(event);\n }\n\n function handleKeyUp(event: React.KeyboardEvent<HTMLInputElement>) {\n const key = event.key;\n\n setSearchValue(event.currentTarget.value);\n\n if (key === 'Enter') {\n if (isSuggestionsOpen) {\n closeSuggestions();\n } else {\n openSuggestions();\n event.preventDefault();\n }\n }\n\n if (valueRef.current !== event.currentTarget.value) {\n openSuggestions();\n }\n\n onKeyUp && onKeyUp(event);\n }\n\n function handlMouseDown(event: React.MouseEvent<HTMLInputElement>) {\n setAnchorElement(event.currentTarget);\n isAlreadyFocusedRef.current = document.activeElement === event.currentTarget;\n onMouseDown && onMouseDown(event);\n }\n\n function handleMouseUp(event: React.MouseEvent<HTMLInputElement>) {\n if (isClosingRef.current) {\n isClosingRef.current = false;\n closeSuggestions();\n }\n\n openSuggestions();\n onMouseUp && onMouseUp(event);\n }\n\n return (\n <>\n <Input\n ref={forkedRef}\n className={clsx(className, 'tcn-combo-box-input')}\n {...props}\n value={value}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onMouseDown={handlMouseDown}\n onMouseUp={handleMouseUp}\n />\n <SuggestionList\n open={isSuggestionsOpen}\n anchorElement={anchorElement}\n onClose={handleClose}\n value={value}\n initialSearchValue={searchValue}\n trimCustomInput={trimCustomInput}\n onOptionSelect={handleSelection}\n noSuggestionMessage={noOptionMatchedMessage}\n haveValueAsOption={true}\n >\n {children}\n </SuggestionList>\n </>\n );\n});\n"],"names":["ComboBox","React","onSuggestionSelect","children","onKeyDown","onKeyUp","value","noOptionMatchedMessage","trimCustomInput","className","onMouseDown","onMouseUp","props","ref","isAlreadyFocusedRef","useRef","searchValue","setSearchValue","useState","valueRef","isClosingRef","anchorElement","setAnchorElement","internalInputRef","isSuggestionsOpen","setIsSuggestionsOpen","forkedRef","useForkRef","openSuggestions","closeSuggestions","handleClose","selectionStart","selectionEnd","input","handleSelection","handleKeyDown","event","handleKeyUp","key","handlMouseDown","handleMouseUp","jsxs","Fragment","jsx","Input","clsx","SuggestionList"],"mappings":"
|
|
1
|
+
{"version":3,"file":"combo_box.js","sources":["../../../src/inputs/combo_box/combo_box.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport { clsx } from 'clsx';\nimport React, { useRef, useState } from 'react';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { Input, InputProps } from '../input/input.js';\nimport { OptionProps } from '../options/option.js';\n\nexport interface ComboBoxProps extends InputProps {\n children?: React.ReactElement<OptionProps>[] | React.ReactElement<OptionProps>;\n onOptionSelect?: (value: string) => void;\n noOptionMatchedMessage?: React.ReactNode;\n trimCustomInput?: boolean;\n}\n\nexport const ComboBox = React.forwardRef(function ComboBox(\n {\n onOptionSelect: onSuggestionSelect,\n children = [],\n onKeyDown,\n onKeyUp,\n value,\n noOptionMatchedMessage,\n trimCustomInput = false,\n className,\n onMouseDown,\n onMouseUp,\n ...props\n }: ComboBoxProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const isAlreadyFocusedRef = useRef(false);\n const [searchValue, setSearchValue] = useState(value);\n const valueRef = useRef(value);\n const isClosingRef = useRef(false);\n const [anchorElement, setAnchorElement] = useState<HTMLInputElement | null>(null);\n const internalInputRef = useRef<HTMLInputElement | null>(null);\n const [isSuggestionsOpen, setIsSuggestionsOpen] = useState(false);\n const forkedRef = useForkRef(ref, internalInputRef);\n\n function openSuggestions() {\n setIsSuggestionsOpen(true);\n }\n\n function closeSuggestions() {\n isClosingRef.current = false;\n setSearchValue('');\n setIsSuggestionsOpen(false);\n }\n\n function handleClose(\n value: string,\n selectionStart: number | null,\n selectionEnd: number | null\n ) {\n isClosingRef.current = true;\n const input = internalInputRef.current;\n\n requestAnimationFrame(() => {\n if (input != null) {\n input.value = value;\n input.focus();\n input.setSelectionRange(selectionStart, selectionEnd);\n }\n });\n props.onChange && props.onChange(value);\n closeSuggestions();\n }\n\n function handleSelection(value: string) {\n isClosingRef.current = true;\n const input = internalInputRef.current;\n\n if (input != null) {\n input.focus();\n }\n\n closeSuggestions();\n onSuggestionSelect && onSuggestionSelect(value);\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n valueRef.current = event.currentTarget.value;\n\n if (isClosingRef.current) {\n isClosingRef.current = false;\n onKeyDown && onKeyDown(event);\n return;\n }\n\n onKeyDown && onKeyDown(event);\n }\n\n function handleKeyUp(event: React.KeyboardEvent<HTMLInputElement>) {\n const key = event.key;\n\n setSearchValue(event.currentTarget.value);\n\n if (key === 'Enter') {\n if (isSuggestionsOpen) {\n closeSuggestions();\n } else {\n openSuggestions();\n event.preventDefault();\n }\n }\n\n if (valueRef.current !== event.currentTarget.value) {\n openSuggestions();\n }\n\n onKeyUp && onKeyUp(event);\n }\n\n function handlMouseDown(event: React.MouseEvent<HTMLInputElement>) {\n setAnchorElement(event.currentTarget);\n isAlreadyFocusedRef.current = document.activeElement === event.currentTarget;\n onMouseDown && onMouseDown(event);\n }\n\n function handleMouseUp(event: React.MouseEvent<HTMLInputElement>) {\n if (isClosingRef.current) {\n isClosingRef.current = false;\n closeSuggestions();\n }\n\n openSuggestions();\n onMouseUp && onMouseUp(event);\n }\n\n return (\n <>\n <Input\n ref={forkedRef}\n className={clsx(className, 'tcn-combo-box-input')}\n {...props}\n value={value}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onMouseDown={handlMouseDown}\n onMouseUp={handleMouseUp}\n />\n <SuggestionList\n open={isSuggestionsOpen}\n anchorElement={anchorElement}\n onClose={handleClose}\n value={value}\n initialSearchValue={searchValue}\n trimCustomInput={trimCustomInput}\n onOptionSelect={handleSelection}\n noSuggestionMessage={noOptionMatchedMessage}\n haveValueAsOption={true}\n >\n {children}\n </SuggestionList>\n </>\n );\n});\n"],"names":["ComboBox","React","onSuggestionSelect","children","onKeyDown","onKeyUp","value","noOptionMatchedMessage","trimCustomInput","className","onMouseDown","onMouseUp","props","ref","isAlreadyFocusedRef","useRef","searchValue","setSearchValue","useState","valueRef","isClosingRef","anchorElement","setAnchorElement","internalInputRef","isSuggestionsOpen","setIsSuggestionsOpen","forkedRef","useForkRef","openSuggestions","closeSuggestions","handleClose","selectionStart","selectionEnd","input","handleSelection","handleKeyDown","event","handleKeyUp","key","handlMouseDown","handleMouseUp","jsxs","Fragment","jsx","Input","clsx","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;AAcO,MAAMA,KAAWC,EAAM,WAAW,SACvC;AAAA,EACE,gBAAgBC;AAAA,EAChB,UAAAC,IAAW,CAAA;AAAA,EACX,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAsBC,EAAO,EAAK,GAClC,CAACC,GAAaC,CAAc,IAAIC,EAASZ,CAAK,GAC9Ca,IAAWJ,EAAOT,CAAK,GACvBc,IA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AQ+B,CAAK;AAAA,EAC1B;AAEA,WAASG,EAAeH,GAA2C;AACjE,IAAAd,EAAiBc,EAAM,aAAa,GACpCtB,EAAoB,UAAU,SAAS,kBAAkBsB,EAAM,eAC/D1B,KAAeA,EAAY0B,CAAK;AAAA,EAClC;AAEA,WAASI,EAAcJ,GAA2C;AAChE,IAAIhB,EAAa,YACfA,EAAa,UAAU,IACvBS,EAAA,IAGFD,EAAA,GACAjB,KAAaA,EAAUyB,CAAK;AAAA,EAC9B;AAEA,SACE,gBAAAK,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAKlB;AAAA,QACL,WAAWmB,EAAKpC,GAAW,qBAAqB;AAAA,QAC/C,GAAGG;AAAA,QACJ,OAAAN;AAAA,QACA,WAAW6B;AAAA,QACX,SAASE;AAAA,QACT,aAAaE;AAAA,QACb,WAAWC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEb,gBAAAG;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAMtB;AAAA,QACN,eAAAH;AAAA,QACA,SAASS;AAAA,QACT,OAAAxB;AAAA,QACA,oBAAoBU;AAAA,QACpB,iBAAAR;AAAA,QACA,gBAAgB0B;AAAA,QAChB,qBAAqB3B;AAAA,QACrB,mBAAmB;AAAA,QAElB,UAAAJ;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ,CAAC;"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as n, Fragment as T } from "react/jsx-runtime";
|
|
2
2
|
import { useSignalValue as y, useSignalValueEffect as _ } from "@tcn/state";
|
|
3
|
-
import "../../utils/click_away_listener.js";
|
|
4
|
-
import "../../utils/focus_redirect.js";
|
|
5
|
-
import "../../utils/scroll_away_listener.js";
|
|
3
|
+
import "../../utils/listeners/click_away_listener.js";
|
|
4
|
+
import "../../utils/listeners/focus_redirect.js";
|
|
5
|
+
import "../../utils/listeners/scroll_away_listener.js";
|
|
6
6
|
import Y, { useState as B, useRef as L, useLayoutEffect as r } from "react";
|
|
7
7
|
import { useResizeObserver as O } from "../../utils/hooks/use_resize_observer.js";
|
|
8
|
-
import "../../utils/
|
|
8
|
+
import "../../utils/hooks/labelled_by_context.js";
|
|
9
|
+
import "../../utils/decorators/draggable/context.js";
|
|
9
10
|
import { clsx as R } from "clsx";
|
|
10
|
-
import "../../draggable.module-
|
|
11
|
+
import "../../draggable.module-DFYR5n3n.js";
|
|
12
|
+
import "../../utils/decorators/resizable/context.js";
|
|
13
|
+
import "../../resizable.module-ur5FBfxo.js";
|
|
14
|
+
import "../../utils/decorators/resizable/resize_handle.js";
|
|
11
15
|
import { HStack as U } from "../../stacks/h_stack.js";
|
|
12
16
|
import { Spacer as V } from "../../stacks/spacer.js";
|
|
13
17
|
import { VStack as u } from "../../stacks/v_stack.js";
|
|
@@ -15,7 +19,7 @@ import { DatePickerBody as $ } from "./date_picker_body.js";
|
|
|
15
19
|
import { DatePickerHeader as q } from "./date_picker_header.js";
|
|
16
20
|
import { DatePickerPresenter as E } from "./date_picker_presenter.js";
|
|
17
21
|
import { DatePickerTimeSelector as G } from "./date_picker_time_selector.js";
|
|
18
|
-
import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-picker-box_4da3776", w = { "date-picker": J, "date-picker-box": K },
|
|
22
|
+
import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-picker-box_4da3776", w = { "date-picker": J, "date-picker-box": K }, he = Y.forwardRef(function({
|
|
19
23
|
value: i,
|
|
20
24
|
disabled: h,
|
|
21
25
|
onChange: k,
|
|
@@ -23,7 +27,7 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
23
27
|
showTime: c = !1,
|
|
24
28
|
min: g = null,
|
|
25
29
|
max: b = null,
|
|
26
|
-
minVisibleTimeInMilliseconds:
|
|
30
|
+
minVisibleTimeInMilliseconds: l,
|
|
27
31
|
maxVisibleTimeInMilliseconds: p,
|
|
28
32
|
disabledDates: f,
|
|
29
33
|
countryCode: D = "en-US",
|
|
@@ -52,14 +56,14 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
52
56
|
}, [e, b]), r(() => {
|
|
53
57
|
f == null ? e.setDisabledDates([]) : e.setDisabledDates(f);
|
|
54
58
|
}, [e, f]), r(() => {
|
|
55
|
-
typeof
|
|
56
|
-
}, [e,
|
|
59
|
+
typeof l == "number" && e.setMinVisibleTime(l);
|
|
60
|
+
}, [e, l]), r(() => {
|
|
57
61
|
typeof p == "number" && e.setMaxVisibleTime(p);
|
|
58
62
|
}, [e, p]), r(() => {
|
|
59
63
|
typeof d == "number" && e.setTimeIntervalInMinutes(d);
|
|
60
64
|
}, [e, d]), r(() => {
|
|
61
65
|
e.selectDate(i);
|
|
62
|
-
}, [e, i]), /* @__PURE__ */
|
|
66
|
+
}, [e, i]), /* @__PURE__ */ m(
|
|
63
67
|
U,
|
|
64
68
|
{
|
|
65
69
|
ref: H,
|
|
@@ -68,7 +72,7 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
68
72
|
className: R(w["date-picker"], "tcn-date-picker"),
|
|
69
73
|
tabIndex: 0,
|
|
70
74
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ m(
|
|
72
76
|
u,
|
|
73
77
|
{
|
|
74
78
|
ref: j,
|
|
@@ -78,7 +82,7 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
78
82
|
className: R(w["date-picker-box"], "tcn-date-picker-box"),
|
|
79
83
|
"data-is-disabled": h,
|
|
80
84
|
children: [
|
|
81
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ m(u, { height: "auto", children: [
|
|
82
86
|
/* @__PURE__ */ n(q, { countryCode: D, presenter: e }),
|
|
83
87
|
/* @__PURE__ */ n($, { countryCode: D, presenter: e })
|
|
84
88
|
] }),
|
|
@@ -87,7 +91,7 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
87
91
|
]
|
|
88
92
|
}
|
|
89
93
|
),
|
|
90
|
-
c && /* @__PURE__ */
|
|
94
|
+
c && /* @__PURE__ */ m(T, { children: [
|
|
91
95
|
/* @__PURE__ */ n(V, { width: "8px" }),
|
|
92
96
|
/* @__PURE__ */ n(
|
|
93
97
|
G,
|
|
@@ -111,6 +115,6 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
111
115
|
);
|
|
112
116
|
});
|
|
113
117
|
export {
|
|
114
|
-
|
|
118
|
+
he as DatePicker
|
|
115
119
|
};
|
|
116
120
|
//# sourceMappingURL=date_picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date_picker.js","sources":["../../../src/inputs/date_picker/date_picker.tsx"],"sourcesContent":["import { useSignalValue, useSignalValueEffect } from '@tcn/state';\nimport { useResizeObserver } from '../../utils/index.js';\nimport { HStack } from '../../stacks/h_stack.js';\nimport { Spacer } from '../../stacks/spacer.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport { clsx } from 'clsx';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport { DatePickerBody } from './date_picker_body.js';\nimport { DatePickerHeader } from './date_picker_header.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { DatePickerTimeSelector } from './date_picker_time_selector.js';\nimport styles from './date_picker.module.css';\n\nexport interface DatePickerProps {\n value: Date | null;\n disabled?: boolean;\n onChange?: (value: Date | null) => void;\n onError?: (error: string | null) => void;\n showTime?: boolean;\n min?: Date | null;\n max?: Date | null;\n minVisibleTimeInMilliseconds?: number;\n maxVisibleTimeInMilliseconds?: number;\n disabledDates?: Date[];\n countryCode?: string;\n onTimeSelected?: (hour: number, minutes: number, seconds: number) => void;\n timeIntervalInMinutes?: number;\n renderActions?: (datePickerPresenter: DatePickerPresenter) => React.ReactNode;\n}\n\nexport const DatePicker = React.forwardRef(function DatePicker(\n {\n value,\n disabled,\n onChange,\n onError,\n showTime = false,\n min: minDate = null,\n max: maxDate = null,\n minVisibleTimeInMilliseconds,\n maxVisibleTimeInMilliseconds,\n disabledDates,\n countryCode = 'en-US',\n renderActions,\n onTimeSelected,\n timeIntervalInMinutes,\n }: DatePickerProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [calendarHeight, setCalendarHeight] = useState(0);\n const isMountedRef = useRef(false);\n const calendarRef = useResizeObserver((_, height) => {\n setCalendarHeight(height);\n });\n const [presenter] = useState(() => {\n const today = new Date();\n\n const year = value == null ? today.getFullYear() : value.getFullYear();\n const month = value == null ? today.getMonth() : value.getMonth();\n\n return new DatePickerPresenter(value, year, month, showTime);\n });\n\n const state = useSignalValue(presenter.stateBroadcast);\n const innerValue = useSignalValue(presenter.valueBroadcast);\n const error = state.error;\n\n useSignalValueEffect<string | null>(innerError => {\n error !== innerError && onError && onError(innerError);\n }, presenter.errorBroadcast);\n\n useSignalValueEffect<Date | null>(value => {\n if (isMountedRef.current) {\n onChange && onChange(value);\n } else {\n isMountedRef.current = true;\n }\n }, presenter.valueBroadcast);\n\n useLayoutEffect(() => {\n presenter.initialize();\n }, [presenter]);\n\n useLayoutEffect(() => {\n presenter.setShowTime(showTime);\n }, [presenter, showTime]);\n\n useLayoutEffect(() => {\n presenter.setMinDate(minDate);\n }, [presenter, minDate]);\n\n useLayoutEffect(() => {\n presenter.setMaxDate(maxDate);\n }, [presenter, maxDate]);\n\n useLayoutEffect(() => {\n if (disabledDates == null) {\n presenter.setDisabledDates([]);\n } else {\n presenter.setDisabledDates(disabledDates);\n }\n }, [presenter, disabledDates]);\n\n useLayoutEffect(() => {\n if (typeof minVisibleTimeInMilliseconds === 'number') {\n presenter.setMinVisibleTime(minVisibleTimeInMilliseconds);\n }\n }, [presenter, minVisibleTimeInMilliseconds]);\n\n useLayoutEffect(() => {\n if (typeof maxVisibleTimeInMilliseconds === 'number') {\n presenter.setMaxVisibleTime(maxVisibleTimeInMilliseconds);\n }\n }, [presenter, maxVisibleTimeInMilliseconds]);\n\n useLayoutEffect(() => {\n if (typeof timeIntervalInMinutes === 'number') {\n presenter.setTimeIntervalInMinutes(timeIntervalInMinutes);\n }\n }, [presenter, timeIntervalInMinutes]);\n\n useLayoutEffect(() => {\n presenter.selectDate(value);\n }, [presenter, value]);\n\n return (\n <HStack\n ref={ref}\n width=\"auto\"\n height=\"auto\"\n className={clsx(styles['date-picker'], 'tcn-date-picker')}\n tabIndex={0}\n >\n <VStack\n ref={calendarRef}\n inline\n height=\"auto\"\n width=\"auto\"\n className={clsx(styles['date-picker-box'], 'tcn-date-picker-box')}\n data-is-disabled={disabled}\n >\n <VStack height=\"auto\">\n <DatePickerHeader countryCode={countryCode} presenter={presenter} />\n <DatePickerBody countryCode={countryCode} presenter={presenter} />\n </VStack>\n {renderActions && <VStack paddingInline=\"8px\">{renderActions(presenter)}</VStack>}\n <Spacer height=\"8px\" />\n </VStack>\n {showTime && (\n <>\n <Spacer width=\"8px\" />\n <DatePickerTimeSelector\n height={`${calendarHeight}px`}\n origin={innerValue}\n max={state.max}\n min={state.min}\n minVisibleTimeInMilliseconds={state.minVisibleTimeInMilliseconds}\n maxVisibleTimeInMilliseconds={state.maxVisibleTimeInMilliseconds}\n intervalInMinutes={state.timeIntervalInMinutes}\n disabled={disabled}\n onSelect={(hour, minutes, seconds) => {\n presenter.setTime(hour, minutes, seconds);\n onTimeSelected && onTimeSelected(hour, minutes, seconds);\n }}\n />\n </>\n )}\n </HStack>\n );\n});\n"],"names":["DatePicker","React","value","disabled","onChange","onError","showTime","minDate","maxDate","minVisibleTimeInMilliseconds","maxVisibleTimeInMilliseconds","disabledDates","countryCode","renderActions","onTimeSelected","timeIntervalInMinutes","ref","calendarHeight","setCalendarHeight","useState","isMountedRef","useRef","calendarRef","useResizeObserver","_","height","presenter","today","year","month","DatePickerPresenter","state","useSignalValue","innerValue","error","useSignalValueEffect","innerError","useLayoutEffect","jsxs","HStack","clsx","styles","VStack","jsx","DatePickerHeader","DatePickerBody","Spacer","Fragment","DatePickerTimeSelector","hour","minutes","seconds"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date_picker.js","sources":["../../../src/inputs/date_picker/date_picker.tsx"],"sourcesContent":["import { useSignalValue, useSignalValueEffect } from '@tcn/state';\nimport { useResizeObserver } from '../../utils/index.js';\nimport { HStack } from '../../stacks/h_stack.js';\nimport { Spacer } from '../../stacks/spacer.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport { clsx } from 'clsx';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport { DatePickerBody } from './date_picker_body.js';\nimport { DatePickerHeader } from './date_picker_header.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { DatePickerTimeSelector } from './date_picker_time_selector.js';\nimport styles from './date_picker.module.css';\n\nexport interface DatePickerProps {\n value: Date | null;\n disabled?: boolean;\n onChange?: (value: Date | null) => void;\n onError?: (error: string | null) => void;\n showTime?: boolean;\n min?: Date | null;\n max?: Date | null;\n minVisibleTimeInMilliseconds?: number;\n maxVisibleTimeInMilliseconds?: number;\n disabledDates?: Date[];\n countryCode?: string;\n onTimeSelected?: (hour: number, minutes: number, seconds: number) => void;\n timeIntervalInMinutes?: number;\n renderActions?: (datePickerPresenter: DatePickerPresenter) => React.ReactNode;\n}\n\nexport const DatePicker = React.forwardRef(function DatePicker(\n {\n value,\n disabled,\n onChange,\n onError,\n showTime = false,\n min: minDate = null,\n max: maxDate = null,\n minVisibleTimeInMilliseconds,\n maxVisibleTimeInMilliseconds,\n disabledDates,\n countryCode = 'en-US',\n renderActions,\n onTimeSelected,\n timeIntervalInMinutes,\n }: DatePickerProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [calendarHeight, setCalendarHeight] = useState(0);\n const isMountedRef = useRef(false);\n const calendarRef = useResizeObserver((_, height) => {\n setCalendarHeight(height);\n });\n const [presenter] = useState(() => {\n const today = new Date();\n\n const year = value == null ? today.getFullYear() : value.getFullYear();\n const month = value == null ? today.getMonth() : value.getMonth();\n\n return new DatePickerPresenter(value, year, month, showTime);\n });\n\n const state = useSignalValue(presenter.stateBroadcast);\n const innerValue = useSignalValue(presenter.valueBroadcast);\n const error = state.error;\n\n useSignalValueEffect<string | null>(innerError => {\n error !== innerError && onError && onError(innerError);\n }, presenter.errorBroadcast);\n\n useSignalValueEffect<Date | null>(value => {\n if (isMountedRef.current) {\n onChange && onChange(value);\n } else {\n isMountedRef.current = true;\n }\n }, presenter.valueBroadcast);\n\n useLayoutEffect(() => {\n presenter.initialize();\n }, [presenter]);\n\n useLayoutEffect(() => {\n presenter.setShowTime(showTime);\n }, [presenter, showTime]);\n\n useLayoutEffect(() => {\n presenter.setMinDate(minDate);\n }, [presenter, minDate]);\n\n useLayoutEffect(() => {\n presenter.setMaxDate(maxDate);\n }, [presenter, maxDate]);\n\n useLayoutEffect(() => {\n if (disabledDates == null) {\n presenter.setDisabledDates([]);\n } else {\n presenter.setDisabledDates(disabledDates);\n }\n }, [presenter, disabledDates]);\n\n useLayoutEffect(() => {\n if (typeof minVisibleTimeInMilliseconds === 'number') {\n presenter.setMinVisibleTime(minVisibleTimeInMilliseconds);\n }\n }, [presenter, minVisibleTimeInMilliseconds]);\n\n useLayoutEffect(() => {\n if (typeof maxVisibleTimeInMilliseconds === 'number') {\n presenter.setMaxVisibleTime(maxVisibleTimeInMilliseconds);\n }\n }, [presenter, maxVisibleTimeInMilliseconds]);\n\n useLayoutEffect(() => {\n if (typeof timeIntervalInMinutes === 'number') {\n presenter.setTimeIntervalInMinutes(timeIntervalInMinutes);\n }\n }, [presenter, timeIntervalInMinutes]);\n\n useLayoutEffect(() => {\n presenter.selectDate(value);\n }, [presenter, value]);\n\n return (\n <HStack\n ref={ref}\n width=\"auto\"\n height=\"auto\"\n className={clsx(styles['date-picker'], 'tcn-date-picker')}\n tabIndex={0}\n >\n <VStack\n ref={calendarRef}\n inline\n height=\"auto\"\n width=\"auto\"\n className={clsx(styles['date-picker-box'], 'tcn-date-picker-box')}\n data-is-disabled={disabled}\n >\n <VStack height=\"auto\">\n <DatePickerHeader countryCode={countryCode} presenter={presenter} />\n <DatePickerBody countryCode={countryCode} presenter={presenter} />\n </VStack>\n {renderActions && <VStack paddingInline=\"8px\">{renderActions(presenter)}</VStack>}\n <Spacer height=\"8px\" />\n </VStack>\n {showTime && (\n <>\n <Spacer width=\"8px\" />\n <DatePickerTimeSelector\n height={`${calendarHeight}px`}\n origin={innerValue}\n max={state.max}\n min={state.min}\n minVisibleTimeInMilliseconds={state.minVisibleTimeInMilliseconds}\n maxVisibleTimeInMilliseconds={state.maxVisibleTimeInMilliseconds}\n intervalInMinutes={state.timeIntervalInMinutes}\n disabled={disabled}\n onSelect={(hour, minutes, seconds) => {\n presenter.setTime(hour, minutes, seconds);\n onTimeSelected && onTimeSelected(hour, minutes, seconds);\n }}\n />\n </>\n )}\n </HStack>\n );\n});\n"],"names":["DatePicker","React","value","disabled","onChange","onError","showTime","minDate","maxDate","minVisibleTimeInMilliseconds","maxVisibleTimeInMilliseconds","disabledDates","countryCode","renderActions","onTimeSelected","timeIntervalInMinutes","ref","calendarHeight","setCalendarHeight","useState","isMountedRef","useRef","calendarRef","useResizeObserver","_","height","presenter","today","year","month","DatePickerPresenter","state","useSignalValue","innerValue","error","useSignalValueEffect","innerError","useLayoutEffect","jsxs","HStack","clsx","styles","VStack","jsx","DatePickerHeader","DatePickerBody","Spacer","Fragment","DatePickerTimeSelector","hour","minutes","seconds"],"mappings":";;;;;;;;;;;;;;;;;;;;;kHA8BaA,KAAaC,EAAM,WAAW,SACzC;AAAA,EACE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,KAAKC,IAAU;AAAA,EACf,KAAKC,IAAU;AAAA,EACf,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,eAAAC;AAAA,EACA,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,aAAAjC,GAA0B,WAAAc,EAAA,CAAsB;AAAA,cAAA,GAClE;AAAA,cACCb,KAAiB,gBAAA8B,EAACD,GAAA,EAAO,eAAc,OAAO,UAAA7B,EAAca,CAAS,GAAE;AAAA,cACxE,gBAAAiB,EAACG,GAAA,EAAO,QAAO,MAAA,CAAM;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAEtBxC,KACC,gBAAAgC,EAAAS,GAAA,EACE,UAAA;AAAA,UAAA,gBAAAJ,EAACG,GAAA,EAAO,OAAM,MAAA,CAAM;AAAA,UACpB,gBAAAH;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,QAAQ,GAAG/B,CAAc;AAAA,cACzB,QAAQgB;AAAA,cACR,KAAKF,EAAM;AAAA,cACX,KAAKA,EAAM;AAAA,cACX,8BAA8BA,EAAM;AAAA,cACpC,8BAA8BA,EAAM;AAAA,cACpC,mBAAmBA,EAAM;AAAA,cACzB,UAAA5B;AAAA,cACA,UAAU,CAAC8C,GAAMC,GAASC,MAAY;AACpC,gBAAAzB,EAAU,QAAQuB,GAAMC,GAASC,CAAO,GACxCrC,KAAkBA,EAAemC,GAAMC,GAASC,CAAO;AAAA,cACzD;AAAA,YAAA;AAAA,UAAA;AAAA,QACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date_picker_header.d.ts","sourceRoot":"","sources":["../../../src/inputs/date_picker/date_picker_header.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAuBjE,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"date_picker_header.d.ts","sourceRoot":"","sources":["../../../src/inputs/date_picker/date_picker_header.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAuBjE,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,qBAAqB,2CAiEjF"}
|
|
@@ -5,30 +5,29 @@ import { Spacer as h } from "../../stacks/spacer.js";
|
|
|
5
5
|
import { useRef as M, useMemo as b } from "react";
|
|
6
6
|
import "../../actions/button/base_button/base_button.js";
|
|
7
7
|
import "../../actions/button/button_group/button_group.js";
|
|
8
|
-
import {
|
|
9
|
-
import "../../actions/button/button/button.js";
|
|
8
|
+
import { Button as m } from "../../actions/button/button/button.js";
|
|
10
9
|
import "../../actions/toggle/toggle.js";
|
|
11
10
|
import { getMonthsOfYear as u } from "../../utils/calendar/get_months_of_year.js";
|
|
12
11
|
import { Select as k } from "../select/select.js";
|
|
13
|
-
import { ChevronLeftIcon as
|
|
14
|
-
import { ChevronRightIcon as
|
|
15
|
-
import { Option as
|
|
12
|
+
import { ChevronLeftIcon as y } from "@tcn/icons/chevron_left_icon.js";
|
|
13
|
+
import { ChevronRightIcon as S } from "@tcn/icons/chevron_right_icon.js";
|
|
14
|
+
import { Option as x } from "../options/option.js";
|
|
16
15
|
import { clsx as O } from "clsx";
|
|
17
16
|
import { DatePickerYearInput as B } from "./date_picker_year_input.js";
|
|
18
17
|
import '../../date_picker_header.css';const N = "_date-picker-header_696681a", R = { "date-picker-header": N };
|
|
19
18
|
function V(t) {
|
|
20
19
|
const o = u(t, "short"), i = u(t, "long");
|
|
21
|
-
return o.map((n, r) => /* @__PURE__ */ e(
|
|
20
|
+
return o.map((n, r) => /* @__PURE__ */ e(x, { value: String(r), label: n, keywords: [n], children: i[r] }, r));
|
|
22
21
|
}
|
|
23
|
-
function
|
|
22
|
+
function F({ presenter: t, countryCode: o }) {
|
|
24
23
|
const i = g(t.stateBroadcast), n = M(null);
|
|
25
24
|
function r(a) {
|
|
26
25
|
t.setVisibleMonth(Number(a));
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function d() {
|
|
29
28
|
return t.setVisibleMonth(t.stateBroadcast.get().visibleMonth - 1);
|
|
30
29
|
}
|
|
31
|
-
function
|
|
30
|
+
function p() {
|
|
32
31
|
return t.setVisibleMonth(t.stateBroadcast.get().visibleMonth + 1);
|
|
33
32
|
}
|
|
34
33
|
const f = b(() => V(o), [o]);
|
|
@@ -45,10 +44,11 @@ function G({ presenter: t, countryCode: o }) {
|
|
|
45
44
|
/* @__PURE__ */ e(
|
|
46
45
|
m,
|
|
47
46
|
{
|
|
47
|
+
utility: !0,
|
|
48
48
|
disabled: !i.canNavigateToPreviousMonth,
|
|
49
49
|
hierarchy: "tertiary",
|
|
50
|
-
onClick:
|
|
51
|
-
children: /* @__PURE__ */ e(
|
|
50
|
+
onClick: d,
|
|
51
|
+
children: /* @__PURE__ */ e(y, { flipOnRtl: !0, size: "md" })
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
54
|
/* @__PURE__ */ e(h, {}),
|
|
@@ -70,10 +70,11 @@ function G({ presenter: t, countryCode: o }) {
|
|
|
70
70
|
/* @__PURE__ */ e(
|
|
71
71
|
m,
|
|
72
72
|
{
|
|
73
|
+
utility: !0,
|
|
73
74
|
disabled: !i.canNavigateToNextMonth,
|
|
74
75
|
hierarchy: "tertiary",
|
|
75
|
-
onClick:
|
|
76
|
-
children: /* @__PURE__ */ e(
|
|
76
|
+
onClick: p,
|
|
77
|
+
children: /* @__PURE__ */ e(S, { flipOnRtl: !0, size: "md" })
|
|
77
78
|
}
|
|
78
79
|
)
|
|
79
80
|
]
|
|
@@ -81,6 +82,6 @@ function G({ presenter: t, countryCode: o }) {
|
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
F as DatePickerHeader
|
|
85
86
|
};
|
|
86
87
|
//# sourceMappingURL=date_picker_header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date_picker_header.js","sources":["../../../src/inputs/date_picker/date_picker_header.tsx"],"sourcesContent":["import { useSignalValue, useSignalValueEffect } from '@tcn/state';\nimport { HStack } from '../../stacks/h_stack.js';\nimport { Spacer } from '../../stacks/spacer.js';\nimport React, { useMemo, useRef } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"date_picker_header.js","sources":["../../../src/inputs/date_picker/date_picker_header.tsx"],"sourcesContent":["import { useSignalValue, useSignalValueEffect } from '@tcn/state';\nimport { HStack } from '../../stacks/h_stack.js';\nimport { Spacer } from '../../stacks/spacer.js';\nimport React, { useMemo, useRef } from 'react';\nimport { Button } from '../../actions/index.js';\nimport { getMonthsOfYear } from '../../utils/calendar/get_months_of_year.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { Select } from '../select/select.js';\nimport { ChevronLeftIcon } from '@tcn/icons/chevron_left_icon.js';\nimport { ChevronRightIcon } from '@tcn/icons/chevron_right_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { DatePickerState } from './date_picker_presenter.js';\nimport styles from './date_picker_header.module.css';\nimport { clsx } from 'clsx';\nimport { DatePickerYearInput } from './date_picker_year_input.js';\n\nfunction makeMonthsOptions(countryCode: string): React.ReactElement<OptionProps>[] {\n const shortMonths = getMonthsOfYear(countryCode, 'short');\n const longMonths = getMonthsOfYear(countryCode, 'long');\n\n return shortMonths.map((m, index) => {\n return (\n <Option key={index} value={String(index)} label={m} keywords={[m]}>\n {longMonths[index]}\n </Option>\n );\n });\n}\n\nexport interface DatePickerHeaderProps {\n presenter: DatePickerPresenter;\n countryCode: string;\n}\n\nexport function DatePickerHeader({ presenter, countryCode }: DatePickerHeaderProps) {\n const state = useSignalValue(presenter.stateBroadcast);\n const yearInputRef = useRef<HTMLInputElement>(null);\n\n function selectMonth(value: string) {\n presenter.setVisibleMonth(Number(value));\n }\n\n function previous() {\n return presenter.setVisibleMonth(presenter.stateBroadcast.get().visibleMonth - 1);\n }\n\n function next() {\n return presenter.setVisibleMonth(presenter.stateBroadcast.get().visibleMonth + 1);\n }\n\n const monthsOptions = useMemo(() => {\n return makeMonthsOptions(countryCode);\n }, [countryCode]);\n\n useSignalValueEffect((state: DatePickerState) => {\n const input = yearInputRef.current;\n if (input && input.value !== String(state.visibleYear)) {\n input.value = String(state.visibleYear);\n }\n }, presenter.stateBroadcast);\n\n return (\n <HStack\n className={clsx(styles['date-picker-header'], 'tcn-date-picker-header')}\n minWidth=\"35px\"\n width=\"100%\"\n >\n <Button\n utility\n disabled={!state.canNavigateToPreviousMonth}\n hierarchy=\"tertiary\"\n onClick={previous}\n >\n <ChevronLeftIcon flipOnRtl size=\"md\" />\n </Button>\n <Spacer />\n <HStack hAlign=\"center\" gap=\"4px\" width=\"auto\">\n <Select\n hierarchy=\"tertiary\"\n width=\"auto\"\n maxWidth=\"150px\"\n value={String(state.visibleMonth)}\n onChange={selectMonth}\n >\n {monthsOptions}\n </Select>\n <DatePickerYearInput presenter={presenter} />\n </HStack>\n <Spacer />\n <Button\n utility\n disabled={!state.canNavigateToNextMonth}\n hierarchy=\"tertiary\"\n onClick={next}\n >\n <ChevronRightIcon flipOnRtl size=\"md\" />\n </Button>\n </HStack>\n );\n}\n"],"names":["makeMonthsOptions","countryCode","shortMonths","getMonthsOfYear","longMonths","m","index","jsx","Option","DatePickerHeader","presenter","state","useSignalValue","yearInputRef","useRef","selectMonth","value","previous","next","monthsOptions","useMemo","useSignalValueEffect","input","jsxs","HStack","clsx","styles","Button","ChevronLeftIcon","Spacer","Select","DatePickerYearInput","ChevronRightIcon"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,SAASA,EAAkBC,GAAwD;AACjF,QAAMC,IAAcC,EAAgBF,GAAa,OAAO,GAClDG,IAAaD,EAAgBF,GAAa,MAAM;AAEtD,SAAOC,EAAY,IAAI,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AAA,EAAO,QAAO,UAAS,KAAI,OAAM,OAAM,QACtC,UAAA;AAAA,UAAA,gBAAAjB;AAAA,YAACuB;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAM;AAAA,cACN,UAAS;AAAA,cACT,OAAO,OAAOnB,EAAM,YAAY;AAAA,cAChC,UAAUI;AAAA,cAET,UAAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAEH,gBAAAZ,EAACwB,KAAoB,WAAArB,EAAA,CAAsB;AAAA,QAAA,GAC7C;AAAA,0BACCmB,GAAA,EAAO;AAAA,QACR,gBAAAtB;AAAA,UAACoB;AAAA,UAAA;AAAA,YACC,SAAO;AAAA,YACP,UAAU,CAAChB,EAAM;AAAA,YACjB,WAAU;AAAA,YACV,SAASO;AAAA,YAET,UAAA,gBAAAX,EAACyB,GAAA,EAAiB,WAAS,IAAC,MAAK,KAAA,CAAK;AAAA,UAAA;AAAA,QAAA;AAAA,MACxC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, Fragment as q, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import B, { useState as L, useRef as M, useCallback as V, useMemo as W, useLayoutEffect as Z } from "react";
|
|
3
3
|
import { ZStack as G } from "../../stacks/z_stack.js";
|
|
4
4
|
import { Popper as H } from "../../overlay/popper/legacy/popper.js";
|
|
5
|
-
import { clsx as
|
|
5
|
+
import { clsx as u } from "clsx";
|
|
6
6
|
import "../../actions/button/base_button/base_button.js";
|
|
7
7
|
import "../../actions/button/button_group/button_group.js";
|
|
8
|
-
import "../../actions/button/slim_button/slim_button.js";
|
|
9
8
|
import { Button as J } from "../../actions/button/button/button.js";
|
|
10
9
|
import "../../actions/toggle/toggle.js";
|
|
11
10
|
import { DatePicker as Q } from "./date_picker.js";
|
|
12
|
-
import "../../utils/click_away_listener.js";
|
|
13
|
-
import { FocusRedirect as T } from "../../utils/focus_redirect.js";
|
|
14
|
-
import "../../utils/scroll_away_listener.js";
|
|
11
|
+
import "../../utils/listeners/click_away_listener.js";
|
|
12
|
+
import { FocusRedirect as T } from "../../utils/listeners/focus_redirect.js";
|
|
13
|
+
import "../../utils/listeners/scroll_away_listener.js";
|
|
15
14
|
import "../../utils/hooks/use_resize_observer.js";
|
|
16
|
-
import "../../utils/
|
|
17
|
-
import "../../draggable.
|
|
18
|
-
import
|
|
15
|
+
import "../../utils/hooks/labelled_by_context.js";
|
|
16
|
+
import "../../utils/decorators/draggable/context.js";
|
|
17
|
+
import "../../draggable.module-DFYR5n3n.js";
|
|
18
|
+
import "../../utils/decorators/resizable/context.js";
|
|
19
|
+
import "../../resizable.module-ur5FBfxo.js";
|
|
20
|
+
import "../../utils/decorators/resizable/resize_handle.js";
|
|
21
|
+
import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_708f951", f = { button: U, popover: X }, Dt = B.forwardRef(
|
|
19
22
|
({
|
|
20
23
|
value: c = /* @__PURE__ */ new Date(),
|
|
21
24
|
onChange: d,
|
|
@@ -26,7 +29,7 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
26
29
|
width: y = "100%",
|
|
27
30
|
maxWidth: D,
|
|
28
31
|
minWidth: Y,
|
|
29
|
-
showTime:
|
|
32
|
+
showTime: o = !1,
|
|
30
33
|
timeIntervalInMinutes: x = 15,
|
|
31
34
|
hierarchy: A = "secondary",
|
|
32
35
|
disabledDates: E,
|
|
@@ -36,14 +39,14 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
36
39
|
onTimeSelected: w,
|
|
37
40
|
..._
|
|
38
41
|
}, b) => {
|
|
39
|
-
const [
|
|
42
|
+
const [n, a] = L(null), v = n != null, i = M(null), p = V((t) => t.closest(".tcn-suggestion-list") != null, []), C = W(() => {
|
|
40
43
|
const t = {
|
|
41
44
|
year: "numeric",
|
|
42
45
|
month: "short",
|
|
43
46
|
day: "numeric"
|
|
44
47
|
};
|
|
45
|
-
return
|
|
46
|
-
}, [s,
|
|
48
|
+
return o && (t.hour = "numeric", t.minute = "2-digit", t.hour12 = !0), new Intl.DateTimeFormat(s, t);
|
|
49
|
+
}, [s, o]), F = c != null ? C.format(c) : R;
|
|
47
50
|
function P(t) {
|
|
48
51
|
a(t.currentTarget);
|
|
49
52
|
}
|
|
@@ -52,9 +55,9 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
52
55
|
}
|
|
53
56
|
Z(() => {
|
|
54
57
|
requestAnimationFrame(() => {
|
|
55
|
-
|
|
58
|
+
n != null && i.current && i.current.focus();
|
|
56
59
|
});
|
|
57
|
-
}, [
|
|
60
|
+
}, [n]);
|
|
58
61
|
function O(t) {
|
|
59
62
|
t.key === "Escape" && e();
|
|
60
63
|
}
|
|
@@ -63,17 +66,17 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
63
66
|
t?.focus();
|
|
64
67
|
}
|
|
65
68
|
function N(t) {
|
|
66
|
-
d?.(t), !
|
|
69
|
+
d?.(t), !o && e();
|
|
67
70
|
}
|
|
68
71
|
function j(t, z, K) {
|
|
69
72
|
w?.(t, z, K), e();
|
|
70
73
|
}
|
|
71
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ m(q, { children: [
|
|
72
75
|
/* @__PURE__ */ r(
|
|
73
76
|
J,
|
|
74
77
|
{
|
|
75
78
|
ref: b,
|
|
76
|
-
className:
|
|
79
|
+
className: u(f.button, "tcn-entry", "tcn-date-picker-input"),
|
|
77
80
|
hAlign: "start",
|
|
78
81
|
disabled: l,
|
|
79
82
|
hierarchy: A,
|
|
@@ -87,7 +90,7 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
87
90
|
/* @__PURE__ */ r(
|
|
88
91
|
H,
|
|
89
92
|
{
|
|
90
|
-
anchorElement:
|
|
93
|
+
anchorElement: n,
|
|
91
94
|
disableClickAway: !0,
|
|
92
95
|
veil: !0,
|
|
93
96
|
onVeilClick: e,
|
|
@@ -100,11 +103,11 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
100
103
|
isClickAwayException: p,
|
|
101
104
|
isScrollAwayException: p,
|
|
102
105
|
restoreFocus: !0,
|
|
103
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ m(
|
|
104
107
|
G,
|
|
105
108
|
{
|
|
106
109
|
padding: "8px",
|
|
107
|
-
className:
|
|
110
|
+
className: u(f.popover, "tcn-date-picker-popover"),
|
|
108
111
|
onKeyDown: O,
|
|
109
112
|
children: [
|
|
110
113
|
/* @__PURE__ */ r(
|
|
@@ -115,7 +118,7 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
115
118
|
onChange: N,
|
|
116
119
|
min: k,
|
|
117
120
|
max: g,
|
|
118
|
-
showTime:
|
|
121
|
+
showTime: o,
|
|
119
122
|
onError: h,
|
|
120
123
|
disabled: l,
|
|
121
124
|
disabledDates: E,
|
|
@@ -135,6 +138,6 @@ import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_
|
|
|
135
138
|
}
|
|
136
139
|
);
|
|
137
140
|
export {
|
|
138
|
-
|
|
141
|
+
Dt as DatePickerInput
|
|
139
142
|
};
|
|
140
143
|
//# sourceMappingURL=date_picker_input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date_picker_input.js","sources":["../../../src/inputs/date_picker/date_picker_input.tsx"],"sourcesContent":["import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Hierarchy } from '../../utils/index.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { Popper } from '../../overlay/popper/legacy/popper.js';\nimport { clsx } from 'clsx';\nimport { HTMLAttributes } from 'react';\nimport { Button } from '../../actions/index.js';\nimport { DatePicker } from './date_picker.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { FocusRedirect } from '../../utils/index.js';\nimport styles from './date_picker_input.module.css';\n\nexport interface DatePickerInputProps\n extends Omit<HTMLAttributes<HTMLButtonElement>, 'onChange' | 'onError'> {\n value?: Date | null;\n disabled?: boolean;\n onChange?: (date: Date | null) => void;\n onError?: (error: string | null) => void;\n width?: string;\n maxWidth?: string;\n minWidth?: string;\n showTime?: boolean;\n timeIntervalInMinutes?: number;\n disabledDates?: Date[] | undefined;\n countryCode?: string;\n renderActions?: (datePickerPresenter: DatePickerPresenter) => React.ReactNode;\n min?: Date;\n max?: Date;\n hierarchy?: Hierarchy;\n selectDateMessage?: string;\n onTimeSelected?: (hour: number, minutes: number, seconds: number) => void;\n}\n\nexport const DatePickerInput = React.forwardRef<HTMLButtonElement, DatePickerInputProps>(\n (\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 countryCode,\n renderActions,\n onTimeSelected,\n ...props\n }: DatePickerInputProps,\n ref: React.Ref<HTMLButtonElement>\n ) => {\n const [anchorElement, setAnchorElement] = useState<HTMLButtonElement | null>(null);\n const isOpen = anchorElement != null;\n const pickerRef = useRef<HTMLDivElement | null>(null);\n\n const isException = useCallback((target: HTMLElement) => {\n return target.closest('.tcn-suggestion-list') != null;\n }, []);\n\n const formatter = useMemo(() => {\n const formatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n };\n\n if (showTime) {\n formatOptions.hour = 'numeric';\n formatOptions.minute = '2-digit';\n formatOptions.hour12 = true;\n }\n\n return new Intl.DateTimeFormat(countryCode, formatOptions);\n }, [countryCode, showTime]);\n\n const formattedDate = value != null ? formatter.format(value) : selectDateMessage;\n\n function openPicker(e: React.MouseEvent<HTMLButtonElement>) {\n setAnchorElement(e.currentTarget);\n }\n\n function closePicker() {\n setAnchorElement(null);\n }\n\n useLayoutEffect(() => {\n requestAnimationFrame(() => {\n if (anchorElement != null) {\n pickerRef.current && pickerRef.current.focus();\n }\n });\n }, [anchorElement]);\n\n function processKeyInput(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closePicker();\n }\n }\n\n function handleRedirect() {\n const picker = pickerRef.current;\n\n if (picker != null) {\n picker.focus();\n }\n }\n\n function dateSelected(date: Date | null) {\n onChange?.(date);\n !showTime && closePicker();\n }\n\n function timeSelected(hour: number, minutes: number, seconds: number) {\n onTimeSelected?.(hour, minutes, seconds);\n closePicker();\n }\n\n return (\n <>\n <Button\n ref={ref}\n className={clsx(styles.button, 'tcn-entry', 'tcn-date-picker-input')}\n hAlign=\"start\"\n disabled={disabled}\n hierarchy={hierarchy}\n onClick={openPicker}\n width={width}\n maxWidth={maxWidth}\n {...props}\n >\n <span className=\"ellipsis\">{formattedDate}</span>\n </Button>\n <Popper\n anchorElement={anchorElement}\n disableClickAway\n veil\n onVeilClick={closePicker}\n onClose={closePicker}\n verticalAnchor=\"bottom\"\n horizontalAnchor=\"start\"\n verticalOrigin=\"top\"\n horizontalOrigin=\"start\"\n open={isOpen}\n isClickAwayException={isException}\n isScrollAwayException={isException}\n restoreFocus\n >\n <ZStack\n padding=\"8px\"\n className={clsx(styles.popover, 'tcn-date-picker-popover')}\n onKeyDown={processKeyInput}\n >\n <DatePicker\n ref={pickerRef}\n value={value}\n onChange={dateSelected}\n min={min}\n max={max}\n showTime={showTime}\n onError={onError}\n disabled={disabled}\n disabledDates={disabledDates}\n countryCode={countryCode}\n renderActions={renderActions}\n onTimeSelected={timeSelected}\n timeIntervalInMinutes={timeIntervalInMinutes}\n />\n <FocusRedirect onRedirect={handleRedirect} />\n </ZStack>\n </Popper>\n </>\n );\n }\n);\n"],"names":["DatePickerInput","React","value","onChange","onError","min","max","disabled","width","maxWidth","minWidth","showTime","timeIntervalInMinutes","hierarchy","disabledDates","selectDateMessage","countryCode","renderActions","onTimeSelected","props","ref","anchorElement","setAnchorElement","useState","isOpen","pickerRef","useRef","isException","useCallback","target","formatter","useMemo","formatOptions","formattedDate","openPicker","e","closePicker","useLayoutEffect","processKeyInput","event","handleRedirect","picker","dateSelected","date","timeSelected","hour","minutes","seconds","jsxs","Fragment","jsx","Button","clsx","styles","Popper","ZStack","DatePicker","FocusRedirect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date_picker_input.js","sources":["../../../src/inputs/date_picker/date_picker_input.tsx"],"sourcesContent":["import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Hierarchy } from '../../utils/index.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { Popper } from '../../overlay/popper/legacy/popper.js';\nimport { clsx } from 'clsx';\nimport { HTMLAttributes } from 'react';\nimport { Button } from '../../actions/index.js';\nimport { DatePicker } from './date_picker.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { FocusRedirect } from '../../utils/index.js';\nimport styles from './date_picker_input.module.css';\n\nexport interface DatePickerInputProps\n extends Omit<HTMLAttributes<HTMLButtonElement>, 'onChange' | 'onError'> {\n value?: Date | null;\n disabled?: boolean;\n onChange?: (date: Date | null) => void;\n onError?: (error: string | null) => void;\n width?: string;\n maxWidth?: string;\n minWidth?: string;\n showTime?: boolean;\n timeIntervalInMinutes?: number;\n disabledDates?: Date[] | undefined;\n countryCode?: string;\n renderActions?: (datePickerPresenter: DatePickerPresenter) => React.ReactNode;\n min?: Date;\n max?: Date;\n hierarchy?: Hierarchy;\n selectDateMessage?: string;\n onTimeSelected?: (hour: number, minutes: number, seconds: number) => void;\n}\n\nexport const DatePickerInput = React.forwardRef<HTMLButtonElement, DatePickerInputProps>(\n (\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 countryCode,\n renderActions,\n onTimeSelected,\n ...props\n }: DatePickerInputProps,\n ref: React.Ref<HTMLButtonElement>\n ) => {\n const [anchorElement, setAnchorElement] = useState<HTMLButtonElement | null>(null);\n const isOpen = anchorElement != null;\n const pickerRef = useRef<HTMLDivElement | null>(null);\n\n const isException = useCallback((target: HTMLElement) => {\n return target.closest('.tcn-suggestion-list') != null;\n }, []);\n\n const formatter = useMemo(() => {\n const formatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n };\n\n if (showTime) {\n formatOptions.hour = 'numeric';\n formatOptions.minute = '2-digit';\n formatOptions.hour12 = true;\n }\n\n return new Intl.DateTimeFormat(countryCode, formatOptions);\n }, [countryCode, showTime]);\n\n const formattedDate = value != null ? formatter.format(value) : selectDateMessage;\n\n function openPicker(e: React.MouseEvent<HTMLButtonElement>) {\n setAnchorElement(e.currentTarget);\n }\n\n function closePicker() {\n setAnchorElement(null);\n }\n\n useLayoutEffect(() => {\n requestAnimationFrame(() => {\n if (anchorElement != null) {\n pickerRef.current && pickerRef.current.focus();\n }\n });\n }, [anchorElement]);\n\n function processKeyInput(event: React.KeyboardEvent) {\n if (event.key === 'Escape') {\n closePicker();\n }\n }\n\n function handleRedirect() {\n const picker = pickerRef.current;\n\n if (picker != null) {\n picker.focus();\n }\n }\n\n function dateSelected(date: Date | null) {\n onChange?.(date);\n !showTime && closePicker();\n }\n\n function timeSelected(hour: number, minutes: number, seconds: number) {\n onTimeSelected?.(hour, minutes, seconds);\n closePicker();\n }\n\n return (\n <>\n <Button\n ref={ref}\n className={clsx(styles.button, 'tcn-entry', 'tcn-date-picker-input')}\n hAlign=\"start\"\n disabled={disabled}\n hierarchy={hierarchy}\n onClick={openPicker}\n width={width}\n maxWidth={maxWidth}\n {...props}\n >\n <span className=\"ellipsis\">{formattedDate}</span>\n </Button>\n <Popper\n anchorElement={anchorElement}\n disableClickAway\n veil\n onVeilClick={closePicker}\n onClose={closePicker}\n verticalAnchor=\"bottom\"\n horizontalAnchor=\"start\"\n verticalOrigin=\"top\"\n horizontalOrigin=\"start\"\n open={isOpen}\n isClickAwayException={isException}\n isScrollAwayException={isException}\n restoreFocus\n >\n <ZStack\n padding=\"8px\"\n className={clsx(styles.popover, 'tcn-date-picker-popover')}\n onKeyDown={processKeyInput}\n >\n <DatePicker\n ref={pickerRef}\n value={value}\n onChange={dateSelected}\n min={min}\n max={max}\n showTime={showTime}\n onError={onError}\n disabled={disabled}\n disabledDates={disabledDates}\n countryCode={countryCode}\n renderActions={renderActions}\n onTimeSelected={timeSelected}\n timeIntervalInMinutes={timeIntervalInMinutes}\n />\n <FocusRedirect onRedirect={handleRedirect} />\n </ZStack>\n </Popper>\n </>\n );\n }\n);\n"],"names":["DatePickerInput","React","value","onChange","onError","min","max","disabled","width","maxWidth","minWidth","showTime","timeIntervalInMinutes","hierarchy","disabledDates","selectDateMessage","countryCode","renderActions","onTimeSelected","props","ref","anchorElement","setAnchorElement","useState","isOpen","pickerRef","useRef","isException","useCallback","target","formatter","useMemo","formatOptions","formattedDate","openPicker","e","closePicker","useLayoutEffect","processKeyInput","event","handleRedirect","picker","dateSelected","date","timeSelected","hour","minutes","seconds","jsxs","Fragment","jsx","Button","clsx","styles","Popper","ZStack","DatePicker","FocusRedirect"],"mappings":";;;;;;;;;;;;;;;;;;;;oFAiCaA,KAAkBC,EAAM;AAAA,EACnC,CACE;AAAA,IACE,OAAAC,wBAAY,KAAA;AAAA,IACZ,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC,IAAM,oBAAI,KAAK,YAAY;AAAA,IAC3B,KAAAC,IAAM,oBAAI,KAAK,YAAY;AAAA,IAC3B,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,uBAAAC,IAAwB;AAAA,IACxB,WAAAC,IAAY;AAAA,IACZ,eAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,aAAAC;AAAA,I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,EAAc,YAAYjB,EAAA,CAAgB;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAC7C;AAAA,MAAA;AAAA,IACF,GACF;AAAA,EAEJ;AACF;"}
|
|
@@ -4,7 +4,6 @@ import { ZStack as C } from "../../stacks/z_stack.js";
|
|
|
4
4
|
import { clsx as n } from "clsx";
|
|
5
5
|
import "../../actions/button/base_button/base_button.js";
|
|
6
6
|
import "../../actions/button/button_group/button_group.js";
|
|
7
|
-
import "../../actions/button/slim_button/slim_button.js";
|
|
8
7
|
import { Button as O } from "../../actions/button/button/button.js";
|
|
9
8
|
import "../../actions/toggle/toggle.js";
|
|
10
9
|
import { BodyText as $ } from "../../typography/body_text/body_text.js";
|
|
@@ -16,7 +15,7 @@ import "../../typography/subheadline/subheadline.js";
|
|
|
16
15
|
import "../../typography/title/title.js";
|
|
17
16
|
import { ClockIcon as j } from "@tcn/icons/clock_icon.js";
|
|
18
17
|
import '../../date_picker_time_selector.css';const z = "_time-box_f3145be", P = "_time-box-title_6cc801b", Z = "_time-box-title-container_22add52", v = "_selected-time_33e3aa3", s = { "time-box": z, "time-box-title": P, "time-box-title-container": Z, "selected-time": v };
|
|
19
|
-
function
|
|
18
|
+
function et({
|
|
20
19
|
origin: e,
|
|
21
20
|
intervalInMinutes: f,
|
|
22
21
|
max: b,
|
|
@@ -84,6 +83,6 @@ function ot({
|
|
|
84
83
|
);
|
|
85
84
|
}
|
|
86
85
|
export {
|
|
87
|
-
|
|
86
|
+
et as DatePickerTimeSelector
|
|
88
87
|
};
|
|
89
88
|
//# sourceMappingURL=date_picker_time_selector.js.map
|