@tcn/ui 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -3
- package/dist/divider.module-FptFV0PX.js +5 -0
- package/dist/divider.module-FptFV0PX.js.map +1 -0
- package/dist/draggable.css +1 -0
- package/dist/feedback/progress/progress_bar.js +1 -1
- package/dist/form/field/common/field_description.js +1 -1
- package/dist/form/field/common/field_error.js +1 -1
- package/dist/form/field/common/field_label.js +1 -1
- package/dist/form/field/field.js +1 -1
- package/dist/frame.css +1 -0
- 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 +1 -1
- package/dist/inputs/combo_box/combo_box.js +1 -1
- package/dist/inputs/date_picker/date_picker.js +1 -1
- package/dist/inputs/date_picker/date_picker_date.js +1 -1
- package/dist/inputs/date_picker/date_picker_day.js +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +2 -2
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.js +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 +2 -2
- package/dist/inputs/mask_input/key_capture_input.js +1 -1
- package/dist/inputs/mask_input/mask_input.js +1 -1
- package/dist/inputs/multiselect/multiselect.js +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +2 -0
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +160 -154
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/select/select.js +1 -1
- package/dist/inputs/slider/slider.js +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +3 -3
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +1 -1
- package/dist/inputs/textarea/textarea.d.ts +2 -2
- package/dist/inputs/textarea/textarea.d.ts.map +1 -1
- package/dist/inputs/textarea/textarea.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +1 -1
- package/dist/layouts/divider/divider.js +24 -23
- package/dist/layouts/divider/divider.js.map +1 -1
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js.map +1 -1
- 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/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/modal.css +1 -1
- package/dist/overlay/frame/frame.d.ts +11 -0
- package/dist/overlay/frame/frame.d.ts.map +1 -0
- package/dist/overlay/frame/frame.js +35 -0
- package/dist/overlay/frame/frame.js.map +1 -0
- package/dist/overlay/index.d.ts +10 -2
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/index.js +22 -8
- 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 +2 -2
- 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/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/stacks/box/box.d.ts +1 -1
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js +1 -1
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/h_collapsible_box.js +1 -1
- package/dist/stacks/v_collapsible_box.js +1 -1
- 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/index.d.ts +4 -2
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +26 -22
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts +4 -3
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +12 -11
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/panel/h_panel.js +23 -24
- 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 +4 -3
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +18 -6
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/tethered.css +1 -0
- package/dist/themes/themes/ergo/ergo_theme.js +166 -158
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/typography/title/title.d.ts +2 -1
- package/dist/typography/title/title.d.ts.map +1 -1
- package/dist/typography/title/title.js +23 -22
- package/dist/typography/title/title.js.map +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 +2 -1
- package/dist/utils/click_away_listener.js.map +1 -1
- package/dist/utils/dnd/context.d.ts +4 -0
- package/dist/utils/dnd/context.d.ts.map +1 -0
- package/dist/utils/dnd/context.js +20 -0
- package/dist/utils/dnd/context.js.map +1 -0
- package/dist/utils/dnd/draggable/draggable.d.ts +7 -0
- package/dist/utils/dnd/draggable/draggable.d.ts.map +1 -0
- package/dist/utils/dnd/draggable/draggable.js +27 -0
- package/dist/utils/dnd/draggable/draggable.js.map +1 -0
- package/dist/utils/dnd/handle.d.ts +6 -0
- package/dist/utils/dnd/handle.d.ts.map +1 -0
- package/dist/utils/dnd/handle.js +22 -0
- package/dist/utils/dnd/handle.js.map +1 -0
- package/dist/utils/dnd/hooks/use_drag_container.d.ts +7 -0
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -0
- package/dist/utils/dnd/hooks/use_drag_container.js +30 -0
- package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -0
- package/dist/utils/{hooks → dnd/hooks}/use_draggable.d.ts +3 -3
- package/dist/utils/dnd/hooks/use_draggable.d.ts.map +1 -0
- package/dist/utils/dnd/hooks/use_draggable.js +41 -0
- package/dist/utils/dnd/hooks/use_draggable.js.map +1 -0
- package/dist/utils/dnd/types.d.ts +10 -0
- package/dist/utils/dnd/types.d.ts.map +1 -0
- package/dist/utils/dnd/types.js +2 -0
- package/dist/utils/dnd/types.js.map +1 -0
- 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 +9 -3
- 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/phone_number_input/phone_number_input.tsx +8 -0
- package/src/inputs/suggestions/suggestion_list.tsx +1 -1
- package/src/inputs/textarea/textarea.tsx +2 -2
- package/src/layouts/header/header.tsx +0 -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 +40 -0
- package/src/overlay/frame/frame.tsx +50 -0
- package/src/overlay/frame/frame_stories.module.css +14 -0
- package/src/overlay/index.ts +30 -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/box/box.tsx +8 -2
- 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 +4 -2
- package/src/surfaces/modal/__stories__/modal.stories.tsx +31 -28
- package/src/surfaces/modal/modal.module.css +2 -2
- package/src/surfaces/modal/modal.tsx +16 -11
- 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 +51 -4
- package/src/surfaces/window/window.tsx +19 -7
- 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 +166 -158
- package/src/typography/title/title.tsx +22 -18
- package/src/utils/click_away_listener.tsx +1 -1
- package/src/utils/dnd/__stories__/draggable.stories.tsx +48 -0
- package/src/utils/dnd/__stories__/draggable_stories.module.css +21 -0
- package/src/utils/{__stories__ → dnd/__stories__}/use_draggable.stories.tsx +15 -10
- package/src/utils/dnd/context.ts +24 -0
- package/src/utils/dnd/draggable/draggable.module.css +8 -0
- package/src/utils/dnd/draggable/draggable.tsx +42 -0
- package/src/utils/dnd/handle.tsx +32 -0
- package/src/utils/dnd/hooks/use_drag_container.ts +42 -0
- package/src/utils/{hooks → dnd/hooks}/use_draggable.ts +23 -17
- package/src/utils/dnd/types.ts +6 -0
- 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/dist/title.module-B16de2jd.js +0 -5
- package/dist/title.module-B16de2jd.js.map +0 -1
- package/dist/utils/hooks/use_draggable.d.ts.map +0 -1
- package/dist/utils/hooks/use_draggable.js +0 -30
- package/dist/utils/hooks/use_draggable.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
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { HStack as
|
|
3
|
-
import { clsx as
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as Q, jsx as i, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { HStack as X } from "../../stacks/h_stack.js";
|
|
3
|
+
import { clsx as d } from "clsx";
|
|
4
|
+
import me, { useRef as Y, useState as m, useMemo as Z, Children as fe, isValidElement as he, useLayoutEffect as A, useCallback as be } from "react";
|
|
5
5
|
import "../../actions/button/base_button/base_button.js";
|
|
6
6
|
import "../../actions/button/button_group/button_group.js";
|
|
7
|
-
import { SlimButton as
|
|
7
|
+
import { SlimButton as de } from "../../actions/button/slim_button/slim_button.js";
|
|
8
8
|
import "../../actions/button/button/button.js";
|
|
9
9
|
import "../../actions/button/select_group/select_group.js";
|
|
10
10
|
import "../../actions/button/select_group/single_select_group.js";
|
|
11
|
-
import { Select as
|
|
12
|
-
import { MaskInput as
|
|
13
|
-
import { countriesPhoneInformation as
|
|
14
|
-
import { NotebookIcon as
|
|
15
|
-
import { Option as
|
|
16
|
-
import { SuggestionList as
|
|
17
|
-
import { stripNonNumericAfterCountryCode as
|
|
18
|
-
import "../../utils/focus_redirect.js";
|
|
11
|
+
import { Select as ke } from "../select/select.js";
|
|
12
|
+
import { MaskInput as ee } from "../mask_input/mask_input.js";
|
|
13
|
+
import { countriesPhoneInformation as $ } from "./countries_phone_information.js";
|
|
14
|
+
import { NotebookIcon as Ie } from "@tcn/icons/notebook_icon.js";
|
|
15
|
+
import { Option as F } from "../options/option.js";
|
|
16
|
+
import { SuggestionList as Ne } from "../suggestions/suggestion_list.js";
|
|
17
|
+
import { stripNonNumericAfterCountryCode as S } 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
|
-
import { useForkRef as
|
|
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
|
|
24
|
-
function
|
|
23
|
+
import '../../phone_number_input.css';const xe = "_phone-number-input_5c4483d", ge = "_phone-number-input-select_a7b33ac", Pe = "_phone-number-input-input_5b14556", Se = "_phone-number-input-phone-book-popover_1511f35", _e = "_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": Se, "phone-number-input-phone-book": _e, "phone-number-input-obfuscated": Be }, Oe = "•";
|
|
24
|
+
function Ve(o) {
|
|
25
25
|
return o.map((n) => ({
|
|
26
26
|
...n,
|
|
27
|
-
placeholder: n.mask.replace(/[9a*]/g,
|
|
27
|
+
placeholder: n.mask.replace(/[9a*]/g, Oe)
|
|
28
28
|
}));
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const v = $.map((o) => ({
|
|
31
31
|
name: o.name,
|
|
32
32
|
selectedLabel: o.prefix,
|
|
33
33
|
optionLabel: `${o.prefix} (${o.code}) ${o.unicodeFlag}`,
|
|
34
34
|
value: o.code,
|
|
35
35
|
keywords: o.keywords
|
|
36
36
|
}));
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
v.sort((o, n) => parseInt(o.value) - parseInt(n.value));
|
|
38
|
+
const B = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
|
|
39
|
+
$.forEach((o) => {
|
|
40
|
+
k.set(o.code, o), B.has(o.prefix) ? B.get(o.prefix)?.push(o) : B.set(o.prefix, [o]);
|
|
41
41
|
});
|
|
42
|
-
function
|
|
42
|
+
function Me(o) {
|
|
43
43
|
if (o != null) {
|
|
44
44
|
const n = {};
|
|
45
|
-
return o.forEach((
|
|
46
|
-
n[
|
|
47
|
-
}),
|
|
48
|
-
|
|
45
|
+
return o.forEach((r) => {
|
|
46
|
+
n[r] = !0;
|
|
47
|
+
}), v.filter((r) => !!n[r.value]).map((r) => /* @__PURE__ */ i(
|
|
48
|
+
F,
|
|
49
49
|
{
|
|
50
|
-
value:
|
|
51
|
-
label:
|
|
52
|
-
keywords:
|
|
53
|
-
children:
|
|
50
|
+
value: r.value,
|
|
51
|
+
label: r.selectedLabel,
|
|
52
|
+
keywords: r.keywords,
|
|
53
|
+
children: r.optionLabel
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
r.value
|
|
56
56
|
));
|
|
57
57
|
} else
|
|
58
|
-
return
|
|
59
|
-
|
|
58
|
+
return v.map((n) => /* @__PURE__ */ i(
|
|
59
|
+
F,
|
|
60
60
|
{
|
|
61
61
|
value: n.value,
|
|
62
62
|
label: n.selectedLabel,
|
|
@@ -66,141 +66,145 @@ function Oe(o) {
|
|
|
66
66
|
n.value
|
|
67
67
|
));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
for (let
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
(
|
|
69
|
+
function _(o, n, r) {
|
|
70
|
+
for (let h = 5; h > 1; h--) {
|
|
71
|
+
const c = o.slice(0, h), u = B.get(c);
|
|
72
|
+
if (u != null) {
|
|
73
|
+
const I = u.find(
|
|
74
|
+
(O) => O.code === n
|
|
75
75
|
);
|
|
76
|
-
return
|
|
76
|
+
return I ?? u[0];
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return k.get(r.toUpperCase()) || k.get("US");
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const Ye = me.forwardRef(function({
|
|
82
82
|
value: n = "",
|
|
83
|
-
|
|
83
|
+
name: r,
|
|
84
|
+
autoComplete: h,
|
|
85
|
+
defaultCountry: c = "US",
|
|
84
86
|
onChange: u,
|
|
85
|
-
countrySelectRef:
|
|
86
|
-
phoneNumberInputRef:
|
|
87
|
-
disabled:
|
|
88
|
-
allowedCountryCodes:
|
|
89
|
-
children:
|
|
90
|
-
...
|
|
91
|
-
},
|
|
92
|
-
const
|
|
87
|
+
countrySelectRef: I,
|
|
88
|
+
phoneNumberInputRef: O,
|
|
89
|
+
disabled: l = !1,
|
|
90
|
+
allowedCountryCodes: U,
|
|
91
|
+
children: T,
|
|
92
|
+
...oe
|
|
93
|
+
}, ne) {
|
|
94
|
+
const N = Y(n), [j, V] = m(
|
|
93
95
|
null
|
|
94
|
-
),
|
|
96
|
+
), z = j != null, [b, M] = m(c), H = _(
|
|
95
97
|
n,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
), [
|
|
99
|
-
const e = n.split(
|
|
100
|
-
return e == null ? "" :
|
|
101
|
-
}),
|
|
102
|
-
(e) =>
|
|
103
|
-
), [
|
|
104
|
-
|
|
105
|
-
]), [a,
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
98
|
+
b,
|
|
99
|
+
c
|
|
100
|
+
), [y, x] = m(() => {
|
|
101
|
+
const e = n.split(H.prefix)[1];
|
|
102
|
+
return e == null ? "" : S(e);
|
|
103
|
+
}), D = Z(() => fe.toArray(T).filter(
|
|
104
|
+
(e) => he(e) && e.type === F
|
|
105
|
+
), [T]), R = D.length > 0, [C, g] = m(H.code), [W, P] = m([
|
|
106
|
+
...$[0].masks
|
|
107
|
+
]), [a, E] = m(!1), [q, G] = m(!1), L = Y(null), J = ye(O, L), te = Z(() => Me(U), [U]);
|
|
108
|
+
function re(e) {
|
|
109
|
+
const t = k.get(e);
|
|
110
|
+
if (t == null || (g(t.code), P([...t.masks]), M(t.code), y == null))
|
|
109
111
|
return;
|
|
110
|
-
const p = `${
|
|
111
|
-
|
|
112
|
+
const p = `${t.prefix}${S(y)}`;
|
|
113
|
+
N.current = p, u && u(p, !1);
|
|
112
114
|
}
|
|
113
|
-
|
|
114
|
-
const e =
|
|
115
|
+
A(() => {
|
|
116
|
+
const e = _(
|
|
115
117
|
n,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
b,
|
|
119
|
+
c
|
|
118
120
|
);
|
|
119
|
-
|
|
120
|
-
}, [n,
|
|
121
|
-
function
|
|
122
|
-
const
|
|
123
|
-
a &&
|
|
121
|
+
g(e.code), P([...e.masks]), M(e.code);
|
|
122
|
+
}, [n, b, c]);
|
|
123
|
+
function ue(e) {
|
|
124
|
+
const t = k.get(C)?.prefix, p = S(e), s = t + p;
|
|
125
|
+
a && E(!1), N.current = s, y !== e && x(e), u && u(s, !1);
|
|
124
126
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
+
function se(e) {
|
|
128
|
+
V(z ? null : e.currentTarget);
|
|
127
129
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
+
function K() {
|
|
131
|
+
V(null);
|
|
130
132
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
+
function pe(e, t, p, s) {
|
|
134
|
+
E(s), w(e, s), K();
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function ce(e) {
|
|
135
137
|
if (e.startsWith("+")) {
|
|
136
|
-
const
|
|
138
|
+
const t = _(
|
|
137
139
|
e,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
b,
|
|
141
|
+
c
|
|
140
142
|
);
|
|
141
|
-
|
|
142
|
-
const p = e.split(
|
|
143
|
-
return
|
|
143
|
+
g(t.code), P([...t.masks]);
|
|
144
|
+
const p = e.split(t.prefix)[1];
|
|
145
|
+
return x(p), p;
|
|
144
146
|
}
|
|
145
147
|
return e;
|
|
146
148
|
}
|
|
147
|
-
function
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
149
|
+
function ae(e) {
|
|
150
|
+
G(!0), E(!1), x(e);
|
|
151
|
+
const t = k.get(C)?.prefix, p = S(e), s = t + p;
|
|
152
|
+
N.current = s, u && u(s, !1);
|
|
151
153
|
}
|
|
152
|
-
const
|
|
153
|
-
(e,
|
|
154
|
-
const p =
|
|
154
|
+
const w = be(
|
|
155
|
+
(e, t = !1) => {
|
|
156
|
+
const p = N.current, s = _(
|
|
155
157
|
e,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
),
|
|
159
|
-
|
|
158
|
+
b,
|
|
159
|
+
c
|
|
160
|
+
), ie = e.split(s.prefix)[1];
|
|
161
|
+
g(s.code), P([...s.masks]), M(s.code), p !== e && (x(ie), u && u(e, t));
|
|
160
162
|
},
|
|
161
|
-
[
|
|
163
|
+
[c, b, u]
|
|
162
164
|
);
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
}, [n,
|
|
166
|
-
|
|
167
|
-
}, [
|
|
168
|
-
|
|
165
|
+
return A(() => {
|
|
166
|
+
w(n);
|
|
167
|
+
}, [n, w]), A(() => {
|
|
168
|
+
q && !a && L.current && (L.current.focus(), G(!1));
|
|
169
|
+
}, [q, a]), /* @__PURE__ */ Q(
|
|
170
|
+
X,
|
|
169
171
|
{
|
|
170
|
-
ref:
|
|
171
|
-
className:
|
|
172
|
+
ref: ne,
|
|
173
|
+
className: d(f["phone-number-input"], "phone-number-input"),
|
|
172
174
|
height: "auto",
|
|
173
|
-
...
|
|
175
|
+
...oe,
|
|
174
176
|
children: [
|
|
175
177
|
/* @__PURE__ */ i(
|
|
176
|
-
|
|
178
|
+
ke,
|
|
177
179
|
{
|
|
178
|
-
className:
|
|
179
|
-
ref:
|
|
180
|
+
className: d(f["phone-number-input-select"], "phone-number-input-select"),
|
|
181
|
+
ref: I,
|
|
180
182
|
width: "auto",
|
|
181
|
-
value: a ? "" :
|
|
182
|
-
onChange:
|
|
183
|
-
disabled:
|
|
184
|
-
"data-is-disabled":
|
|
183
|
+
value: a ? "" : C,
|
|
184
|
+
onChange: re,
|
|
185
|
+
disabled: l || a,
|
|
186
|
+
"data-is-disabled": l || a,
|
|
185
187
|
"data-is-obfuscated": a,
|
|
186
188
|
placeholder: a ? "––" : void 0,
|
|
187
|
-
children:
|
|
189
|
+
children: te
|
|
188
190
|
}
|
|
189
191
|
),
|
|
190
|
-
/* @__PURE__ */ i(
|
|
191
|
-
|
|
192
|
+
/* @__PURE__ */ i(X, { width: "flex", className: d(f["phone-number-input-container"]), children: a ? /* @__PURE__ */ i(
|
|
193
|
+
ee,
|
|
192
194
|
{
|
|
193
|
-
|
|
195
|
+
name: r,
|
|
196
|
+
autoComplete: h,
|
|
197
|
+
ref: J,
|
|
194
198
|
value: "",
|
|
195
|
-
mask:
|
|
196
|
-
onChange:
|
|
197
|
-
disabled:
|
|
198
|
-
"data-is-disabled":
|
|
199
|
-
"data-has-phone-book":
|
|
199
|
+
mask: Ve(W),
|
|
200
|
+
onChange: ae,
|
|
201
|
+
disabled: l,
|
|
202
|
+
"data-is-disabled": l,
|
|
203
|
+
"data-has-phone-book": R,
|
|
200
204
|
"data-is-obfuscated": !0,
|
|
201
|
-
className:
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
className: d(
|
|
206
|
+
f["phone-number-input"],
|
|
207
|
+
f["phone-number-input-obfuscated"],
|
|
204
208
|
"phone-number-input"
|
|
205
209
|
),
|
|
206
210
|
preparePasteValue: () => "",
|
|
@@ -209,43 +213,45 @@ const Qe = ie.forwardRef(function({
|
|
|
209
213
|
},
|
|
210
214
|
"obfuscated"
|
|
211
215
|
) : /* @__PURE__ */ i(
|
|
212
|
-
|
|
216
|
+
ee,
|
|
213
217
|
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
name: r,
|
|
219
|
+
autoComplete: h,
|
|
220
|
+
ref: J,
|
|
221
|
+
value: y,
|
|
222
|
+
mask: W,
|
|
223
|
+
onChange: ue,
|
|
224
|
+
disabled: l,
|
|
225
|
+
"data-is-disabled": l,
|
|
226
|
+
"data-has-phone-book": R,
|
|
221
227
|
"data-is-obfuscated": !1,
|
|
222
|
-
className:
|
|
223
|
-
preparePasteValue:
|
|
228
|
+
className: d(f["phone-number-input"], "phone-number-input"),
|
|
229
|
+
preparePasteValue: ce
|
|
224
230
|
},
|
|
225
231
|
"normal"
|
|
226
232
|
) }),
|
|
227
|
-
|
|
233
|
+
R && /* @__PURE__ */ Q(le, { children: [
|
|
228
234
|
/* @__PURE__ */ i(
|
|
229
|
-
|
|
235
|
+
de,
|
|
230
236
|
{
|
|
231
|
-
disabled:
|
|
232
|
-
className:
|
|
233
|
-
|
|
237
|
+
disabled: l,
|
|
238
|
+
className: d(
|
|
239
|
+
f["phone-number-input-phone-book"],
|
|
234
240
|
"phone-number-input-phone-book"
|
|
235
241
|
),
|
|
236
|
-
onClick:
|
|
242
|
+
onClick: se,
|
|
237
243
|
size: "md",
|
|
238
|
-
children: /* @__PURE__ */ i(
|
|
244
|
+
children: /* @__PURE__ */ i(Ie, { size: "md" })
|
|
239
245
|
}
|
|
240
246
|
),
|
|
241
|
-
|
|
242
|
-
|
|
247
|
+
z && /* @__PURE__ */ i(
|
|
248
|
+
Ne,
|
|
243
249
|
{
|
|
244
|
-
anchorElement:
|
|
245
|
-
onOptionSelect:
|
|
246
|
-
onClose:
|
|
250
|
+
anchorElement: j,
|
|
251
|
+
onOptionSelect: pe,
|
|
252
|
+
onClose: K,
|
|
247
253
|
noSuggestionMessage: "No phone numbers found",
|
|
248
|
-
children:
|
|
254
|
+
children: D
|
|
249
255
|
}
|
|
250
256
|
)
|
|
251
257
|
] })
|
|
@@ -254,6 +260,6 @@ const Qe = ie.forwardRef(function({
|
|
|
254
260
|
);
|
|
255
261
|
});
|
|
256
262
|
export {
|
|
257
|
-
|
|
263
|
+
Ye as PhoneNumberInput
|
|
258
264
|
};
|
|
259
265
|
//# sourceMappingURL=phone_number_input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport { clsx } from 'clsx';\nimport React, {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n Children,\n isValidElement,\n} from 'react';\nimport { SlimButton } from '../../actions/index.js';\nimport { Select } from '../select/select.js';\nimport { MaskInput } from '../mask_input/mask_input.js';\nimport {\n CountryPhoneInformation,\n countriesPhoneInformation,\n} from './countries_phone_information.js';\nimport styles from './phone_number_input.module.css';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { stripNonNumericAfterCountryCode } from './utils.js';\nimport { useForkRef } from '../../utils/index.js';\n\nconst OBFUSCATED_CHARACTER = '•';\n\nfunction createObfuscatedMasks(masks: { mask: string; placeholder?: string }[]) {\n return masks.map(m => ({\n ...m,\n placeholder: m.mask.replace(/[9a*]/g, OBFUSCATED_CHARACTER),\n }));\n}\n\nconst countryList = countriesPhoneInformation.map(i => ({\n name: i.name,\n selectedLabel: i.prefix,\n optionLabel: `${i.prefix} (${i.code}) ${i.unicodeFlag}`,\n value: i.code,\n keywords: i.keywords,\n}));\n\ncountryList.sort((a, b) => parseInt(a.value) - parseInt(b.value));\n\nconst countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nconst countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nfunction createCountryOptions(allowedCountryCodes?: string[]) {\n if (allowedCountryCodes != null) {\n const allowedMap: Record<string, boolean> = {};\n allowedCountryCodes.forEach(c => {\n allowedMap[c] = true;\n });\n return countryList\n .filter(c => Boolean(allowedMap[c.value]))\n .map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n } else {\n return countryList.map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n }\n}\n\nfunction getCountryCodeFromValue(\n value: string,\n previousCountry: string,\n defaultCountry: string\n) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(\n c => c.code === previousCountry\n );\n\n if (countryInformation != null) {\n return countryInformation;\n } else {\n return countriesInformation[0];\n }\n }\n }\n\n return (countryCodeMap.get(defaultCountry.toUpperCase()) ||\n countryCodeMap.get('US')) as CountryPhoneInformation;\n}\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n defaultCountry?: string;\n /**\n * Callback fired when the phone number value changes.\n * @param value - The phone number value with country prefix\n * @param obfuscate - Whether the selected phone number is obfuscated (e.g., from a phone book entry marked as obfuscated)\n */\n onChange?: (value: string, obfuscate: boolean) => void;\n countrySelectRef?: React.Ref<HTMLButtonElement>;\n phoneNumberInputRef?: React.Ref<HTMLInputElement>;\n disabled?: boolean;\n allowedCountryCodes?: string[];\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport const PhoneNumberInput = React.forwardRef(function PhoneNumberInput(\n {\n value = '',\n defaultCountry = 'US',\n onChange,\n countrySelectRef: countryRef,\n phoneNumberInputRef: numberRef,\n disabled = false,\n allowedCountryCodes,\n children,\n ...props\n }: PhoneNumberInputProps,\n ref: React.Ref<HTMLElement>\n) {\n const lastOutputValueRef = useRef(value);\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const [selectedCountry, setSelectedCountry] = useState(defaultCountry);\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const [phoneNumber, setPhoneNumber] = useState(() => {\n const phoneNumber = value.split(countryInformation.prefix)[1];\n\n return phoneNumber == null ? '' : stripNonNumericAfterCountryCode(phoneNumber);\n });\n\n // Extract valid Option components from children\n const phoneBookOptions = useMemo(() => {\n return Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const showPhoneBook = phoneBookOptions.length > 0;\n const [countryCode, setCountryCode] = useState(countryInformation.code);\n const [currentMasks, setCurrentMasks] = useState([\n ...countriesPhoneInformation[0].masks,\n ]);\n const [obfuscateValue, setObfuscateValue] = useState(false);\n const [shouldFocusAfterClear, setShouldFocusAfterClear] = useState(false);\n const internalInputRef = useRef<HTMLInputElement>(null);\n const forkedInputRef = useForkRef(numberRef, internalInputRef);\n\n const countryOptions = useMemo(() => {\n return createCountryOptions(allowedCountryCodes);\n }, [allowedCountryCodes]);\n\n function changeCountry(countryCodeValue: string) {\n const countryInformation = countryCodeMap.get(countryCodeValue);\n\n if (countryInformation == null) {\n return;\n }\n\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (phoneNumber == null) {\n return;\n }\n\n const value = `${countryInformation.prefix}${stripNonNumericAfterCountryCode(phoneNumber)}`;\n lastOutputValueRef.current = value;\n onChange && onChange(value, false);\n }\n\n useLayoutEffect(() => {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n }, [value, selectedCountry, defaultCountry]);\n\n function transformValue(newPhoneNumber: string) {\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newPhoneNumber);\n const outputValue = countryPrefix + lineNumber;\n\n // Clear obfuscated state when user types manually\n if (obfuscateValue) {\n setObfuscateValue(false);\n }\n\n lastOutputValueRef.current = outputValue;\n phoneNumber !== newPhoneNumber && setPhoneNumber(newPhoneNumber);\n onChange && onChange(outputValue, false);\n }\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(\n value: string,\n _label: string | undefined,\n _isSuggestion: boolean,\n obfuscate: boolean\n ) {\n // Update the phone number with the selected value\n setObfuscateValue(obfuscate);\n updatePhoneNumber(value, obfuscate);\n closePhoneBook();\n }\n\n function preparePasteValue(value: string) {\n if (value.startsWith('+')) {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setPhoneNumber(phoneNumber);\n\n return phoneNumber;\n }\n\n return value;\n }\n\n function handleObfuscatedInputChange(newValue: string) {\n // When user types on a obfuscated input, clear the obfuscated state and start fresh\n // The newValue will be the digits the user typed (mask filters to valid input)\n setShouldFocusAfterClear(true);\n setObfuscateValue(false);\n setPhoneNumber(newValue);\n\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newValue);\n const outputValue = countryPrefix + lineNumber;\n lastOutputValueRef.current = outputValue;\n onChange && onChange(outputValue, false);\n }\n\n const updatePhoneNumber = useCallback(\n (value: string, obfuscate = false) => {\n const oldValue = lastOutputValueRef.current;\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (oldValue !== value) {\n setPhoneNumber(phoneNumber);\n onChange && onChange(value, obfuscate);\n }\n },\n [defaultCountry, selectedCountry, onChange]\n );\n\n useLayoutEffect(() => {\n updatePhoneNumber(value);\n }, [value, updatePhoneNumber]);\n\n // Focus the input after transitioning from obfuscated to normal mode\n useLayoutEffect(() => {\n if (shouldFocusAfterClear && !obfuscateValue && internalInputRef.current) {\n internalInputRef.current.focus();\n setShouldFocusAfterClear(false);\n }\n }, [shouldFocusAfterClear, obfuscateValue]);\n\n return (\n <HStack\n ref={ref}\n className={clsx(styles['phone-number-input'], 'phone-number-input')}\n height=\"auto\"\n {...props}\n >\n <Select\n className={clsx(styles['phone-number-input-select'], 'phone-number-input-select')}\n ref={countryRef}\n width=\"auto\"\n value={obfuscateValue ? '' : countryCode}\n onChange={changeCountry}\n disabled={disabled || obfuscateValue}\n data-is-disabled={disabled || obfuscateValue}\n data-is-obfuscated={obfuscateValue}\n placeholder={obfuscateValue ? '––' : undefined}\n >\n {countryOptions}\n </Select>\n <HStack width=\"flex\" className={clsx(styles['phone-number-input-container'])}>\n {obfuscateValue ? (\n <MaskInput\n key=\"obfuscated\"\n ref={forkedInputRef}\n value=\"\"\n mask={createObfuscatedMasks(currentMasks)}\n onChange={handleObfuscatedInputChange}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n data-is-obfuscated={true}\n className={clsx(\n styles['phone-number-input'],\n styles['phone-number-input-obfuscated'],\n 'phone-number-input'\n )}\n preparePasteValue={() => ''}\n prepareCopyValue={() => ''}\n prepareCutValue={() => ''}\n />\n ) : (\n <MaskInput\n key=\"normal\"\n ref={forkedInputRef}\n value={phoneNumber}\n mask={currentMasks}\n onChange={transformValue}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n data-is-obfuscated={false}\n className={clsx(styles['phone-number-input'], 'phone-number-input')}\n preparePasteValue={preparePasteValue}\n />\n )}\n </HStack>\n {showPhoneBook && (\n <>\n <SlimButton\n disabled={disabled}\n className={clsx(\n styles['phone-number-input-phone-book'],\n 'phone-number-input-phone-book'\n )}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </SlimButton>\n\n {isPhoneBookOpen && (\n <SuggestionList\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n )}\n </>\n )}\n </HStack>\n );\n});\n"],"names":["OBFUSCATED_CHARACTER","createObfuscatedMasks","masks","m","countryList","countriesPhoneInformation","i","a","b","countryPrefixMap","countryCodeMap","createCountryOptions","allowedCountryCodes","allowedMap","c","jsx","Option","getCountryCodeFromValue","value","previousCountry","defaultCountry","x","prefix","countriesInformation","countryInformation","PhoneNumberInput","React","onChange","countryRef","numberRef","disabled","children","props","ref","lastOutputValueRef","useRef","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","selectedCountry","setSelectedCountry","phoneNumber","setPhoneNumber","stripNonNumericAfterCountryCode","phoneBookOptions","useMemo","Children","child","isValidElement","showPhoneBook","countryCode","setCountryCode","currentMasks","setCurrentMasks","obfuscateValue","setObfuscateValue","shouldFocusAfterClear","setShouldFocusAfterClear","internalInputRef","forkedInputRef","useForkRef","countryOptions","changeCountry","countryCodeValue","useLayoutEffect","transformValue","newPhoneNumber","countryPrefix","lineNumber","outputValue","togglePhoneBook","closePhoneBook","handlePhoneBookOptionSelect","_label","_isSuggestion","obfuscate","updatePhoneNumber","preparePasteValue","handleObfuscatedInputChange","newValue","useCallback","oldValue","jsxs","HStack","clsx","styles","Select","MaskInput","Fragment","SlimButton","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;8eAyBMA,KAAuB;AAE7B,SAASC,GAAsBC,GAAiD;AAC9E,SAAOA,EAAM,IAAI,CAAAC,OAAM;AAAA,IACrB,GAAGA;AAAA,IACH,aAAaA,EAAE,KAAK,QAAQ,UAAUH,EAAoB;AAAA,EAAA,EAC1D;AACJ;AAEA,MAAMI,IAAcC,EAA0B,IAAI,CAAAC,OAAM;AAAA,EACtD,MAAMA,EAAE;AAAA,EACR,eAAeA,EAAE;AAAA,EACjB,aAAa,GAAGA,EAAE,MAAM,KAAKA,EAAE,IAAI,KAAKA,EAAE,WAAW;AAAA,EACrD,OAAOA,EAAE;AAAA,EACT,UAAUA,EAAE;AACd,EAAE;AAEFF,EAAY,KAAK,CAACG,GAAGC,MAAM,SAASD,EAAE,KAAK,IAAI,SAASC,EAAE,KAAK,CAAC;AAEhE,MAAMC,wBAA+D,IAAA,GAC/DC,wBAA2D,IAAA;AACjEL,EAA0B,QAAQ,CAAAC,MAAK;AACrC,EAAAI,EAAe,IAAIJ,EAAE,MAAMA,CAA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AAvE;AAAA,UAACyE;AAAA,UAAA;AAAA,YAEC,KAAK5B;AAAA,YACL,OAAOlB;AAAA,YACP,MAAMW;AAAA,YACN,UAAUa;AAAA,YACV,UAAApC;AAAA,YACA,oBAAkBA;AAAA,YAClB,uBAAqBoB;AAAA,YACrB,sBAAoB;AAAA,YACpB,WAAWmC,EAAKC,EAAO,oBAAoB,GAAG,oBAAoB;AAAA,YAClE,mBAAAR;AAAA,UAAA;AAAA,UAVI;AAAA,QAAA,GAaV;AAAA,QACC5B,KACC,gBAAAiC,EAAAM,IAAA,EACE,UAAA;AAAA,UAAA,gBAAA1E;AAAA,YAAC2E;AAAA,YAAA;AAAA,cACC,UAAA5D;AAAA,cACA,WAAWuD;AAAA,gBACTC,EAAO,+BAA+B;AAAA,gBACtC;AAAA,cAAA;AAAA,cAEF,SAASf;AAAA,cACT,MAAK;AAAA,cAEL,UAAA,gBAAAxD,EAAC4E,IAAA,EAAa,MAAK,KAAA,CAAK;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzBpD,KACC,gBAAAxB;AAAA,YAAC6E;AAAA,YAAA;AAAA,cACC,eAAexD;AAAA,cACf,gBAAgBqC;AAAA,cAChB,SAASD;AAAA,cACT,qBAAoB;AAAA,cAEnB,UAAA3B;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport { clsx } from 'clsx';\nimport React, {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n Children,\n isValidElement,\n} from 'react';\nimport { SlimButton } from '../../actions/index.js';\nimport { Select } from '../select/select.js';\nimport { MaskInput } from '../mask_input/mask_input.js';\nimport {\n CountryPhoneInformation,\n countriesPhoneInformation,\n} from './countries_phone_information.js';\nimport styles from './phone_number_input.module.css';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { stripNonNumericAfterCountryCode } from './utils.js';\nimport { useForkRef } from '../../utils/index.js';\n\nconst OBFUSCATED_CHARACTER = '•';\n\nfunction createObfuscatedMasks(masks: { mask: string; placeholder?: string }[]) {\n return masks.map(m => ({\n ...m,\n placeholder: m.mask.replace(/[9a*]/g, OBFUSCATED_CHARACTER),\n }));\n}\n\nconst countryList = countriesPhoneInformation.map(i => ({\n name: i.name,\n selectedLabel: i.prefix,\n optionLabel: `${i.prefix} (${i.code}) ${i.unicodeFlag}`,\n value: i.code,\n keywords: i.keywords,\n}));\n\ncountryList.sort((a, b) => parseInt(a.value) - parseInt(b.value));\n\nconst countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nconst countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nfunction createCountryOptions(allowedCountryCodes?: string[]) {\n if (allowedCountryCodes != null) {\n const allowedMap: Record<string, boolean> = {};\n allowedCountryCodes.forEach(c => {\n allowedMap[c] = true;\n });\n return countryList\n .filter(c => Boolean(allowedMap[c.value]))\n .map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n } else {\n return countryList.map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n }\n}\n\nfunction getCountryCodeFromValue(\n value: string,\n previousCountry: string,\n defaultCountry: string\n) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(\n c => c.code === previousCountry\n );\n\n if (countryInformation != null) {\n return countryInformation;\n } else {\n return countriesInformation[0];\n }\n }\n }\n\n return (countryCodeMap.get(defaultCountry.toUpperCase()) ||\n countryCodeMap.get('US')) as CountryPhoneInformation;\n}\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n name?: string;\n autoComplete?: string;\n defaultCountry?: string;\n /**\n * Callback fired when the phone number value changes.\n * @param value - The phone number value with country prefix\n * @param obfuscate - Whether the selected phone number is obfuscated (e.g., from a phone book entry marked as obfuscated)\n */\n onChange?: (value: string, obfuscate: boolean) => void;\n countrySelectRef?: React.Ref<HTMLButtonElement>;\n phoneNumberInputRef?: React.Ref<HTMLInputElement>;\n disabled?: boolean;\n allowedCountryCodes?: string[];\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport const PhoneNumberInput = React.forwardRef(function PhoneNumberInput(\n {\n value = '',\n name,\n autoComplete,\n defaultCountry = 'US',\n onChange,\n countrySelectRef: countryRef,\n phoneNumberInputRef: numberRef,\n disabled = false,\n allowedCountryCodes,\n children,\n ...props\n }: PhoneNumberInputProps,\n ref: React.Ref<HTMLElement>\n) {\n const lastOutputValueRef = useRef(value);\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const [selectedCountry, setSelectedCountry] = useState(defaultCountry);\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const [phoneNumber, setPhoneNumber] = useState(() => {\n const phoneNumber = value.split(countryInformation.prefix)[1];\n\n return phoneNumber == null ? '' : stripNonNumericAfterCountryCode(phoneNumber);\n });\n\n // Extract valid Option components from children\n const phoneBookOptions = useMemo(() => {\n return Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const showPhoneBook = phoneBookOptions.length > 0;\n const [countryCode, setCountryCode] = useState(countryInformation.code);\n const [currentMasks, setCurrentMasks] = useState([\n ...countriesPhoneInformation[0].masks,\n ]);\n const [obfuscateValue, setObfuscateValue] = useState(false);\n const [shouldFocusAfterClear, setShouldFocusAfterClear] = useState(false);\n const internalInputRef = useRef<HTMLInputElement>(null);\n const forkedInputRef = useForkRef(numberRef, internalInputRef);\n\n const countryOptions = useMemo(() => {\n return createCountryOptions(allowedCountryCodes);\n }, [allowedCountryCodes]);\n\n function changeCountry(countryCodeValue: string) {\n const countryInformation = countryCodeMap.get(countryCodeValue);\n\n if (countryInformation == null) {\n return;\n }\n\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (phoneNumber == null) {\n return;\n }\n\n const value = `${countryInformation.prefix}${stripNonNumericAfterCountryCode(phoneNumber)}`;\n lastOutputValueRef.current = value;\n onChange && onChange(value, false);\n }\n\n useLayoutEffect(() => {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n }, [value, selectedCountry, defaultCountry]);\n\n function transformValue(newPhoneNumber: string) {\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newPhoneNumber);\n const outputValue = countryPrefix + lineNumber;\n\n // Clear obfuscated state when user types manually\n if (obfuscateValue) {\n setObfuscateValue(false);\n }\n\n lastOutputValueRef.current = outputValue;\n phoneNumber !== newPhoneNumber && setPhoneNumber(newPhoneNumber);\n onChange && onChange(outputValue, false);\n }\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(\n value: string,\n _label: string | undefined,\n _isSuggestion: boolean,\n obfuscate: boolean\n ) {\n // Update the phone number with the selected value\n setObfuscateValue(obfuscate);\n updatePhoneNumber(value, obfuscate);\n closePhoneBook();\n }\n\n function preparePasteValue(value: string) {\n if (value.startsWith('+')) {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setPhoneNumber(phoneNumber);\n\n return phoneNumber;\n }\n\n return value;\n }\n\n function handleObfuscatedInputChange(newValue: string) {\n // When user types on a obfuscated input, clear the obfuscated state and start fresh\n // The newValue will be the digits the user typed (mask filters to valid input)\n setShouldFocusAfterClear(true);\n setObfuscateValue(false);\n setPhoneNumber(newValue);\n\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newValue);\n const outputValue = countryPrefix + lineNumber;\n lastOutputValueRef.current = outputValue;\n onChange && onChange(outputValue, false);\n }\n\n const updatePhoneNumber = useCallback(\n (value: string, obfuscate = false) => {\n const oldValue = lastOutputValueRef.current;\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (oldValue !== value) {\n setPhoneNumber(phoneNumber);\n onChange && onChange(value, obfuscate);\n }\n },\n [defaultCountry, selectedCountry, onChange]\n );\n\n useLayoutEffect(() => {\n updatePhoneNumber(value);\n }, [value, updatePhoneNumber]);\n\n // Focus the input after transitioning from obfuscated to normal mode\n useLayoutEffect(() => {\n if (shouldFocusAfterClear && !obfuscateValue && internalInputRef.current) {\n internalInputRef.current.focus();\n setShouldFocusAfterClear(false);\n }\n }, [shouldFocusAfterClear, obfuscateValue]);\n\n return (\n <HStack\n ref={ref}\n className={clsx(styles['phone-number-input'], 'phone-number-input')}\n height=\"auto\"\n {...props}\n >\n <Select\n className={clsx(styles['phone-number-input-select'], 'phone-number-input-select')}\n ref={countryRef}\n width=\"auto\"\n value={obfuscateValue ? '' : countryCode}\n onChange={changeCountry}\n disabled={disabled || obfuscateValue}\n data-is-disabled={disabled || obfuscateValue}\n data-is-obfuscated={obfuscateValue}\n placeholder={obfuscateValue ? '––' : undefined}\n >\n {countryOptions}\n </Select>\n <HStack width=\"flex\" className={clsx(styles['phone-number-input-container'])}>\n {obfuscateValue ? (\n <MaskInput\n key=\"obfuscated\"\n name={name}\n autoComplete={autoComplete}\n ref={forkedInputRef}\n value=\"\"\n mask={createObfuscatedMasks(currentMasks)}\n onChange={handleObfuscatedInputChange}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n data-is-obfuscated={true}\n className={clsx(\n styles['phone-number-input'],\n styles['phone-number-input-obfuscated'],\n 'phone-number-input'\n )}\n preparePasteValue={() => ''}\n prepareCopyValue={() => ''}\n prepareCutValue={() => ''}\n />\n ) : (\n <MaskInput\n key=\"normal\"\n name={name}\n autoComplete={autoComplete}\n ref={forkedInputRef}\n value={phoneNumber}\n mask={currentMasks}\n onChange={transformValue}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n data-is-obfuscated={false}\n className={clsx(styles['phone-number-input'], 'phone-number-input')}\n preparePasteValue={preparePasteValue}\n />\n )}\n </HStack>\n {showPhoneBook && (\n <>\n <SlimButton\n disabled={disabled}\n className={clsx(\n styles['phone-number-input-phone-book'],\n 'phone-number-input-phone-book'\n )}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </SlimButton>\n\n {isPhoneBookOpen && (\n <SuggestionList\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n )}\n </>\n )}\n </HStack>\n );\n});\n"],"names":["OBFUSCATED_CHARACTER","createObfuscatedMasks","masks","m","countryList","countriesPhoneInformation","i","a","b","countryPrefixMap","countryCodeMap","createCountryOptions","allowedCountryCodes","allowedMap","c","jsx","Option","getCountryCodeFromValue","value","previousCountry","defaultCountry","x","prefix","countriesInformation","countryInformation","PhoneNumberInput","React","name","autoComplete","onChange","countryRef","numberRef","disabled","children","props","ref","lastOutputValueRef","useRef","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","selectedCountry","setSelectedCountry","phoneNumber","setPhoneNumber","stripNonNumericAfterCountryCode","phoneBookOptions","useMemo","Children","child","isValidElement","showPhoneBook","countryCode","setCountryCode","currentMasks","setCurrentMasks","obfuscateValue","setObfuscateValue","shouldFocusAfterClear","setShouldFocusAfterClear","internalInputRef","forkedInputRef","useForkRef","countryOptions","changeCountry","countryCodeValue","useLayoutEffect","transformValue","newPhoneNumber","countryPrefix","lineNumber","outputValue","togglePhoneBook","closePhoneBook","handlePhoneBookOptionSelect","_label","_isSuggestion","obfuscate","updatePhoneNumber","preparePasteValue","handleObfuscatedInputChange","newValue","useCallback","oldValue","jsxs","HStack","clsx","styles","Select","MaskInput","Fragment","SlimButton","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;8eAyBMA,KAAuB;AAE7B,SAASC,GAAsBC,GAAiD;AAC9E,SAAOA,EAAM,IAAI,CAAAC,OAAM;AAAA,IACrB,GAAGA;AAAA,IACH,aAAaA,EAAE,KAAK,QAAQ,UAAUH,EAAoB;AAAA,EAAA,EAC1D;AACJ;AAEA,MAAMI,IAAcC,EAA0B,IAAI,CAAAC,OAAM;AAAA,EACtD,MAAMA,EAAE;AAAA,EACR,eAAeA,EAAE;AAAA,EACjB,aAAa,GAAGA,EAAE,MAAM,KAAKA,EAAE,IAAI,KAAKA,EAAE,WAAW;AAAA,EACrD,OAAOA,EAAE;AAAA,EACT,U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AAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
import w, { useRef as c, useState as L } from "react";
|
|
6
6
|
import { useForkRef as H } from "../../utils/hooks/use_fork_ref.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
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";
|
|
@@ -6,12 +6,12 @@ import "../../caption.module-DDq0H4xZ.js";
|
|
|
6
6
|
import "../../footnote.module-DEyFuqOr.js";
|
|
7
7
|
import "../../headline.module-BiwHBtGf.js";
|
|
8
8
|
import "../../subheadline.module-C-v7zMkQ.js";
|
|
9
|
-
import "../../title.
|
|
9
|
+
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 = "",
|