@tcn/ui 0.2.0 → 0.3.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/Color-ASIRERSW-B4GaVKuQ.js +990 -0
- package/dist/Color-ASIRERSW-B4GaVKuQ.js.map +1 -0
- package/dist/WithTooltip-IO6J4KBT-B1oq93K5.js +1485 -0
- package/dist/WithTooltip-IO6J4KBT-B1oq93K5.js.map +1 -0
- package/dist/actions/__docs__/components/gallery.d.ts +8 -0
- package/dist/actions/__docs__/components/gallery.d.ts.map +1 -0
- package/dist/actions/__docs__/components/gallery.js +20 -0
- package/dist/actions/__docs__/components/gallery.js.map +1 -0
- package/dist/actions/__docs__/components/showcase.d.ts +27 -0
- package/dist/actions/__docs__/components/showcase.d.ts.map +1 -0
- package/dist/actions/__docs__/components/showcase.js +15 -0
- package/dist/actions/__docs__/components/showcase.js.map +1 -0
- package/dist/actions/button/base_button/base_button.d.ts +2 -0
- package/dist/actions/button/base_button/base_button.d.ts.map +1 -1
- package/dist/actions/button/base_button/base_button.js +18 -16
- package/dist/actions/button/base_button/base_button.js.map +1 -1
- package/dist/actions/button/button/button.js +6 -6
- package/dist/actions/button/button_group/button_group.js +1 -1
- package/dist/actions/button/select_group/select_group.js +13 -13
- package/dist/actions/button/select_group/single_select_group.js +6 -6
- package/dist/actions/button/slim_button/slim_button.js +2 -2
- package/dist/actions/types.d.ts +2 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/types.js +2 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/divider.module-FptFV0PX.js +5 -0
- package/dist/divider.module-FptFV0PX.js.map +1 -0
- package/dist/feedback/loading/loading.js +12 -12
- package/dist/feedback/loading/loading.js.map +1 -1
- package/dist/feedback/progress/progress_bar.js +1 -1
- package/dist/form/field/common/field_control/field_control.js +8 -8
- package/dist/form/field/common/status_input/status_input.js +6 -6
- package/dist/form/field/field.js +6 -6
- package/dist/form/field/h_field/h_field.js +11 -11
- package/dist/form/field/v_field/v_field.js +10 -10
- package/dist/form/field_set/field_set.js +3 -3
- package/dist/formatter-QJ4M4OGQ-DaIl2Wi_.js +6 -0
- package/dist/formatter-QJ4M4OGQ-DaIl2Wi_.js.map +1 -0
- package/dist/frame.css +1 -0
- package/dist/gallery.css +1 -0
- package/dist/inputs/checkbox/checkbox.js +11 -11
- package/dist/inputs/color_input/color_input.js +1 -1
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/color_input/color_picker.js +6 -6
- package/dist/inputs/combo_box/combo_box.js +17 -17
- package/dist/inputs/date_picker/date_picker.js +19 -19
- package/dist/inputs/date_picker/date_picker_body.js +2 -2
- package/dist/inputs/date_picker/date_picker_input.js +20 -20
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +1 -1
- package/dist/inputs/input/input.js +5 -5
- package/dist/inputs/mask_input/key_capture_input.js +8 -8
- package/dist/inputs/mask_input/mask_input.js +5 -5
- package/dist/inputs/multi_combo_box/multi_combo_box.js +17 -17
- package/dist/inputs/multiselect/multiselect.js +14 -14
- package/dist/inputs/multiselect/multiselect_row.js +8 -8
- package/dist/inputs/phone_number_input/phone_number_input.js +12 -12
- package/dist/inputs/radio/radio.js +10 -10
- package/dist/inputs/radio/radio_row.js +3 -3
- package/dist/inputs/select/select.js +15 -15
- package/dist/inputs/slider/slider.js +11 -11
- package/dist/inputs/suggestions/suggestion_list.js +2 -2
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +5 -5
- package/dist/inputs/textarea/textarea.js +7 -7
- package/dist/inputs/unit_input/unit_input.js +5 -5
- package/dist/layouts/body/h_body.js +7 -7
- package/dist/layouts/body/v_body.js +6 -6
- package/dist/layouts/column/column.js +17 -17
- package/dist/layouts/divider/divider.js +24 -23
- package/dist/layouts/divider/divider.js.map +1 -1
- package/dist/layouts/footer/footer.js +7 -7
- package/dist/layouts/grid/grid.js +24 -24
- package/dist/layouts/header/header.js +2 -2
- package/dist/layouts/index.d.ts +6 -5
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +28 -26
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/list/item.js +2 -2
- package/dist/layouts/list/list.js +7 -7
- package/dist/layouts/list/section_header.js +6 -6
- package/dist/layouts/scaffold/scaffold.d.ts +9 -0
- package/dist/layouts/scaffold/scaffold.d.ts.map +1 -0
- package/dist/layouts/scaffold/scaffold.js +55 -0
- package/dist/layouts/scaffold/scaffold.js.map +1 -0
- package/dist/layouts/sidebar_end/sidebar_end.js +14 -14
- package/dist/layouts/sidebar_start/sidebar_start.js +10 -10
- package/dist/layouts/utility_bar/utility_bar.js +10 -10
- package/dist/modal.css +1 -1
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +22 -5
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/overlay/index.d.ts +9 -2
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/index.js +22 -10
- package/dist/overlay/index.js.map +1 -1
- package/dist/overlay/menu/menu.d.ts +1 -1
- package/dist/overlay/menu/menu.d.ts.map +1 -1
- package/dist/overlay/menu/menu.js +36 -36
- package/dist/overlay/menu/menu.js.map +1 -1
- package/dist/overlay/popper/base/base_popper.d.ts +11 -0
- package/dist/overlay/popper/base/base_popper.d.ts.map +1 -0
- package/dist/overlay/popper/base/base_popper.js +27 -0
- package/dist/overlay/popper/base/base_popper.js.map +1 -0
- package/dist/overlay/popper/base/dismissal_decorator.d.ts +16 -0
- package/dist/overlay/popper/base/dismissal_decorator.d.ts.map +1 -0
- package/dist/overlay/popper/base/dismissal_decorator.js +69 -0
- package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -0
- package/dist/overlay/popper/context_popper.d.ts +11 -0
- package/dist/overlay/popper/context_popper.d.ts.map +1 -0
- package/dist/overlay/popper/context_popper.js +33 -0
- package/dist/overlay/popper/context_popper.js.map +1 -0
- package/dist/overlay/popper/element_popper.d.ts +7 -0
- package/dist/overlay/popper/element_popper.d.ts.map +1 -0
- package/dist/overlay/popper/element_popper.js +33 -0
- package/dist/overlay/popper/element_popper.js.map +1 -0
- package/dist/overlay/popper/hooks/use_context_trigger.d.ts +7 -0
- package/dist/overlay/popper/hooks/use_context_trigger.d.ts.map +1 -0
- package/dist/overlay/popper/hooks/use_context_trigger.js +31 -0
- package/dist/overlay/popper/hooks/use_context_trigger.js.map +1 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.d.ts +6 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.d.ts.map +1 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.js +17 -0
- package/dist/overlay/popper/hooks/use_hover_trigger.js.map +1 -0
- package/dist/overlay/popper/hooks/use_restore_focus.d.ts +2 -0
- package/dist/overlay/popper/hooks/use_restore_focus.d.ts.map +1 -0
- package/dist/overlay/popper/hooks/use_restore_focus.js +18 -0
- package/dist/overlay/popper/hooks/use_restore_focus.js.map +1 -0
- package/dist/overlay/popper/legacy/popper.d.ts.map +1 -0
- package/dist/overlay/popper/{popper.js → legacy/popper.js} +6 -6
- package/dist/overlay/popper/legacy/popper.js.map +1 -0
- package/dist/overlay/popper/preview_popper.d.ts +7 -0
- package/dist/overlay/popper/preview_popper.d.ts.map +1 -0
- package/dist/overlay/popper/preview_popper.js +46 -0
- package/dist/overlay/popper/preview_popper.js.map +1 -0
- package/dist/overlay/portal/portal_platform_context.js +4 -4
- package/dist/overlay/tethered/element_tethered.d.ts +8 -0
- package/dist/overlay/tethered/element_tethered.d.ts.map +1 -0
- package/dist/overlay/tethered/element_tethered.js +33 -0
- package/dist/overlay/tethered/element_tethered.js.map +1 -0
- package/dist/overlay/tethered/hooks/calculate_position.d.ts +19 -0
- package/dist/overlay/tethered/hooks/calculate_position.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/calculate_position.js +43 -0
- package/dist/overlay/tethered/hooks/calculate_position.js.map +1 -0
- package/dist/overlay/tethered/hooks/useTether.d.ts +19 -0
- package/dist/overlay/tethered/hooks/useTether.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/useTether.js +61 -0
- package/dist/overlay/tethered/hooks/useTether.js.map +1 -0
- package/dist/overlay/tethered/tethered.d.ts +20 -0
- package/dist/overlay/tethered/tethered.d.ts.map +1 -0
- package/dist/overlay/tethered/tethered.js +59 -0
- package/dist/overlay/tethered/tethered.js.map +1 -0
- package/dist/overlay/tethered/types.d.ts +3 -0
- package/dist/overlay/tethered/types.d.ts.map +1 -0
- package/dist/overlay/tethered/types.js +2 -0
- package/dist/overlay/tethered/types.js.map +1 -0
- package/dist/popper.css +1 -1
- package/dist/scaffold.css +1 -0
- package/dist/showcase-WfP6kBEb.js +58401 -0
- package/dist/showcase-WfP6kBEb.js.map +1 -0
- package/dist/showcase.css +1 -0
- package/dist/stacks/box/box.js +24 -24
- package/dist/stacks/h_collapsible_box.js +3 -3
- package/dist/stacks/h_stack.js +41 -41
- package/dist/stacks/spacer.js +11 -11
- package/dist/stacks/story_components/circle.js +10 -10
- package/dist/stacks/story_components/picture_placeholder.js +9 -9
- package/dist/stacks/story_components/rect.js +7 -7
- package/dist/stacks/story_components/style_box.js +4 -4
- package/dist/stacks/utils/use_is_collapsed.js +6 -6
- package/dist/stacks/v_collapsible_box.js +3 -3
- package/dist/stacks/v_stack.js +42 -42
- package/dist/stacks/z_stack.js +39 -39
- package/dist/surfaces/alert/alert.js +4 -4
- package/dist/surfaces/card/card.d.ts +2 -2
- package/dist/surfaces/card/card.d.ts.map +1 -1
- package/dist/surfaces/card/card.js +7 -7
- package/dist/surfaces/card/card.js.map +1 -1
- package/dist/surfaces/confirm/confirm.js +9 -9
- package/dist/surfaces/drawers/drawer_start/drawer_start.js +2 -2
- package/dist/surfaces/drawers/drawer_top/drawer_top.js +2 -2
- package/dist/surfaces/index.d.ts +2 -0
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +22 -18
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts +3 -3
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +14 -14
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/page/h_page.js +7 -7
- package/dist/surfaces/page/v_page.js +5 -5
- package/dist/surfaces/panel/h_panel.js +29 -30
- package/dist/surfaces/panel/h_panel.js.map +1 -1
- package/dist/surfaces/panel/v_panel.d.ts +3 -7
- package/dist/surfaces/panel/v_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/v_panel.js +12 -54
- package/dist/surfaces/panel/v_panel.js.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.d.ts +5 -0
- package/dist/surfaces/pop_confirm/pop_confirm.d.ts.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js +37 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -0
- package/dist/surfaces/popconfirm/pop_confirm.d.ts +5 -0
- package/dist/surfaces/popconfirm/pop_confirm.d.ts.map +1 -0
- package/dist/surfaces/popconfirm/pop_confirm.js +13 -0
- package/dist/surfaces/popconfirm/pop_confirm.js.map +1 -0
- package/dist/surfaces/popover/popover.d.ts +1 -1
- package/dist/surfaces/popover/popover.d.ts.map +1 -1
- package/dist/surfaces/popover/popover.js +1 -1
- package/dist/surfaces/popover/popover.js.map +1 -1
- package/dist/surfaces/tooltip/tooltip.d.ts +10 -0
- package/dist/surfaces/tooltip/tooltip.d.ts.map +1 -0
- package/dist/surfaces/tooltip/tooltip.js +38 -0
- package/dist/surfaces/tooltip/tooltip.js.map +1 -0
- package/dist/surfaces/window/window.d.ts +3 -3
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +15 -13
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/syntaxhighlighter-IQDEPFLK-BX_eF8__.js +3777 -0
- package/dist/syntaxhighlighter-IQDEPFLK-BX_eF8__.js.map +1 -0
- package/dist/tethered.css +1 -0
- package/dist/themes/themes/ergo/ergo_theme.js +177 -206
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/tokens/badge/badge.js +9 -9
- package/dist/tokens/bubble/bubble.js +8 -8
- package/dist/tokens/chip/chip.js +3 -3
- package/dist/tooltip.css +1 -1
- package/dist/utility_bar.css +1 -1
- package/dist/utils/click_away_listener.d.ts +1 -0
- package/dist/utils/click_away_listener.d.ts.map +1 -1
- package/dist/utils/click_away_listener.js +12 -11
- package/dist/utils/click_away_listener.js.map +1 -1
- package/dist/utils/dnd/draggable/draggable.js +4 -4
- package/dist/utils/dnd/handle.js +8 -8
- package/dist/utils/focus_redirect.js +5 -5
- package/dist/utils/hooks/make_context_hook.js +4 -4
- package/dist/utils/hooks/use_media_query.js +2 -2
- package/dist/utils/hooks/use_media_query.js.map +1 -1
- package/dist/utils/index.d.ts +6 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +26 -23
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mouse_leave_region.d.ts +8 -0
- package/dist/utils/mouse_leave_region.d.ts.map +1 -0
- package/dist/utils/mouse_leave_region.js +26 -0
- package/dist/utils/mouse_leave_region.js.map +1 -0
- package/dist/utils/types/dimensions.d.ts +11 -1
- package/dist/utils/types/dimensions.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actions/__docs__/actions.mdx +131 -0
- package/src/actions/__docs__/actions.stories.tsx +309 -0
- package/src/actions/__docs__/components/gallery.module.css +6 -0
- package/src/actions/__docs__/components/gallery.tsx +28 -0
- package/src/actions/__docs__/components/showcase.module.css +55 -0
- package/src/actions/__docs__/components/showcase.tsx +121 -0
- package/src/actions/button/base_button/base_button.tsx +5 -1
- package/src/actions/types.ts +6 -0
- package/src/inputs/color_input/color_input.tsx +1 -1
- package/src/inputs/date_picker/date_picker_input.tsx +1 -1
- package/src/inputs/date_picker/date_picker_year_input.tsx +1 -1
- package/src/inputs/suggestions/suggestion_list.tsx +1 -1
- package/src/layouts/index.ts +7 -5
- package/src/layouts/scaffold/scaffold.module.css +5 -0
- package/src/layouts/scaffold/scaffold.tsx +60 -0
- package/src/layouts/utility_bar/utility_bar.module.css +0 -3
- package/src/overlay/frame/frame.module.css +5 -0
- package/src/overlay/frame/frame.stories.tsx +1 -1
- package/src/overlay/frame/frame.tsx +19 -3
- package/src/overlay/index.ts +29 -2
- package/src/overlay/menu/menu.tsx +1 -1
- package/src/overlay/popper/__stories__/base_args.ts +75 -0
- package/src/overlay/popper/__stories__/context_popper.stories.tsx +77 -0
- package/src/overlay/popper/__stories__/element_popper.stories.tsx +80 -0
- package/src/overlay/popper/__stories__/preview_popper.stories.tsx +73 -0
- package/src/overlay/popper/base/base_popper.tsx +55 -0
- package/src/overlay/popper/base/dismissal_decorator.tsx +80 -0
- package/src/overlay/popper/context_popper.tsx +43 -0
- package/src/overlay/popper/element_popper.tsx +42 -0
- package/src/overlay/popper/hooks/use_context_trigger.ts +50 -0
- package/src/overlay/popper/hooks/use_hover_trigger.ts +24 -0
- package/src/overlay/popper/hooks/use_restore_focus.ts +16 -0
- package/src/overlay/popper/{popper.stories.tsx → legacy/popper.stories.tsx} +11 -5
- package/src/overlay/popper/{popper.tsx → legacy/popper.tsx} +3 -2
- package/src/overlay/popper/preview_popper.tsx +54 -0
- package/src/overlay/tethered/__stories__/element/element_tethered.stories.tsx +57 -0
- package/src/overlay/tethered/__stories__/element/element_tethered_stories.module.css +14 -0
- package/src/overlay/tethered/__stories__/shared/base_story_config.ts +52 -0
- package/src/overlay/tethered/__stories__/shared/components/sb_point.module.css +20 -0
- package/src/overlay/tethered/__stories__/shared/components/sb_point.tsx +34 -0
- package/src/overlay/tethered/__stories__/shared/components/sb_reference_points.tsx +54 -0
- package/src/overlay/tethered/__stories__/tethered/tethered.stories.tsx +90 -0
- package/src/overlay/tethered/__stories__/tethered/tethered_stories.module.css +25 -0
- package/src/overlay/tethered/element_tethered.tsx +62 -0
- package/src/overlay/tethered/hooks/calculate_position.ts +110 -0
- package/src/overlay/tethered/hooks/useTether.ts +85 -0
- package/src/overlay/tethered/tethered.module.css +8 -0
- package/src/overlay/tethered/tethered.tsx +72 -0
- package/src/overlay/tethered/types.ts +2 -0
- package/src/stacks/h_stack.stories.tsx +2 -2
- package/src/stacks/v_stack.stories.tsx +2 -2
- package/src/surfaces/card/card.stories.tsx +64 -0
- package/src/surfaces/card/card.tsx +4 -4
- package/src/surfaces/card/card_stories.module.css +13 -0
- package/src/surfaces/index.ts +2 -0
- package/src/surfaces/modal/__stories__/modal.stories.tsx +12 -1
- package/src/surfaces/modal/modal.module.css +2 -2
- package/src/surfaces/modal/modal.tsx +14 -12
- package/src/surfaces/panel/__stories__/panel.stories.tsx +1 -1
- package/src/surfaces/panel/v_panel.tsx +8 -53
- package/src/surfaces/pop_confirm/pop_confirm.stories.tsx +70 -0
- package/src/surfaces/pop_confirm/pop_confirm.tsx +30 -0
- package/src/surfaces/popconfirm/pop_confirm.tsx +18 -0
- package/src/surfaces/popover/popover.tsx +1 -1
- package/src/surfaces/tooltip/tooltip.stories.tsx +54 -0
- package/src/surfaces/tooltip/tooltip.tsx +59 -0
- package/src/surfaces/window/window.stories.tsx +15 -1
- package/src/surfaces/window/window.tsx +16 -12
- package/src/themes/themes/ergo/__stories__/components/tone_picker/sb_tone_picker.tsx +7 -9
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +2 -6
- package/src/themes/themes/ergo/__stories__/sb_materials.module.css +29 -21
- package/src/themes/themes/ergo/ergo_theme.css +177 -206
- package/src/utils/click_away_listener.tsx +1 -1
- package/src/utils/index.ts +7 -5
- package/src/utils/mouse_leave_region.tsx +38 -0
- package/src/utils/types/dimensions.ts +13 -1
- package/tsconfig.json +3 -0
- package/dist/overlay/popper/popper.d.ts.map +0 -1
- package/dist/overlay/popper/popper.js.map +0 -1
- package/dist/overlay/tooltip/tooltip.d.ts +0 -7
- package/dist/overlay/tooltip/tooltip.d.ts.map +0 -1
- package/dist/overlay/tooltip/tooltip.js +0 -20
- package/dist/overlay/tooltip/tooltip.js.map +0 -1
- package/dist/panel.module-DwGKncon.js +0 -5
- package/dist/panel.module-DwGKncon.js.map +0 -1
- package/src/overlay/tooltip/tooltip.stories.tsx +0 -22
- package/src/overlay/tooltip/tooltip.tsx +0 -24
- /package/dist/{panel.css → h_panel.css} +0 -0
- /package/dist/overlay/popper/{popper.d.ts → legacy/popper.d.ts} +0 -0
- /package/src/overlay/popper/{popper.module.css → legacy/popper.module.css} +0 -0
- /package/src/{overlay → surfaces}/tooltip/tooltip.module.css +0 -0
|
@@ -3,21 +3,21 @@ import R from "react";
|
|
|
3
3
|
import { useSignalValue as p } from "@tcn/state";
|
|
4
4
|
import { HField as E } from "../../form/field/h_field/h_field.js";
|
|
5
5
|
import { Multiselect as S } from "./multiselect.js";
|
|
6
|
-
const
|
|
6
|
+
const j = R.forwardRef(function({ presenter: r, children: c, id: u, ...m }, d) {
|
|
7
7
|
let n = [];
|
|
8
|
-
const
|
|
8
|
+
const a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = p(r.optionsBroadcast), { value: g, label: M, description: w, error: v } = p(r.stateBroadcast), V = f.map((e, o) => {
|
|
9
9
|
const t = c(e, o);
|
|
10
|
-
return
|
|
10
|
+
return a.set(e, t.props.value), l.set(t.props.value, e), t;
|
|
11
11
|
});
|
|
12
12
|
function h(e) {
|
|
13
13
|
const o = e.map((t) => {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
14
|
+
const s = l.get(t);
|
|
15
|
+
if (s == null) throw new Error(`Invalid value: ${t}`);
|
|
16
|
+
return s;
|
|
17
17
|
});
|
|
18
18
|
o && r.setValue(o);
|
|
19
19
|
}
|
|
20
|
-
return n = g.map((e) =>
|
|
20
|
+
return n = g.map((e) => a.get(e) || "") || [], /* @__PURE__ */ i(
|
|
21
21
|
E,
|
|
22
22
|
{
|
|
23
23
|
id: u,
|
|
@@ -30,6 +30,6 @@ const C = R.forwardRef(function({ presenter: r, children: c, id: u, ...m }, d) {
|
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
j as MultiselectRow
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=multiselect_row.js.map
|
|
@@ -14,13 +14,13 @@ import { countriesPhoneInformation as $ } from "./countries_phone_information.js
|
|
|
14
14
|
import { NotebookIcon as Ie } from "@tcn/icons/notebook_icon.js";
|
|
15
15
|
import { Option as F } from "../options/option.js";
|
|
16
16
|
import { SuggestionList as Ne } from "../suggestions/suggestion_list.js";
|
|
17
|
-
import { stripNonNumericAfterCountryCode as
|
|
18
|
-
import "../../utils/focus_redirect.js";
|
|
17
|
+
import { stripNonNumericAfterCountryCode as _ } from "./utils.js";
|
|
19
18
|
import "../../utils/click_away_listener.js";
|
|
19
|
+
import "../../utils/focus_redirect.js";
|
|
20
20
|
import "../../utils/scroll_away_listener.js";
|
|
21
21
|
import { useForkRef as ye } from "../../utils/hooks/use_fork_ref.js";
|
|
22
22
|
import "../../utils/hooks/use_resize_observer.js";
|
|
23
|
-
import '../../phone_number_input.css';const xe = "_phone-number-input_5c4483d", ge = "_phone-number-input-select_a7b33ac", Pe = "_phone-number-input-input_5b14556",
|
|
23
|
+
import '../../phone_number_input.css';const xe = "_phone-number-input_5c4483d", ge = "_phone-number-input-select_a7b33ac", Pe = "_phone-number-input-input_5b14556", _e = "_phone-number-input-phone-book-popover_1511f35", Se = "_phone-number-input-phone-book_7999ca1", Be = "_phone-number-input-obfuscated_5a0ed8c", f = { "phone-number-input": xe, "phone-number-input-select": ge, "phone-number-input-input": Pe, "phone-number-input-phone-book-popover": _e, "phone-number-input-phone-book": Se, "phone-number-input-obfuscated": Be }, Oe = "•";
|
|
24
24
|
function Ve(o) {
|
|
25
25
|
return o.map((n) => ({
|
|
26
26
|
...n,
|
|
@@ -66,7 +66,7 @@ function Me(o) {
|
|
|
66
66
|
n.value
|
|
67
67
|
));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function S(o, n, r) {
|
|
70
70
|
for (let h = 5; h > 1; h--) {
|
|
71
71
|
const c = o.slice(0, h), u = B.get(c);
|
|
72
72
|
if (u != null) {
|
|
@@ -93,13 +93,13 @@ const Ye = me.forwardRef(function({
|
|
|
93
93
|
}, ne) {
|
|
94
94
|
const N = Y(n), [j, V] = m(
|
|
95
95
|
null
|
|
96
|
-
), z = j != null, [b, M] = m(c), H =
|
|
96
|
+
), z = j != null, [b, M] = m(c), H = S(
|
|
97
97
|
n,
|
|
98
98
|
b,
|
|
99
99
|
c
|
|
100
100
|
), [y, x] = m(() => {
|
|
101
101
|
const e = n.split(H.prefix)[1];
|
|
102
|
-
return e == null ? "" :
|
|
102
|
+
return e == null ? "" : _(e);
|
|
103
103
|
}), D = Z(() => fe.toArray(T).filter(
|
|
104
104
|
(e) => he(e) && e.type === F
|
|
105
105
|
), [T]), R = D.length > 0, [C, g] = m(H.code), [W, P] = m([
|
|
@@ -109,11 +109,11 @@ const Ye = me.forwardRef(function({
|
|
|
109
109
|
const t = k.get(e);
|
|
110
110
|
if (t == null || (g(t.code), P([...t.masks]), M(t.code), y == null))
|
|
111
111
|
return;
|
|
112
|
-
const p = `${t.prefix}${
|
|
112
|
+
const p = `${t.prefix}${_(y)}`;
|
|
113
113
|
N.current = p, u && u(p, !1);
|
|
114
114
|
}
|
|
115
115
|
A(() => {
|
|
116
|
-
const e =
|
|
116
|
+
const e = S(
|
|
117
117
|
n,
|
|
118
118
|
b,
|
|
119
119
|
c
|
|
@@ -121,7 +121,7 @@ const Ye = me.forwardRef(function({
|
|
|
121
121
|
g(e.code), P([...e.masks]), M(e.code);
|
|
122
122
|
}, [n, b, c]);
|
|
123
123
|
function ue(e) {
|
|
124
|
-
const t = k.get(C)?.prefix, p =
|
|
124
|
+
const t = k.get(C)?.prefix, p = _(e), s = t + p;
|
|
125
125
|
a && E(!1), N.current = s, y !== e && x(e), u && u(s, !1);
|
|
126
126
|
}
|
|
127
127
|
function se(e) {
|
|
@@ -135,7 +135,7 @@ const Ye = me.forwardRef(function({
|
|
|
135
135
|
}
|
|
136
136
|
function ce(e) {
|
|
137
137
|
if (e.startsWith("+")) {
|
|
138
|
-
const t =
|
|
138
|
+
const t = S(
|
|
139
139
|
e,
|
|
140
140
|
b,
|
|
141
141
|
c
|
|
@@ -148,12 +148,12 @@ const Ye = me.forwardRef(function({
|
|
|
148
148
|
}
|
|
149
149
|
function ae(e) {
|
|
150
150
|
G(!0), E(!1), x(e);
|
|
151
|
-
const t = k.get(C)?.prefix, p =
|
|
151
|
+
const t = k.get(C)?.prefix, p = _(e), s = t + p;
|
|
152
152
|
N.current = s, u && u(s, !1);
|
|
153
153
|
}
|
|
154
154
|
const w = be(
|
|
155
155
|
(e, t = !1) => {
|
|
156
|
-
const p = N.current, s =
|
|
156
|
+
const p = N.current, s = S(
|
|
157
157
|
e,
|
|
158
158
|
b,
|
|
159
159
|
c
|
|
@@ -3,32 +3,32 @@ import { clsx as x } from "clsx";
|
|
|
3
3
|
import h from "react";
|
|
4
4
|
import { HStack as p } from "../../stacks/h_stack.js";
|
|
5
5
|
import '../../radio.css';const y = "_radio_ce5c4e1", R = { radio: y };
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
return o ?? `radio-${
|
|
6
|
+
let _ = 0;
|
|
7
|
+
function g(o) {
|
|
8
|
+
return o ?? `radio-${_++}`;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const j = h.forwardRef(function({
|
|
11
11
|
name: l,
|
|
12
12
|
id: s,
|
|
13
13
|
label: a,
|
|
14
14
|
className: c,
|
|
15
15
|
checked: r,
|
|
16
16
|
backgroundColor: u,
|
|
17
|
-
value:
|
|
17
|
+
value: f,
|
|
18
18
|
onChange: e,
|
|
19
19
|
...t
|
|
20
|
-
},
|
|
21
|
-
const d =
|
|
20
|
+
}, m) {
|
|
21
|
+
const d = g(s);
|
|
22
22
|
return /* @__PURE__ */ b(p, { inline: !0, width: "auto", children: [
|
|
23
23
|
/* @__PURE__ */ n(
|
|
24
24
|
"input",
|
|
25
25
|
{
|
|
26
|
-
ref:
|
|
26
|
+
ref: m,
|
|
27
27
|
className: x(c, R.radio, "radio"),
|
|
28
28
|
type: "radio",
|
|
29
29
|
id: d,
|
|
30
30
|
name: l,
|
|
31
|
-
value:
|
|
31
|
+
value: f,
|
|
32
32
|
style: { backgroundColor: u },
|
|
33
33
|
checked: r,
|
|
34
34
|
"data-checked": r,
|
|
@@ -52,6 +52,6 @@ const C = h.forwardRef(function({
|
|
|
52
52
|
] });
|
|
53
53
|
});
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
j as Radio
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=radio.js.map
|
|
@@ -4,14 +4,14 @@ import r, { useState as c } from "react";
|
|
|
4
4
|
import { HField as d } from "../../form/field/h_field/h_field.js";
|
|
5
5
|
import { FieldPresenter as R } from "../../form/field_presenters/field_presenter.js";
|
|
6
6
|
function C({ presenter: t, id: n, ...a }) {
|
|
7
|
-
const [o] = c(() => t ?? new R("Label", "")), { label: i, value: s, description: l, error:
|
|
7
|
+
const [o] = c(() => t ?? new R("Label", "")), { label: i, value: s, description: l, error: u } = f(
|
|
8
8
|
o.stateBroadcast
|
|
9
|
-
),
|
|
9
|
+
), m = r.Children.map(a.children, (e) => !r.isValidElement(e) || e.type !== "Radio" ? e : r.cloneElement(e, {
|
|
10
10
|
...e.props,
|
|
11
11
|
checked: s === e.props,
|
|
12
12
|
onChange: o.setValue
|
|
13
13
|
}));
|
|
14
|
-
return /* @__PURE__ */ p(d, { id: n, label: i, description: l, errorMessage:
|
|
14
|
+
return /* @__PURE__ */ p(d, { id: n, label: i, description: l, errorMessage: u, children: m });
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
17
|
C as RadioRow
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as z, Fragment as G, jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import "../../utils/focus_redirect.js";
|
|
3
2
|
import "../../utils/click_away_listener.js";
|
|
3
|
+
import "../../utils/focus_redirect.js";
|
|
4
4
|
import "../../utils/scroll_away_listener.js";
|
|
5
|
-
import
|
|
5
|
+
import F, { useRef as c, useState as w } from "react";
|
|
6
6
|
import { useForkRef as H } from "../../utils/hooks/use_fork_ref.js";
|
|
7
7
|
import "../../utils/hooks/use_resize_observer.js";
|
|
8
8
|
import { clsx as J } from "clsx";
|
|
@@ -13,16 +13,16 @@ import "../../actions/button/slim_button/slim_button.js";
|
|
|
13
13
|
import { Button as W } from "../../actions/button/button/button.js";
|
|
14
14
|
import "../../actions/button/select_group/select_group.js";
|
|
15
15
|
import "../../actions/button/select_group/single_select_group.js";
|
|
16
|
-
import '../../select.css';const X = "_select_aabe288", Y = "_selectedLabel_b92ff3e",
|
|
16
|
+
import '../../select.css';const X = "_select_aabe288", Y = "_selectedLabel_b92ff3e", L = { select: X, selectedLabel: Y };
|
|
17
17
|
function Z(a, t) {
|
|
18
18
|
return a.find((n) => n.props.value === t);
|
|
19
19
|
}
|
|
20
|
-
const pe =
|
|
20
|
+
const pe = F.forwardRef(function({
|
|
21
21
|
children: t = [],
|
|
22
22
|
onKeyDown: n,
|
|
23
23
|
onKeyUp: f,
|
|
24
24
|
value: m,
|
|
25
|
-
placeholder:
|
|
25
|
+
placeholder: O = "-- Select --",
|
|
26
26
|
noOptionMatchedMessage: x,
|
|
27
27
|
trimCustomInput: C = !1,
|
|
28
28
|
className: E,
|
|
@@ -31,10 +31,10 @@ const pe = w.forwardRef(function({
|
|
|
31
31
|
onChange: g,
|
|
32
32
|
...T
|
|
33
33
|
}, D) {
|
|
34
|
-
const K =
|
|
34
|
+
const K = F.Children.toArray(
|
|
35
35
|
t
|
|
36
|
-
), l = c(""), M = c(!1), h = c(!1), [j, S] =
|
|
37
|
-
function
|
|
36
|
+
), l = c(""), M = c(!1), h = c(!1), [j, S] = w(null), i = c(null), [y, b] = w(!1), q = H(D, i), R = Z(K, m || ""), k = R == null ? O || "" : R.props.label;
|
|
37
|
+
function _() {
|
|
38
38
|
b(!0);
|
|
39
39
|
}
|
|
40
40
|
function o() {
|
|
@@ -47,9 +47,9 @@ const pe = w.forwardRef(function({
|
|
|
47
47
|
}), o();
|
|
48
48
|
}
|
|
49
49
|
function N(e, s, r) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
r && g && g(e),
|
|
50
|
+
const A = i.current;
|
|
51
|
+
A != null && requestAnimationFrame(() => {
|
|
52
|
+
r && g && g(e), A.focus();
|
|
53
53
|
}), o();
|
|
54
54
|
}
|
|
55
55
|
function U(e) {
|
|
@@ -61,20 +61,20 @@ const pe = w.forwardRef(function({
|
|
|
61
61
|
const s = l.current = e.key;
|
|
62
62
|
l.current = "";
|
|
63
63
|
const r = e.key;
|
|
64
|
-
s && (r === "Enter" || r === " ") && (y ? o() :
|
|
64
|
+
s && (r === "Enter" || r === " ") && (y ? o() : _()), f && f(e);
|
|
65
65
|
}
|
|
66
66
|
function I(e) {
|
|
67
67
|
S(e.currentTarget), M.current = document.activeElement === e.currentTarget, p && p(e);
|
|
68
68
|
}
|
|
69
69
|
function P(e) {
|
|
70
|
-
h.current && (h.current = !1, o()),
|
|
70
|
+
h.current && (h.current = !1, o()), _(), d && d(e);
|
|
71
71
|
}
|
|
72
72
|
return /* @__PURE__ */ z(G, { children: [
|
|
73
73
|
/* @__PURE__ */ u(
|
|
74
74
|
W,
|
|
75
75
|
{
|
|
76
76
|
ref: q,
|
|
77
|
-
className: J(E, "select",
|
|
77
|
+
className: J(E, "select", L.select),
|
|
78
78
|
width: "100%",
|
|
79
79
|
...T,
|
|
80
80
|
hAlign: "start",
|
|
@@ -83,7 +83,7 @@ const pe = w.forwardRef(function({
|
|
|
83
83
|
onKeyUp: V,
|
|
84
84
|
onMouseDown: I,
|
|
85
85
|
onMouseUp: P,
|
|
86
|
-
children: /* @__PURE__ */ u("span", { className:
|
|
86
|
+
children: /* @__PURE__ */ u("span", { className: L.selectedLabel, children: k })
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
89
|
y && /* @__PURE__ */ u(
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as m } from "clsx";
|
|
3
3
|
import g, { useRef as v, useLayoutEffect as y } from "react";
|
|
4
|
-
import "../../utils/focus_redirect.js";
|
|
5
4
|
import "../../utils/click_away_listener.js";
|
|
5
|
+
import "../../utils/focus_redirect.js";
|
|
6
6
|
import "../../utils/scroll_away_listener.js";
|
|
7
7
|
import { useForkRef as R } from "../../utils/hooks/use_fork_ref.js";
|
|
8
8
|
import "../../utils/hooks/use_resize_observer.js";
|
|
9
|
-
import '../../slider.css';const S = "_slider_eb84151",
|
|
10
|
-
const
|
|
9
|
+
import '../../slider.css';const S = "_slider_eb84151", _ = { slider: S }, N = g.forwardRef(function({ style: i, className: a, width: u, min: t = 0, max: r = 100, onChange: o, ...n }, d) {
|
|
10
|
+
const l = v(null), c = R(d, l);
|
|
11
11
|
return y(() => {
|
|
12
|
-
const e =
|
|
12
|
+
const e = l.current;
|
|
13
13
|
if (e == null) return;
|
|
14
14
|
const s = () => {
|
|
15
|
-
const f = (parseFloat(e.value) -
|
|
15
|
+
const f = (parseFloat(e.value) - t) / (r - t) * 100;
|
|
16
16
|
e.style.setProperty("--progress", `${f}%`);
|
|
17
17
|
};
|
|
18
18
|
return e.addEventListener("input", s), s(), () => {
|
|
19
19
|
e.removeEventListener("input", s);
|
|
20
20
|
};
|
|
21
|
-
}, [
|
|
21
|
+
}, [t, r]), /* @__PURE__ */ p(
|
|
22
22
|
"input",
|
|
23
23
|
{
|
|
24
24
|
type: "range",
|
|
25
|
-
className: m(a,
|
|
25
|
+
className: m(a, _.slider, "slider"),
|
|
26
26
|
"data-is-disabled": n.disabled || !1,
|
|
27
|
-
ref:
|
|
27
|
+
ref: c,
|
|
28
28
|
onChange: (e) => {
|
|
29
29
|
o && o(e.currentTarget.value, e);
|
|
30
30
|
},
|
|
31
31
|
...n,
|
|
32
|
-
min: String(
|
|
33
|
-
max: String(
|
|
32
|
+
min: String(t),
|
|
33
|
+
max: String(r),
|
|
34
34
|
"data-width": "100%",
|
|
35
|
-
style: { width: u, ...
|
|
35
|
+
style: { width: u, ...i }
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
38
|
});
|
|
@@ -10,8 +10,8 @@ import "../../typography/title/title.js";
|
|
|
10
10
|
import { VStack as O } from "../../stacks/v_stack.js";
|
|
11
11
|
import { ZStack as ue } from "../../stacks/z_stack.js";
|
|
12
12
|
import { Children as pe, isValidElement as de, useState as a, useRef as T, useLayoutEffect as S } from "react";
|
|
13
|
-
import { FocusRedirect as fe } from "../../utils/focus_redirect.js";
|
|
14
13
|
import "../../utils/click_away_listener.js";
|
|
14
|
+
import { FocusRedirect as fe } from "../../utils/focus_redirect.js";
|
|
15
15
|
import "../../utils/scroll_away_listener.js";
|
|
16
16
|
import "../../utils/hooks/use_resize_observer.js";
|
|
17
17
|
import { SuggestionItem as ge } from "./suggestion_item.js";
|
|
@@ -22,7 +22,7 @@ import "../../actions/button/slim_button/slim_button.js";
|
|
|
22
22
|
import { Button as he } from "../../actions/button/button/button.js";
|
|
23
23
|
import "../../actions/button/select_group/select_group.js";
|
|
24
24
|
import "../../actions/button/select_group/single_select_group.js";
|
|
25
|
-
import { Popper as me } from "../../overlay/popper/popper.js";
|
|
25
|
+
import { Popper as me } from "../../overlay/popper/legacy/popper.js";
|
|
26
26
|
import '../../suggestion_list.css';const we = "_suggestion-list_711fb17", be = "_input_a0df060", R = { "suggestion-list": we, input: be }, I = 50, xe = 50;
|
|
27
27
|
function je({
|
|
28
28
|
value: A = "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion_list.js","sources":["../../../src/inputs/suggestions/suggestion_list.tsx"],"sourcesContent":["import { BodyText } from '../../typography/index.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { clsx } from 'clsx';\nimport React, { useLayoutEffect, Children, isValidElement } from 'react';\nimport { useRef, useState } from 'react';\nimport { FocusRedirect } from '../../utils/index.js';\nimport { SuggestionItem } from './suggestion_item.js';\nimport { OptionProps, Option } from '../options/option.js';\nimport styles from './suggestion_list.module.css';\n\nimport { Button } from '../../actions/index.js';\nimport { Popper } from '../../overlay/popper/popper.js';\n\nconst MAX_RESULTS = 50;\nconst BATCH_SIZE = 50;\n\nexport interface SuggestionListProps\n extends Omit<React.HTMLAttributes<HTMLInputElement>, 'onChange'> {\n value?: string;\n scrollToValue?: string;\n anchorElement: HTMLElement | null;\n children?: React.ReactNode;\n onChange?: (value: string) => void;\n onOptionSelect?: (\n value: string,\n label: string | undefined,\n isSuggestion: boolean,\n obfuscate: boolean\n ) => void;\n noSuggestionMessage?: React.ReactNode;\n trimCustomInput?: boolean;\n haveValueAsOption?: boolean;\n onClose?: (\n inputValue: string,\n cursorStartPosition: number | null,\n cursorEndPosition: number | null\n ) => void;\n}\n\nexport function SuggestionList({\n value = '',\n scrollToValue,\n anchorElement,\n children,\n onOptionSelect,\n noSuggestionMessage = '-- No Matches --',\n onClose,\n onChange,\n onKeyUp,\n onKeyDown,\n trimCustomInput = false,\n haveValueAsOption = false,\n ...props\n}: SuggestionListProps) {\n // Extract valid Option components from children\n const suggestions = Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n\n const [selectedIndex, setSelectedIndex] = useState(() => {\n if (scrollToValue != null) {\n const index = suggestions.findIndex(option => option.props.value === scrollToValue);\n if (index !== -1) {\n return index;\n }\n }\n return -1;\n });\n\n const keyPressedDownRef = useRef('');\n const [maxResults, setMaxResults] = useState(MAX_RESULTS);\n const [focusedIndex, setFocusedIndex] = useState(selectedIndex);\n const [internalValue, setInternalValue] = useState(value);\n const internalInputRef = useRef<HTMLInputElement | null>(null);\n const [totalMatchedLength, setTotalMatchedLength] = useState(suggestions.length);\n const [matchedOptions, setMatchedOptions] = useState<React.ReactElement<OptionProps>[]>(\n () => getMatchedOptions(value, MAX_RESULTS)\n );\n const [suggestionsWidth, setSuggestionsWidth] = useState<string | undefined>();\n const [suggestionsHeight, setSuggestionsHeight] = useState<string | undefined>();\n\n function handleKeyUp(event: React.KeyboardEvent<HTMLInputElement>) {\n const key = event.key;\n const input = event.currentTarget;\n\n const isSameKey = (keyPressedDownRef.current = key);\n keyPressedDownRef.current = '';\n\n // Enter and Escape remove the popover, so we want to handle this on keyup.\n // This prevents from another element from getting the key events.\n if (isSameKey) {\n switch (key) {\n case 'Enter': {\n if (matchedOptions[focusedIndex] == null) {\n const value = trimCustomInput ? input.value.trim() : input.value;\n\n if (value === '') {\n return;\n }\n\n const lowercaseValue = value.toLocaleLowerCase();\n const option = suggestions.find(\n option =>\n option.props.value.toLocaleLowerCase() === lowercaseValue ||\n (option.props.label != null &&\n option.props.label.toLocaleLowerCase() === lowercaseValue)\n );\n\n const isSuggestion = option != null;\n const label = option?.props.label || value;\n const optionValue = option?.props.value || value;\n\n requestAnimationFrame(() => {\n onOptionSelect &&\n onOptionSelect(\n optionValue,\n label,\n isSuggestion,\n option?.props.obfuscate ?? false\n );\n });\n\n break;\n }\n const selectedOption = matchedOptions[focusedIndex];\n const optionProps = selectedOption.props;\n\n // Don't select disabled options\n if (optionProps.disabled) {\n break;\n }\n\n requestAnimationFrame(() => {\n onOptionSelect &&\n onOptionSelect(\n optionProps.value,\n optionProps.label,\n true,\n optionProps.obfuscate ?? false\n );\n });\n break;\n }\n case 'Escape': {\n onClose && onClose(input.value, input.selectionStart, input.selectionEnd);\n break;\n }\n }\n }\n\n onKeyUp && onKeyUp(event);\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n const key = event.key;\n keyPressedDownRef.current = key;\n\n // We handle these key events on keydown to be responsive navigation.\n switch (key) {\n case 'ArrowDown': {\n let newIndex = focusedIndex + 1;\n\n // Skip disabled options\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n\n if (newIndex === matchedOptions.length) {\n // Wrap around to first non-disabled option\n newIndex = 0;\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n // If all options are disabled, stay at -1\n if (newIndex === matchedOptions.length) {\n newIndex = -1;\n }\n }\n\n setFocusedIndex(newIndex);\n event.preventDefault();\n break;\n }\n case 'Tab': {\n let step = 1;\n if (event.shiftKey) {\n step = -1;\n }\n let newIndex = focusedIndex + step;\n // Skip disabled options\n if (step > 0) {\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n } else {\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n }\n\n if (newIndex === matchedOptions.length) {\n // Wrap around to first non-disabled option\n newIndex = 0;\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n // If all options are disabled, stay at -1\n if (newIndex === matchedOptions.length) {\n newIndex = -1;\n }\n } else if (newIndex <= -1) {\n // Wrap around to last non-disabled option\n newIndex = matchedOptions.length - 1;\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n // If all options are disabled, stay at -1\n if (newIndex === -1) {\n newIndex = -1;\n }\n }\n\n setFocusedIndex(newIndex);\n event.preventDefault();\n break;\n }\n case 'ArrowUp': {\n let newIndex = focusedIndex - 1;\n\n // Skip disabled options\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n\n if (newIndex === -1) {\n // Wrap around to last non-disabled option\n newIndex = matchedOptions.length - 1;\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n // If all options are disabled, stay at -1\n if (newIndex === -1) {\n newIndex = -1;\n }\n }\n\n setFocusedIndex(newIndex);\n event.preventDefault();\n break;\n }\n }\n onKeyDown && onKeyDown(event);\n }\n\n function getMatchedOptions(value: string, maxResults: number) {\n const results = suggestions.filter(option => {\n const props = option.props;\n const label = String(props.label).toLocaleLowerCase();\n const keywords = props.keywords?.map(k => k.toLocaleLowerCase()) || [];\n const optionValue = String(props.value).toLocaleLowerCase();\n const searchValue = value.toLocaleLowerCase();\n const obfuscate = props.obfuscate ?? false;\n\n // Obfuscated options can only be searched by label or keywords, not by value\n if (obfuscate) {\n return label.includes(searchValue) || keywords.some(k => k.includes(searchValue));\n }\n\n return (\n label.includes(searchValue) ||\n keywords.some(k => k.includes(searchValue)) ||\n optionValue.includes(searchValue)\n );\n });\n\n if (\n haveValueAsOption &&\n value.trim().length > 0 &&\n !results.some(r => r.props.value === value)\n ) {\n results.unshift(\n <Option key=\"value\" value={value} label={value} keywords={[value]}>\n {value}\n </Option>\n );\n }\n\n setTotalMatchedLength(results.length);\n return results.slice(0, maxResults);\n }\n\n function focusInput() {\n const input = internalInputRef.current;\n if (input != null) {\n input.focus();\n }\n }\n\n function handleUseClose() {\n const input = internalInputRef.current;\n if (input != null) {\n onClose && onClose(input.value, input.selectionStart, input.selectionEnd);\n }\n }\n\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n const input = event.currentTarget;\n\n setMaxResults(MAX_RESULTS);\n setInternalValue(event.target.value);\n\n const newMatches = getMatchedOptions(input.value, MAX_RESULTS);\n setMatchedOptions(newMatches);\n\n onChange && onChange(event.target.value);\n }\n\n function handleShowMore() {\n const newMaxResults = maxResults + BATCH_SIZE;\n setMaxResults(newMaxResults);\n const newMatches = getMatchedOptions(internalValue, newMaxResults);\n setMatchedOptions(newMatches);\n }\n\n useLayoutEffect(() => {\n const input = internalInputRef.current;\n\n if (input != null && input.value.length > 0) {\n input.select();\n } else if (input != null) {\n input.focus();\n }\n }, []);\n\n useLayoutEffect(() => {\n if (anchorElement != null) {\n const rect = anchorElement.getBoundingClientRect();\n setSuggestionsWidth(`${rect.width}px`);\n setSuggestionsHeight(`${rect.height}px`);\n\n if (internalInputRef.current != null && anchorElement instanceof HTMLInputElement) {\n internalInputRef.current.value = anchorElement.value;\n internalInputRef.current.selectionStart = anchorElement.selectionStart;\n internalInputRef.current.selectionEnd = anchorElement.selectionEnd;\n }\n }\n }, [anchorElement]);\n\n useLayoutEffect(() => {\n if (scrollToValue != null) {\n const index = matchedOptions.findIndex(\n option => option.props.value === scrollToValue\n );\n setSelectedIndex(index);\n }\n }, [matchedOptions, scrollToValue]);\n\n useLayoutEffect(() => {\n setFocusedIndex(internalValue === '' ? selectedIndex : -1);\n }, [internalValue, selectedIndex]);\n\n return (\n <Popper\n open\n anchorElement={anchorElement}\n onClose={handleUseClose}\n verticalAnchor=\"top\"\n verticalOrigin=\"top\"\n verticalOffset={-4}\n >\n <VStack\n minHeight={`calc(${suggestionsHeight}, 8px)`}\n maxHeight=\"300px\"\n minWidth={suggestionsWidth}\n width=\"auto\"\n hAlign=\"start\"\n className={clsx(styles['suggestion-list'], 'suggestion-list')}\n >\n <input\n ref={internalInputRef}\n key={-1}\n value={internalValue}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n className={clsx(styles.input, 'suggestion-list-search-input')}\n {...props}\n />\n <VStack>\n {matchedOptions.map((option, index) => (\n <SuggestionItem\n key={index}\n option={option}\n isSelected={index === selectedIndex && internalValue !== ''}\n isFocused={index === focusedIndex}\n onClick={onOptionSelect}\n />\n ))}\n {totalMatchedLength > matchedOptions.length && (\n <>\n <Button marginBlock=\"8px\" hierarchy=\"tertiary\" onClick={handleShowMore}>\n Show More\n </Button>\n </>\n )}\n </VStack>\n {matchedOptions.length === 0 && (\n <ZStack padding=\"8px\" className={styles['no-results']}>\n <BodyText>{noSuggestionMessage}</BodyText>\n </ZStack>\n )}\n <FocusRedirect key={matchedOptions.length + 1} onRedirect={focusInput} />\n </VStack>\n </Popper>\n );\n}\n"],"names":["MAX_RESULTS","BATCH_SIZE","SuggestionList","value","scrollToValue","anchorElement","children","onOptionSelect","noSuggestionMessage","onClose","onChange","onKeyUp","onKeyDown","trimCustomInput","haveValueAsOption","props","suggestions","Children","child","isValidElement","Option","selectedIndex","setSelectedIndex","useState","index","option","keyPressedDownRef","useRef","maxResults","setMaxResults","focusedIndex","setFocusedIndex","internalValue","setInternalValue","internalInputRef","totalMatchedLength","setTotalMatchedLength","matchedOptions","setMatchedOptions","getMatchedOptions","suggestionsWidth","setSuggestionsWidth","suggestionsHeight","setSuggestionsHeight","handleKeyUp","event","key","input","isSameKey","lowercaseValue","isSuggestion","label","optionValue","optionProps","handleKeyDown","newIndex","step","results","keywords","k","searchValue","r","jsx","focusInput","handleUseClose","handleChange","newMatches","handleShowMore","newMaxResults","useLayoutEffect","rect","Popper","jsxs","VStack","clsx","styles","SuggestionItem","Fragment","Button","ZStack","BodyText","FocusRedirect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wGAcMA,IAAc,IACdC,KAAa;AAyBZ,SAASC,GAAe;AAAA,EAC7B,OAAAC,IAAQ;AAAA,EACR,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,mBAAAC,IAAoB;AAAA,EACpB,GAAGC;AACL,GAAwB;AAEtB,QAAMC,IAAcC,GAAS,QAAQX,CAAQ,EAAE;AAAA,IAC7C,CAACY,MACCC,GAAeD,CAAK,KAAKA,EAAM,SAASE;AAAA,EAAA,GAGtC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,MAAM;AACvD,QAAInB,KAAiB,MAAM;AACzB,YAAMoB,IAAQR,EAAY,UAAU,OAAUS,EAAO,MAAM,UAAUrB,CAAa;AAClF,UAAIoB,MAAU;AACZ,eAAOA;AAAA,IAEX;AACA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AAAA,gBACV,WAAWS,EAAKC,EAAO,OAAO,8BAA8B;AAAA,gBAC3D,GAAG5D;AAAA,cAAA;AAAA,cANC;AAAA,YAAA;AAAA,8BAQN0D,GAAA,EACE,UAAA;AAAA,cAAApC,EAAe,IAAI,CAACZ,GAAQD,MAC3B,gBAAAsC;AAAA,gBAACc;AAAA,gBAAA;AAAA,kBAEC,QAAAnD;AAAA,kBACA,YAAYD,MAAUH,KAAiBW,MAAkB;AAAA,kBACzD,WAAWR,MAAUM;AAAA,kBACrB,SAASvB;AAAA,gBAAA;AAAA,gBAJJiB;AAAA,cAAA,CAMR;AAAA,cACAW,IAAqBE,EAAe,UACnC,gBAAAyB,EAAAe,IAAA,EACE,UAAA,gBAAAf,EAACgB,IAAA,EAAO,aAAY,OAAM,WAAU,YAAW,SAASX,IAAgB,uBAExE,EAAA,CACF;AAAA,YAAA,GAEJ;AAAA,YACC9B,EAAe,WAAW,KACzB,gBAAAyB,EAACiB,MAAO,SAAQ,OAAM,WAAWJ,EAAO,YAAY,GAClD,UAAA,gBAAAb,EAACkB,IAAA,EAAU,aAAoB,GACjC;AAAA,8BAEDC,IAAA,EAA8C,YAAYlB,GAAA,GAAvC1B,EAAe,SAAS,CAA2B;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzE;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"suggestion_list.js","sources":["../../../src/inputs/suggestions/suggestion_list.tsx"],"sourcesContent":["import { BodyText } from '../../typography/index.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { clsx } from 'clsx';\nimport React, { useLayoutEffect, Children, isValidElement } from 'react';\nimport { useRef, useState } from 'react';\nimport { FocusRedirect } from '../../utils/index.js';\nimport { SuggestionItem } from './suggestion_item.js';\nimport { OptionProps, Option } from '../options/option.js';\nimport styles from './suggestion_list.module.css';\n\nimport { Button } from '../../actions/index.js';\nimport { Popper } from '../../overlay/popper/legacy/popper.js';\n\nconst MAX_RESULTS = 50;\nconst BATCH_SIZE = 50;\n\nexport interface SuggestionListProps\n extends Omit<React.HTMLAttributes<HTMLInputElement>, 'onChange'> {\n value?: string;\n scrollToValue?: string;\n anchorElement: HTMLElement | null;\n children?: React.ReactNode;\n onChange?: (value: string) => void;\n onOptionSelect?: (\n value: string,\n label: string | undefined,\n isSuggestion: boolean,\n obfuscate: boolean\n ) => void;\n noSuggestionMessage?: React.ReactNode;\n trimCustomInput?: boolean;\n haveValueAsOption?: boolean;\n onClose?: (\n inputValue: string,\n cursorStartPosition: number | null,\n cursorEndPosition: number | null\n ) => void;\n}\n\nexport function SuggestionList({\n value = '',\n scrollToValue,\n anchorElement,\n children,\n onOptionSelect,\n noSuggestionMessage = '-- No Matches --',\n onClose,\n onChange,\n onKeyUp,\n onKeyDown,\n trimCustomInput = false,\n haveValueAsOption = false,\n ...props\n}: SuggestionListProps) {\n // Extract valid Option components from children\n const suggestions = Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n\n const [selectedIndex, setSelectedIndex] = useState(() => {\n if (scrollToValue != null) {\n const index = suggestions.findIndex(option => option.props.value === scrollToValue);\n if (index !== -1) {\n return index;\n }\n }\n return -1;\n });\n\n const keyPressedDownRef = useRef('');\n const [maxResults, setMaxResults] = useState(MAX_RESULTS);\n const [focusedIndex, setFocusedIndex] = useState(selectedIndex);\n const [internalValue, setInternalValue] = useState(value);\n const internalInputRef = useRef<HTMLInputElement | null>(null);\n const [totalMatchedLength, setTotalMatchedLength] = useState(suggestions.length);\n const [matchedOptions, setMatchedOptions] = useState<React.ReactElement<OptionProps>[]>(\n () => getMatchedOptions(value, MAX_RESULTS)\n );\n const [suggestionsWidth, setSuggestionsWidth] = useState<string | undefined>();\n const [suggestionsHeight, setSuggestionsHeight] = useState<string | undefined>();\n\n function handleKeyUp(event: React.KeyboardEvent<HTMLInputElement>) {\n const key = event.key;\n const input = event.currentTarget;\n\n const isSameKey = (keyPressedDownRef.current = key);\n keyPressedDownRef.current = '';\n\n // Enter and Escape remove the popover, so we want to handle this on keyup.\n // This prevents from another element from getting the key events.\n if (isSameKey) {\n switch (key) {\n case 'Enter': {\n if (matchedOptions[focusedIndex] == null) {\n const value = trimCustomInput ? input.value.trim() : input.value;\n\n if (value === '') {\n return;\n }\n\n const lowercaseValue = value.toLocaleLowerCase();\n const option = suggestions.find(\n option =>\n option.props.value.toLocaleLowerCase() === lowercaseValue ||\n (option.props.label != null &&\n option.props.label.toLocaleLowerCase() === lowercaseValue)\n );\n\n const isSuggestion = option != null;\n const label = option?.props.label || value;\n const optionValue = option?.props.value || value;\n\n requestAnimationFrame(() => {\n onOptionSelect &&\n onOptionSelect(\n optionValue,\n label,\n isSuggestion,\n option?.props.obfuscate ?? false\n );\n });\n\n break;\n }\n const selectedOption = matchedOptions[focusedIndex];\n const optionProps = selectedOption.props;\n\n // Don't select disabled options\n if (optionProps.disabled) {\n break;\n }\n\n requestAnimationFrame(() => {\n onOptionSelect &&\n onOptionSelect(\n optionProps.value,\n optionProps.label,\n true,\n optionProps.obfuscate ?? false\n );\n });\n break;\n }\n case 'Escape': {\n onClose && onClose(input.value, input.selectionStart, input.selectionEnd);\n break;\n }\n }\n }\n\n onKeyUp && onKeyUp(event);\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n const key = event.key;\n keyPressedDownRef.current = key;\n\n // We handle these key events on keydown to be responsive navigation.\n switch (key) {\n case 'ArrowDown': {\n let newIndex = focusedIndex + 1;\n\n // Skip disabled options\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n\n if (newIndex === matchedOptions.length) {\n // Wrap around to first non-disabled option\n newIndex = 0;\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n // If all options are disabled, stay at -1\n if (newIndex === matchedOptions.length) {\n newIndex = -1;\n }\n }\n\n setFocusedIndex(newIndex);\n event.preventDefault();\n break;\n }\n case 'Tab': {\n let step = 1;\n if (event.shiftKey) {\n step = -1;\n }\n let newIndex = focusedIndex + step;\n // Skip disabled options\n if (step > 0) {\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n } else {\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n }\n\n if (newIndex === matchedOptions.length) {\n // Wrap around to first non-disabled option\n newIndex = 0;\n while (\n newIndex < matchedOptions.length &&\n matchedOptions[newIndex]?.props.disabled\n ) {\n newIndex++;\n }\n // If all options are disabled, stay at -1\n if (newIndex === matchedOptions.length) {\n newIndex = -1;\n }\n } else if (newIndex <= -1) {\n // Wrap around to last non-disabled option\n newIndex = matchedOptions.length - 1;\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n // If all options are disabled, stay at -1\n if (newIndex === -1) {\n newIndex = -1;\n }\n }\n\n setFocusedIndex(newIndex);\n event.preventDefault();\n break;\n }\n case 'ArrowUp': {\n let newIndex = focusedIndex - 1;\n\n // Skip disabled options\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n\n if (newIndex === -1) {\n // Wrap around to last non-disabled option\n newIndex = matchedOptions.length - 1;\n while (newIndex >= 0 && matchedOptions[newIndex]?.props.disabled) {\n newIndex--;\n }\n // If all options are disabled, stay at -1\n if (newIndex === -1) {\n newIndex = -1;\n }\n }\n\n setFocusedIndex(newIndex);\n event.preventDefault();\n break;\n }\n }\n onKeyDown && onKeyDown(event);\n }\n\n function getMatchedOptions(value: string, maxResults: number) {\n const results = suggestions.filter(option => {\n const props = option.props;\n const label = String(props.label).toLocaleLowerCase();\n const keywords = props.keywords?.map(k => k.toLocaleLowerCase()) || [];\n const optionValue = String(props.value).toLocaleLowerCase();\n const searchValue = value.toLocaleLowerCase();\n const obfuscate = props.obfuscate ?? false;\n\n // Obfuscated options can only be searched by label or keywords, not by value\n if (obfuscate) {\n return label.includes(searchValue) || keywords.some(k => k.includes(searchValue));\n }\n\n return (\n label.includes(searchValue) ||\n keywords.some(k => k.includes(searchValue)) ||\n optionValue.includes(searchValue)\n );\n });\n\n if (\n haveValueAsOption &&\n value.trim().length > 0 &&\n !results.some(r => r.props.value === value)\n ) {\n results.unshift(\n <Option key=\"value\" value={value} label={value} keywords={[value]}>\n {value}\n </Option>\n );\n }\n\n setTotalMatchedLength(results.length);\n return results.slice(0, maxResults);\n }\n\n function focusInput() {\n const input = internalInputRef.current;\n if (input != null) {\n input.focus();\n }\n }\n\n function handleUseClose() {\n const input = internalInputRef.current;\n if (input != null) {\n onClose && onClose(input.value, input.selectionStart, input.selectionEnd);\n }\n }\n\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n const input = event.currentTarget;\n\n setMaxResults(MAX_RESULTS);\n setInternalValue(event.target.value);\n\n const newMatches = getMatchedOptions(input.value, MAX_RESULTS);\n setMatchedOptions(newMatches);\n\n onChange && onChange(event.target.value);\n }\n\n function handleShowMore() {\n const newMaxResults = maxResults + BATCH_SIZE;\n setMaxResults(newMaxResults);\n const newMatches = getMatchedOptions(internalValue, newMaxResults);\n setMatchedOptions(newMatches);\n }\n\n useLayoutEffect(() => {\n const input = internalInputRef.current;\n\n if (input != null && input.value.length > 0) {\n input.select();\n } else if (input != null) {\n input.focus();\n }\n }, []);\n\n useLayoutEffect(() => {\n if (anchorElement != null) {\n const rect = anchorElement.getBoundingClientRect();\n setSuggestionsWidth(`${rect.width}px`);\n setSuggestionsHeight(`${rect.height}px`);\n\n if (internalInputRef.current != null && anchorElement instanceof HTMLInputElement) {\n internalInputRef.current.value = anchorElement.value;\n internalInputRef.current.selectionStart = anchorElement.selectionStart;\n internalInputRef.current.selectionEnd = anchorElement.selectionEnd;\n }\n }\n }, [anchorElement]);\n\n useLayoutEffect(() => {\n if (scrollToValue != null) {\n const index = matchedOptions.findIndex(\n option => option.props.value === scrollToValue\n );\n setSelectedIndex(index);\n }\n }, [matchedOptions, scrollToValue]);\n\n useLayoutEffect(() => {\n setFocusedIndex(internalValue === '' ? selectedIndex : -1);\n }, [internalValue, selectedIndex]);\n\n return (\n <Popper\n open\n anchorElement={anchorElement}\n onClose={handleUseClose}\n verticalAnchor=\"top\"\n verticalOrigin=\"top\"\n verticalOffset={-4}\n >\n <VStack\n minHeight={`calc(${suggestionsHeight}, 8px)`}\n maxHeight=\"300px\"\n minWidth={suggestionsWidth}\n width=\"auto\"\n hAlign=\"start\"\n className={clsx(styles['suggestion-list'], 'suggestion-list')}\n >\n <input\n ref={internalInputRef}\n key={-1}\n value={internalValue}\n onKeyUp={handleKeyUp}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n className={clsx(styles.input, 'suggestion-list-search-input')}\n {...props}\n />\n <VStack>\n {matchedOptions.map((option, index) => (\n <SuggestionItem\n key={index}\n option={option}\n isSelected={index === selectedIndex && internalValue !== ''}\n isFocused={index === focusedIndex}\n onClick={onOptionSelect}\n />\n ))}\n {totalMatchedLength > matchedOptions.length && (\n <>\n <Button marginBlock=\"8px\" hierarchy=\"tertiary\" onClick={handleShowMore}>\n Show More\n </Button>\n </>\n )}\n </VStack>\n {matchedOptions.length === 0 && (\n <ZStack padding=\"8px\" className={styles['no-results']}>\n <BodyText>{noSuggestionMessage}</BodyText>\n </ZStack>\n )}\n <FocusRedirect key={matchedOptions.length + 1} onRedirect={focusInput} />\n </VStack>\n </Popper>\n );\n}\n"],"names":["MAX_RESULTS","BATCH_SIZE","SuggestionList","value","scrollToValue","anchorElement","children","onOptionSelect","noSuggestionMessage","onClose","onChange","onKeyUp","onKeyDown","trimCustomInput","haveValueAsOption","props","suggestions","Children","child","isValidElement","Option","selectedIndex","setSelectedIndex","useState","index","option","keyPressedDownRef","useRef","maxResults","setMaxResults","focusedIndex","setFocusedIndex","internalValue","setInternalValue","internalInputRef","totalMatchedLength","setTotalMatchedLength","matchedOptions","setMatchedOptions","getMatchedOptions","suggestionsWidth","setSuggestionsWidth","suggestionsHeight","setSuggestionsHeight","handleKeyUp","event","key","input","isSameKey","lowercaseValue","isSuggestion","label","optionValue","optionProps","handleKeyDown","newIndex","step","results","keywords","k","searchValue","r","jsx","focusInput","handleUseClose","handleChange","newMatches","handleShowMore","newMaxResults","useLayoutEffect","rect","Popper","jsxs","VStack","clsx","styles","SuggestionItem","Fragment","Button","ZStack","BodyText","FocusRedirect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wGAcMA,IAAc,IACdC,KAAa;AAyBZ,SAASC,GAAe;AAAA,EAC7B,OAAAC,IAAQ;AAAA,EACR,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,mBAAAC,IAAoB;AAAA,EACpB,GAAGC;AACL,GAAwB;AAEtB,QAAMC,IAAcC,GAAS,QAAQX,CAAQ,EAAE;AAAA,IAC7C,CAACY,MACCC,GAAeD,CAAK,KAAKA,EAAM,SAASE;AAAA,EAAA,GAGtC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,MAAM;AACvD,QAAInB,KAAiB,MAAM;AACzB,YAAMoB,IAAQR,EAAY,UAAU,OAAUS,EAAO,MAAM,UAAUrB,CAAa;AAClF,UAAIoB,MAAU;AACZ,eAAOA;AAAA,IAEX;AACA,WAAO;AAAA,EACT,CAAC,GAEKE,IAAoBC,EAAO,EAAE,GAC7B,CAACC,GAAYC,CAAa,IAAIN,EAASvB,CAAW,GAClD,CAAC8B,GAAcC,CAAe,IAAIR,EAASF,CAAa,GACxD,CAACW,GAAeC,CAAgB,IAAIV,EAASpB,CAAK,GAClD+B,IAAmBP,EAAgC,IAAI,GACvD,CAACQ,GAAoBC,CAAqB,IAAIb,EAASP,EAAY,MAAM,GACzE,CAACqB,GA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ACzD,WAAWR,MAAUM;AAAA,kBACrB,SAASvB;AAAA,gBAAA;AAAA,gBAJJiB;AAAA,cAAA,CAMR;AAAA,cACAW,IAAqBE,EAAe,UACnC,gBAAAyB,EAAAe,IAAA,EACE,UAAA,gBAAAf,EAACgB,IAAA,EAAO,aAAY,OAAM,WAAU,YAAW,SAASX,IAAgB,uBAExE,EAAA,CACF;AAAA,YAAA,GAEJ;AAAA,YACC9B,EAAe,WAAW,KACzB,gBAAAyB,EAACiB,MAAO,SAAQ,OAAM,WAAWJ,EAAO,YAAY,GAClD,UAAA,gBAAAb,EAACkB,IAAA,EAAU,aAAoB,GACjC;AAAA,8BAEDC,IAAA,EAA8C,YAAYlB,GAAA,GAAvC1B,EAAe,SAAS,CAA2B;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzE;AAAA,EAAA;AAGN;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as F, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import R, { useState as k, useRef as B } from "react";
|
|
3
|
-
import "../../utils/focus_redirect.js";
|
|
4
3
|
import "../../utils/click_away_listener.js";
|
|
4
|
+
import "../../utils/focus_redirect.js";
|
|
5
5
|
import "../../utils/scroll_away_listener.js";
|
|
6
6
|
import { useForkRef as y } from "../../utils/hooks/use_fork_ref.js";
|
|
7
7
|
import "../../utils/hooks/use_resize_observer.js";
|
|
@@ -19,10 +19,10 @@ import '../../switch.css';const g = "_switch-wrapper_db1838e", j = "_switch_bf67
|
|
|
19
19
|
...t
|
|
20
20
|
}, h) {
|
|
21
21
|
const [m, a] = k(!1), p = B(null), b = y(d, p), r = {};
|
|
22
|
-
function
|
|
22
|
+
function _(s) {
|
|
23
23
|
t.onBlur && t.onBlur(s), a(!1);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function I(s) {
|
|
26
26
|
t.onFocus && t.onFocus(s), a(!0);
|
|
27
27
|
}
|
|
28
28
|
i != null && (r["--accent-color"] = i);
|
|
@@ -50,8 +50,8 @@ import '../../switch.css';const g = "_switch-wrapper_db1838e", j = "_switch_bf67
|
|
|
50
50
|
ref: b,
|
|
51
51
|
type: "checkbox",
|
|
52
52
|
className: o(e.switch, "switch"),
|
|
53
|
-
onBlur:
|
|
54
|
-
onFocus:
|
|
53
|
+
onBlur: _,
|
|
54
|
+
onFocus: I,
|
|
55
55
|
style: { ...f, ...r },
|
|
56
56
|
checked: c,
|
|
57
57
|
"data-is-disabled": t.disabled || !1,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as f } from "clsx";
|
|
3
|
-
import
|
|
4
|
-
import '../../textarea.css';const
|
|
5
|
-
return /* @__PURE__ */
|
|
3
|
+
import d from "react";
|
|
4
|
+
import '../../textarea.css';const i = "_textarea_8286394", m = { textarea: i }, b = d.forwardRef(function({ className: r, width: s, height: o, style: x, onChange: t, ...e }, l) {
|
|
5
|
+
return /* @__PURE__ */ c(
|
|
6
6
|
"textarea",
|
|
7
7
|
{
|
|
8
8
|
style: { width: s, height: o, ...x },
|
|
9
|
-
className: f(r,
|
|
9
|
+
className: f(r, m.textarea, "textarea"),
|
|
10
10
|
"data-is-disabled": e.disabled || !1,
|
|
11
|
-
ref:
|
|
11
|
+
ref: l,
|
|
12
12
|
onChange: (a) => {
|
|
13
13
|
t && t(a.currentTarget.value, a);
|
|
14
14
|
},
|
|
@@ -17,6 +17,6 @@ import '../../textarea.css';const m = "_textarea_8286394", n = { textarea: m },
|
|
|
17
17
|
);
|
|
18
18
|
});
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
b as Textarea
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=textarea.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as g, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import y, { useRef as k } from "react";
|
|
3
3
|
import { clsx as o } from "clsx";
|
|
4
|
-
import "../../utils/focus_redirect.js";
|
|
5
4
|
import "../../utils/click_away_listener.js";
|
|
5
|
+
import "../../utils/focus_redirect.js";
|
|
6
6
|
import "../../utils/scroll_away_listener.js";
|
|
7
7
|
import { useForkRef as E } from "../../utils/hooks/use_fork_ref.js";
|
|
8
8
|
import "../../utils/hooks/use_resize_observer.js";
|
|
@@ -25,13 +25,13 @@ const O = y.forwardRef(function({
|
|
|
25
25
|
...R
|
|
26
26
|
}, N) {
|
|
27
27
|
const a = k(null), S = E(b, a);
|
|
28
|
-
function
|
|
28
|
+
function _(e, u) {
|
|
29
29
|
if (u == null)
|
|
30
30
|
return;
|
|
31
31
|
const n = u.currentTarget, f = n.selectionStart || 0, i = A(e), m = Number(i);
|
|
32
32
|
n.value = i, i.length < e.length && n.setSelectionRange(f - 1, f - 1), i === "" ? t && t(null, r || "") : isNaN(m) || t && t(m, r || "");
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function I(e) {
|
|
35
35
|
const u = a.current;
|
|
36
36
|
if (u == null)
|
|
37
37
|
return;
|
|
@@ -51,7 +51,7 @@ const O = y.forwardRef(function({
|
|
|
51
51
|
{
|
|
52
52
|
className: o(s["unit-input-number"], "unit-input-number"),
|
|
53
53
|
ref: S,
|
|
54
|
-
onChange:
|
|
54
|
+
onChange: _,
|
|
55
55
|
disabled: c,
|
|
56
56
|
style: {
|
|
57
57
|
borderEndEndRadius: 0,
|
|
@@ -67,7 +67,7 @@ const O = y.forwardRef(function({
|
|
|
67
67
|
ref: x,
|
|
68
68
|
width: "auto",
|
|
69
69
|
value: r,
|
|
70
|
-
onChange:
|
|
70
|
+
onChange: I,
|
|
71
71
|
disabled: c,
|
|
72
72
|
style: { borderStartStartRadius: 0, borderEndStartRadius: 0 },
|
|
73
73
|
children: d
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { HStack as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { HStack as c } from "../../stacks/h_stack.js";
|
|
3
3
|
import m from "react";
|
|
4
4
|
import { clsx as y } from "clsx";
|
|
5
|
-
import '../../h_body.css';const a = "_h-body_d56f4f1",
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
|
|
5
|
+
import '../../h_body.css';const a = "_h-body_d56f4f1", e = { "h-body": a }, l = m.forwardRef(function({ children: o, className: t, overflowX: r = "auto", ...d }, f) {
|
|
6
|
+
return /* @__PURE__ */ s(
|
|
7
|
+
c,
|
|
8
8
|
{
|
|
9
|
-
ref:
|
|
9
|
+
ref: f,
|
|
10
10
|
as: "div",
|
|
11
11
|
overflowX: r,
|
|
12
|
-
className: y(
|
|
12
|
+
className: y(e["h-body"], t, "tcn-h-body", "body"),
|
|
13
13
|
...d,
|
|
14
14
|
children: o
|
|
15
15
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { VStack as
|
|
3
|
-
import
|
|
4
|
-
import { clsx as
|
|
5
|
-
import '../../v_body.css';const
|
|
2
|
+
import { VStack as f } from "../../stacks/v_stack.js";
|
|
3
|
+
import m from "react";
|
|
4
|
+
import { clsx as y } from "clsx";
|
|
5
|
+
import '../../v_body.css';const a = "_v-body_d8f1917", n = { "v-body": a }, l = m.forwardRef(function({ children: o, className: t, overflowY: r = "auto", ...d }, c) {
|
|
6
6
|
return /* @__PURE__ */ s(
|
|
7
|
-
|
|
7
|
+
f,
|
|
8
8
|
{
|
|
9
9
|
ref: c,
|
|
10
10
|
as: "div",
|
|
11
11
|
overflowY: r,
|
|
12
|
-
className:
|
|
12
|
+
className: y(n["v-body"], t, "tcn-body", "tcn-v-body"),
|
|
13
13
|
...d,
|
|
14
14
|
children: o
|
|
15
15
|
}
|