@tcn/ui 0.17.0 → 0.18.1
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/AI_USAGE.md +59 -0
- package/CHANGELOG.md +1009 -0
- package/ai-docs/actions.md +43 -0
- package/ai-docs/decorators.md +34 -0
- package/ai-docs/feedback.md +31 -0
- package/ai-docs/form.md +58 -0
- package/ai-docs/inputs.md +71 -0
- package/ai-docs/layouts.md +76 -0
- package/ai-docs/mobile.md +34 -0
- package/ai-docs/navigation.md +48 -0
- package/ai-docs/overlay.md +58 -0
- package/ai-docs/stacks.md +59 -0
- package/ai-docs/surfaces.md +79 -0
- package/ai-docs/themes.md +47 -0
- package/ai-docs/tokens.md +35 -0
- package/ai-docs/typography.md +38 -0
- package/ai-docs/utils.md +51 -0
- 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/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 +11 -10
- 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 -10
- package/dist/inputs/color_input/color_picker.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +11 -10
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/date_picker/date_picker.js +11 -10
- 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 +9 -9
- 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 +22 -22
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/mask_input/key_capture_input.js +21 -20
- package/dist/inputs/mask_input/key_capture_input.js.map +1 -1
- package/dist/inputs/mask_input/mask_input.js +18 -17
- package/dist/inputs/mask_input/mask_input.js.map +1 -1
- package/dist/inputs/multiselect/multiselect.js +11 -10
- 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 -12
- 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 +9 -9
- package/dist/inputs/slider/slider.js +21 -20
- package/dist/inputs/slider/slider.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +9 -9
- package/dist/inputs/switch/switch.js +16 -15
- package/dist/inputs/switch/switch.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +11 -10
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/mobile/inputs/date_picker/mobile_date_picker_header.js +11 -10
- 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 -10
- 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 +11 -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 +11 -10
- 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 -20
- 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 +11 -10
- package/dist/overlay/popper/context_popper.js.map +1 -1
- package/dist/overlay/popper/element_popper.js +11 -10
- package/dist/overlay/popper/element_popper.js.map +1 -1
- package/dist/overlay/popper/legacy/popper.js +28 -27
- package/dist/overlay/popper/legacy/popper.js.map +1 -1
- package/dist/overlay/popper/preview_popper.js +11 -10
- package/dist/overlay/popper/preview_popper.js.map +1 -1
- package/dist/overlay/tethered/tethered.js +11 -10
- package/dist/overlay/tethered/tethered.js.map +1 -1
- package/dist/resizable.css +1 -1
- package/dist/resizable.module-ur5FBfxo.js +5 -0
- package/dist/resizable.module-ur5FBfxo.js.map +1 -0
- package/dist/resize_handle.css +1 -1
- 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 +98 -99
- package/dist/stacks/box/box.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 +14 -13
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +14 -13
- 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/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/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 +336 -294
- 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/{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.map +1 -0
- package/dist/utils/{resize → decorators/resizable}/context.js +1 -1
- package/dist/utils/decorators/resizable/context.js.map +1 -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.map +1 -0
- package/dist/utils/decorators/resizable/index.js.map +1 -0
- package/dist/utils/decorators/resizable/resizable.d.ts.map +1 -0
- package/dist/utils/{resize → decorators/resizable}/resizable.js +2 -2
- package/dist/utils/decorators/resizable/resizable.js.map +1 -0
- package/dist/utils/decorators/resizable/resize_handle.d.ts.map +1 -0
- package/dist/utils/{resize → decorators/resizable}/resize_handle.js +2 -2
- package/dist/utils/decorators/resizable/resize_handle.js.map +1 -0
- package/dist/utils/{resize → decorators/resizable}/resize_strategy.d.ts +1 -1
- package/dist/utils/decorators/resizable/resize_strategy.d.ts.map +1 -0
- package/dist/utils/decorators/resizable/resize_strategy.js.map +1 -0
- package/dist/utils/{resize → decorators/resizable}/types.d.ts +2 -2
- package/dist/utils/decorators/resizable/types.d.ts.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 -8
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +44 -40
- 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 +7 -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/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/popper/legacy/popper.stories.tsx +9 -2
- package/src/overlay/slide/slide.stories.tsx +1 -1
- package/src/stacks/box/box.tsx +29 -4
- 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/page/page.stories.tsx +4 -4
- package/src/surfaces/window/window.stories.tsx +1 -1
- 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/themes/ergo/INTERACTIVE.md +89 -0
- package/src/themes/themes/ergo/ROADMAP.md +116 -0
- package/src/themes/themes/ergo/ergo_theme.css +22 -717
- 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/{resize → decorators/resizable}/__stories__/resizable.stories.tsx +23 -23
- package/src/utils/{resize → decorators/resizable}/__tests__/handle_config.test.ts +19 -97
- package/src/utils/{resize → decorators/resizable}/__tests__/resize_strategy.test.ts +20 -20
- package/src/utils/{resize → decorators/resizable}/context.ts +1 -1
- package/src/utils/{resize → decorators/resizable}/handle_config.ts +7 -31
- package/src/utils/{resize → decorators/resizable}/resizable.tsx +1 -1
- package/src/utils/{resize → decorators/resizable}/resize_handle.module.css +1 -41
- package/src/utils/{resize → decorators/resizable}/resize_handle.tsx +1 -1
- package/src/utils/{resize → decorators/resizable}/resize_strategy.ts +1 -1
- package/src/utils/{resize → decorators/resizable}/types.ts +1 -7
- package/src/utils/hooks/labelled_by_context.ts +27 -0
- package/src/utils/index.ts +8 -8
- 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/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/resizable.module-I6iyBAvM.js +0 -5
- package/dist/resizable.module-I6iyBAvM.js.map +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/resize/context.d.ts.map +0 -1
- package/dist/utils/resize/context.js.map +0 -1
- package/dist/utils/resize/handle_config.d.ts.map +0 -1
- package/dist/utils/resize/handle_config.js +0 -85
- package/dist/utils/resize/handle_config.js.map +0 -1
- package/dist/utils/resize/index.d.ts.map +0 -1
- package/dist/utils/resize/resizable.d.ts.map +0 -1
- package/dist/utils/resize/resizable.js.map +0 -1
- package/dist/utils/resize/resize_handle.d.ts.map +0 -1
- package/dist/utils/resize/resize_handle.js.map +0 -1
- package/dist/utils/resize/resize_strategy.d.ts.map +0 -1
- package/dist/utils/resize/resize_strategy.js.map +0 -1
- package/dist/utils/resize/types.d.ts.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/{resize → decorators/draggable}/index.js.map +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/{resize → decorators/resizable}/context.d.ts +0 -0
- /package/dist/utils/{resize → decorators/resizable}/handle_config.d.ts +0 -0
- /package/dist/utils/{resize → decorators/resizable}/index.d.ts +0 -0
- /package/dist/utils/{resize → decorators/resizable}/index.js +0 -0
- /package/dist/utils/{resize → decorators/resizable}/resizable.d.ts +0 -0
- /package/dist/utils/{resize → decorators/resizable}/resize_handle.d.ts +0 -0
- /package/dist/utils/{resize → decorators/resizable}/resize_strategy.js +0 -0
- /package/dist/utils/{resize → decorators/resizable}/types.js +0 -0
- /package/dist/utils/{resize → decorators/resizable}/types.js.map +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/{resize → decorators/resizable}/__stories__/resizable_stories.module.css +0 -0
- /package/src/utils/{resize → decorators/resizable}/index.ts +0 -0
- /package/src/utils/{resize → decorators/resizable}/resizable.module.css +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,19 +1,20 @@
|
|
|
1
1
|
import { jsx as o } 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 s, { useRef as a, useLayoutEffect as k } from "react";
|
|
6
6
|
import { useForkRef as l } 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 e } from "clsx";
|
|
10
|
-
import "../../draggable.module-
|
|
11
|
-
import "../../utils/
|
|
12
|
-
import "../../resizable.module-
|
|
13
|
-
import "../../utils/
|
|
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";
|
|
14
15
|
import { ZStack as u } from "../../stacks/z_stack.js";
|
|
15
16
|
import { ChromePicker as h } from "react-color";
|
|
16
|
-
import '../../color_picker.css';const d = "_color-picker_4757d5a", R = "_chrome-picker_2f64060", c = { "color-picker": d, "chrome-picker": R },
|
|
17
|
+
import '../../color_picker.css';const d = "_color-picker_4757d5a", R = "_chrome-picker_2f64060", c = { "color-picker": d, "chrome-picker": R }, v = s.forwardRef(function({ color: t, onColorChange: i, className: m, ...p }, f) {
|
|
17
18
|
const r = a(null), n = l(r, f);
|
|
18
19
|
return k(() => {
|
|
19
20
|
r.current && r.current.focus();
|
|
@@ -39,6 +40,6 @@ import '../../color_picker.css';const d = "_color-picker_4757d5a", R = "_chrome-
|
|
|
39
40
|
);
|
|
40
41
|
});
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
v as ColorPicker
|
|
43
44
|
};
|
|
44
45
|
//# sourceMappingURL=color_picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color_picker.js","sources":["../../../src/inputs/color_input/color_picker.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { clsx } from 'clsx';\nimport React, { HTMLAttributes, useLayoutEffect, useRef } from 'react';\nimport { ChromePicker, Color, type ColorResult } from 'react-color';\nimport styles from './color_picker.module.css';\n\nexport interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n color: Color;\n onColorChange: (color: ColorResult) => void;\n}\n\nexport const ColorPicker = React.forwardRef(function ColorPicker(\n { color, onColorChange, className, ...props }: ColorPickerProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const padRef = useRef<HTMLDivElement | null>(null);\n const forkedRef = useForkRef(padRef, ref);\n\n useLayoutEffect(() => {\n padRef.current && padRef.current.focus();\n }, []);\n\n return (\n <ZStack\n tabIndex={0}\n ref={forkedRef}\n padding=\"8px\"\n height=\"auto\"\n width=\"auto\"\n className={clsx(styles['color-picker'], 'tcn-color-picker', className)}\n {...props}\n >\n <ChromePicker\n className={clsx(styles['chrome-picker'], 'tcn-chrome-picker')}\n color={color}\n onChange={onColorChange}\n />\n </ZStack>\n );\n});\n"],"names":["ColorPicker","React","color","onColorChange","className","props","ref","padRef","useRef","forkedRef","useForkRef","useLayoutEffect","jsx","ZStack","clsx","styles","ChromePicker"],"mappings":"
|
|
1
|
+
{"version":3,"file":"color_picker.js","sources":["../../../src/inputs/color_input/color_picker.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { clsx } from 'clsx';\nimport React, { HTMLAttributes, useLayoutEffect, useRef } from 'react';\nimport { ChromePicker, Color, type ColorResult } from 'react-color';\nimport styles from './color_picker.module.css';\n\nexport interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n color: Color;\n onColorChange: (color: ColorResult) => void;\n}\n\nexport const ColorPicker = React.forwardRef(function ColorPicker(\n { color, onColorChange, className, ...props }: ColorPickerProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const padRef = useRef<HTMLDivElement | null>(null);\n const forkedRef = useForkRef(padRef, ref);\n\n useLayoutEffect(() => {\n padRef.current && padRef.current.focus();\n }, []);\n\n return (\n <ZStack\n tabIndex={0}\n ref={forkedRef}\n padding=\"8px\"\n height=\"auto\"\n width=\"auto\"\n className={clsx(styles['color-picker'], 'tcn-color-picker', className)}\n {...props}\n >\n <ChromePicker\n className={clsx(styles['chrome-picker'], 'tcn-chrome-picker')}\n color={color}\n onChange={onColorChange}\n />\n </ZStack>\n );\n});\n"],"names":["ColorPicker","React","color","onColorChange","className","props","ref","padRef","useRef","forkedRef","useForkRef","useLayoutEffect","jsx","ZStack","clsx","styles","ChromePicker"],"mappings":";;;;;;;;;;;;;;;;gHAYaA,IAAcC,EAAM,WAAW,SAC1C,EAAE,OAAAC,GAAO,eAAAC,GAAe,WAAAC,GAAW,GAAGC,EAAA,GACtCC,GACA;AACA,QAAMC,IAASC,EAA8B,IAAI,GAC3CC,IAAYC,EAAWH,GAAQD,CAAG;AAExC,SAAAK,EAAgB,MAAM;AACpB,IAAAJ,EAAO,WAAWA,EAAO,QAAQ,MAAA;AAAA,EACnC,GAAG,CAAA,CAAE,GAGH,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,UAAU;AAAA,MACV,KAAKJ;AAAA,MACL,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,OAAM;AAAA,MACN,WAAWK,EAAKC,EAAO,cAAc,GAAG,oBAAoBX,CAAS;AAAA,MACpE,GAAGC;AAAA,MAEJ,UAAA,gBAAAO;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,WAAWF,EAAKC,EAAO,eAAe,GAAG,mBAAmB;AAAA,UAC5D,OAAAb;AAAA,UACA,UAAUC;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1,19 +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 "../../utils/
|
|
12
|
-
import "../../resizable.module-
|
|
13
|
-
import "../../utils/
|
|
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";
|
|
14
15
|
import { SuggestionList as H } from "../suggestions/suggestion_list.js";
|
|
15
16
|
import { Input as J } from "../input/input.js";
|
|
16
|
-
const
|
|
17
|
+
const ie = N.forwardRef(function({
|
|
17
18
|
onOptionSelect: m,
|
|
18
19
|
children: O = [],
|
|
19
20
|
onKeyDown: r,
|
|
@@ -94,6 +95,6 @@ const ce = N.forwardRef(function({
|
|
|
94
95
|
] });
|
|
95
96
|
});
|
|
96
97
|
export {
|
|
97
|
-
|
|
98
|
+
ie as ComboBox
|
|
98
99
|
};
|
|
99
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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,KAAWA,EAAQ+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,16 +1,17 @@
|
|
|
1
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 "../../utils/
|
|
12
|
-
import "../../resizable.module-
|
|
13
|
-
import "../../utils/
|
|
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";
|
|
14
15
|
import { HStack as U } from "../../stacks/h_stack.js";
|
|
15
16
|
import { Spacer as V } from "../../stacks/spacer.js";
|
|
16
17
|
import { VStack as u } from "../../stacks/v_stack.js";
|
|
@@ -18,7 +19,7 @@ import { DatePickerBody as $ } from "./date_picker_body.js";
|
|
|
18
19
|
import { DatePickerHeader as q } from "./date_picker_header.js";
|
|
19
20
|
import { DatePickerPresenter as E } from "./date_picker_presenter.js";
|
|
20
21
|
import { DatePickerTimeSelector as G } from "./date_picker_time_selector.js";
|
|
21
|
-
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({
|
|
22
23
|
value: i,
|
|
23
24
|
disabled: h,
|
|
24
25
|
onChange: k,
|
|
@@ -114,6 +115,6 @@ import '../../date_picker.css';const J = "_date-picker_0a0d8e4", K = "_date-pick
|
|
|
114
115
|
);
|
|
115
116
|
});
|
|
116
117
|
export {
|
|
117
|
-
|
|
118
|
+
he as DatePicker
|
|
118
119
|
};
|
|
119
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,aAAAC,IAAc;AAAA,EACd,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,uBAAAC;AACF,GACAC,GACA;AACA,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,CAAC,GAChDC,IAAeC,EAAO,EAAK,GAC3BC,IAAcC,EAAkB,CAACC,GAAGC,MAAW;AACnD,IAAAP,EAAkBO,CAAM;AAAA,EAC1B,CAAC,GACK,CAACC,CAAS,IAAIP,EAAS,MAAM;AACjC,UAAMQ,wBAAY,KAAA,GAEZC,IAAO1B,KAAS,OAAOyB,EAAM,YAAA,IAAgBzB,EAAM,YAAA,GACnD2B,IAAQ3B,KAAS,OAAOyB,EAAM,SAAA,IAAazB,EAAM,SAAA;AAE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A,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,CAACG,GAAGC,MAEvB,gBAAAC,EAACC,GAAA,EAAmB,OAAO,OAAOF,CAAK,GAAG,OAAOD,GAAG,UAAU,CAACA,CAAC,GAC7D,UAAAD,EAAWE,CAAK,KADNA,CAEb,CAEH;AACH;AAOO,SAASG,EAAiB,EAAE,WAAAC,GAAW,aAAAT,KAAsC;AAClF,QAAMU,IAAQC,EAAeF,EAAU,cAAc,GAC/CG,IAAeC,EAAyB,IAAI;AAElD,WAASC,EAAYC,GAAe;AAClC,IAAAN,EAAU,gBAAgB,OAAOM,CAAK,CAAC;AAAA,EACzC;AAEA,WAASC,IAAW;AAClB,WAAOP,EAAU,gBAAgBA,EAAU,eAAe,IAAA,EAAM,eAAe,CAAC;AAA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A,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;"}
|
|
@@ -5,19 +5,19 @@ import { Popper as H } from "../../overlay/popper/legacy/popper.js";
|
|
|
5
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 "../../
|
|
19
|
-
import "../../resizable.
|
|
20
|
-
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
21
|
import '../../date_picker_input.css';const U = "_button_f404820", X = "_popover_708f951", f = { button: U, popover: X }, Dt = B.forwardRef(
|
|
22
22
|
({
|
|
23
23
|
value: c = /* @__PURE__ */ new Date(),
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date_picker_time_selector.js","sources":["../../../src/inputs/date_picker/date_picker_time_selector.tsx"],"sourcesContent":["import { VStack } from '../../stacks/v_stack.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { clsx } from 'clsx';\nimport React from 'react';\nimport { Button } from '../../actions/index.js';\nimport styles from './date_picker_time_selector.module.css';\nimport { BodyText } from '../../typography/index.js';\nimport { ClockIcon } from '@tcn/icons/clock_icon.js';\n\nexport interface DatePickerTimeSelectorProps {\n origin: Date | null;\n intervalInMinutes: number;\n max: Date | null;\n min: Date | null;\n minVisibleTimeInMilliseconds: number;\n maxVisibleTimeInMilliseconds: number;\n onSelect: (hours: number, minutes: number, seconds: number) => void;\n disabled?: boolean;\n height?: string;\n}\n\nexport function DatePickerTimeSelector({\n origin,\n intervalInMinutes,\n max,\n min,\n minVisibleTimeInMilliseconds,\n maxVisibleTimeInMilliseconds,\n onSelect,\n disabled,\n height,\n}: DatePickerTimeSelectorProps) {\n const stepInMilliseconds = intervalInMinutes * 1000 * 60;\n const amountOfSteps = (24 * 1000 * 60 * 60) / stepInMilliseconds;\n const normalizedDate = new Date(origin || new Date());\n const options: React.ReactElement[] = [];\n const minTime = min?.getTime() ?? -Infinity;\n const maxTime = max?.getTime() ?? Infinity;\n\n normalizedDate.setHours(0, 0, 0, 0);\n let offset = normalizedDate.getTime();\n let offsetFromZero = 0;\n\n for (let x = 0; x < amountOfSteps; x++) {\n const date = new Date(offset);\n\n let hour = date.getHours() % 12;\n const minute = date.getMinutes();\n const meridiem = date.getHours() >= 12 ? 'PM' : 'AM';\n hour = hour === 0 ? 12 : hour;\n\n const isSelected =\n origin != null &&\n date.getHours() === origin.getHours() &&\n date.getMinutes() === origin.getMinutes() &&\n date.getSeconds() === origin.getSeconds();\n\n const time = date.getTime();\n const isOutOfRange = time < minTime || time > maxTime;\n\n const button = (\n <Button\n key={x}\n width=\"flex\"\n hierarchy=\"tertiary\"\n className={clsx('tcn-selected-time', isSelected && styles['selected-time'])}\n disabled={origin == null || disabled || isOutOfRange}\n onClick={() => {\n onSelect(date.getHours(), date.getMinutes(), date.getSeconds());\n }}\n >{`${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')} ${meridiem}`}</Button>\n );\n\n if (\n offsetFromZero >= minVisibleTimeInMilliseconds &&\n offsetFromZero <= maxVisibleTimeInMilliseconds\n ) {\n options.push(button);\n }\n\n offset += stepInMilliseconds;\n offsetFromZero += stepInMilliseconds;\n }\n\n return (\n <VStack\n width=\"auto\"\n height={height}\n data-is-disabled={disabled || origin == null}\n className={clsx(styles['time-box'], 'tcn-time-box')}\n >\n <ZStack\n className={clsx(\n styles['time-box-title-container'],\n 'tcn-time-box-title-container'\n )}\n >\n <BodyText className={clsx(styles['time-box-title'], 'tcn-time-box-title')}>\n <ClockIcon size=\"lg\" />\n </BodyText>\n </ZStack>\n <VStack\n width=\"auto\"\n height=\"flex\"\n overflowY=\"auto\"\n style={{ paddingInline: '4px' }}\n >\n {options}\n </VStack>\n </VStack>\n );\n}\n"],"names":["DatePickerTimeSelector","origin","intervalInMinutes","max","min","minVisibleTimeInMilliseconds","maxVisibleTimeInMilliseconds","onSelect","disabled","height","stepInMilliseconds","amountOfSteps","normalizedDate","options","minTime","maxTime","offset","offsetFromZero","x","date","hour","minute","meridiem","isSelected","time","isOutOfRange","button","jsx","Button","clsx","styles","jsxs","VStack","ZStack","BodyText","ClockIcon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date_picker_time_selector.js","sources":["../../../src/inputs/date_picker/date_picker_time_selector.tsx"],"sourcesContent":["import { VStack } from '../../stacks/v_stack.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { clsx } from 'clsx';\nimport React from 'react';\nimport { Button } from '../../actions/index.js';\nimport styles from './date_picker_time_selector.module.css';\nimport { BodyText } from '../../typography/index.js';\nimport { ClockIcon } from '@tcn/icons/clock_icon.js';\n\nexport interface DatePickerTimeSelectorProps {\n origin: Date | null;\n intervalInMinutes: number;\n max: Date | null;\n min: Date | null;\n minVisibleTimeInMilliseconds: number;\n maxVisibleTimeInMilliseconds: number;\n onSelect: (hours: number, minutes: number, seconds: number) => void;\n disabled?: boolean;\n height?: string;\n}\n\nexport function DatePickerTimeSelector({\n origin,\n intervalInMinutes,\n max,\n min,\n minVisibleTimeInMilliseconds,\n maxVisibleTimeInMilliseconds,\n onSelect,\n disabled,\n height,\n}: DatePickerTimeSelectorProps) {\n const stepInMilliseconds = intervalInMinutes * 1000 * 60;\n const amountOfSteps = (24 * 1000 * 60 * 60) / stepInMilliseconds;\n const normalizedDate = new Date(origin || new Date());\n const options: React.ReactElement[] = [];\n const minTime = min?.getTime() ?? -Infinity;\n const maxTime = max?.getTime() ?? Infinity;\n\n normalizedDate.setHours(0, 0, 0, 0);\n let offset = normalizedDate.getTime();\n let offsetFromZero = 0;\n\n for (let x = 0; x < amountOfSteps; x++) {\n const date = new Date(offset);\n\n let hour = date.getHours() % 12;\n const minute = date.getMinutes();\n const meridiem = date.getHours() >= 12 ? 'PM' : 'AM';\n hour = hour === 0 ? 12 : hour;\n\n const isSelected =\n origin != null &&\n date.getHours() === origin.getHours() &&\n date.getMinutes() === origin.getMinutes() &&\n date.getSeconds() === origin.getSeconds();\n\n const time = date.getTime();\n const isOutOfRange = time < minTime || time > maxTime;\n\n const button = (\n <Button\n key={x}\n width=\"flex\"\n hierarchy=\"tertiary\"\n className={clsx('tcn-selected-time', isSelected && styles['selected-time'])}\n disabled={origin == null || disabled || isOutOfRange}\n onClick={() => {\n onSelect(date.getHours(), date.getMinutes(), date.getSeconds());\n }}\n >{`${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')} ${meridiem}`}</Button>\n );\n\n if (\n offsetFromZero >= minVisibleTimeInMilliseconds &&\n offsetFromZero <= maxVisibleTimeInMilliseconds\n ) {\n options.push(button);\n }\n\n offset += stepInMilliseconds;\n offsetFromZero += stepInMilliseconds;\n }\n\n return (\n <VStack\n width=\"auto\"\n height={height}\n data-is-disabled={disabled || origin == null}\n className={clsx(styles['time-box'], 'tcn-time-box')}\n >\n <ZStack\n className={clsx(\n styles['time-box-title-container'],\n 'tcn-time-box-title-container'\n )}\n >\n <BodyText className={clsx(styles['time-box-title'], 'tcn-time-box-title')}>\n <ClockIcon size=\"lg\" />\n </BodyText>\n </ZStack>\n <VStack\n width=\"auto\"\n height=\"flex\"\n overflowY=\"auto\"\n style={{ paddingInline: '4px' }}\n >\n {options}\n </VStack>\n </VStack>\n );\n}\n"],"names":["DatePickerTimeSelector","origin","intervalInMinutes","max","min","minVisibleTimeInMilliseconds","maxVisibleTimeInMilliseconds","onSelect","disabled","height","stepInMilliseconds","amountOfSteps","normalizedDate","options","minTime","maxTime","offset","offsetFromZero","x","date","hour","minute","meridiem","isSelected","time","isOutOfRange","button","jsx","Button","clsx","styles","jsxs","VStack","ZStack","BodyText","ClockIcon"],"mappings":";;;;;;;;;;;;;;;;;AAqBO,SAASA,GAAuB;AAAA,EACrC,QAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF,GAAgC;AAC9B,QAAMC,IAAqBR,IAAoB,MAAO,IAChDS,IAAiB,KAAK,MAAO,KAAK,KAAMD,GACxCE,IAAiB,IAAI,KAAKX,KAAU,oBAAI,MAAM,GAC9CY,IAAgC,CAAA,GAChCC,IAAUV,GAAK,QAAA,KAAa,QAC5BW,IAAUZ,GAAK,QAAA,KAAa;AAElC,EAAAS,EAAe,SAAS,GAAG,GAAG,GAAG,CAAC;AAClC,MAAII,IAASJ,EAAe,QAAA,GACxBK,IAAiB;AAErB,WAASC,IAAI,GAAGA,IAAIP,GAAeO,KAAK;AACtC,UAAMC,IAAO,IAAI,KAAKH,CAAM;AAE5B,QAAII,IAAOD,EAAK,SAAA,IAAa;AAC7B,UAAME,IAASF,EAAK,WAAA,GACdG,IAAWH,EAAK,SAAA,KAAc,KAAK,OAAO;AAChD,IAAAC,IAAOA,MAAS,IAAI,KAAKA;AAEzB,UAAMG,IACJtB,KAAU,QACVkB,EAAK,SAAA,MAAelB,EAAO,SAAA,KAC3BkB,EAAK,WAAA,MAAiBlB,EAAO,WAAA,KAC7BkB,EAAK,WAAA,MAAiBlB,EAAO,WAAA,GAEzBuB,IAAOL,EAAK,QAAA,GACZM,IAAeD,IAAOV,KAAWU,IAAOT,GAExCW,IACJ,gBAAAC;AAAA,MAACC;AAA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|
import { jsxs as u, Fragment as f, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "../../actions/button/base_button/base_button.js";
|
|
3
3
|
import "../../actions/button/button_group/button_group.js";
|
|
4
|
-
import "../../actions/button/slim_button/slim_button.js";
|
|
5
4
|
import { Button as h } from "../../actions/button/button/button.js";
|
|
6
5
|
import "../../actions/toggle/toggle.js";
|
|
7
6
|
import { clsx as d } from "clsx";
|
|
@@ -10,7 +9,7 @@ import { Popper as y } from "../../overlay/popper/legacy/popper.js";
|
|
|
10
9
|
import { DatePickerYearSelector as g } from "./date_picker_year_selector.js";
|
|
11
10
|
import { useSignalValue as b } from "@tcn/state";
|
|
12
11
|
import '../../date_picker_year_input.css';const k = "_year-select_eb568a7", s = { "year-select": k };
|
|
13
|
-
function
|
|
12
|
+
function D({ presenter: t }) {
|
|
14
13
|
const { visibleYear: c } = b(t.stateBroadcast), [a, i] = n(null), [l, r] = n(!1);
|
|
15
14
|
function o() {
|
|
16
15
|
r(!1);
|
|
@@ -45,6 +44,6 @@ function F({ presenter: t }) {
|
|
|
45
44
|
] });
|
|
46
45
|
}
|
|
47
46
|
export {
|
|
48
|
-
|
|
47
|
+
D as DatePickerYearInput
|
|
49
48
|
};
|
|
50
49
|
//# sourceMappingURL=date_picker_year_input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date_picker_year_input.js","sources":["../../../src/inputs/date_picker/date_picker_year_input.tsx"],"sourcesContent":["import { Button } from '../../actions/index.js';\nimport { clsx } from 'clsx';\nimport styles from './date_picker_year_input.module.css';\nimport { useState } from 'react';\nimport { Popper } from '../../overlay/popper/legacy/popper.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { DatePickerYearSelector } from './date_picker_year_selector.js';\nimport { useSignalValue } from '@tcn/state';\n\nexport interface DatePickerYearInputProps {\n presenter: DatePickerPresenter;\n}\n\nexport function DatePickerYearInput({ presenter }: DatePickerYearInputProps) {\n const { visibleYear } = useSignalValue(presenter.stateBroadcast);\n const [buttonRef, setButtonRef] = useState<HTMLButtonElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n\n function close() {\n setIsOpen(false);\n }\n\n function open(event: React.MouseEvent<HTMLButtonElement>) {\n setButtonRef(event.currentTarget);\n setIsOpen(true);\n }\n\n return (\n <>\n <Button\n hierarchy=\"tertiary\"\n className={clsx('tcn-date-picker-year-select', styles['year-select'])}\n width=\"auto\"\n hAlign=\"start\"\n onClick={open}\n >\n <span className={styles.selectedLabel}>{visibleYear}</span>\n </Button>\n <Popper\n anchorElement={buttonRef}\n horizontalAnchor=\"center\"\n horizontalOrigin=\"center\"\n onClose={close}\n open={isOpen}\n restoreFocus\n >\n <DatePickerYearSelector presenter={presenter} onClose={close} />\n </Popper>\n </>\n );\n}\n"],"names":["DatePickerYearInput","presenter","visibleYear","useSignalValue","buttonRef","setButtonRef","useState","isOpen","setIsOpen","close","open","event","jsxs","Fragment","jsx","Button","clsx","styles","Popper","DatePickerYearSelector"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date_picker_year_input.js","sources":["../../../src/inputs/date_picker/date_picker_year_input.tsx"],"sourcesContent":["import { Button } from '../../actions/index.js';\nimport { clsx } from 'clsx';\nimport styles from './date_picker_year_input.module.css';\nimport { useState } from 'react';\nimport { Popper } from '../../overlay/popper/legacy/popper.js';\nimport { DatePickerPresenter } from './date_picker_presenter.js';\nimport { DatePickerYearSelector } from './date_picker_year_selector.js';\nimport { useSignalValue } from '@tcn/state';\n\nexport interface DatePickerYearInputProps {\n presenter: DatePickerPresenter;\n}\n\nexport function DatePickerYearInput({ presenter }: DatePickerYearInputProps) {\n const { visibleYear } = useSignalValue(presenter.stateBroadcast);\n const [buttonRef, setButtonRef] = useState<HTMLButtonElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n\n function close() {\n setIsOpen(false);\n }\n\n function open(event: React.MouseEvent<HTMLButtonElement>) {\n setButtonRef(event.currentTarget);\n setIsOpen(true);\n }\n\n return (\n <>\n <Button\n hierarchy=\"tertiary\"\n className={clsx('tcn-date-picker-year-select', styles['year-select'])}\n width=\"auto\"\n hAlign=\"start\"\n onClick={open}\n >\n <span className={styles.selectedLabel}>{visibleYear}</span>\n </Button>\n <Popper\n anchorElement={buttonRef}\n horizontalAnchor=\"center\"\n horizontalOrigin=\"center\"\n onClose={close}\n open={isOpen}\n restoreFocus\n >\n <DatePickerYearSelector presenter={presenter} onClose={close} />\n </Popper>\n </>\n );\n}\n"],"names":["DatePickerYearInput","presenter","visibleYear","useSignalValue","buttonRef","setButtonRef","useState","isOpen","setIsOpen","close","open","event","jsxs","Fragment","jsx","Button","clsx","styles","Popper","DatePickerYearSelector"],"mappings":";;;;;;;;;;;AAaO,SAASA,EAAoB,EAAE,WAAAC,KAAuC;AAC3E,QAAM,EAAE,aAAAC,EAAA,IAAgBC,EAAeF,EAAU,cAAc,GACzD,CAACG,GAAWC,CAAY,IAAIC,EAAmC,IAAI,GACnE,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK;AAE1C,WAASG,IAAQ;AACf,IAAAD,EAAU,EAAK;AAAA,EACjB;AAEA,WAASE,EAAKC,GAA4C;AACxD,IAAAN,EAAaM,EAAM,aAAa,GAChCH,EAAU,EAAI;AAAA,EAChB;AAEA,SACE,gBAAAI,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,WAAWC,EAAK,+BAA+BC,EAAO,aAAa,CAAC;AAAA,QACpE,OAAM;AAAA,QACN,QAAO;AAAA,QACP,SAASP;AAAA,QAET,UAAA,gBAAAI,EAAC,QAAA,EAAK,WAAWG,EAAO,eAAgB,UAAAf,EAAA,CAAY;AAAA,MAAA;AAAA,IAAA;AAAA,IAEtD,gBAAAY;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,eAAed;AAAA,QACf,kBAAiB;AAAA,QACjB,kBAAiB;AAAA,QACjB,SAASK;AAAA,QACT,MAAMF;AAAA,QACN,cAAY;AAAA,QAEZ,UAAA,gBAAAO,EAACK,GAAA,EAAuB,WAAAlB,GAAsB,SAASQ,EAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAChE,GACF;AAEJ;"}
|
|
@@ -5,11 +5,10 @@ import { ChevronRightIcon as O } from "@tcn/icons/chevron_right_icon.js";
|
|
|
5
5
|
import { useSignalValue as $ } from "@tcn/state";
|
|
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 y } from "../../actions/button/button/button.js";
|
|
10
9
|
import "../../actions/toggle/toggle.js";
|
|
11
10
|
import { HStack as t } from "../../stacks/h_stack.js";
|
|
12
|
-
import { Spacer as
|
|
11
|
+
import { Spacer as g } from "../../stacks/spacer.js";
|
|
13
12
|
import { VStack as E } from "../../stacks/v_stack.js";
|
|
14
13
|
import { BodyText as L } from "../../typography/body_text/body_text.js";
|
|
15
14
|
import "../../typography/callout/callout.js";
|
|
@@ -18,16 +17,17 @@ import "../../typography/footnote/footnote.js";
|
|
|
18
17
|
import { Headline as M } from "../../typography/headline/headline.js";
|
|
19
18
|
import "../../typography/subheadline/subheadline.js";
|
|
20
19
|
import "../../typography/title/title.js";
|
|
21
|
-
import "../../utils/click_away_listener.js";
|
|
22
|
-
import { FocusRedirect as T } from "../../utils/focus_redirect.js";
|
|
23
|
-
import "../../utils/scroll_away_listener.js";
|
|
20
|
+
import "../../utils/listeners/click_away_listener.js";
|
|
21
|
+
import { FocusRedirect as T } from "../../utils/listeners/focus_redirect.js";
|
|
22
|
+
import "../../utils/listeners/scroll_away_listener.js";
|
|
24
23
|
import "../../utils/hooks/use_resize_observer.js";
|
|
25
|
-
import "../../utils/
|
|
26
|
-
import
|
|
27
|
-
import "
|
|
28
|
-
import "../../
|
|
29
|
-
import "../../resizable.
|
|
30
|
-
import "../../
|
|
24
|
+
import "../../utils/hooks/labelled_by_context.js";
|
|
25
|
+
import "../../utils/decorators/draggable/context.js";
|
|
26
|
+
import { clsx as x } from "clsx";
|
|
27
|
+
import "../../draggable.module-DFYR5n3n.js";
|
|
28
|
+
import "../../utils/decorators/resizable/context.js";
|
|
29
|
+
import "../../resizable.module-ur5FBfxo.js";
|
|
30
|
+
import "../../utils/decorators/resizable/resize_handle.js";
|
|
31
31
|
import '../../date_picker_year_selector.css';const q = "_date-picker-year-selector_ab05e1f", A = "_date-picker-year-button_fded757", Y = { "date-picker-year-selector": q, "date-picker-year-button": A };
|
|
32
32
|
function Re({
|
|
33
33
|
presenter: s,
|
|
@@ -35,12 +35,12 @@ function Re({
|
|
|
35
35
|
}) {
|
|
36
36
|
const { min: p, max: m, visibleYear: o, visibleMonth: b } = $(
|
|
37
37
|
s.stateBroadcast
|
|
38
|
-
), [a, f] = z(0), c = D(null), R = p == null ? -1 / 0 : p.getFullYear(),
|
|
39
|
-
let
|
|
38
|
+
), [a, f] = z(0), c = D(null), R = p == null ? -1 / 0 : p.getFullYear(), F = m == null ? 1 / 0 : m.getFullYear(), r = [], u = o % 20;
|
|
39
|
+
let d = o - u + a, S = d + 19;
|
|
40
40
|
for (let n = 0; n < 20; n++) {
|
|
41
41
|
let l = !1;
|
|
42
42
|
const i = new Date(o, b, 1);
|
|
43
|
-
i.setFullYear(o -
|
|
43
|
+
i.setFullYear(o - u + n + a), (i.getFullYear() > F || i.getFullYear() < R) && (l = !0);
|
|
44
44
|
const j = t;
|
|
45
45
|
r.push(
|
|
46
46
|
/* @__PURE__ */ e(
|
|
@@ -49,7 +49,7 @@ function Re({
|
|
|
49
49
|
as: "button",
|
|
50
50
|
width: "flex",
|
|
51
51
|
disabled: l,
|
|
52
|
-
className:
|
|
52
|
+
className: x(Y["date-picker-year-button"], "tcn-date-picker-year-button"),
|
|
53
53
|
"data-is-disabled": String(l),
|
|
54
54
|
"data-is-selected": String(i.getFullYear() === o),
|
|
55
55
|
onClick: () => {
|
|
@@ -80,26 +80,26 @@ function Re({
|
|
|
80
80
|
ref: c,
|
|
81
81
|
tabIndex: 0,
|
|
82
82
|
padding: "8px",
|
|
83
|
-
className:
|
|
83
|
+
className: x(
|
|
84
84
|
Y["date-picker-year-selector"],
|
|
85
85
|
"tcn-date-picker-year-selector"
|
|
86
86
|
),
|
|
87
87
|
gap: "4px",
|
|
88
88
|
children: [
|
|
89
89
|
/* @__PURE__ */ h(t, { gap: "4px", children: [
|
|
90
|
-
/* @__PURE__ */ e(
|
|
91
|
-
/* @__PURE__ */ e(
|
|
90
|
+
/* @__PURE__ */ e(y, { utility: !0, onClick: P, hierarchy: "tertiary", children: /* @__PURE__ */ e(N, { flipOnRtl: !0, size: "md" }) }),
|
|
91
|
+
/* @__PURE__ */ e(g, {}),
|
|
92
92
|
/* @__PURE__ */ e(
|
|
93
93
|
M,
|
|
94
94
|
{
|
|
95
95
|
selectable: !1,
|
|
96
96
|
emphasis: "faint",
|
|
97
97
|
hierarchy: "tertiary",
|
|
98
|
-
children: `${
|
|
98
|
+
children: `${d}-${S}`
|
|
99
99
|
}
|
|
100
100
|
),
|
|
101
|
-
/* @__PURE__ */ e(
|
|
102
|
-
/* @__PURE__ */ e(
|
|
101
|
+
/* @__PURE__ */ e(g, {}),
|
|
102
|
+
/* @__PURE__ */ e(y, { utility: !0, hierarchy: "tertiary", onClick: V, children: /* @__PURE__ */ e(O, { size: "md" }) })
|
|
103
103
|
] }),
|
|
104
104
|
/* @__PURE__ */ e(t, { gap: "4px", children: v }),
|
|
105
105
|
/* @__PURE__ */ e(t, { gap: "4px", children: B }),
|