@tcn/ui 0.0.3 → 0.1.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/dist/actions/button/base_button/base_button.d.ts.map +1 -1
- package/dist/actions/button/base_button/base_button.js +20 -15
- package/dist/actions/button/base_button/base_button.js.map +1 -1
- package/dist/actions/button/button/button.d.ts.map +1 -1
- package/dist/actions/button/button/button.js +7 -7
- package/dist/actions/button/button/button.js.map +1 -1
- package/dist/actions/button/button_group/button_group.d.ts.map +1 -1
- package/dist/actions/button/button_group/button_group.js +2 -5
- package/dist/actions/button/button_group/button_group.js.map +1 -1
- package/dist/actions/button/select_group/select_group.js +7 -7
- package/dist/actions/button/select_group/select_group.js.map +1 -1
- package/dist/actions/button/slim_button/slim_button.d.ts.map +1 -1
- package/dist/actions/button/slim_button/slim_button.js +5 -5
- package/dist/actions/button/slim_button/slim_button.js.map +1 -1
- package/dist/button.css +1 -1
- package/dist/feedback/progress/progress_bar.js +1 -1
- package/dist/footer.css +1 -1
- package/dist/form/field/common/field_control/field_control.js +6 -6
- package/dist/form/field/common/field_control/field_control.js.map +1 -1
- package/dist/form/field/common/field_description.js +1 -1
- package/dist/form/field/common/field_error.js +2 -2
- package/dist/form/field/common/field_header.js +8 -8
- package/dist/form/field/common/field_header.js.map +1 -1
- package/dist/form/field/common/field_label.js +1 -1
- package/dist/form/field/common/status_input/status_input.d.ts.map +1 -1
- package/dist/form/field/common/status_input/status_input.js +9 -15
- package/dist/form/field/common/status_input/status_input.js.map +1 -1
- package/dist/form/field/h_field/h_field.js +9 -9
- package/dist/form/field/h_field/h_field.js.map +1 -1
- package/dist/form/field/v_field/v_field.js +8 -8
- package/dist/form/field/v_field/v_field.js.map +1 -1
- package/dist/form/field_set/field_set.d.ts.map +1 -1
- package/dist/form/field_set/field_set.js +12 -19
- package/dist/form/field_set/field_set.js.map +1 -1
- package/dist/inputs/checkbox/checkbox.js +12 -12
- package/dist/inputs/checkbox/checkbox.js.map +1 -1
- package/dist/inputs/color_input/color_input.d.ts.map +1 -1
- package/dist/inputs/color_input/color_input.js +13 -17
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/color_input/color_picker.js +6 -6
- package/dist/inputs/color_input/color_picker.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +15 -15
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/date_picker/date_picker.js +6 -6
- package/dist/inputs/date_picker/date_picker.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_date.js +13 -13
- package/dist/inputs/date_picker/date_picker_date.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_day.js +1 -1
- package/dist/inputs/date_picker/date_picker_header.js +24 -24
- package/dist/inputs/date_picker/date_picker_header.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +19 -19
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.d.ts.map +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.js +6 -9
- package/dist/inputs/date_picker/date_picker_time_selector.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js +3 -3
- package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.d.ts.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +18 -24
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/input/input.d.ts +2 -2
- package/dist/inputs/input/input.d.ts.map +1 -1
- package/dist/inputs/input/input.js +4 -4
- package/dist/inputs/input/input.js.map +1 -1
- package/dist/inputs/multi_combo_box/multi_combo_box.js +1 -1
- package/dist/inputs/multi_combo_box/multi_combo_box.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_values.js +8 -8
- package/dist/inputs/multiselect/multiselect_values.js.map +1 -1
- package/dist/inputs/options/option.d.ts +1 -0
- package/dist/inputs/options/option.d.ts.map +1 -1
- package/dist/inputs/options/option.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +6 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +169 -128
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/radio/radio.js +14 -14
- package/dist/inputs/radio/radio.js.map +1 -1
- package/dist/inputs/select/select.js +16 -16
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/slider/slider.js +7 -7
- package/dist/inputs/slider/slider.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_item.d.ts +1 -1
- package/dist/inputs/suggestions/suggestion_item.d.ts.map +1 -1
- package/dist/inputs/suggestions/suggestion_item.js +23 -18
- package/dist/inputs/suggestions/suggestion_item.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts +1 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +105 -95
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +14 -14
- package/dist/inputs/switch/switch.js.map +1 -1
- package/dist/inputs/textarea/textarea.js +6 -6
- package/dist/inputs/textarea/textarea.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +5 -5
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/layouts/body/h_body.js +10 -10
- package/dist/layouts/body/h_body.js.map +1 -1
- package/dist/layouts/body/v_body.js +8 -8
- package/dist/layouts/body/v_body.js.map +1 -1
- package/dist/layouts/column/column.js +16 -16
- package/dist/layouts/column/column.js.map +1 -1
- package/dist/layouts/divider/divider.js +9 -9
- package/dist/layouts/divider/divider.js.map +1 -1
- package/dist/layouts/footer/footer.js +6 -6
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/grid/grid.d.ts.map +1 -1
- package/dist/layouts/grid/grid.js +22 -31
- package/dist/layouts/grid/grid.js.map +1 -1
- package/dist/layouts/header/header.js +11 -11
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +3 -2
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +26 -24
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/list/item.d.ts +1 -0
- package/dist/layouts/list/item.d.ts.map +1 -1
- package/dist/layouts/list/item.js +18 -7
- package/dist/layouts/list/item.js.map +1 -1
- package/dist/layouts/list/list.js +12 -12
- package/dist/layouts/list/list.js.map +1 -1
- package/dist/layouts/sidebar_end/sidebar_end.js +15 -15
- package/dist/layouts/sidebar_end/sidebar_end.js.map +1 -1
- package/dist/layouts/sidebar_start/sidebar_start.js +16 -16
- package/dist/layouts/sidebar_start/sidebar_start.js.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.js +14 -14
- package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
- package/dist/modal.css +1 -1
- package/dist/overlay/context_menu/context_menu.js +4 -4
- package/dist/overlay/index.js +3 -3
- package/dist/overlay/menu/menu.js +8 -8
- package/dist/overlay/menu/menu.js.map +1 -1
- package/dist/overlay/popper/popper.js +12 -12
- package/dist/{portal-qqIp4SIl.js → overlay/portal/portal.js} +3 -3
- package/dist/overlay/portal/portal.js.map +1 -0
- package/dist/overlay/portal/portal_platform.js +3 -4
- package/dist/overlay/portal/portal_platform.js.map +1 -1
- package/dist/overlay/tooltip/tooltip.js +10 -10
- package/dist/overlay/tooltip/tooltip.js.map +1 -1
- package/dist/phone_number_input.css +1 -1
- package/dist/slim_button.css +1 -1
- package/dist/stacks/box/bottom_resize_handle.js +9 -9
- package/dist/stacks/box/bottom_resize_handle.js.map +1 -1
- package/dist/stacks/box/box.js +42 -42
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/end_resize_handle.js +6 -6
- package/dist/stacks/box/end_resize_handle.js.map +1 -1
- package/dist/stacks/box/left_resize_handle.js +3 -3
- package/dist/stacks/box/left_resize_handle.js.map +1 -1
- package/dist/stacks/box/right_resize_handle.js +8 -8
- package/dist/stacks/box/right_resize_handle.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/top_resize_handle.js +8 -8
- package/dist/stacks/box/top_resize_handle.js.map +1 -1
- package/dist/stacks/h_collapsible_box.js +5 -5
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/h_stack.js +26 -26
- package/dist/stacks/h_stack.js.map +1 -1
- package/dist/stacks/spacer.js +5 -5
- package/dist/stacks/spacer.js.map +1 -1
- package/dist/stacks/story_components/circle.js +6 -6
- package/dist/stacks/story_components/circle.js.map +1 -1
- package/dist/stacks/story_components/picture_placeholder.js +8 -8
- package/dist/stacks/story_components/picture_placeholder.js.map +1 -1
- package/dist/stacks/story_components/rect.js +11 -11
- package/dist/stacks/story_components/rect.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +8 -8
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/stacks/v_stack.js +35 -35
- package/dist/stacks/v_stack.js.map +1 -1
- package/dist/stacks/z_stack.js +34 -34
- package/dist/stacks/z_stack.js.map +1 -1
- package/dist/surfaces/alert/alert.js +8 -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 +6 -15
- package/dist/surfaces/card/card.js.map +1 -1
- package/dist/surfaces/confirm/confirm.d.ts.map +1 -1
- package/dist/surfaces/confirm/confirm.js +17 -24
- package/dist/surfaces/confirm/confirm.js.map +1 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js +5 -5
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js.map +1 -1
- package/dist/surfaces/drawers/drawer_end/drawer_end.js +8 -8
- package/dist/surfaces/drawers/drawer_end/drawer_end.js.map +1 -1
- package/dist/surfaces/drawers/drawer_start/drawer_start.js +4 -4
- package/dist/surfaces/drawers/drawer_start/drawer_start.js.map +1 -1
- package/dist/surfaces/drawers/drawer_top/drawer_top.js +4 -4
- package/dist/surfaces/drawers/drawer_top/drawer_top.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts +2 -4
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +16 -7
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/page/h_page.js +6 -6
- package/dist/surfaces/page/h_page.js.map +1 -1
- package/dist/surfaces/page/v_page.js +9 -9
- package/dist/surfaces/page/v_page.js.map +1 -1
- package/dist/surfaces/panel/h_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/h_panel.js +18 -24
- package/dist/surfaces/panel/h_panel.js.map +1 -1
- package/dist/surfaces/panel/v_panel.js +9 -9
- package/dist/surfaces/panel/v_panel.js.map +1 -1
- package/dist/surfaces/popover/popover.js +34 -34
- package/dist/surfaces/popover/popover.js.map +1 -1
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +6 -14
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/index.d.ts +0 -2
- package/dist/themes/index.d.ts.map +1 -1
- package/dist/themes/index.js +6 -402
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/stylesheets/reset.js +140 -0
- package/dist/themes/stylesheets/reset.js.map +1 -0
- package/dist/themes/themes/ergo/ergo_theme.js +595 -0
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -0
- package/dist/tokens/badge/badge.js +13 -13
- package/dist/tokens/badge/badge.js.map +1 -1
- package/dist/tokens/bubble/bubble.js +11 -11
- package/dist/tokens/bubble/bubble.js.map +1 -1
- package/dist/tokens/chip/chip.js +11 -11
- package/dist/tokens/chip/chip.js.map +1 -1
- package/dist/typography/body_text/body_text.js +21 -21
- package/dist/typography/body_text/body_text.js.map +1 -1
- package/dist/typography/callout/callout.js +16 -16
- package/dist/typography/callout/callout.js.map +1 -1
- package/dist/typography/caption/caption.js +13 -13
- package/dist/typography/caption/caption.js.map +1 -1
- package/dist/typography/footnote/footnote.js +14 -14
- package/dist/typography/footnote/footnote.js.map +1 -1
- package/dist/typography/headline/headline.js +12 -12
- package/dist/typography/headline/headline.js.map +1 -1
- package/dist/typography/subheadline/subheadline.js +13 -13
- package/dist/typography/subheadline/subheadline.js.map +1 -1
- package/dist/typography/title/title.js +17 -17
- package/dist/typography/title/title.js.map +1 -1
- package/package.json +23 -4
- package/src/actions/button/__stories__/button.stories.tsx +1 -1
- package/src/actions/button/__stories__/button_group.stories.tsx +1 -1
- package/src/actions/button/__stories__/select_group.stories.tsx +1 -1
- package/src/actions/button/__stories__/slim_button.stories.tsx +1 -1
- package/src/actions/button/base_button/base_button.tsx +8 -3
- package/src/actions/button/button/button.module.css +0 -78
- package/src/actions/button/button/button.tsx +3 -5
- package/src/actions/button/button_group/button_group.tsx +4 -7
- package/src/actions/button/select_group/select_group.tsx +3 -3
- package/src/actions/button/slim_button/slim_button.module.css +0 -26
- package/src/actions/button/slim_button/slim_button.tsx +3 -2
- package/src/feedback/lazy/lazy.stories.tsx +1 -1
- package/src/feedback/loading/__storybook__/loading.stories.tsx +1 -1
- package/src/feedback/progress/progress_bar.stories.tsx +1 -1
- package/src/form/field/common/field_control/field_control.tsx +2 -2
- package/src/form/field/common/field_header.tsx +2 -2
- package/src/form/field/common/status_input/status_input.tsx +3 -6
- package/src/form/field/field.stories.tsx +2 -1
- package/src/form/field/h_field/h_field.stories.tsx +10 -1
- package/src/form/field/h_field/h_field.tsx +2 -2
- package/src/form/field/v_field/v_field.stories.tsx +10 -1
- package/src/form/field/v_field/v_field.tsx +2 -2
- package/src/form/field_set/field_set.stories.tsx +9 -1
- package/src/form/field_set/field_set.tsx +4 -7
- package/src/inputs/checkbox/checkbox.stories.tsx +9 -1
- package/src/inputs/checkbox/checkbox.tsx +2 -2
- package/src/inputs/color_input/color_input.stories.tsx +9 -1
- package/src/inputs/color_input/color_input.tsx +2 -6
- package/src/inputs/color_input/color_picker.tsx +2 -2
- package/src/inputs/combo_box/combo_box.stories.tsx +14 -5
- package/src/inputs/combo_box/combo_box.tsx +2 -2
- package/src/inputs/date_picker/date_picker.stories.tsx +18 -10
- package/src/inputs/date_picker/date_picker.tsx +3 -3
- package/src/inputs/date_picker/date_picker_date.tsx +3 -3
- package/src/inputs/date_picker/date_picker_header.tsx +2 -2
- package/src/inputs/date_picker/date_picker_input.stories.tsx +15 -7
- package/src/inputs/date_picker/date_picker_input.tsx +3 -3
- package/src/inputs/date_picker/date_picker_time_selector.tsx +5 -8
- package/src/inputs/date_picker/date_picker_year_input.tsx +2 -2
- package/src/inputs/date_picker/date_picker_year_selector.tsx +3 -9
- package/src/inputs/input/input.stories.tsx +9 -1
- package/src/inputs/input/input.tsx +5 -4
- package/src/inputs/mask_input/key_capture_input.stories.tsx +9 -1
- package/src/inputs/mask_input/mask_input.stories.tsx +10 -1
- package/src/inputs/multi_combo_box/multi_combo_box.stories.tsx +10 -1
- package/src/inputs/multi_combo_box/multi_combo_box.tsx +2 -2
- package/src/inputs/multiselect/multiselect_values.tsx +2 -2
- package/src/inputs/multiselect/mutliselect.stories.tsx +10 -1
- package/src/inputs/options/option.tsx +1 -0
- package/src/inputs/phone_number_input/phone_number_input.module.css +12 -0
- package/src/inputs/phone_number_input/phone_number_input.stories.tsx +18 -1
- package/src/inputs/phone_number_input/phone_number_input.tsx +104 -29
- package/src/inputs/radio/radio.stories.tsx +14 -6
- package/src/inputs/radio/radio.tsx +2 -2
- package/src/inputs/select/select.stories.tsx +18 -9
- package/src/inputs/select/select.tsx +2 -2
- package/src/inputs/slider/slider.stories.tsx +9 -1
- package/src/inputs/slider/slider.tsx +2 -2
- package/src/inputs/suggestions/suggestion_item.tsx +14 -4
- package/src/inputs/suggestions/suggestion_list.stories.tsx +21 -12
- package/src/inputs/suggestions/suggestion_list.tsx +25 -6
- package/src/inputs/switch/switch.stories.tsx +9 -1
- package/src/inputs/switch/switch.tsx +4 -4
- package/src/inputs/textarea/textarea.stories.tsx +9 -1
- package/src/inputs/textarea/textarea.tsx +2 -2
- package/src/inputs/unit_input/unit_input.stories.tsx +9 -1
- package/src/inputs/unit_input/unit_input.tsx +4 -4
- package/src/layouts/body/h_body.tsx +2 -2
- package/src/layouts/body/v_body.tsx +2 -2
- package/src/layouts/column/column.tsx +3 -3
- package/src/layouts/divider/__stories__/divider.stories.tsx +59 -19
- package/src/layouts/divider/divider.tsx +3 -3
- package/src/layouts/footer/footer.module.css +0 -1
- package/src/layouts/footer/footer.tsx +2 -2
- package/src/layouts/grid/grid.stories.tsx +42 -34
- package/src/layouts/grid/grid.tsx +2 -7
- package/src/layouts/header/header.tsx +2 -2
- package/src/layouts/index.ts +3 -2
- package/src/layouts/list/item.tsx +11 -3
- package/src/layouts/list/list.tsx +3 -3
- package/src/layouts/sidebar_end/sidebar_end.tsx +2 -2
- package/src/layouts/sidebar_start/sidebar_start.tsx +2 -2
- package/src/layouts/utility_bar/utility_bar.tsx +2 -2
- package/src/overlay/context_menu/context_menu.stories.tsx +13 -5
- package/src/overlay/menu/menu.stories.tsx +22 -14
- package/src/overlay/menu/menu.tsx +3 -3
- package/src/overlay/popper/popper.stories.tsx +43 -22
- package/src/overlay/portal/portal.stories.tsx +10 -1
- package/src/overlay/tooltip/tooltip.stories.tsx +9 -2
- package/src/overlay/tooltip/tooltip.tsx +2 -2
- package/src/stacks/box/bottom_resize_handle.tsx +2 -2
- package/src/stacks/box/box.tsx +2 -2
- package/src/stacks/box/end_resize_handle.tsx +2 -2
- package/src/stacks/box/left_resize_handle.tsx +2 -2
- package/src/stacks/box/right_resize_handle.tsx +2 -2
- package/src/stacks/box/start_resize_handle.tsx +2 -2
- package/src/stacks/box/top_resize_handle.tsx +2 -2
- package/src/stacks/collapsible_box.stories.tsx +10 -1
- package/src/stacks/h_collapsible_box.tsx +2 -2
- package/src/stacks/h_stack.stories.tsx +104 -59
- package/src/stacks/h_stack.tsx +2 -2
- package/src/stacks/spacer.tsx +2 -2
- package/src/stacks/story_components/circle.tsx +2 -2
- package/src/stacks/story_components/picture_placeholder.tsx +2 -2
- package/src/stacks/story_components/rect.tsx +2 -2
- package/src/stacks/v_collapsible_box.tsx +2 -2
- package/src/stacks/v_stack.stories.tsx +91 -10
- package/src/stacks/v_stack.tsx +2 -2
- package/src/stacks/z_stack.stories.tsx +9 -1
- package/src/stacks/z_stack.tsx +2 -2
- package/src/surfaces/alert/alert.stories.tsx +4 -4
- package/src/surfaces/alert/alert.tsx +2 -2
- package/src/surfaces/card/card.tsx +3 -9
- package/src/surfaces/confirm/confirm.stories.tsx +4 -4
- package/src/surfaces/confirm/confirm.tsx +3 -6
- package/src/surfaces/drawers/__stories__/drawers.stories.tsx +1 -1
- package/src/surfaces/drawers/drawer_bottom/drawer_bottom.tsx +2 -2
- package/src/surfaces/drawers/drawer_end/drawer_end.tsx +2 -2
- package/src/surfaces/drawers/drawer_start/drawer_start.tsx +2 -2
- package/src/surfaces/drawers/drawer_top/drawer_top.tsx +2 -2
- package/src/surfaces/modal/__stories__/modal.stories.tsx +54 -0
- package/src/surfaces/modal/modal.module.css +2 -1
- package/src/surfaces/modal/modal.tsx +9 -6
- package/src/surfaces/page/h_page.tsx +2 -2
- package/src/surfaces/page/v_page.tsx +2 -2
- package/src/surfaces/panel/__stories__/panel.stories.tsx +13 -12
- package/src/surfaces/panel/h_panel.tsx +3 -9
- package/src/surfaces/panel/v_panel.tsx +3 -3
- package/src/surfaces/popover/popover.tsx +2 -2
- package/src/surfaces/window/window.stories.tsx +1 -1
- package/src/surfaces/window/window.tsx +2 -6
- package/src/themes/index.ts +0 -2
- package/src/themes/stories/themes.stories.tsx +1 -1
- package/src/themes/themes/ergo/__stories__/components/material_picker/sb_inverted_materials.module.css +34 -0
- package/src/themes/themes/ergo/__stories__/components/material_picker/sb_material_picker.tsx +52 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_card.module.css +5 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_card.tsx +40 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +83 -0
- package/src/themes/themes/ergo/__stories__/components/tone_picker/types.ts +7 -0
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +154 -0
- package/src/themes/themes/ergo/__stories__/sb_materials.module.css +110 -0
- package/src/themes/themes/ergo/__stories__/utils.ts +92 -0
- package/src/themes/themes/ergo/ergo_theme.css +348 -15
- package/src/tokens/badge/badge.stories.tsx +6 -6
- package/src/tokens/badge/badge.tsx +3 -3
- package/src/tokens/bubble/bubble.stories.tsx +16 -9
- package/src/tokens/bubble/bubble.tsx +2 -2
- package/src/tokens/chip/chip.stories.tsx +1 -1
- package/src/tokens/chip/chip.tsx +2 -2
- package/src/typography/body_text/body_text.tsx +2 -2
- package/src/typography/callout/callout.tsx +2 -2
- package/src/typography/caption/caption.tsx +2 -2
- package/src/typography/footnote/footnote.tsx +2 -2
- package/src/typography/headline/headline.tsx +2 -2
- package/src/typography/subheadline/subheadline.tsx +2 -2
- package/src/typography/title/title.tsx +2 -2
- package/src/typography/typography-showcase.stories.tsx +2 -2
- package/src/utils/click_away_listener.stories.tsx +21 -11
- package/src/utils/responsive/responsive_renderer.stories.tsx +7 -7
- package/src/utils/scroll_away_listener.stories.tsx +11 -1
- package/tsconfig.json +0 -3
- package/dist/card.css +0 -1
- package/dist/portal-qqIp4SIl.js.map +0 -1
- package/dist/themes/stylesheets/reset.css +0 -1
- package/dist/themes/themes/ergo/ergo_theme.css +0 -1
- package/dist/themes/themes/windows_98/windows_98.css +0 -1
- package/src/surfaces/card/card.module.css +0 -5
- package/src/surfaces/modal/modal.stories.tsx +0 -15
- /package/dist/{overlay/portal/portal.css → portal_platform.css} +0 -0
|
@@ -9,8 +9,8 @@ import "../../utils/hooks/use_resize_observer.js";
|
|
|
9
9
|
import { HStack as G } from "../../stacks/h_stack.js";
|
|
10
10
|
import { VStack as J } from "../../stacks/v_stack.js";
|
|
11
11
|
import { Popper as K } from "../popper/popper.js";
|
|
12
|
-
import L from "
|
|
13
|
-
import '../../menu.css';const Q = "_menu_9ce21e3", U = "_menu-item_68b387f",
|
|
12
|
+
import { clsx as L } from "clsx";
|
|
13
|
+
import '../../menu.css';const Q = "_menu_9ce21e3", U = "_menu-item_68b387f", j = { menu: Q, "menu-item": U }, Z = f.forwardRef(function({
|
|
14
14
|
anchorElement: R,
|
|
15
15
|
verticalAnchor: y,
|
|
16
16
|
verticalOrigin: S,
|
|
@@ -73,7 +73,7 @@ import '../../menu.css';const Q = "_menu_9ce21e3", U = "_menu-item_68b387f", N =
|
|
|
73
73
|
onClose: x,
|
|
74
74
|
restoreFocus: Y,
|
|
75
75
|
veil: s,
|
|
76
|
-
children: /* @__PURE__ */ g(J, { ref: z, className: L(
|
|
76
|
+
children: /* @__PURE__ */ g(J, { ref: z, className: L(j.menu, E, "menu"), ...I, children: l })
|
|
77
77
|
}
|
|
78
78
|
);
|
|
79
79
|
}), D = f.forwardRef(function({
|
|
@@ -105,14 +105,14 @@ import '../../menu.css';const Q = "_menu_9ce21e3", U = "_menu-item_68b387f", N =
|
|
|
105
105
|
o.x = n.clientX, o.y = n.clientY, r(!1);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const H = Math.sqrt(p.x ** 2 + p.y ** 2);
|
|
109
109
|
if (E.current) {
|
|
110
110
|
o.x = n.clientX, o.y = n.clientY, r(!1);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
r(!!
|
|
113
|
+
if (H > 5) {
|
|
114
|
+
const N = p.x / p.y > 0.2;
|
|
115
|
+
r(!!N), o.x = n.clientX, o.y = n.clientY;
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
return window.addEventListener("mousemove", B), () => {
|
|
@@ -129,7 +129,7 @@ import '../../menu.css';const Q = "_menu_9ce21e3", U = "_menu-item_68b387f", N =
|
|
|
129
129
|
ref: t,
|
|
130
130
|
"data-is-selected": !!R,
|
|
131
131
|
"data-has-children": !!a,
|
|
132
|
-
className: L(S,
|
|
132
|
+
className: L(S, j["menu-item"], "menu-item"),
|
|
133
133
|
"data-is-open": s,
|
|
134
134
|
...c,
|
|
135
135
|
children: typeof y == "string" ? /* @__PURE__ */ g(O, { color: "inherit", children: y }) : y
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sources":["../../../src/overlay/menu/menu.tsx"],"sourcesContent":["import { BodyText } from '../../typography/body_text/body_text.js';\nimport { useForkRef } from '../../utils/index.js';\nimport { HStack } from '../../stacks/h_stack.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport type { HStackProps } from '../../stacks/h_stack.js';\nimport type { VStackProps } from '../../stacks/v_stack.js';\nimport { Popper, type PopperProps } from '../../overlay/popper/popper.js';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport styles from './menu.module.css';\nimport classNames from 'classnames';\n\nexport type MenuProps = Omit<PopperProps & VStackProps, 'children'> & {\n children?: React.ReactNode;\n onActivatedMenu?: (hasActiveMenu: boolean) => void;\n direction?: 'up' | 'down';\n};\n\nexport const Menu = React.forwardRef(function Menu(\n {\n anchorElement,\n verticalAnchor,\n verticalOrigin,\n verticalOffset,\n horizontalAnchor,\n horizontalOrigin,\n horizontalOffset,\n direction,\n open,\n onClose,\n restoreFocus,\n veil,\n onActivatedMenu,\n children = [],\n className,\n ...props\n }: MenuProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [focusedIndex, setFocusedIndex] = useState(-1);\n const clonedChildren = React.Children.toArray(children).map((child, index) => {\n if (!React.isValidElement(child)) {\n return child;\n }\n\n if (child.type !== MenuItem) {\n return React.cloneElement(child, {\n ...child.props,\n onClick: (e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n child.props.onClick && child.props.onClick(e);\n },\n });\n }\n\n const props = {\n ...child.props,\n key: index,\n verticalAnchor: direction === 'up' ? 'bottom' : 'top',\n verticalOrigin: direction === 'up' ? 'bottom' : 'top',\n verticalOffset,\n horizontalAnchor: 'end',\n horizontalOrigin: 'start',\n horizontalOffset,\n direction,\n onClick: (e: React.MouseEvent<HTMLDivElement>) => {\n if (child.props.children == null) {\n onClose && onClose();\n }\n child.props.onClick && child.props.onClick(e);\n },\n onMouseEnter: (e: React.MouseEvent<HTMLDivElement>) => {\n setFocusedIndex(index);\n onActivatedMenu && onActivatedMenu(true);\n child.props.onMouseEnter && child.props.onMouseEnter(e);\n },\n };\n\n if (child.type === MenuItem) {\n props.open = focusedIndex === index;\n }\n\n return React.cloneElement(child, props);\n });\n\n direction === 'up' && clonedChildren.reverse();\n\n useLayoutEffect(() => {\n if (!open) {\n setFocusedIndex(-1);\n onActivatedMenu && onActivatedMenu(false);\n }\n }, [open, onActivatedMenu]);\n\n return (\n <Popper\n anchorElement={anchorElement}\n verticalAnchor={verticalAnchor}\n verticalOrigin={verticalOrigin}\n verticalOffset={verticalOffset}\n horizontalAnchor={horizontalAnchor || 'end'}\n horizontalOrigin={horizontalOrigin || 'end'}\n horizontalOffset={horizontalOffset}\n open={open}\n onClose={onClose}\n restoreFocus={restoreFocus}\n veil={veil}\n >\n <VStack ref={ref} className={classNames(styles.menu, className, 'menu')} {...props}>\n {clonedChildren}\n </VStack>\n </Popper>\n );\n});\n\nexport interface MenuItemProps extends Omit<HStackProps, 'children'> {\n open?: boolean;\n children?: React.ReactElement<MenuItemProps>[];\n selected?: boolean;\n label?: React.ReactNode;\n direction?: 'up' | 'down';\n verticalAnchor?: 'top' | 'center' | 'bottom';\n verticalOrigin?: 'top' | 'center' | 'bottom';\n verticalOffset?: number;\n horizontalAnchor?: 'center' | 'start' | 'end';\n horizontalOrigin?: 'center' | 'start' | 'end';\n horizontalOffset?: number;\n}\n\nexport const MenuItem = React.forwardRef(function MenuItem(\n {\n selected,\n label,\n className,\n children,\n direction = 'down',\n verticalAnchor = 'top',\n verticalOrigin = 'top',\n verticalOffset,\n horizontalAnchor = 'end',\n horizontalOrigin = 'start',\n horizontalOffset,\n open = false,\n ...props\n }: MenuItemProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const hasEnteredMenuRef = useRef(false);\n const cursorPositionRef = useRef({ x: -1, y: -1 });\n const cursorDeltaRef = useRef({ x: -1, y: -1 });\n const [showVeil, setShowVeil] = useState(false);\n const itemRef = useRef<HTMLElement | null>(null);\n const forkedRef = useForkRef(ref, itemRef);\n const hasSubmenu = children != null && children.length > 0;\n\n function close() {\n setShowVeil(false);\n }\n\n useLayoutEffect(() => {\n const itemElement = itemRef.current;\n\n if (itemElement && hasSubmenu && open) {\n const direction = window.getComputedStyle(itemElement).direction;\n\n const startPosition = cursorPositionRef.current;\n const delta = cursorDeltaRef.current;\n\n const calculateSlope = (event: MouseEvent) => {\n if (startPosition.x === -1) {\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n }\n\n const deltaX = event.clientX - startPosition.x;\n const deltaY = event.clientY - startPosition.y;\n delta.x = Math.max(Math.abs(deltaX), 0.001);\n delta.y = Math.max(Math.abs(deltaY), 0.001);\n\n const isSlopeWrongDirection =\n ((deltaX < 0 ||\n (direction === 'down' && deltaY < 0) ||\n (direction === 'up' && deltaY > 0)) &&\n direction === 'ltr') ||\n ((deltaX > 0 ||\n (direction === 'down' && deltaY < 0) ||\n (direction === 'up' && deltaY > 0)) &&\n direction === 'rtl');\n\n if (isSlopeWrongDirection) {\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n setShowVeil(false);\n return;\n }\n\n const distance = Math.sqrt(delta.x ** 2 + delta.y ** 2);\n\n if (hasEnteredMenuRef.current) {\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n setShowVeil(false);\n return;\n }\n\n if (distance > 5) {\n const movingHorizontal = delta.x / delta.y > 0.2;\n\n if (movingHorizontal) {\n setShowVeil(true);\n } else {\n setShowVeil(false);\n }\n\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n }\n };\n\n window.addEventListener('mousemove', calculateSlope);\n\n return () => {\n window.removeEventListener('mousemove', calculateSlope);\n };\n }\n }, [hasSubmenu, open]);\n\n useLayoutEffect(() => {\n setShowVeil(open);\n }, [open]);\n\n return (\n <>\n <HStack\n as=\"button\"\n ref={forkedRef}\n data-is-selected={Boolean(selected)}\n data-has-children={Boolean(hasSubmenu)}\n className={classNames(className, styles['menu-item'], 'menu-item')}\n data-is-open={open}\n {...props}\n >\n {typeof label === 'string' ? <BodyText color=\"inherit\">{label}</BodyText> : label}\n </HStack>\n {children && (\n <Menu\n anchorElement={itemRef.current}\n veil={showVeil}\n onClose={close}\n open={open}\n direction={direction}\n verticalAnchor={verticalAnchor}\n verticalOrigin={verticalOrigin}\n verticalOffset={verticalOffset}\n horizontalAnchor={horizontalAnchor}\n horizontalOrigin={horizontalOrigin}\n horizontalOffset={horizontalOffset}\n hAlign=\"start\"\n onActivatedMenu={hasActiveMenu => {\n hasEnteredMenuRef.current = hasActiveMenu;\n }}\n >\n {children}\n </Menu>\n )}\n </>\n );\n});\n"],"names":["Menu","React","anchorElement","verticalAnchor","verticalOrigin","verticalOffset","horizontalAnchor","horizontalOrigin","horizontalOffset","direction","open","onClose","restoreFocus","veil","onActivatedMenu","children","className","props","ref","focusedIndex","setFocusedIndex","useState","clonedChildren","child","index","MenuItem","useLayoutEffect","jsx","Popper","VStack","classNames","styles","selected","label","hasEnteredMenuRef","useRef","cursorPositionRef","cursorDeltaRef","showVeil","setShowVeil","itemRef","forkedRef","useForkRef","hasSubmenu","close","itemElement","startPosition","delta","calculateSlope","event","deltaX","deltaY","distance","movingHorizontal","jsxs","Fragment","HStack","BodyText","hasActiveMenu"],"mappings":";;;;;;;;;;;;sFAiBaA,IAAOC,EAAM,WAAW,SACnC;AAAA,EACE,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC;AAAA,EACA,iBAAAC;AAAA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CAACL,GAAYjC,CAAI,CAAC,GAErBgB,EAAgB,MAAM;AACpB,IAAAa,EAAY7B,CAAI;AAAA,EAClB,GAAG,CAACA,CAAI,CAAC,GAGP,gBAAA4C,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAA5B;AAAA,MAAC6B;AAAA,MAAA;AAAA,QACC,IAAG;AAAA,QACH,KAAKf;AAAA,QACL,oBAAkB,EAAQT;AAAA,QAC1B,qBAAmB,EAAQW;AAAA,QAC3B,WAAWb,EAAWd,GAAWe,EAAO,WAAW,GAAG,WAAW;AAAA,QACjE,gBAAcrB;AAAA,QACb,GAAGO;AAAA,QAEH,UAAA,OAAOgB,KAAU,WAAW,gBAAAN,EAAC8B,KAAS,OAAM,WAAW,aAAM,IAAcxB;AAAA,MAAA;AAAA,IAAA;AAAA,IAE7ElB,KACC,gBAAAY;AAAA,MAAC3B;AAAA,MAAA;AAAA,QACC,eAAewC,EAAQ;AAAA,QACvB,MAAMF;AAAA,QACN,SAASM;AAAA,QACT,MAAAlC;AAAA,QACA,WAAAD;AAAA,QACA,gBAAAN;AAAA,QACA,gBAAAC;AAAA,QACA,gBAAAC;AAAA,QACA,kBAAAC;AAAA,QACA,kBAAAC;AAAA,QACA,kBAAAC;AAAA,QACA,QAAO;AAAA,QACP,iBAAiB,CAAAkD,MAAiB;AAChC,UAAAxB,EAAkB,UAAUwB;AAAA,QAC9B;AAAA,QAEC,UAAA3C;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"menu.js","sources":["../../../src/overlay/menu/menu.tsx"],"sourcesContent":["import { BodyText } from '../../typography/body_text/body_text.js';\nimport { useForkRef } from '../../utils/index.js';\nimport { HStack } from '../../stacks/h_stack.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport type { HStackProps } from '../../stacks/h_stack.js';\nimport type { VStackProps } from '../../stacks/v_stack.js';\nimport { Popper, type PopperProps } from '../../overlay/popper/popper.js';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport styles from './menu.module.css';\nimport { clsx } from 'clsx';\n\nexport type MenuProps = Omit<PopperProps & VStackProps, 'children'> & {\n children?: React.ReactNode;\n onActivatedMenu?: (hasActiveMenu: boolean) => void;\n direction?: 'up' | 'down';\n};\n\nexport const Menu = React.forwardRef(function Menu(\n {\n anchorElement,\n verticalAnchor,\n verticalOrigin,\n verticalOffset,\n horizontalAnchor,\n horizontalOrigin,\n horizontalOffset,\n direction,\n open,\n onClose,\n restoreFocus,\n veil,\n onActivatedMenu,\n children = [],\n className,\n ...props\n }: MenuProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [focusedIndex, setFocusedIndex] = useState(-1);\n const clonedChildren = React.Children.toArray(children).map((child, index) => {\n if (!React.isValidElement(child)) {\n return child;\n }\n\n if (child.type !== MenuItem) {\n return React.cloneElement(child, {\n ...child.props,\n onClick: (e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n child.props.onClick && child.props.onClick(e);\n },\n });\n }\n\n const props = {\n ...child.props,\n key: index,\n verticalAnchor: direction === 'up' ? 'bottom' : 'top',\n verticalOrigin: direction === 'up' ? 'bottom' : 'top',\n verticalOffset,\n horizontalAnchor: 'end',\n horizontalOrigin: 'start',\n horizontalOffset,\n direction,\n onClick: (e: React.MouseEvent<HTMLDivElement>) => {\n if (child.props.children == null) {\n onClose && onClose();\n }\n child.props.onClick && child.props.onClick(e);\n },\n onMouseEnter: (e: React.MouseEvent<HTMLDivElement>) => {\n setFocusedIndex(index);\n onActivatedMenu && onActivatedMenu(true);\n child.props.onMouseEnter && child.props.onMouseEnter(e);\n },\n };\n\n if (child.type === MenuItem) {\n props.open = focusedIndex === index;\n }\n\n return React.cloneElement(child, props);\n });\n\n direction === 'up' && clonedChildren.reverse();\n\n useLayoutEffect(() => {\n if (!open) {\n setFocusedIndex(-1);\n onActivatedMenu && onActivatedMenu(false);\n }\n }, [open, onActivatedMenu]);\n\n return (\n <Popper\n anchorElement={anchorElement}\n verticalAnchor={verticalAnchor}\n verticalOrigin={verticalOrigin}\n verticalOffset={verticalOffset}\n horizontalAnchor={horizontalAnchor || 'end'}\n horizontalOrigin={horizontalOrigin || 'end'}\n horizontalOffset={horizontalOffset}\n open={open}\n onClose={onClose}\n restoreFocus={restoreFocus}\n veil={veil}\n >\n <VStack ref={ref} className={clsx(styles.menu, className, 'menu')} {...props}>\n {clonedChildren}\n </VStack>\n </Popper>\n );\n});\n\nexport interface MenuItemProps extends Omit<HStackProps, 'children'> {\n open?: boolean;\n children?: React.ReactElement<MenuItemProps>[];\n selected?: boolean;\n label?: React.ReactNode;\n direction?: 'up' | 'down';\n verticalAnchor?: 'top' | 'center' | 'bottom';\n verticalOrigin?: 'top' | 'center' | 'bottom';\n verticalOffset?: number;\n horizontalAnchor?: 'center' | 'start' | 'end';\n horizontalOrigin?: 'center' | 'start' | 'end';\n horizontalOffset?: number;\n}\n\nexport const MenuItem = React.forwardRef(function MenuItem(\n {\n selected,\n label,\n className,\n children,\n direction = 'down',\n verticalAnchor = 'top',\n verticalOrigin = 'top',\n verticalOffset,\n horizontalAnchor = 'end',\n horizontalOrigin = 'start',\n horizontalOffset,\n open = false,\n ...props\n }: MenuItemProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const hasEnteredMenuRef = useRef(false);\n const cursorPositionRef = useRef({ x: -1, y: -1 });\n const cursorDeltaRef = useRef({ x: -1, y: -1 });\n const [showVeil, setShowVeil] = useState(false);\n const itemRef = useRef<HTMLElement | null>(null);\n const forkedRef = useForkRef(ref, itemRef);\n const hasSubmenu = children != null && children.length > 0;\n\n function close() {\n setShowVeil(false);\n }\n\n useLayoutEffect(() => {\n const itemElement = itemRef.current;\n\n if (itemElement && hasSubmenu && open) {\n const direction = window.getComputedStyle(itemElement).direction;\n\n const startPosition = cursorPositionRef.current;\n const delta = cursorDeltaRef.current;\n\n const calculateSlope = (event: MouseEvent) => {\n if (startPosition.x === -1) {\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n }\n\n const deltaX = event.clientX - startPosition.x;\n const deltaY = event.clientY - startPosition.y;\n delta.x = Math.max(Math.abs(deltaX), 0.001);\n delta.y = Math.max(Math.abs(deltaY), 0.001);\n\n const isSlopeWrongDirection =\n ((deltaX < 0 ||\n (direction === 'down' && deltaY < 0) ||\n (direction === 'up' && deltaY > 0)) &&\n direction === 'ltr') ||\n ((deltaX > 0 ||\n (direction === 'down' && deltaY < 0) ||\n (direction === 'up' && deltaY > 0)) &&\n direction === 'rtl');\n\n if (isSlopeWrongDirection) {\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n setShowVeil(false);\n return;\n }\n\n const distance = Math.sqrt(delta.x ** 2 + delta.y ** 2);\n\n if (hasEnteredMenuRef.current) {\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n setShowVeil(false);\n return;\n }\n\n if (distance > 5) {\n const movingHorizontal = delta.x / delta.y > 0.2;\n\n if (movingHorizontal) {\n setShowVeil(true);\n } else {\n setShowVeil(false);\n }\n\n startPosition.x = event.clientX;\n startPosition.y = event.clientY;\n }\n };\n\n window.addEventListener('mousemove', calculateSlope);\n\n return () => {\n window.removeEventListener('mousemove', calculateSlope);\n };\n }\n }, [hasSubmenu, open]);\n\n useLayoutEffect(() => {\n setShowVeil(open);\n }, [open]);\n\n return (\n <>\n <HStack\n as=\"button\"\n ref={forkedRef}\n data-is-selected={Boolean(selected)}\n data-has-children={Boolean(hasSubmenu)}\n className={clsx(className, styles['menu-item'], 'menu-item')}\n data-is-open={open}\n {...props}\n >\n {typeof label === 'string' ? <BodyText color=\"inherit\">{label}</BodyText> : label}\n </HStack>\n {children && (\n <Menu\n anchorElement={itemRef.current}\n veil={showVeil}\n onClose={close}\n open={open}\n direction={direction}\n verticalAnchor={verticalAnchor}\n verticalOrigin={verticalOrigin}\n verticalOffset={verticalOffset}\n horizontalAnchor={horizontalAnchor}\n horizontalOrigin={horizontalOrigin}\n horizontalOffset={horizontalOffset}\n hAlign=\"start\"\n onActivatedMenu={hasActiveMenu => {\n hasEnteredMenuRef.current = hasActiveMenu;\n }}\n >\n {children}\n </Menu>\n )}\n </>\n );\n});\n"],"names":["Menu","React","anchorElement","verticalAnchor","verticalOrigin","verticalOffset","horizontalAnchor","horizontalOrigin","horizontalOffset","direction","open","onClose","restoreFocus","veil","onActivatedMenu","children","className","props","ref","focusedIndex","setFocusedIndex","useState","clonedChildren","child","index","MenuItem","useLayoutEffect","jsx","Popper","VStack","clsx","styles","selected","label","hasEnteredMenuRef","useRef","cursorPositionRef","cursorDeltaRef","showVeil","setShowVeil","itemRef","forkedRef","useForkRef","hasSubmenu","close","itemElement","startPosition","delta","calculateSlope","event","deltaX","deltaY","distance","movingHorizontal","jsxs","Fragment","HStack","BodyText","hasActiveMenu"],"mappings":";;;;;;;;;;;;sFAiBaA,IAAOC,EAAM,WAAW,SACnC;AAAA,EACE,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC,IAAW,CAAA;AAAA,EACX,WAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAS,EAAE,GAC7CC,IAAiBrB,EAAM,SAAS,QAAQc,CAAQ,EAAE,IAAI,CAACQ,GAAOC,MAAU;AAC5E,QAAI,CAACvB,EAAM,eAAesB,CAAK;AAC7B,aAAOA;AAGT,QAAIA,EAAM,SAASE;AACjB,aAAOxB,EAAM,aAAasB,GAAO;AAAA,QAC/B,GAAGA,EAAM;AAAA,QACT,SAAS,CAAC,MAAqC;AAC7C,YAAE,gBAAA,GACFA,EAAM,MAAM,WAAWA,EAAM,MAAM,QAAQ,CAAC;AAAA,QAC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M,WAAW,aAAM,IAAcxB;AAAA,MAAA;AAAA,IAAA;AAAA,IAE7ElB,KACC,gBAAAY;AAAA,MAAC3B;AAAA,MAAA;AAAA,QACC,eAAewC,EAAQ;AAAA,QACvB,MAAMF;AAAA,QACN,SAASM;AAAA,QACT,MAAAlC;AAAA,QACA,WAAAD;AAAA,QACA,gBAAAN;AAAA,QACA,gBAAAC;AAAA,QACA,gBAAAC;AAAA,QACA,kBAAAC;AAAA,QACA,kBAAAC;AAAA,QACA,kBAAAC;AAAA,QACA,QAAO;AAAA,QACP,iBAAiB,CAAAkD,MAAiB;AAChC,UAAAxB,EAAkB,UAAUwB;AAAA,QAC9B;AAAA,QAEC,UAAA3C;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ,CAAC;"}
|
|
@@ -2,17 +2,17 @@ import { jsx as p, jsxs as G } from "react/jsx-runtime";
|
|
|
2
2
|
import "../../utils/focus_redirect.js";
|
|
3
3
|
import { ClickAwayListener as I } from "../../utils/click_away_listener.js";
|
|
4
4
|
import { ScrollAwayListener as J } from "../../utils/scroll_away_listener.js";
|
|
5
|
-
import { useRef as f, useState as K, useLayoutEffect as
|
|
5
|
+
import { useRef as f, useState as K, useLayoutEffect as E } from "react";
|
|
6
6
|
import "../../utils/hooks/use_resize_observer.js";
|
|
7
|
-
import {
|
|
8
|
-
import '../../popper.css';const Q = "_popover_069b323", U = "_popover-veil_2f5f985",
|
|
7
|
+
import { Portal as M } from "../portal/portal.js";
|
|
8
|
+
import '../../popper.css';const Q = "_popover_069b323", U = "_popover-veil_2f5f985", P = { popover: Q, "popover-veil": U };
|
|
9
9
|
function ie({
|
|
10
10
|
anchorElement: n,
|
|
11
11
|
verticalAnchor: _ = "bottom",
|
|
12
12
|
verticalOrigin: j = "top",
|
|
13
13
|
verticalOffset: h = 0,
|
|
14
|
-
horizontalAnchor:
|
|
15
|
-
horizontalOrigin:
|
|
14
|
+
horizontalAnchor: d = "start",
|
|
15
|
+
horizontalOrigin: a = "start",
|
|
16
16
|
horizontalOffset: s = 0,
|
|
17
17
|
restoreFocus: g = !1,
|
|
18
18
|
veil: y = !1,
|
|
@@ -54,13 +54,13 @@ function ie({
|
|
|
54
54
|
t -= o.height;
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
let r =
|
|
59
|
-
v && (
|
|
57
|
+
d === "start" ? i += v ? e.width + s : s : d === "center" ? i += e.width / 2 : d === "end" && (i += v ? -s : e.width + s);
|
|
58
|
+
let r = a;
|
|
59
|
+
v && (a === "start" ? r = "end" : a === "end" && (r = "start")), r === "start" || (r === "center" ? i -= o.width / 2 : r === "end" && (i -= o.width)), i + o.width > A && (i = A - o.width), i < 0 && (i = 0), t + o.height > L && (t = L - o.height), t < 0 && (t = 0), (t !== c.top || i !== c.left) && q({ top: t, left: i });
|
|
60
60
|
};
|
|
61
|
-
if (
|
|
61
|
+
if (E(() => (m(), window.addEventListener("resize", m), () => {
|
|
62
62
|
window.removeEventListener("resize", m);
|
|
63
|
-
})),
|
|
63
|
+
})), E(() => {
|
|
64
64
|
if (u)
|
|
65
65
|
x.current = window.document.activeElement;
|
|
66
66
|
else {
|
|
@@ -76,7 +76,7 @@ function ie({
|
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
ref: w,
|
|
79
|
-
className:
|
|
79
|
+
className: P.popover,
|
|
80
80
|
style: {
|
|
81
81
|
top: `${c.top}px`,
|
|
82
82
|
left: `${c.left}px`
|
|
@@ -98,7 +98,7 @@ function ie({
|
|
|
98
98
|
{
|
|
99
99
|
ref: C,
|
|
100
100
|
onClick: (e) => C.current === e.target && b && b(e),
|
|
101
|
-
className:
|
|
101
|
+
className: P["popover-veil"],
|
|
102
102
|
children: l
|
|
103
103
|
}
|
|
104
104
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as n, useLayoutEffect as e } from "react";
|
|
2
|
-
import { usePortalPlatform as u } from "./
|
|
2
|
+
import { usePortalPlatform as u } from "./portal_platform_context.js";
|
|
3
3
|
const s = ({ children: a, zIndex: o }) => {
|
|
4
4
|
const r = u(), [t] = n(() => r.createPortal());
|
|
5
5
|
return e(() => {
|
|
@@ -7,6 +7,6 @@ const s = ({ children: a, zIndex: o }) => {
|
|
|
7
7
|
}, [t, o]), e(() => (r.mountPortal(t), () => r.unmountPortal(t)), [t, r]), t.render(a);
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
s as
|
|
10
|
+
s as Portal
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=portal
|
|
12
|
+
//# sourceMappingURL=portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.js","sources":["../../../src/overlay/portal/portal.tsx"],"sourcesContent":["import React, { useState, useLayoutEffect } from 'react';\nimport { usePortalPlatform } from './portal_platform_context.js';\n\nexport interface PortalProps {\n children: React.ReactNode | React.ReactNode[];\n zIndex?: number;\n}\n\nexport const Portal = ({ children, zIndex }: PortalProps) => {\n const portalPlatform = usePortalPlatform();\n\n const [portal] = useState(() => {\n return portalPlatform.createPortal();\n });\n\n useLayoutEffect(() => {\n portal.setZIndex(zIndex);\n }, [portal, zIndex]);\n\n useLayoutEffect(() => {\n portalPlatform.mountPortal(portal);\n return () => portalPlatform.unmountPortal(portal);\n }, [portal, portalPlatform]);\n\n return portal.render(children);\n};\n"],"names":["Portal","children","zIndex","portalPlatform","usePortalPlatform","portal","useState","useLayoutEffect"],"mappings":";;AAQO,MAAMA,IAAS,CAAC,EAAE,UAAAC,GAAU,QAAAC,QAA0B;AAC3D,QAAMC,IAAiBC,EAAA,GAEjB,CAACC,CAAM,IAAIC,EAAS,MACjBH,EAAe,aAAA,CACvB;AAED,SAAAI,EAAgB,MAAM;AACpB,IAAAF,EAAO,UAAUH,CAAM;AAAA,EACzB,GAAG,CAACG,GAAQH,CAAM,CAAC,GAEnBK,EAAgB,OACdJ,EAAe,YAAYE,CAAM,GAC1B,MAAMF,EAAe,cAAcE,CAAM,IAC/C,CAACA,GAAQF,CAAc,CAAC,GAEpBE,EAAO,OAAOJ,CAAQ;AAC/B;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createPortal as e } from "react-dom";
|
|
2
|
-
import '
|
|
3
|
-
class s {
|
|
2
|
+
import '../../portal_platform.css';class s {
|
|
4
3
|
_window;
|
|
5
4
|
div;
|
|
6
5
|
hasMounted = !1;
|
|
@@ -14,7 +13,7 @@ class s {
|
|
|
14
13
|
return this.div == null ? null : e(t, this.div);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
class
|
|
16
|
+
class a {
|
|
18
17
|
_window;
|
|
19
18
|
_root;
|
|
20
19
|
_portals = [];
|
|
@@ -64,7 +63,7 @@ class n {
|
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
export {
|
|
67
|
-
|
|
66
|
+
a as PortalPlatform,
|
|
68
67
|
s as PortalPresenter
|
|
69
68
|
};
|
|
70
69
|
//# sourceMappingURL=portal_platform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal_platform.js","sources":["../../../src/overlay/portal/portal_platform.tsx"],"sourcesContent":["import React from 'react';\nimport { createPortal } from 'react-dom';\nimport './portal.css';\n\nexport class PortalPresenter {\n private _window: Window & typeof globalThis;\n div: HTMLDivElement;\n hasMounted = false;\n\n constructor(win = window, zIndex: number | string = '0') {\n this._window = win;\n this.div = this._window.document.createElement('div');\n this.div.className = 'portal';\n this.setZIndex(zIndex);\n }\n\n setZIndex(zIndex: number | string = '0') {\n if (this.div != null) {\n this.div.style.zIndex = zIndex.toString();\n }\n }\n\n render(children: React.ReactNode) {\n if (this.div == null) {\n return null;\n }\n\n return createPortal(children, this.div);\n }\n}\n\nexport class PortalPlatform {\n private _window: Window & typeof globalThis;\n private _root: HTMLElement;\n private _portals: PortalPresenter[] = [];\n\n readonly platform: HTMLDivElement;\n\n constructor(win = window, root: HTMLElement = win.document.body) {\n this._window = win;\n this._root = root;\n this.platform = this._getPlatformRoot();\n this.platform.classList.add('platform-root');\n }\n\n private _getPlatformRoot() {\n const existingPlatformRoot = this._window.document.body.querySelector(\n '.platform-root'\n ) as HTMLDivElement | null;\n if (!existingPlatformRoot) {\n const root = this._window.document.createElement('div');\n const portalPlatform = this._window.document.createElement('div');\n portalPlatform.id = 'portal-platform';\n portalPlatform.classList.add('portal-platform');\n root.appendChild(portalPlatform);\n\n return root;\n } else {\n return existingPlatformRoot;\n }\n }\n\n setZIndex(zIndex: number | string = 'auto') {\n if (this.platform != null) {\n this.platform.style.zIndex = zIndex.toString();\n }\n }\n\n setRoot(root: HTMLElement | null) {\n if (root !== this._root) {\n this.platform?.parentNode?.removeChild(this.platform);\n this._root = root == null ? document.body : root;\n this.showPlatform();\n }\n }\n\n createPortal() {\n const portal = new PortalPresenter(this._window);\n this._portals.push(portal);\n return portal;\n }\n\n mountPortal(portal: PortalPresenter) {\n portal.hasMounted = true;\n this.platform.firstElementChild?.appendChild(portal.div);\n this.showPlatform();\n }\n\n unmountPortal(portal: PortalPresenter) {\n this.removePortal(portal);\n }\n\n removePortal(portal: PortalPresenter) {\n const index = this._portals.indexOf(portal);\n if (index > -1) {\n portal.hasMounted = false;\n this._portals.splice(index, 1);\n this.platform.firstElementChild?.removeChild(portal.div);\n this.hidePlatformIfNecessary();\n }\n }\n\n showPlatform() {\n if (this.platform != null && this.platform.parentElement == null) {\n this._root.appendChild(this.platform);\n }\n }\n\n hidePlatformIfNecessary() {\n if (this._portals.length === 0 && this.platform.parentElement != null) {\n this._root.removeChild(this.platform);\n }\n }\n\n dispose() {\n if (this.platform != null && this._root.contains(this.platform)) {\n this._root.removeChild(this.platform);\n }\n }\n}\n"],"names":["PortalPresenter","win","zIndex","children","createPortal","PortalPlatform","root","existingPlatformRoot","portalPlatform","portal","index"],"mappings":"
|
|
1
|
+
{"version":3,"file":"portal_platform.js","sources":["../../../src/overlay/portal/portal_platform.tsx"],"sourcesContent":["import React from 'react';\nimport { createPortal } from 'react-dom';\nimport './portal.css';\n\nexport class PortalPresenter {\n private _window: Window & typeof globalThis;\n div: HTMLDivElement;\n hasMounted = false;\n\n constructor(win = window, zIndex: number | string = '0') {\n this._window = win;\n this.div = this._window.document.createElement('div');\n this.div.className = 'portal';\n this.setZIndex(zIndex);\n }\n\n setZIndex(zIndex: number | string = '0') {\n if (this.div != null) {\n this.div.style.zIndex = zIndex.toString();\n }\n }\n\n render(children: React.ReactNode) {\n if (this.div == null) {\n return null;\n }\n\n return createPortal(children, this.div);\n }\n}\n\nexport class PortalPlatform {\n private _window: Window & typeof globalThis;\n private _root: HTMLElement;\n private _portals: PortalPresenter[] = [];\n\n readonly platform: HTMLDivElement;\n\n constructor(win = window, root: HTMLElement = win.document.body) {\n this._window = win;\n this._root = root;\n this.platform = this._getPlatformRoot();\n this.platform.classList.add('platform-root');\n }\n\n private _getPlatformRoot() {\n const existingPlatformRoot = this._window.document.body.querySelector(\n '.platform-root'\n ) as HTMLDivElement | null;\n if (!existingPlatformRoot) {\n const root = this._window.document.createElement('div');\n const portalPlatform = this._window.document.createElement('div');\n portalPlatform.id = 'portal-platform';\n portalPlatform.classList.add('portal-platform');\n root.appendChild(portalPlatform);\n\n return root;\n } else {\n return existingPlatformRoot;\n }\n }\n\n setZIndex(zIndex: number | string = 'auto') {\n if (this.platform != null) {\n this.platform.style.zIndex = zIndex.toString();\n }\n }\n\n setRoot(root: HTMLElement | null) {\n if (root !== this._root) {\n this.platform?.parentNode?.removeChild(this.platform);\n this._root = root == null ? document.body : root;\n this.showPlatform();\n }\n }\n\n createPortal() {\n const portal = new PortalPresenter(this._window);\n this._portals.push(portal);\n return portal;\n }\n\n mountPortal(portal: PortalPresenter) {\n portal.hasMounted = true;\n this.platform.firstElementChild?.appendChild(portal.div);\n this.showPlatform();\n }\n\n unmountPortal(portal: PortalPresenter) {\n this.removePortal(portal);\n }\n\n removePortal(portal: PortalPresenter) {\n const index = this._portals.indexOf(portal);\n if (index > -1) {\n portal.hasMounted = false;\n this._portals.splice(index, 1);\n this.platform.firstElementChild?.removeChild(portal.div);\n this.hidePlatformIfNecessary();\n }\n }\n\n showPlatform() {\n if (this.platform != null && this.platform.parentElement == null) {\n this._root.appendChild(this.platform);\n }\n }\n\n hidePlatformIfNecessary() {\n if (this._portals.length === 0 && this.platform.parentElement != null) {\n this._root.removeChild(this.platform);\n }\n }\n\n dispose() {\n if (this.platform != null && this._root.contains(this.platform)) {\n this._root.removeChild(this.platform);\n }\n }\n}\n"],"names":["PortalPresenter","win","zIndex","children","createPortal","PortalPlatform","root","existingPlatformRoot","portalPlatform","portal","index"],"mappings":";AAIO,MAAMA,EAAgB;AAAA,EACnB;AAAA,EACR;AAAA,EACA,aAAa;AAAA,EAEb,YAAYC,IAAM,QAAQC,IAA0B,KAAK;AACvD,SAAK,UAAUD,GACf,KAAK,MAAM,KAAK,QAAQ,SAAS,cAAc,KAAK,GACpD,KAAK,IAAI,YAAY,UACrB,KAAK,UAAUC,CAAM;AAAA,EACvB;AAAA,EAEA,UAAUA,IAA0B,KAAK;AACvC,IAAI,KAAK,OAAO,SACd,KAAK,IAAI,MAAM,SAASA,EAAO,SAAA;AAAA,EAEnC;AAAA,EAEA,OAAOC,GAA2B;AAChC,WAAI,KAAK,OAAO,OACP,OAGFC,EAAaD,GAAU,KAAK,GAAG;AAAA,EACxC;AACF;AAEO,MAAME,EAAe;AAAA,EAClB;AAAA,EACA;AAAA,EACA,WAA8B,CAAA;AAAA,EAE7B;AAAA,EAET,YAAYJ,IAAM,QAAQK,IAAoBL,EAAI,SAAS,MAAM;AAC/D,SAAK,UAAUA,GACf,KAAK,QAAQK,GACb,KAAK,WAAW,KAAK,iBAAA,GACrB,KAAK,SAAS,UAAU,IAAI,eAAe;AAAA,EAC7C;AAAA,EAEQ,mBAAmB;AACzB,UAAMC,IAAuB,KAAK,QAAQ,SAAS,KAAK;AAAA,MACtD;AAAA,IAAA;AAEF,QAAKA;AASH,aAAOA;AATkB;AACzB,YAAMD,IAAO,KAAK,QAA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;AAAA,EAEA,UAAU;AACR,IAAI,KAAK,YAAY,QAAQ,KAAK,MAAM,SAAS,KAAK,QAAQ,KAC5D,KAAK,MAAM,YAAY,KAAK,QAAQ;AAAA,EAExC;AACF;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { VStack as
|
|
3
|
-
import e from "
|
|
4
|
-
import
|
|
5
|
-
import '../../tooltip.css';const m = "_tooltip_e324d7e",
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { VStack as i } from "../../stacks/v_stack.js";
|
|
3
|
+
import { clsx as e } from "clsx";
|
|
4
|
+
import l from "react";
|
|
5
|
+
import '../../tooltip.css';const m = "_tooltip_e324d7e", a = { tooltip: m }, u = l.forwardRef(function({ children: o, className: t, ...r }, p) {
|
|
6
|
+
return /* @__PURE__ */ s(
|
|
7
|
+
i,
|
|
8
8
|
{
|
|
9
|
-
ref:
|
|
9
|
+
ref: p,
|
|
10
10
|
as: "span",
|
|
11
|
-
className: e(t,
|
|
11
|
+
className: e(t, a.tooltip, "tooltip"),
|
|
12
12
|
...r,
|
|
13
13
|
children: o
|
|
14
14
|
}
|
|
15
15
|
);
|
|
16
16
|
});
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
u as Tooltip
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../../../src/overlay/tooltip/tooltip.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../stacks/v_stack.js';\nimport
|
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../../../src/overlay/tooltip/tooltip.tsx"],"sourcesContent":["import { VStack, type VStackProps } from '../../stacks/v_stack.js';\nimport { clsx } from 'clsx';\nimport React from 'react';\nimport styles from './tooltip.module.css';\n\nexport interface TooltipProps extends Omit<VStackProps, 'as' | 'children'> {\n children?: React.ReactNode;\n}\n\nexport const Tooltip = React.forwardRef<HTMLElement, TooltipProps>(function VPanel(\n { children, className, ...props }: TooltipProps,\n ref\n) {\n return (\n <VStack\n ref={ref}\n as=\"span\"\n className={clsx(className, styles.tooltip, 'tooltip')}\n {...props}\n >\n {children}\n </VStack>\n );\n});\n"],"names":["Tooltip","React","children","className","props","ref","jsx","VStack","clsx","styles"],"mappings":";;;;kDASaA,IAAUC,EAAM,WAAsC,SACjE,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAWG,EAAKL,GAAWM,EAAO,SAAS,SAAS;AAAA,MACnD,GAAGL;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._phone-number-input_5c4483d{position:relative;opacity:1;border-radius:0}._phone-number-input_5c4483d[data-has-phone-book=false]{border-end-end-radius:4px;border-start-end-radius:4px}._phone-number-input-select_a7b33ac{border-end-end-radius:0px;border-start-end-radius:0px}._phone-number-input_5c4483d>*{position:relative;z-index:1}._phone-number-input-select_a7b33ac:has(button){z-index:2}._phone-number-input-input_5b14556:has(input:focus),._phone-number-input-select_a7b33ac:focus,._phone-number-input-input_5b14556:has(input:focus-visible),._phone-number-input-select_a7b33ac:focus-visible{z-index:3}._phone-number-input-phone-book-popover_1511f35{border-radius:calc(4px * var(--scalar, 1));padding:8px;background-color:#fefefe;box-shadow:var(--raised-box-shadow),var(--drop-shadow-depth-3);min-width:calc(200px * var(--scalar, 1))}._phone-number-input-phone-book_7999ca1{border-start-start-radius:0px;border-end-start-radius:0px;height:calc(26px * var(--scalar, 1))!important;width:calc(26px * var(--scalar, 1))!important;min-height:calc(26px * var(--scalar, 1))!important;min-width:calc(26px * var(--scalar, 1))!important;max-height:calc(26px * var(--scalar, 1))!important;max-width:calc(26px * var(--scalar, 1))!important}
|
|
1
|
+
._phone-number-input_5c4483d{position:relative;opacity:1;border-radius:0}._phone-number-input_5c4483d[data-has-phone-book=false]{border-end-end-radius:4px;border-start-end-radius:4px}._phone-number-input-select_a7b33ac{border-end-end-radius:0px;border-start-end-radius:0px}._phone-number-input_5c4483d>*{position:relative;z-index:1}._phone-number-input-select_a7b33ac:has(button){z-index:2}._phone-number-input-input_5b14556:has(input:focus),._phone-number-input-select_a7b33ac:focus,._phone-number-input-input_5b14556:has(input:focus-visible),._phone-number-input-select_a7b33ac:focus-visible{z-index:3}._phone-number-input-phone-book-popover_1511f35{border-radius:calc(4px * var(--scalar, 1));padding:8px;background-color:#fefefe;box-shadow:var(--raised-box-shadow),var(--drop-shadow-depth-3);min-width:calc(200px * var(--scalar, 1))}._phone-number-input-phone-book_7999ca1{border-start-start-radius:0px;border-end-start-radius:0px;height:calc(26px * var(--scalar, 1))!important;width:calc(26px * var(--scalar, 1))!important;min-height:calc(26px * var(--scalar, 1))!important;min-width:calc(26px * var(--scalar, 1))!important;max-height:calc(26px * var(--scalar, 1))!important;max-width:calc(26px * var(--scalar, 1))!important}._phone-number-input-obfuscated_5a0ed8c{user-select:none;-webkit-user-select:none;cursor:default;width:100%;height:100%}._phone-number-input-obfuscated_5a0ed8c::selection{background:transparent}
|
package/dist/slim_button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._slim-button_188fdc3{min-height:auto}._slim-button_188fdc3[data-is-disabled=true]{pointer-events:none}
|
|
1
|
+
._slim-button_188fdc3{min-height:auto}._slim-button_188fdc3[data-is-disabled=true]{pointer-events:none}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { createVerticalResizeHandler as l } from "./resize_handlers.js";
|
|
3
|
-
import c from "
|
|
4
|
-
import '../../bottom_resize_handle.css';const
|
|
5
|
-
function
|
|
3
|
+
import { clsx as c } from "clsx";
|
|
4
|
+
import '../../bottom_resize_handle.css';const f = "_bottom-resize-handle_e3e2ef2", z = { "bottom-resize-handle": f };
|
|
5
|
+
function x({
|
|
6
6
|
targetRef: t,
|
|
7
7
|
handleProps: e,
|
|
8
8
|
onHeightResize: o,
|
|
@@ -12,22 +12,22 @@ function H({
|
|
|
12
12
|
t,
|
|
13
13
|
o,
|
|
14
14
|
s
|
|
15
|
-
), n = e?.offset ? e.offset : -8,
|
|
15
|
+
), n = e?.offset ? e.offset : -8, r = {
|
|
16
16
|
...e?.style,
|
|
17
17
|
bottom: `${n}px`,
|
|
18
18
|
height: e?.size || "16px"
|
|
19
19
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ m(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
|
-
className: c(
|
|
23
|
+
className: c(z["bottom-resize-handle"], "bottom-resize-handle"),
|
|
24
24
|
onMouseDown: i,
|
|
25
|
-
style:
|
|
25
|
+
style: r,
|
|
26
26
|
children: e?.children
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
x as BottomResizeHandle
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=bottom_resize_handle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom_resize_handle.js","sources":["../../../src/stacks/box/bottom_resize_handle.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './bottom_resize_handle.module.css';\nimport { createVerticalResizeHandler } from './resize_handlers.js';\nimport
|
|
1
|
+
{"version":3,"file":"bottom_resize_handle.js","sources":["../../../src/stacks/box/bottom_resize_handle.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './bottom_resize_handle.module.css';\nimport { createVerticalResizeHandler } from './resize_handlers.js';\nimport { clsx } from 'clsx';\nimport type { HandleProps } from './handle_props.js';\n\nexport interface BottomResizeHandleProps {\n targetRef: React.MutableRefObject<HTMLElement | null>;\n handleProps?: HandleProps;\n onHeightResize?: (value: number) => void;\n onHeightResizeEnd?: (value: number) => void;\n}\n\nexport function BottomResizeHandle({\n targetRef,\n handleProps,\n onHeightResize,\n onHeightResizeEnd,\n}: BottomResizeHandleProps) {\n const resizeHandler = createVerticalResizeHandler(\n targetRef,\n onHeightResize,\n onHeightResizeEnd\n );\n const offset = handleProps?.offset ? handleProps.offset : -8;\n\n const bottomResizeHandleStyle: React.CSSProperties = {\n ...handleProps?.style,\n bottom: `${offset}px`,\n height: handleProps?.size || '16px',\n };\n\n return (\n <div\n className={clsx(styles['bottom-resize-handle'], 'bottom-resize-handle')}\n onMouseDown={resizeHandler}\n style={bottomResizeHandleStyle}\n >\n {handleProps?.children}\n </div>\n );\n}\n"],"names":["BottomResizeHandle","targetRef","handleProps","onHeightResize","onHeightResizeEnd","resizeHandler","createVerticalResizeHandler","offset","bottomResizeHandleStyle","jsx","clsx","styles"],"mappings":";;;;AAaO,SAASA,EAAmB;AAAA,EACjC,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,GAA4B;AAC1B,QAAMC,IAAgBC;AAAA,IACpBL;AAAA,IACAE;AAAA,IACAC;AAAA,EAAA,GAEIG,IAASL,GAAa,SAASA,EAAY,SAAS,IAEpDM,IAA+C;AAAA,IACnD,GAAGN,GAAa;AAAA,IAChB,QAAQ,GAAGK,CAAM;AAAA,IACjB,QAAQL,GAAa,QAAQ;AAAA,EAAA;AAG/B,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAKC,EAAO,sBAAsB,GAAG,sBAAsB;AAAA,MACtE,aAAaN;AAAA,MACb,OAAOG;AAAA,MAEN,UAAAN,GAAa;AAAA,IAAA;AAAA,EAAA;AAGpB;"}
|
package/dist/stacks/box/box.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as h, jsx as
|
|
1
|
+
import { jsxs as h, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import "../../utils/focus_redirect.js";
|
|
3
3
|
import "../../utils/click_away_listener.js";
|
|
4
4
|
import "../../utils/scroll_away_listener.js";
|
|
5
5
|
import O, { useRef as oo } from "react";
|
|
6
6
|
import { useForkRef as ro } from "../../utils/hooks/use_fork_ref.js";
|
|
7
7
|
import "../../utils/hooks/use_resize_observer.js";
|
|
8
|
-
import { LeftResizeHandle as
|
|
9
|
-
import { RightResizeHandle as
|
|
8
|
+
import { LeftResizeHandle as to } from "./left_resize_handle.js";
|
|
9
|
+
import { RightResizeHandle as ao } from "./right_resize_handle.js";
|
|
10
10
|
import { BottomResizeHandle as eo } from "./bottom_resize_handle.js";
|
|
11
|
-
import { EndResizeHandle as
|
|
12
|
-
import { StartResizeHandle as
|
|
11
|
+
import { EndResizeHandle as fo } from "./end_resize_handle.js";
|
|
12
|
+
import { StartResizeHandle as so } from "./start_resize_handle.js";
|
|
13
13
|
import { TopResizeHandle as lo } from "./top_resize_handle.js";
|
|
14
|
-
import mo from "
|
|
14
|
+
import { clsx as mo } from "clsx";
|
|
15
15
|
import { isCustomSizeProp as y } from "../utils/isCustomSizeProp.js";
|
|
16
16
|
import { removeUndefinedProperties as no } from "../utils/remove_undefined_properties.js";
|
|
17
17
|
import { s as k } from "../../stack.module-CBV1f12Z.js";
|
|
18
|
-
const
|
|
18
|
+
const _o = O.forwardRef(function({
|
|
19
19
|
style: v,
|
|
20
20
|
className: P,
|
|
21
21
|
as: H = "div",
|
|
@@ -23,14 +23,14 @@ const Yo = O.forwardRef(function({
|
|
|
23
23
|
width: r = "default",
|
|
24
24
|
minWidth: b,
|
|
25
25
|
maxWidth: j,
|
|
26
|
-
height:
|
|
26
|
+
height: t = "default",
|
|
27
27
|
minHeight: w,
|
|
28
|
-
maxHeight:
|
|
29
|
-
zIndex:
|
|
30
|
-
padding:
|
|
31
|
-
paddingInline:
|
|
32
|
-
paddingBlock:
|
|
33
|
-
margin:
|
|
28
|
+
maxHeight: Y,
|
|
29
|
+
zIndex: _,
|
|
30
|
+
padding: A,
|
|
31
|
+
paddingInline: B,
|
|
32
|
+
paddingBlock: C,
|
|
33
|
+
margin: N,
|
|
34
34
|
marginBlock: U,
|
|
35
35
|
marginInline: q,
|
|
36
36
|
marginInlineStart: D,
|
|
@@ -40,7 +40,7 @@ const Yo = O.forwardRef(function({
|
|
|
40
40
|
overflow: K,
|
|
41
41
|
overflowX: M,
|
|
42
42
|
overflowY: Q,
|
|
43
|
-
enableResizeOnTop:
|
|
43
|
+
enableResizeOnTop: s = !1,
|
|
44
44
|
enableResizeOnEnd: l = !1,
|
|
45
45
|
enableResizeOnBottom: m = !1,
|
|
46
46
|
enableResizeOnStart: n = !1,
|
|
@@ -48,25 +48,25 @@ const Yo = O.forwardRef(function({
|
|
|
48
48
|
enableResizeOnRight: p = !1,
|
|
49
49
|
onWidthResize: e,
|
|
50
50
|
onHeightResize: d,
|
|
51
|
-
onWidthResizeEnd:
|
|
51
|
+
onWidthResizeEnd: f,
|
|
52
52
|
onHeightResizeEnd: u,
|
|
53
53
|
horizontalHandleProps: x,
|
|
54
54
|
verticalHandleProps: i,
|
|
55
55
|
...X
|
|
56
56
|
}, Z) {
|
|
57
|
-
const $ = H, o = oo(null), L = ro(Z, o), R = l || n || c || p, T = m ||
|
|
58
|
-
g && (r = "100%", console.warn("You cannot have a resizable box and flex simultaneously")), S && (
|
|
57
|
+
const $ = H, o = oo(null), L = ro(Z, o), R = l || n || c || p, T = m || s, z = R, E = T, g = z && r === "flex", S = E && t === "flex", F = !g && !S && (r === "flex" || t === "flex");
|
|
58
|
+
g && (r = "100%", console.warn("You cannot have a resizable box and flex simultaneously")), S && (t = "auto", console.warn("You cannot have a resizable box and flex simultaneously"));
|
|
59
59
|
const W = {
|
|
60
60
|
width: y(r) ? void 0 : r,
|
|
61
61
|
minWidth: b,
|
|
62
62
|
maxWidth: j,
|
|
63
|
-
height: y(
|
|
63
|
+
height: y(t) ? void 0 : t,
|
|
64
64
|
minHeight: w,
|
|
65
|
-
maxHeight:
|
|
66
|
-
padding:
|
|
67
|
-
paddingInline:
|
|
68
|
-
paddingBlock:
|
|
69
|
-
margin:
|
|
65
|
+
maxHeight: Y,
|
|
66
|
+
padding: A,
|
|
67
|
+
paddingInline: B,
|
|
68
|
+
paddingBlock: C,
|
|
69
|
+
margin: N,
|
|
70
70
|
marginBlock: U,
|
|
71
71
|
marginInline: q,
|
|
72
72
|
marginInlineStart: D,
|
|
@@ -76,18 +76,18 @@ const Yo = O.forwardRef(function({
|
|
|
76
76
|
overflow: K,
|
|
77
77
|
overflowX: M,
|
|
78
78
|
overflowY: Q,
|
|
79
|
-
zIndex:
|
|
79
|
+
zIndex: _
|
|
80
80
|
};
|
|
81
81
|
return /* @__PURE__ */ h(
|
|
82
82
|
$,
|
|
83
83
|
{
|
|
84
84
|
"data-enabled-resize-on-start": String(n),
|
|
85
85
|
"data-enabled-resize-on-end": String(l),
|
|
86
|
-
"data-enabled-resize-on-top": String(
|
|
86
|
+
"data-enabled-resize-on-top": String(s),
|
|
87
87
|
"data-enabled-resize-on-bottom": String(m),
|
|
88
88
|
"data_enabled-resize-on-left": String(c),
|
|
89
89
|
"data_enabled-resize-on-right": String(p),
|
|
90
|
-
"data-height":
|
|
90
|
+
"data-height": t,
|
|
91
91
|
"data-width": r,
|
|
92
92
|
ref: L,
|
|
93
93
|
style: {
|
|
@@ -104,7 +104,7 @@ const Yo = O.forwardRef(function({
|
|
|
104
104
|
...X,
|
|
105
105
|
children: [
|
|
106
106
|
V,
|
|
107
|
-
|
|
107
|
+
s && /* @__PURE__ */ a(
|
|
108
108
|
lo,
|
|
109
109
|
{
|
|
110
110
|
onHeightResize: d,
|
|
@@ -113,7 +113,7 @@ const Yo = O.forwardRef(function({
|
|
|
113
113
|
handleProps: x
|
|
114
114
|
}
|
|
115
115
|
),
|
|
116
|
-
m && /* @__PURE__ */
|
|
116
|
+
m && /* @__PURE__ */ a(
|
|
117
117
|
eo,
|
|
118
118
|
{
|
|
119
119
|
onHeightResize: d,
|
|
@@ -122,38 +122,38 @@ const Yo = O.forwardRef(function({
|
|
|
122
122
|
handleProps: i
|
|
123
123
|
}
|
|
124
124
|
),
|
|
125
|
-
n && /* @__PURE__ */
|
|
126
|
-
|
|
125
|
+
n && /* @__PURE__ */ a(
|
|
126
|
+
so,
|
|
127
127
|
{
|
|
128
128
|
onWidthResize: e,
|
|
129
|
-
onWidthResizeEnd:
|
|
129
|
+
onWidthResizeEnd: f,
|
|
130
130
|
targetRef: o,
|
|
131
131
|
handleProps: x
|
|
132
132
|
}
|
|
133
133
|
),
|
|
134
|
-
l && /* @__PURE__ */
|
|
135
|
-
|
|
134
|
+
l && /* @__PURE__ */ a(
|
|
135
|
+
fo,
|
|
136
136
|
{
|
|
137
137
|
onWidthResize: e,
|
|
138
|
-
onWidthResizeEnd:
|
|
138
|
+
onWidthResizeEnd: f,
|
|
139
139
|
targetRef: o,
|
|
140
140
|
handleProps: x
|
|
141
141
|
}
|
|
142
142
|
),
|
|
143
|
-
c && /* @__PURE__ */
|
|
144
|
-
|
|
143
|
+
c && /* @__PURE__ */ a(
|
|
144
|
+
to,
|
|
145
145
|
{
|
|
146
146
|
onWidthResize: e,
|
|
147
|
-
onWidthResizeEnd:
|
|
147
|
+
onWidthResizeEnd: f,
|
|
148
148
|
targetRef: o,
|
|
149
149
|
handleProps: i
|
|
150
150
|
}
|
|
151
151
|
),
|
|
152
|
-
p && /* @__PURE__ */
|
|
153
|
-
|
|
152
|
+
p && /* @__PURE__ */ a(
|
|
153
|
+
ao,
|
|
154
154
|
{
|
|
155
155
|
onWidthResize: e,
|
|
156
|
-
onWidthResizeEnd:
|
|
156
|
+
onWidthResizeEnd: f,
|
|
157
157
|
targetRef: o,
|
|
158
158
|
handleProps: i
|
|
159
159
|
}
|
|
@@ -163,6 +163,6 @@ const Yo = O.forwardRef(function({
|
|
|
163
163
|
);
|
|
164
164
|
});
|
|
165
165
|
export {
|
|
166
|
-
|
|
166
|
+
_o as Box
|
|
167
167
|
};
|
|
168
168
|
//# sourceMappingURL=box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.js","sources":["../../../src/stacks/box/box.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport React, { CSSProperties, HTMLAttributes, useRef } from 'react';\nimport { LeftResizeHandle } from './left_resize_handle.js';\nimport { RightResizeHandle } from './right_resize_handle.js';\nimport { BottomResizeHandle } from './bottom_resize_handle.js';\nimport { EndResizeHandle } from './end_resize_handle.js';\nimport { StartResizeHandle } from './start_resize_handle.js';\nimport { TopResizeHandle } from './top_resize_handle.js';\nimport classNames from 'classnames';\nimport { isCustomSizeProp } from '../utils/isCustomSizeProp.js';\nimport { removeUndefinedProperties } from '../utils/remove_undefined_properties.js';\nimport styles from '../stack.module.css';\nimport { HandleProps } from './handle_props.js';\n\nexport interface BoxProps extends HTMLAttributes<HTMLElement> {\n as?: string;\n style?: React.CSSProperties;\n className?: string;\n children?: React.ReactNode;\n width?: 'default' | 'flex' | 'auto' | string | number;\n minWidth?: CSSProperties['minWidth'];\n maxWidth?: CSSProperties['maxWidth'];\n height?: 'default' | 'flex' | 'auto' | string | number;\n minHeight?: CSSProperties['minHeight'];\n maxHeight?: CSSProperties['maxHeight'];\n zIndex?: number;\n padding?: CSSProperties['padding'];\n paddingInline?: CSSProperties['paddingInline'];\n paddingBlock?: CSSProperties['paddingBlock'];\n margin?: CSSProperties['margin'];\n marginBlock?: CSSProperties['marginBlock'];\n marginInline?: CSSProperties['marginInline'];\n marginInlineStart?: CSSProperties['marginInlineStart'];\n marginInlineEnd?: CSSProperties['marginInlineEnd'];\n marginTop?: CSSProperties['marginTop'];\n marginBottom?: CSSProperties['marginBottom'];\n overflow?: React.CSSProperties['overflow'];\n overflowX?: React.CSSProperties['overflowX'];\n overflowY?: React.CSSProperties['overflowY'];\n enableResizeOnTop?: boolean;\n enableResizeOnEnd?: boolean;\n enableResizeOnBottom?: boolean;\n enableResizeOnStart?: boolean;\n enableResizeOnLeft?: boolean;\n enableResizeOnRight?: boolean;\n horizontalHandleProps?: HandleProps;\n verticalHandleProps?: HandleProps;\n onWidthResize?: (width: number) => void;\n onHeightResize?: (width: number) => void;\n onWidthResizeEnd?: (width: number) => void;\n onHeightResizeEnd?: (width: number) => void;\n}\n\nexport const Box = React.forwardRef<HTMLElement, BoxProps>(function Box(\n {\n style,\n className,\n as = 'div',\n children,\n width = 'default',\n minWidth,\n maxWidth,\n height = 'default',\n minHeight,\n maxHeight,\n zIndex,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n enableResizeOnTop = false,\n enableResizeOnEnd = false,\n enableResizeOnBottom = false,\n enableResizeOnStart = false,\n enableResizeOnLeft = false,\n enableResizeOnRight = false,\n onWidthResize,\n onHeightResize,\n onWidthResizeEnd,\n onHeightResizeEnd,\n horizontalHandleProps,\n verticalHandleProps,\n ...otherProps\n }: BoxProps,\n ref\n) {\n const As = as as React.ElementType;\n const boxRef = useRef<HTMLElement | null>(null);\n const forkedRef = useForkRef(ref, boxRef);\n const hasHorizontalResize =\n enableResizeOnEnd || enableResizeOnStart || enableResizeOnLeft || enableResizeOnRight;\n const hasVerticalResize = enableResizeOnBottom || enableResizeOnTop;\n\n const cannotHorizontalFlex = hasHorizontalResize;\n const cannotVerticalFlex = hasVerticalResize;\n const warnHorizontalFlex = cannotHorizontalFlex && width === 'flex';\n const warnVerticalFlex = cannotVerticalFlex && height === 'flex';\n const isFlexing =\n !warnHorizontalFlex && !warnVerticalFlex && (width === 'flex' || height === 'flex');\n\n if (warnHorizontalFlex) {\n width = '100%';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n if (warnVerticalFlex) {\n height = 'auto';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n const propStyles = {\n width: !isCustomSizeProp(width) ? width : undefined,\n minWidth,\n maxWidth,\n height: !isCustomSizeProp(height) ? height : undefined,\n minHeight,\n maxHeight,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n zIndex,\n };\n\n return (\n <As\n data-enabled-resize-on-start={String(enableResizeOnStart)}\n data-enabled-resize-on-end={String(enableResizeOnEnd)}\n data-enabled-resize-on-top={String(enableResizeOnTop)}\n data-enabled-resize-on-bottom={String(enableResizeOnBottom)}\n data_enabled-resize-on-left={String(enableResizeOnLeft)}\n data_enabled-resize-on-right={String(enableResizeOnRight)}\n data-height={height}\n data-width={width}\n ref={forkedRef}\n style={{\n ...removeUndefinedProperties(propStyles),\n ...style,\n }}\n className={classNames(\n styles['box'],\n className,\n isFlexing && 'stack-flex',\n isFlexing && styles['stack-flex'],\n 'box'\n )}\n {...otherProps}\n >\n {children}\n {enableResizeOnTop && (\n <TopResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnBottom && (\n <BottomResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnStart && (\n <StartResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnEnd && (\n <EndResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnLeft && (\n <LeftResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnRight && (\n <RightResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n </As>\n );\n});\n"],"names":["Box","React","style","className","as","children","width","minWidth","maxWidth","height","minHeight","maxHeight","zIndex","padding","paddingInline","paddingBlock","margin","marginBlock","marginInline","marginInlineStart","marginInlineEnd","marginTop","marginBottom","overflow","overflowX","overflowY","enableResizeOnTop","enableResizeOnEnd","enableResizeOnBottom","enableResizeOnStart","enableResizeOnLeft","enableResizeOnRight","onWidthResize","onHeightResize","onWidthResizeEnd","onHeightResizeEnd","horizontalHandleProps","verticalHandleProps","otherProps","ref","As","boxRef","useRef","forkedRef","useForkRef","hasHorizontalResize","hasVerticalResize","cannotHorizontalFlex","cannotVerticalFlex","warnHorizontalFlex","warnVerticalFlex","isFlexing","propStyles","isCustomSizeProp","jsxs","removeUndefinedProperties","classNames","styles","jsx","TopResizeHandle","BottomResizeHandle","StartResizeHandle","EndResizeHandle","LeftResizeHandle","RightResizeHandle"],"mappings":";;;;;;;;;;;;;;;;;AAqDO,MAAMA,KAAMC,EAAM,WAAkC,SACzD;AAAA,EACE,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC,IAAK;AAAA,EACL,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,mBAAA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ACX,aAAaJ;AAAA,UAAA;AAAA,QAAA;AAAA,QAGhBN,KACC,gBAAA2B;AAAA,UAACM;AAAA,UAAA;AAAA,YACC,eAAAhC;AAAA,YACA,kBAAAE;AAAA,YACA,WAAWO;AAAA,YACX,aAAaJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACf;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"box.js","sources":["../../../src/stacks/box/box.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport React, { CSSProperties, HTMLAttributes, useRef } from 'react';\nimport { LeftResizeHandle } from './left_resize_handle.js';\nimport { RightResizeHandle } from './right_resize_handle.js';\nimport { BottomResizeHandle } from './bottom_resize_handle.js';\nimport { EndResizeHandle } from './end_resize_handle.js';\nimport { StartResizeHandle } from './start_resize_handle.js';\nimport { TopResizeHandle } from './top_resize_handle.js';\nimport { clsx } from 'clsx';\nimport { isCustomSizeProp } from '../utils/isCustomSizeProp.js';\nimport { removeUndefinedProperties } from '../utils/remove_undefined_properties.js';\nimport styles from '../stack.module.css';\nimport { HandleProps } from './handle_props.js';\n\nexport interface BoxProps extends HTMLAttributes<HTMLElement> {\n as?: string;\n style?: React.CSSProperties;\n className?: string;\n children?: React.ReactNode;\n width?: 'default' | 'flex' | 'auto' | string | number;\n minWidth?: CSSProperties['minWidth'];\n maxWidth?: CSSProperties['maxWidth'];\n height?: 'default' | 'flex' | 'auto' | string | number;\n minHeight?: CSSProperties['minHeight'];\n maxHeight?: CSSProperties['maxHeight'];\n zIndex?: number;\n padding?: CSSProperties['padding'];\n paddingInline?: CSSProperties['paddingInline'];\n paddingBlock?: CSSProperties['paddingBlock'];\n margin?: CSSProperties['margin'];\n marginBlock?: CSSProperties['marginBlock'];\n marginInline?: CSSProperties['marginInline'];\n marginInlineStart?: CSSProperties['marginInlineStart'];\n marginInlineEnd?: CSSProperties['marginInlineEnd'];\n marginTop?: CSSProperties['marginTop'];\n marginBottom?: CSSProperties['marginBottom'];\n overflow?: React.CSSProperties['overflow'];\n overflowX?: React.CSSProperties['overflowX'];\n overflowY?: React.CSSProperties['overflowY'];\n enableResizeOnTop?: boolean;\n enableResizeOnEnd?: boolean;\n enableResizeOnBottom?: boolean;\n enableResizeOnStart?: boolean;\n enableResizeOnLeft?: boolean;\n enableResizeOnRight?: boolean;\n horizontalHandleProps?: HandleProps;\n verticalHandleProps?: HandleProps;\n onWidthResize?: (width: number) => void;\n onHeightResize?: (width: number) => void;\n onWidthResizeEnd?: (width: number) => void;\n onHeightResizeEnd?: (width: number) => void;\n}\n\nexport const Box = React.forwardRef<HTMLElement, BoxProps>(function Box(\n {\n style,\n className,\n as = 'div',\n children,\n width = 'default',\n minWidth,\n maxWidth,\n height = 'default',\n minHeight,\n maxHeight,\n zIndex,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n enableResizeOnTop = false,\n enableResizeOnEnd = false,\n enableResizeOnBottom = false,\n enableResizeOnStart = false,\n enableResizeOnLeft = false,\n enableResizeOnRight = false,\n onWidthResize,\n onHeightResize,\n onWidthResizeEnd,\n onHeightResizeEnd,\n horizontalHandleProps,\n verticalHandleProps,\n ...otherProps\n }: BoxProps,\n ref\n) {\n const As = as as React.ElementType;\n const boxRef = useRef<HTMLElement | null>(null);\n const forkedRef = useForkRef(ref, boxRef);\n const hasHorizontalResize =\n enableResizeOnEnd || enableResizeOnStart || enableResizeOnLeft || enableResizeOnRight;\n const hasVerticalResize = enableResizeOnBottom || enableResizeOnTop;\n\n const cannotHorizontalFlex = hasHorizontalResize;\n const cannotVerticalFlex = hasVerticalResize;\n const warnHorizontalFlex = cannotHorizontalFlex && width === 'flex';\n const warnVerticalFlex = cannotVerticalFlex && height === 'flex';\n const isFlexing =\n !warnHorizontalFlex && !warnVerticalFlex && (width === 'flex' || height === 'flex');\n\n if (warnHorizontalFlex) {\n width = '100%';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n if (warnVerticalFlex) {\n height = 'auto';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n const propStyles = {\n width: !isCustomSizeProp(width) ? width : undefined,\n minWidth,\n maxWidth,\n height: !isCustomSizeProp(height) ? height : undefined,\n minHeight,\n maxHeight,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n zIndex,\n };\n\n return (\n <As\n data-enabled-resize-on-start={String(enableResizeOnStart)}\n data-enabled-resize-on-end={String(enableResizeOnEnd)}\n data-enabled-resize-on-top={String(enableResizeOnTop)}\n data-enabled-resize-on-bottom={String(enableResizeOnBottom)}\n data_enabled-resize-on-left={String(enableResizeOnLeft)}\n data_enabled-resize-on-right={String(enableResizeOnRight)}\n data-height={height}\n data-width={width}\n ref={forkedRef}\n style={{\n ...removeUndefinedProperties(propStyles),\n ...style,\n }}\n className={clsx(\n styles['box'],\n className,\n isFlexing && 'stack-flex',\n isFlexing && styles['stack-flex'],\n 'box'\n )}\n {...otherProps}\n >\n {children}\n {enableResizeOnTop && (\n <TopResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnBottom && (\n <BottomResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnStart && (\n <StartResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnEnd && (\n <EndResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnLeft && (\n <LeftResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnRight && (\n <RightResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n </As>\n );\n});\n"],"names":["Box","React","style","className","as","children","width","minWidth","maxWidth","height","minHeight","maxHeight","zIndex","padding","paddingInline","paddingBlock","margin","marginBlock","marginInline","marginInlineStart","marginInlineEnd","marginTop","marginBottom","overflow","overflowX","overflowY","enableResizeOnTop","enableResizeOnEnd","enableResizeOnBottom","enableResizeOnStart","enableResizeOnLeft","enableResizeOnRight","onWidthResize","onHeightResize","onWidthResizeEnd","onHeightResizeEnd","horizontalHandleProps","verticalHandleProps","otherProps","ref","As","boxRef","useRef","forkedRef","useForkRef","hasHorizontalResize","hasVerticalResize","cannotHorizontalFlex","cannotVerticalFlex","warnHorizontalFlex","warnVerticalFlex","isFlexing","propStyles","isCustomSizeProp","jsxs","removeUndefinedProperties","clsx","styles","jsx","TopResizeHandle","BottomResizeHandle","StartResizeHandle","EndResizeHandle","LeftResizeHandle","RightResizeHandle"],"mappings":";;;;;;;;;;;;;;;;;AAqDO,MAAMA,KAAMC,EAAM,WAAkC,SACzD;AAAA,EACE,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC,IAAK;AAAA,EACL,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC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