@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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
@layer tcn-system {
|
|
2
|
+
.resize-handle {
|
|
3
|
+
position: absolute;
|
|
4
|
+
z-index: 1;
|
|
5
|
+
pointer-events: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Horizontal edges: start, end */
|
|
9
|
+
:where(.resize-handle[data-position="start"]),
|
|
10
|
+
:where(.resize-handle[data-position="end"]) {
|
|
11
|
+
top: 0;
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 16px;
|
|
14
|
+
cursor: ew-resize;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:where(.resize-handle[data-position="start"]:dir(ltr)) {
|
|
18
|
+
left: var(--resize-offset, 0px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:where(.resize-handle[data-position="start"]:dir(rtl)) {
|
|
22
|
+
right: var(--resize-offset, 0px);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:where(.resize-handle[data-position="end"]:dir(ltr)) {
|
|
26
|
+
right: var(--resize-offset, 0px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:where(.resize-handle[data-position="end"]:dir(rtl)) {
|
|
30
|
+
left: var(--resize-offset, 0px);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Vertical edges: top, bottom */
|
|
34
|
+
:where(.resize-handle[data-position="top"]),
|
|
35
|
+
:where(.resize-handle[data-position="bottom"]) {
|
|
36
|
+
left: 0;
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 16px;
|
|
39
|
+
cursor: ns-resize;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:where(.resize-handle[data-position="top"]) {
|
|
43
|
+
top: var(--resize-offset, 0px);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:where(.resize-handle[data-position="bottom"]) {
|
|
47
|
+
bottom: var(--resize-offset, 0px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Corners: small square at intersection */
|
|
51
|
+
:where(.resize-handle[data-position="top-start"]),
|
|
52
|
+
:where(.resize-handle[data-position="top-end"]),
|
|
53
|
+
:where(.resize-handle[data-position="bottom-start"]),
|
|
54
|
+
:where(.resize-handle[data-position="bottom-end"]) {
|
|
55
|
+
width: 16px;
|
|
56
|
+
height: 16px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:where(.resize-handle[data-position="top-start"]:dir(ltr)) {
|
|
60
|
+
top: var(--resize-offset, 0px);
|
|
61
|
+
left: var(--resize-offset, 0px);
|
|
62
|
+
cursor: nwse-resize;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:where(.resize-handle[data-position="top-start"]:dir(rtl)) {
|
|
66
|
+
top: var(--resize-offset, 0px);
|
|
67
|
+
right: var(--resize-offset, 0px);
|
|
68
|
+
cursor: nesw-resize;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:where(.resize-handle[data-position="top-end"]:dir(ltr)) {
|
|
72
|
+
top: var(--resize-offset, 0px);
|
|
73
|
+
right: var(--resize-offset, 0px);
|
|
74
|
+
cursor: nesw-resize;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:where(.resize-handle[data-position="top-end"]:dir(rtl)) {
|
|
78
|
+
top: var(--resize-offset, 0px);
|
|
79
|
+
left: var(--resize-offset, 0px);
|
|
80
|
+
cursor: nwse-resize;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:where(.resize-handle[data-position="bottom-start"]:dir(ltr)) {
|
|
84
|
+
bottom: var(--resize-offset, 0px);
|
|
85
|
+
left: var(--resize-offset, 0px);
|
|
86
|
+
cursor: nesw-resize;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where(.resize-handle[data-position="bottom-start"]:dir(rtl)) {
|
|
90
|
+
bottom: var(--resize-offset, 0px);
|
|
91
|
+
right: var(--resize-offset, 0px);
|
|
92
|
+
cursor: nwse-resize;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:where(.resize-handle[data-position="bottom-end"]:dir(ltr)) {
|
|
96
|
+
bottom: var(--resize-offset, 0px);
|
|
97
|
+
right: var(--resize-offset, 0px);
|
|
98
|
+
cursor: nwse-resize;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:where(.resize-handle[data-position="bottom-end"]:dir(rtl)) {
|
|
102
|
+
bottom: var(--resize-offset, 0px);
|
|
103
|
+
left: var(--resize-offset, 0px);
|
|
104
|
+
cursor: nesw-resize;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { useResizable } from './context.js';
|
|
4
|
+
import { getHandleConfig } from './handle_config.js';
|
|
5
|
+
import { ResizeHandleStrategy } from './resize_strategy.js';
|
|
6
|
+
import { detectResizeBounds } from '../../../stacks/box/detect_resize_bounds.js';
|
|
7
|
+
import type { ResizeHandlePosition } from './types.js';
|
|
8
|
+
import styles from './resize_handle.module.css';
|
|
9
|
+
|
|
10
|
+
export interface ResizeHandleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
position: ResizeHandlePosition;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ResizeHandle = forwardRef<HTMLDivElement, ResizeHandleProps>(
|
|
15
|
+
function ResizeHandle({ position, className, ...rest }, ref) {
|
|
16
|
+
const {
|
|
17
|
+
targetRef,
|
|
18
|
+
onWidthResize,
|
|
19
|
+
onWidthResizeEnd,
|
|
20
|
+
onHeightResize,
|
|
21
|
+
onHeightResizeEnd,
|
|
22
|
+
} = useResizable();
|
|
23
|
+
|
|
24
|
+
const config = getHandleConfig(position);
|
|
25
|
+
const axis =
|
|
26
|
+
config.horizontal && config.vertical
|
|
27
|
+
? 'corner'
|
|
28
|
+
: config.horizontal
|
|
29
|
+
? 'horizontal'
|
|
30
|
+
: 'vertical';
|
|
31
|
+
|
|
32
|
+
const strategy = useMemo(() => new ResizeHandleStrategy(position), [position]);
|
|
33
|
+
|
|
34
|
+
const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
35
|
+
const target = targetRef.current;
|
|
36
|
+
if (target == null) return;
|
|
37
|
+
|
|
38
|
+
const rect = target.getBoundingClientRect();
|
|
39
|
+
strategy.startResize({
|
|
40
|
+
rectangle: {
|
|
41
|
+
dimensions: {
|
|
42
|
+
width: rect.width,
|
|
43
|
+
height: rect.height,
|
|
44
|
+
},
|
|
45
|
+
position: {
|
|
46
|
+
x: event.clientX,
|
|
47
|
+
y: event.clientY,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
languageDirection: window.getComputedStyle(target).direction,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
let frameId = 0;
|
|
54
|
+
|
|
55
|
+
const drag = (e: MouseEvent) => {
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
|
|
59
|
+
cancelAnimationFrame(frameId);
|
|
60
|
+
frameId = requestAnimationFrame(() => {
|
|
61
|
+
const result = strategy.resize({ x: e.clientX, y: e.clientY });
|
|
62
|
+
|
|
63
|
+
let appliedWidth = rect.width;
|
|
64
|
+
let appliedHeight = rect.height;
|
|
65
|
+
|
|
66
|
+
if (result.horizontal) {
|
|
67
|
+
const bounds = detectResizeBounds({
|
|
68
|
+
element: target,
|
|
69
|
+
axis: 'width',
|
|
70
|
+
nextSize: result.horizontal.newSize,
|
|
71
|
+
});
|
|
72
|
+
if (!bounds.clamped) {
|
|
73
|
+
appliedWidth = result.horizontal.newSize;
|
|
74
|
+
target.style.width = `${result.horizontal.newSize}px`;
|
|
75
|
+
onWidthResize?.({
|
|
76
|
+
width: result.horizontal.newSize,
|
|
77
|
+
origin: result.horizontal.origin,
|
|
78
|
+
totalDelta: result.horizontal.totalDelta,
|
|
79
|
+
currentDelta: result.horizontal.currentDelta,
|
|
80
|
+
});
|
|
81
|
+
} else if (
|
|
82
|
+
bounds.clampedSize !== null &&
|
|
83
|
+
bounds.clampedSize !== appliedWidth
|
|
84
|
+
) {
|
|
85
|
+
appliedWidth = bounds.clampedSize;
|
|
86
|
+
target.style.width = `${bounds.clampedSize}px`;
|
|
87
|
+
onWidthResize?.({
|
|
88
|
+
width: bounds.clampedSize,
|
|
89
|
+
origin: result.horizontal.origin,
|
|
90
|
+
totalDelta: result.horizontal.totalDelta,
|
|
91
|
+
currentDelta: result.horizontal.currentDelta,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (result.vertical) {
|
|
97
|
+
const bounds = detectResizeBounds({
|
|
98
|
+
element: target,
|
|
99
|
+
axis: 'height',
|
|
100
|
+
nextSize: result.vertical.newSize,
|
|
101
|
+
});
|
|
102
|
+
if (!bounds.clamped) {
|
|
103
|
+
appliedHeight = result.vertical.newSize;
|
|
104
|
+
target.style.height = `${result.vertical.newSize}px`;
|
|
105
|
+
onHeightResize?.({
|
|
106
|
+
height: result.vertical.newSize,
|
|
107
|
+
origin: result.vertical.origin,
|
|
108
|
+
totalDelta: result.vertical.totalDelta,
|
|
109
|
+
currentDelta: result.vertical.currentDelta,
|
|
110
|
+
});
|
|
111
|
+
} else if (
|
|
112
|
+
bounds.clampedSize !== null &&
|
|
113
|
+
bounds.clampedSize !== appliedHeight
|
|
114
|
+
) {
|
|
115
|
+
appliedHeight = bounds.clampedSize;
|
|
116
|
+
target.style.height = `${bounds.clampedSize}px`;
|
|
117
|
+
onHeightResize?.({
|
|
118
|
+
height: bounds.clampedSize,
|
|
119
|
+
origin: result.vertical.origin,
|
|
120
|
+
totalDelta: result.vertical.totalDelta,
|
|
121
|
+
currentDelta: result.vertical.currentDelta,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
strategy.commitResize({ width: appliedWidth, height: appliedHeight });
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const endDrag = () => {
|
|
131
|
+
cancelAnimationFrame(frameId);
|
|
132
|
+
document.body.removeEventListener('mousemove', drag);
|
|
133
|
+
document.body.removeEventListener('mouseup', endDrag);
|
|
134
|
+
window.removeEventListener('blur', endDrag);
|
|
135
|
+
|
|
136
|
+
const result = strategy.endResize();
|
|
137
|
+
if (result.horizontal) {
|
|
138
|
+
onWidthResizeEnd?.(result.horizontal.width, result.horizontal.origin);
|
|
139
|
+
}
|
|
140
|
+
if (result.vertical) {
|
|
141
|
+
onHeightResizeEnd?.(result.vertical.height, result.vertical.origin);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
document.body.addEventListener('mousemove', drag);
|
|
146
|
+
document.body.addEventListener('mouseup', endDrag);
|
|
147
|
+
window.addEventListener('blur', endDrag);
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<div
|
|
154
|
+
ref={ref}
|
|
155
|
+
className={clsx(styles['resize-handle'], 'tcn-resize-handle', className)}
|
|
156
|
+
data-position={position}
|
|
157
|
+
data-axis={axis}
|
|
158
|
+
onMouseDown={handleMouseDown}
|
|
159
|
+
{...rest}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
ResizeHandle.displayName = 'ResizeHandle';
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getHandleConfig,
|
|
3
|
+
resolveDirection,
|
|
4
|
+
computeResizeState,
|
|
5
|
+
} from './handle_config.js';
|
|
6
|
+
import type {
|
|
7
|
+
AxisConfig,
|
|
8
|
+
ResizeHandlePosition,
|
|
9
|
+
WidthResizeOrigin,
|
|
10
|
+
HeightResizeOrigin,
|
|
11
|
+
} from './types.js';
|
|
12
|
+
import type { Dimensions, Position, Rectangle } from '../../types/dimensions.js';
|
|
13
|
+
|
|
14
|
+
export interface StartResizeParams {
|
|
15
|
+
rectangle: Rectangle;
|
|
16
|
+
languageDirection: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface AxisResizeResult {
|
|
20
|
+
newSize: number;
|
|
21
|
+
totalDelta: number;
|
|
22
|
+
currentDelta: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface HorizontalResizeResult extends AxisResizeResult {
|
|
26
|
+
origin: WidthResizeOrigin;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface VerticalResizeResult extends AxisResizeResult {
|
|
30
|
+
origin: HeightResizeOrigin;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ResizeResult {
|
|
34
|
+
horizontal?: HorizontalResizeResult;
|
|
35
|
+
vertical?: VerticalResizeResult;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface EndResizeResult {
|
|
39
|
+
horizontal?: { width: number; origin: WidthResizeOrigin };
|
|
40
|
+
vertical?: { height: number; origin: HeightResizeOrigin };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Single-axis resize handler. Pure — no DOM, no React.
|
|
45
|
+
* Subclasses extract the correct axis from uniform args.
|
|
46
|
+
*/
|
|
47
|
+
abstract class AxisResizeHandler {
|
|
48
|
+
protected direction = 1;
|
|
49
|
+
protected startSize = 0;
|
|
50
|
+
protected startCoord = 0;
|
|
51
|
+
protected currentSize = 0;
|
|
52
|
+
|
|
53
|
+
constructor(protected axisConfig: AxisConfig) {}
|
|
54
|
+
|
|
55
|
+
get origin() {
|
|
56
|
+
return this.axisConfig.origin;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get size() {
|
|
60
|
+
return this.currentSize;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected abstract extractSize(dimensions: Dimensions): number;
|
|
64
|
+
protected abstract extractCoord(coord: Position): number;
|
|
65
|
+
abstract applyResize(coord: Position): Partial<ResizeResult>;
|
|
66
|
+
abstract applyEnd(): Partial<EndResizeResult>;
|
|
67
|
+
|
|
68
|
+
start(rect: Rectangle, languageDirection: string) {
|
|
69
|
+
this.direction = resolveDirection(
|
|
70
|
+
languageDirection,
|
|
71
|
+
this.axisConfig.invert,
|
|
72
|
+
this.axisConfig.disableDirection
|
|
73
|
+
);
|
|
74
|
+
this.startSize = this.extractSize(rect.dimensions);
|
|
75
|
+
this.startCoord = this.extractCoord(rect.position);
|
|
76
|
+
this.currentSize = this.startSize;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
resize(coord: Position): AxisResizeResult {
|
|
80
|
+
return computeResizeState(
|
|
81
|
+
this.startSize,
|
|
82
|
+
this.startCoord,
|
|
83
|
+
this.extractCoord(coord),
|
|
84
|
+
this.direction,
|
|
85
|
+
this.currentSize
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
commit(dimensions: Dimensions) {
|
|
90
|
+
this.currentSize = this.extractSize(dimensions);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
class HorizontalAxisResizeHandler extends AxisResizeHandler {
|
|
95
|
+
protected extractSize(dimensions: Dimensions) {
|
|
96
|
+
return dimensions.width;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
protected extractCoord(coord: Position) {
|
|
100
|
+
return coord.x;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
applyResize(coord: Position): Partial<ResizeResult> {
|
|
104
|
+
return {
|
|
105
|
+
horizontal: {
|
|
106
|
+
...this.resize(coord),
|
|
107
|
+
origin: this.origin as WidthResizeOrigin,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
applyEnd(): Partial<EndResizeResult> {
|
|
113
|
+
return {
|
|
114
|
+
horizontal: {
|
|
115
|
+
width: this.size,
|
|
116
|
+
origin: this.origin as WidthResizeOrigin,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
class VerticalAxisResizeHandler extends AxisResizeHandler {
|
|
123
|
+
protected extractSize(dimensions: Dimensions) {
|
|
124
|
+
return dimensions.height;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
protected extractCoord(coord: Position) {
|
|
128
|
+
return coord.y;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
applyResize(coord: Position): Partial<ResizeResult> {
|
|
132
|
+
return {
|
|
133
|
+
vertical: {
|
|
134
|
+
...this.resize(coord),
|
|
135
|
+
origin: this.origin as HeightResizeOrigin,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
applyEnd(): Partial<EndResizeResult> {
|
|
141
|
+
return {
|
|
142
|
+
vertical: {
|
|
143
|
+
height: this.size,
|
|
144
|
+
origin: this.origin as HeightResizeOrigin,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Flow:
|
|
152
|
+
* 1. adapter calls startResize() with rect/coords from DOM
|
|
153
|
+
* 2. adapter calls resize() on each mousemove with coord
|
|
154
|
+
* 3. adapter checks bounds (DOM), applies style, then calls commitResize()
|
|
155
|
+
* 4. adapter calls endResize() on mouseup to get final state
|
|
156
|
+
*/
|
|
157
|
+
export class ResizeHandleStrategy {
|
|
158
|
+
private handlers: AxisResizeHandler[];
|
|
159
|
+
|
|
160
|
+
constructor(position: ResizeHandlePosition) {
|
|
161
|
+
const config = getHandleConfig(position);
|
|
162
|
+
this.handlers = [];
|
|
163
|
+
if (config.horizontal) {
|
|
164
|
+
this.handlers.push(new HorizontalAxisResizeHandler(config.horizontal));
|
|
165
|
+
}
|
|
166
|
+
if (config.vertical) {
|
|
167
|
+
this.handlers.push(new VerticalAxisResizeHandler(config.vertical));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
startResize(params: StartResizeParams): void {
|
|
172
|
+
for (const handler of this.handlers) {
|
|
173
|
+
handler.start(params.rectangle, params.languageDirection);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
resize(position: Position): ResizeResult {
|
|
178
|
+
return Object.assign({}, ...this.handlers.map(h => h.applyResize(position)));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
commitResize(dimensions: Dimensions): void {
|
|
182
|
+
for (const handler of this.handlers) {
|
|
183
|
+
handler.commit(dimensions);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
endResize(): EndResizeResult {
|
|
188
|
+
return Object.assign({}, ...this.handlers.map(h => h.applyEnd()));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OnWidthResize,
|
|
3
|
+
OnWidthResizeEnd,
|
|
4
|
+
OnHeightResize,
|
|
5
|
+
OnHeightResizeEnd,
|
|
6
|
+
WidthResizeOrigin,
|
|
7
|
+
HeightResizeOrigin,
|
|
8
|
+
} from '../../../stacks/box/types.js';
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
OnWidthResize,
|
|
12
|
+
OnWidthResizeEnd,
|
|
13
|
+
OnHeightResize,
|
|
14
|
+
OnHeightResizeEnd,
|
|
15
|
+
WidthResizeOrigin,
|
|
16
|
+
HeightResizeOrigin,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ResizeHandlePosition =
|
|
20
|
+
// Edges (single axis)
|
|
21
|
+
| 'top'
|
|
22
|
+
| 'bottom'
|
|
23
|
+
| 'start'
|
|
24
|
+
| 'end'
|
|
25
|
+
// Corners (dual axis)
|
|
26
|
+
| 'top-start'
|
|
27
|
+
| 'top-end'
|
|
28
|
+
| 'bottom-start'
|
|
29
|
+
| 'bottom-end';
|
|
30
|
+
|
|
31
|
+
export interface AxisConfig {
|
|
32
|
+
origin: WidthResizeOrigin | HeightResizeOrigin;
|
|
33
|
+
invert: boolean;
|
|
34
|
+
disableDirection: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface HandleConfig {
|
|
38
|
+
horizontal?: AxisConfig;
|
|
39
|
+
vertical?: AxisConfig;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ResolvedAxisConfig {
|
|
43
|
+
origin: WidthResizeOrigin | HeightResizeOrigin;
|
|
44
|
+
direction: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ResolvedHandleConfig {
|
|
48
|
+
horizontal?: ResolvedAxisConfig;
|
|
49
|
+
vertical?: ResolvedAxisConfig;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ResizableContextValue {
|
|
53
|
+
targetRef: React.RefObject<HTMLElement | null>;
|
|
54
|
+
onWidthResize?: OnWidthResize;
|
|
55
|
+
onWidthResizeEnd?: OnWidthResizeEnd;
|
|
56
|
+
onHeightResize?: OnHeightResize;
|
|
57
|
+
onHeightResizeEnd?: OnHeightResizeEnd;
|
|
58
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createContext, useContext, useId } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface LabelledByContextValue {
|
|
4
|
+
labelId: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context for wiring aria-labelledby between a parent container and a child
|
|
9
|
+
* label element.
|
|
10
|
+
*/
|
|
11
|
+
export const LabelledByContext = createContext<LabelledByContextValue | null>(null);
|
|
12
|
+
|
|
13
|
+
export const useLabelledBy = () => useContext(LabelledByContext);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Derives a stable label ID for aria-labelledby wiring.
|
|
17
|
+
*
|
|
18
|
+
* - If `ariaLabelledBy` is provided, it takes precedence (full override).
|
|
19
|
+
* - If `id` is provided, the label ID is deterministic (`${id}-legend`).
|
|
20
|
+
* - Otherwise, falls back to React's `useId()`.
|
|
21
|
+
*/
|
|
22
|
+
export function useLabelledById(id?: string, ariaLabelledBy?: string) {
|
|
23
|
+
const reactId = useId();
|
|
24
|
+
const baseId = id ?? reactId;
|
|
25
|
+
const labelId = ariaLabelledBy || `${baseId}-legend`;
|
|
26
|
+
return { baseId, labelId };
|
|
27
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './focus_redirect.js';
|
|
3
|
-
export * from './scroll_away_listener.js';
|
|
1
|
+
export * from './listeners/index.js';
|
|
4
2
|
|
|
5
|
-
export * from './
|
|
3
|
+
export * from './decorators/draggable/use_draggable.js';
|
|
6
4
|
export * from './hooks/make_context_hook.js';
|
|
7
5
|
export * from './hooks/use_fork_ref.js';
|
|
8
6
|
export * from './hooks/use_resize_observer.js';
|
|
9
7
|
export * from './hooks/use_media_query.js';
|
|
8
|
+
export * from './hooks/labelled_by_context.js';
|
|
10
9
|
|
|
11
10
|
export * from './default_value.js';
|
|
12
11
|
|
|
@@ -17,7 +16,10 @@ export * from './calendar/get_months_of_year.js';
|
|
|
17
16
|
export * from './calendar/month.js';
|
|
18
17
|
|
|
19
18
|
export * from './types/dimensions.js';
|
|
20
|
-
export * from './types/
|
|
19
|
+
export * from './types/sides.js';
|
|
20
|
+
export * from './system/index.js';
|
|
21
21
|
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
22
|
+
export * from './decorators/draggable/draggable.js';
|
|
23
|
+
export * from './decorators/draggable/drag_handle.js';
|
|
24
|
+
|
|
25
|
+
export * from './decorators/resizable/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useRef } from 'react';
|
|
2
|
-
import { useForkRef } from '
|
|
2
|
+
import { useForkRef } from '../hooks/use_fork_ref.js';
|
|
3
3
|
export interface ClickAwayListenerProps {
|
|
4
4
|
children: React.ReactElement;
|
|
5
5
|
onClickAway: (event: React.MouseEvent | React.TouchEvent) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import { useForkRef } from '
|
|
2
|
+
import { useForkRef } from '../hooks/use_fork_ref.js';
|
|
3
3
|
export interface ScrollAwayListenerProps {
|
|
4
4
|
children: React.ReactElement;
|
|
5
5
|
isException?: (target: HTMLElement) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './variations.js';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { ButtonProps } from '../button/button.js';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated - use Button instead (utility=true)
|
|
5
|
-
* @param props - ButtonProps
|
|
6
|
-
* @returns SlimButton
|
|
7
|
-
*/
|
|
8
|
-
export declare const SlimButton: React.ForwardRefExoticComponent<Omit<Omit<ButtonProps, "utility">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
-
//# sourceMappingURL=slim_button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slim_button.d.ts","sourceRoot":"","sources":["../../../../src/actions/button/slim_button/slim_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAU,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAK1D;;;;GAIG;AACH,eAAO,MAAM,UAAU,qHAcrB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import i from "react";
|
|
3
|
-
import { Button as n } from "../button/button.js";
|
|
4
|
-
import { clsx as l } from "clsx";
|
|
5
|
-
import '../../../slim_button.css';const u = "_slim-button_188fdc3", c = { "slim-button": u }, b = i.forwardRef(({ children: t, className: o, ...m }, r) => /* @__PURE__ */ s(
|
|
6
|
-
n,
|
|
7
|
-
{
|
|
8
|
-
ref: r,
|
|
9
|
-
className: l(c["slim-button"], "tcn-slim-button", o),
|
|
10
|
-
utility: !0,
|
|
11
|
-
...m,
|
|
12
|
-
children: t
|
|
13
|
-
}
|
|
14
|
-
));
|
|
15
|
-
export {
|
|
16
|
-
b as SlimButton
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=slim_button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slim_button.js","sources":["../../../../src/actions/button/slim_button/slim_button.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonProps } from '../button/button.js';\nimport { clsx } from 'clsx';\n// Styles\nimport styles from './slim_button.module.css';\n\n/**\n * @deprecated - use Button instead (utility=true)\n * @param props - ButtonProps\n * @returns SlimButton\n */\nexport const SlimButton = React.forwardRef<\n HTMLButtonElement,\n Omit<ButtonProps, 'utility'>\n>(({ children, className, ...props }, ref) => {\n return (\n <Button\n ref={ref}\n className={clsx(styles['slim-button'], 'tcn-slim-button', className)}\n utility={true}\n {...props}\n >\n {children}\n </Button>\n );\n});\n"],"names":["SlimButton","React","children","className","props","ref","jsx","Button","clsx","styles"],"mappings":";;;;4DAWaA,IAAaC,EAAM,WAG9B,CAAC,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAElC,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG,EAAKC,EAAO,aAAa,GAAG,mBAAmBN,CAAS;AAAA,IACnE,SAAS;AAAA,IACR,GAAGC;AAAA,IAEH,UAAAF;AAAA,EAAA;AAAA,CAGN;"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import './containers.css';const a = "_scaffold_7e9ff51", c = "_rail_9474c96", t = "_container_336e83e", s = "_container-stack_0d2e80a", o = "_scaffold-stack_3a72ba8", n = "_rail-stack_2e4d934", e = { scaffold: a, rail: c, container: t, "container-stack": s, "scaffold-stack": o, "rail-stack": n };
|
|
2
|
-
export {
|
|
3
|
-
e as s
|
|
4
|
-
};
|
|
5
|
-
//# sourceMappingURL=containers.module-DlGySre0.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"containers.module-DlGySre0.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"draggable.module-BgelQsuJ.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/frame.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._frame-dialog_2a77c1d){overflow:hidden}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._left-resize-handle_215501a){position:fixed;bottom:0;left:var(--resize-offset, -8px);height:100%;width:16px;z-index:1;cursor:ew-resize;pointer-events:auto}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._right-resize-handle_7f232b9){position:fixed;bottom:0;right:var(--resize-offset, -8px);height:100%;width:16px;z-index:1;cursor:ew-resize;pointer-events:auto}}
|
package/dist/slim_button.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer tcn-system{:where(._slim-button_188fdc3){min-height:auto}:where(._slim-button_188fdc3[data-is-disabled=true]){pointer-events:none}}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { HorizontalResizeHandleProps } from './types.js';
|
|
2
|
-
export type LeftResizeHandleProps = HorizontalResizeHandleProps;
|
|
3
|
-
export declare function LeftResizeHandle({ targetRef, handleProps, onWidthResize, onWidthResizeEnd, }: LeftResizeHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
//# sourceMappingURL=left_resize_handle.d.ts.map
|