@tcn/ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bar.css +1 -0
- package/dist/body.css +1 -1
- package/dist/body.module-BbFZ7KNP.js +5 -0
- package/dist/body.module-BbFZ7KNP.js.map +1 -0
- package/dist/divider.css +1 -1
- package/dist/footer.css +1 -1
- package/dist/form/field/h_field/h_field.d.ts.map +1 -1
- package/dist/form/field/h_field/h_field.js +33 -35
- package/dist/form/field/h_field/h_field.js.map +1 -1
- package/dist/form/field/v_field/v_field.d.ts.map +1 -1
- package/dist/form/field/v_field/v_field.js +34 -36
- package/dist/form/field/v_field/v_field.js.map +1 -1
- package/dist/frame.css +1 -1
- package/dist/inputs/color_input/color_input.d.ts.map +1 -1
- package/dist/inputs/color_input/color_input.js +47 -46
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.d.ts.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +61 -58
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/index.d.ts +1 -0
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/index.js +34 -31
- package/dist/inputs/index.js.map +1 -1
- package/dist/inputs/input/input.js +9 -9
- package/dist/inputs/input/input.js.map +1 -1
- package/dist/inputs/input_group/input_group.d.ts +5 -0
- package/dist/inputs/input_group/input_group.d.ts.map +1 -0
- package/dist/inputs/input_group/input_group.js +20 -0
- package/dist/inputs/input_group/input_group.js.map +1 -0
- package/dist/inputs/phone_number_input/countries_phone_information.d.ts +2 -2
- package/dist/inputs/phone_number_input/countries_phone_information.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/countries_phone_information.js +5 -353
- package/dist/inputs/phone_number_input/countries_phone_information.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_context.d.ts +24 -0
- package/dist/inputs/phone_number_input/phone_number_context.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_context.js +23 -0
- package/dist/inputs/phone_number_input/phone_number_context.js.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.d.ts +19 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.js +77 -0
- package/dist/inputs/phone_number_input/phone_number_country_select_adapter.js.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +16 -14
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +104 -274
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input_adapter.d.ts +6 -0
- package/dist/inputs/phone_number_input/phone_number_input_adapter.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js +95 -0
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -0
- package/dist/inputs/phone_number_input/sip_input.d.ts +12 -0
- package/dist/inputs/phone_number_input/sip_input.d.ts.map +1 -0
- package/dist/inputs/phone_number_input/sip_input.js +111 -0
- package/dist/inputs/phone_number_input/sip_input.js.map +1 -0
- package/dist/inputs/select/select.d.ts.map +1 -1
- package/dist/inputs/select/select.js +3 -2
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts +4 -1
- package/dist/inputs/suggestions/suggestion_list.d.ts.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +120 -111
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/textarea/textarea.js +8 -8
- package/dist/inputs/textarea/textarea.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.d.ts.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +39 -39
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/layouts/bar/bar.d.ts +5 -0
- package/dist/layouts/bar/bar.d.ts.map +1 -0
- package/dist/layouts/bar/bar.js +20 -0
- package/dist/layouts/bar/bar.js.map +1 -0
- package/dist/layouts/body/body.d.ts +2 -2
- package/dist/layouts/body/body.d.ts.map +1 -1
- package/dist/layouts/body/body.js +12 -12
- package/dist/layouts/body/body.js.map +1 -1
- package/dist/layouts/body/h_body.d.ts.map +1 -1
- package/dist/layouts/body/h_body.js +18 -12
- package/dist/layouts/body/h_body.js.map +1 -1
- package/dist/layouts/body/v_body.d.ts.map +1 -1
- package/dist/layouts/body/v_body.js +16 -10
- package/dist/layouts/body/v_body.js.map +1 -1
- package/dist/layouts/footer/footer.d.ts +2 -3
- package/dist/layouts/footer/footer.d.ts.map +1 -1
- package/dist/layouts/footer/footer.js +7 -7
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/header/header.d.ts +2 -2
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js +13 -21
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +0 -1
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +17 -19
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/rail/rail.js +41 -41
- package/dist/layouts/rail/rail.js.map +1 -1
- package/dist/layouts/rail/side/side.d.ts.map +1 -1
- package/dist/layouts/rail/side/side.js +1 -1
- package/dist/layouts/rail/side/side.js.map +1 -1
- package/dist/layouts/rail/utility_strip/utility_strip.d.ts.map +1 -1
- package/dist/layouts/rail/utility_strip/utility_strip.js +21 -17
- package/dist/layouts/rail/utility_strip/utility_strip.js.map +1 -1
- package/dist/layouts/scaffold/scaffold.js +32 -32
- package/dist/layouts/scaffold/scaffold.js.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts +2 -2
- package/dist/layouts/utility_bar/utility_bar.d.ts.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.js +17 -19
- package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
- package/dist/overlay/frame/frame.d.ts +8 -4
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +87 -23
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -1
- package/dist/overlay/popper/legacy/popper.d.ts.map +1 -1
- package/dist/overlay/popper/legacy/popper.js +52 -50
- package/dist/overlay/popper/legacy/popper.js.map +1 -1
- package/dist/panel.css +1 -0
- package/dist/phone_number_input.css +1 -1
- package/dist/rail.css +1 -1
- package/dist/scaffold.css +1 -1
- package/dist/side.css +1 -1
- package/dist/stacks/box/bottom_resize_handle.d.ts +2 -2
- package/dist/stacks/box/bottom_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/bottom_resize_handle.js +12 -10
- package/dist/stacks/box/bottom_resize_handle.js.map +1 -1
- package/dist/stacks/box/box.d.ts +4 -4
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js +26 -26
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/end_resize_handle.d.ts +2 -2
- package/dist/stacks/box/end_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/end_resize_handle.js +6 -5
- package/dist/stacks/box/end_resize_handle.js.map +1 -1
- package/dist/stacks/box/left_resize_handle.d.ts +2 -2
- package/dist/stacks/box/left_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/left_resize_handle.js +10 -9
- package/dist/stacks/box/left_resize_handle.js.map +1 -1
- package/dist/stacks/box/resize_handlers.d.ts +2 -2
- package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
- package/dist/stacks/box/resize_handlers.js +32 -32
- package/dist/stacks/box/resize_handlers.js.map +1 -1
- package/dist/stacks/box/right_resize_handle.d.ts +2 -2
- package/dist/stacks/box/right_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/right_resize_handle.js +6 -5
- package/dist/stacks/box/right_resize_handle.js.map +1 -1
- package/dist/stacks/box/start_resize_handle.d.ts +2 -2
- package/dist/stacks/box/start_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/start_resize_handle.js +6 -6
- package/dist/stacks/box/start_resize_handle.js.map +1 -1
- package/dist/stacks/box/top_resize_handle.d.ts +2 -2
- package/dist/stacks/box/top_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/top_resize_handle.js +6 -5
- package/dist/stacks/box/top_resize_handle.js.map +1 -1
- package/dist/stacks/h_collapsible_box.d.ts.map +1 -1
- package/dist/stacks/h_collapsible_box.js +25 -25
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +25 -25
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/suggestion_list.css +1 -1
- package/dist/surfaces/index.d.ts +1 -2
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +18 -20
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/panel/panel.d.ts +5 -0
- package/dist/surfaces/panel/panel.d.ts.map +1 -0
- package/dist/surfaces/panel/panel.js +19 -0
- package/dist/surfaces/panel/panel.js.map +1 -0
- package/dist/surfaces/pop_confirm/pop_confirm.js +2 -3
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/surfaces/window/window.d.ts +1 -1
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +20 -10
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/stylesheets/reset.css +1 -1
- package/dist/themes/stylesheets/reset.js +8 -1
- package/dist/themes/stylesheets/reset.js.map +1 -1
- package/dist/themes/theme.d.ts +2 -1
- package/dist/themes/theme.d.ts.map +1 -1
- package/dist/themes/theme.js +16 -9
- package/dist/themes/theme.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +210 -18
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/typography/body_text/body_text.d.ts.map +1 -1
- package/dist/typography/body_text/body_text.js +12 -10
- package/dist/typography/body_text/body_text.js.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -1
- package/dist/utils/dnd/hooks/use_drag_container.js +22 -19
- package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -1
- package/package.json +4 -2
- package/src/form/field/h_field/h_field.tsx +0 -4
- package/src/form/field/v_field/v_field.stories.tsx +8 -0
- package/src/form/field/v_field/v_field.tsx +1 -4
- package/src/form/field_set/field_set.stories.tsx +2 -1
- package/src/inputs/__docs__/inputs.mdx +81 -0
- package/src/inputs/__docs__/inputs.stories.tsx +268 -0
- package/src/inputs/color_input/color_input.tsx +17 -17
- package/src/inputs/combo_box/combo_box.tsx +17 -13
- package/src/inputs/index.ts +2 -0
- package/src/inputs/input/input.tsx +1 -1
- package/src/inputs/input_group/input_group.tsx +26 -0
- package/src/inputs/phone_number_input/countries_phone_information.ts +6 -353
- package/src/inputs/phone_number_input/phone_number_context.tsx +32 -0
- package/src/inputs/phone_number_input/phone_number_country_select_adapter.tsx +126 -0
- package/src/inputs/phone_number_input/phone_number_input.module.css +5 -63
- package/src/inputs/phone_number_input/phone_number_input.stories.tsx +180 -150
- package/src/inputs/phone_number_input/phone_number_input.tsx +133 -400
- package/src/inputs/phone_number_input/phone_number_input_adapter.tsx +123 -0
- package/src/inputs/phone_number_input/sip_input.tsx +147 -0
- package/src/inputs/select/select.tsx +13 -14
- package/src/inputs/suggestions/suggestion_list.module.css +1 -0
- package/src/inputs/suggestions/suggestion_list.stories.tsx +12 -8
- package/src/inputs/suggestions/suggestion_list.tsx +24 -3
- package/src/inputs/textarea/textarea.tsx +1 -1
- package/src/inputs/unit_input/unit_input.tsx +17 -17
- package/src/layouts/__stories__/composed.stories.tsx +0 -55
- package/src/layouts/__stories__/rail.stories.tsx +78 -0
- package/src/layouts/__stories__/scaffold.stories.tsx +90 -0
- package/src/layouts/__stories__/utils/content.tsx +27 -0
- package/src/layouts/__stories__/utils/layout_theme.css +88 -0
- package/src/layouts/__stories__/utils/layout_theme_provider.tsx +11 -0
- package/src/layouts/__stories__/utils.tsx +6 -6
- package/src/layouts/{utility_bar/utility_bar.module.css → bar/bar.module.css} +2 -1
- package/src/layouts/bar/bar.tsx +23 -0
- package/src/layouts/body/body.module.css +9 -4
- package/src/layouts/body/body.tsx +7 -6
- package/src/layouts/body/h_body.module.css +1 -2
- package/src/layouts/body/h_body.tsx +9 -4
- package/src/layouts/body/v_body.tsx +9 -4
- package/src/layouts/divider/divider.module.css +1 -1
- package/src/layouts/footer/footer.module.css +0 -3
- package/src/layouts/footer/footer.tsx +5 -6
- package/src/layouts/header/header.tsx +6 -15
- package/src/layouts/index.ts +0 -1
- package/src/layouts/rail/rail.module.css +9 -5
- package/src/layouts/rail/rail.tsx +1 -1
- package/src/layouts/rail/side/side.module.css +0 -1
- package/src/layouts/rail/side/side.tsx +1 -2
- package/src/layouts/rail/utility_strip/utility_strip.module.css +5 -0
- package/src/layouts/rail/utility_strip/utility_strip.tsx +4 -1
- package/src/layouts/scaffold/scaffold.module.css +10 -7
- package/src/layouts/scaffold/scaffold.tsx +1 -1
- package/src/layouts/utility_bar/utility_bar.tsx +6 -9
- package/src/overlay/frame/frame.module.css +2 -4
- package/src/overlay/frame/frame.stories.tsx +13 -10
- package/src/overlay/frame/frame.tsx +124 -16
- package/src/overlay/popper/base/dismissal_decorator.tsx +1 -1
- package/src/overlay/popper/legacy/popper.tsx +5 -1
- package/src/stacks/box/bottom_resize_handle.tsx +12 -5
- package/src/stacks/box/box.tsx +18 -14
- package/src/stacks/box/end_resize_handle.tsx +11 -6
- package/src/stacks/box/left_resize_handle.tsx +9 -3
- package/src/stacks/box/resize_handlers.ts +27 -13
- package/src/stacks/box/right_resize_handle.tsx +9 -3
- package/src/stacks/box/start_resize_handle.tsx +9 -4
- package/src/stacks/box/top_resize_handle.tsx +10 -4
- package/src/stacks/collapsible_box.stories.tsx +11 -11
- package/src/stacks/h_collapsible_box.tsx +5 -5
- package/src/stacks/v_collapsible_box.tsx +4 -4
- package/src/surfaces/index.ts +1 -2
- package/src/surfaces/panel/__stories__/panel.stories.tsx +12 -12
- package/src/surfaces/panel/__stories__/panel_stories.module.css +3 -3
- package/src/surfaces/panel/panel.module.css +1 -6
- package/src/surfaces/panel/panel.tsx +22 -0
- package/src/surfaces/window/window.tsx +14 -4
- package/src/themes/stories/controls_fieldset.tsx +1 -1
- package/src/themes/stylesheets/reset.css +8 -1
- package/src/themes/theme.tsx +6 -2
- package/src/themes/themes/ergo/__stories__/material.stories.tsx +15 -16
- package/src/themes/themes/ergo/ergo_theme.css +210 -18
- package/src/typography/body_text/body_text.tsx +2 -0
- package/src/utils/dnd/__stories__/draggable.stories.tsx +14 -8
- package/src/utils/dnd/hooks/use_drag_container.ts +13 -3
- package/dist/h_body.css +0 -1
- package/dist/h_panel.css +0 -1
- package/dist/header.css +0 -1
- package/dist/layouts/rail/main/main.d.ts +0 -6
- package/dist/layouts/rail/main/main.d.ts.map +0 -1
- package/dist/layouts/rail/main/main.js +0 -21
- package/dist/layouts/rail/main/main.js.map +0 -1
- package/dist/main.css +0 -1
- package/dist/surfaces/panel/h_panel.d.ts +0 -9
- package/dist/surfaces/panel/h_panel.d.ts.map +0 -1
- package/dist/surfaces/panel/h_panel.js +0 -60
- package/dist/surfaces/panel/h_panel.js.map +0 -1
- package/dist/surfaces/panel/v_panel.d.ts +0 -5
- package/dist/surfaces/panel/v_panel.d.ts.map +0 -1
- package/dist/surfaces/panel/v_panel.js +0 -19
- package/dist/surfaces/panel/v_panel.js.map +0 -1
- package/dist/utility_bar.css +0 -1
- package/dist/v_body.css +0 -1
- package/src/inputs/phone_number_input/__tests__/utils.test.ts +0 -52
- package/src/layouts/header/header.module.css +0 -8
- package/src/layouts/rail/__stories__/rail.stories.tsx +0 -64
- package/src/layouts/rail/__stories__/rail_stories.module.css +0 -25
- package/src/layouts/rail/main/main.module.css +0 -7
- package/src/layouts/rail/main/main.tsx +0 -26
- package/src/layouts/scaffold/__stories__/scaffold.stories.tsx +0 -53
- package/src/layouts/scaffold/__stories__/scaffold_stories.module.css +0 -31
- package/src/surfaces/panel/h_panel.tsx +0 -65
- package/src/surfaces/panel/v_panel.tsx +0 -20
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsxs as h, Fragment as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import g, { useLayoutEffect as F } from "react";
|
|
3
|
+
import { NotebookIcon as L } from "@tcn/icons/notebook_icon.js";
|
|
4
|
+
import { Input as R } from "../input/input.js";
|
|
5
|
+
import "../../actions/button/base_button/base_button.js";
|
|
6
|
+
import "../../actions/button/button_group/button_group.js";
|
|
7
|
+
import "../../actions/button/slim_button/slim_button.js";
|
|
8
|
+
import { Button as j } from "../../actions/button/button/button.js";
|
|
9
|
+
import "../../actions/button/select_group/select_group.js";
|
|
10
|
+
import "../../actions/button/select_group/single_select_group.js";
|
|
11
|
+
import "../../actions/toggle/toggle.js";
|
|
12
|
+
import { InputGroup as y } from "../input_group/input_group.js";
|
|
13
|
+
import z from "clsx";
|
|
14
|
+
import { usePhoneContext as V } from "./phone_number_context.js";
|
|
15
|
+
import { PhoneNumberCountrySelectAdapter as _ } from "./phone_number_country_select_adapter.js";
|
|
16
|
+
import { SuggestionList as q } from "../suggestions/suggestion_list.js";
|
|
17
|
+
function eo({
|
|
18
|
+
disabled: n,
|
|
19
|
+
countries: k,
|
|
20
|
+
name: B,
|
|
21
|
+
"aria-label": S,
|
|
22
|
+
autoFocus: P,
|
|
23
|
+
placeholder: b
|
|
24
|
+
}) {
|
|
25
|
+
const u = g.useRef(null), [i, t] = g.useState(null), l = i != null, {
|
|
26
|
+
phoneBook: s,
|
|
27
|
+
setValue: r,
|
|
28
|
+
setCountry: d,
|
|
29
|
+
ariaPhoneBookButtonLabel: I,
|
|
30
|
+
sipAddress: p,
|
|
31
|
+
setSipAddress: m,
|
|
32
|
+
focusNumberInput: c,
|
|
33
|
+
setFocusNumberInput: a
|
|
34
|
+
} = V(), C = s.length > 0;
|
|
35
|
+
function N(o) {
|
|
36
|
+
t(l ? null : o.currentTarget);
|
|
37
|
+
}
|
|
38
|
+
function f() {
|
|
39
|
+
t(null);
|
|
40
|
+
}
|
|
41
|
+
function x(o) {
|
|
42
|
+
f(), a(!0), r(o);
|
|
43
|
+
}
|
|
44
|
+
const A = k?.map((o) => ({
|
|
45
|
+
value: o,
|
|
46
|
+
label: o
|
|
47
|
+
})) || [];
|
|
48
|
+
function E(o) {
|
|
49
|
+
o !== "SIP" && (m(p), a(!0), r(""), d(o || "US"));
|
|
50
|
+
}
|
|
51
|
+
function O(o) {
|
|
52
|
+
m(o), r(`sip:${o}`);
|
|
53
|
+
}
|
|
54
|
+
return F(() => {
|
|
55
|
+
const o = u.current;
|
|
56
|
+
o == null || !c || requestAnimationFrame(() => {
|
|
57
|
+
o.value.length > 0 ? o.select() : o.focus();
|
|
58
|
+
});
|
|
59
|
+
}, [c]), /* @__PURE__ */ h(v, { children: [
|
|
60
|
+
/* @__PURE__ */ h(y, { children: [
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
_,
|
|
63
|
+
{
|
|
64
|
+
value: "SIP",
|
|
65
|
+
onChange: E,
|
|
66
|
+
options: A,
|
|
67
|
+
disabled: n
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ e(
|
|
71
|
+
R,
|
|
72
|
+
{
|
|
73
|
+
ref: u,
|
|
74
|
+
value: p,
|
|
75
|
+
disabled: n,
|
|
76
|
+
onChange: O,
|
|
77
|
+
name: B,
|
|
78
|
+
"aria-label": S,
|
|
79
|
+
autoFocus: P,
|
|
80
|
+
placeholder: b
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
C && /* @__PURE__ */ e(
|
|
84
|
+
j,
|
|
85
|
+
{
|
|
86
|
+
disabled: n,
|
|
87
|
+
className: z("tcn-input-group-slot", "tcn-phone-number-phone-book"),
|
|
88
|
+
"aria-label": I,
|
|
89
|
+
onClick: N,
|
|
90
|
+
size: "md",
|
|
91
|
+
children: /* @__PURE__ */ e(L, { size: "md" })
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ e(
|
|
96
|
+
q,
|
|
97
|
+
{
|
|
98
|
+
open: l,
|
|
99
|
+
anchorElement: i,
|
|
100
|
+
onOptionSelect: x,
|
|
101
|
+
onClose: f,
|
|
102
|
+
noSuggestionMessage: "No phone numbers found",
|
|
103
|
+
children: s
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
eo as SipInput
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=sip_input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sip_input.js","sources":["../../../src/inputs/phone_number_input/sip_input.tsx"],"sourcesContent":["import React, { useLayoutEffect } from 'react';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Input } from '../input/input.js';\nimport { Button } from '../../actions/index.js';\nimport { InputGroup } from '../input_group/input_group.js';\nimport clsx from 'clsx';\nimport { usePhoneContext } from './phone_number_context.js';\nimport type { CountryCode } from 'libphonenumber-js';\nimport {\n PhoneNumberCountrySelectAdapter,\n type CountryOption,\n} from './phone_number_country_select_adapter.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\n\nexport interface SipInputProps {\n onChange: (value: string) => void;\n countries?: CountryCode[];\n disabled?: boolean;\n name?: string;\n 'aria-label'?: string;\n autoFocus?: boolean;\n placeholder?: string;\n}\n\nexport function SipInput({\n disabled,\n countries,\n name,\n 'aria-label': ariaLabel,\n autoFocus,\n placeholder,\n}: SipInputProps) {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const [phoneBookElement, setPhoneBookElement] =\n React.useState<HTMLButtonElement | null>(null);\n const isPhoneBookOpen = phoneBookElement != null;\n\n const {\n phoneBook: phoneBookOptions,\n setValue,\n setCountry,\n ariaPhoneBookButtonLabel,\n sipAddress,\n setSipAddress,\n focusNumberInput,\n setFocusNumberInput,\n } = usePhoneContext();\n\n const showPhoneBook = phoneBookOptions.length > 0;\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(value: string) {\n closePhoneBook();\n setFocusNumberInput(true);\n setValue(value);\n }\n\n const options: CountryOption[] =\n countries?.map(country => ({\n value: country,\n label: country,\n })) || [];\n\n function selectCountry(countryCode?: string) {\n if (countryCode !== 'SIP') {\n setSipAddress(sipAddress);\n setFocusNumberInput(true);\n setValue('');\n setCountry((countryCode as CountryCode) || 'US');\n }\n }\n\n function updateSipValue(value: string) {\n setSipAddress(value);\n setValue(`sip:${value}`);\n }\n\n useLayoutEffect(() => {\n const input = inputRef.current;\n\n if (input == null || !focusNumberInput) {\n return;\n }\n\n requestAnimationFrame(() => {\n if (input.value.length > 0) {\n input.select();\n } else {\n input.focus();\n }\n });\n }, [focusNumberInput]);\n\n return (\n <>\n <InputGroup>\n <PhoneNumberCountrySelectAdapter\n value=\"SIP\"\n onChange={selectCountry}\n options={options}\n disabled={disabled}\n />\n <Input\n ref={inputRef}\n value={sipAddress}\n disabled={disabled}\n onChange={updateSipValue}\n name={name}\n aria-label={ariaLabel}\n autoFocus={autoFocus}\n placeholder={placeholder}\n />\n {showPhoneBook && (\n <Button\n disabled={disabled}\n className={clsx('tcn-input-group-slot', 'tcn-phone-number-phone-book')}\n aria-label={ariaPhoneBookButtonLabel}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </Button>\n )}\n </InputGroup>\n <SuggestionList\n open={isPhoneBookOpen}\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n </>\n );\n}\n"],"names":["SipInput","disabled","countries","name","ariaLabel","autoFocus","placeholder","inputRef","React","phoneBookElement","setPhoneBookElement","isPhoneBookOpen","phoneBookOptions","setValue","setCountry","ariaPhoneBookButtonLabel","sipAddress","setSipAddress","focusNumberInput","setFocusNumberInput","usePhoneContext","showPhoneBook","togglePhoneBook","e","closePhoneBook","handlePhoneBookOptionSelect","value","options","country","selectCountry","countryCode","updateSipValue","useLayoutEffect","input","jsxs","Fragment","InputGroup","jsx","PhoneNumberCountrySelectAdapter","Input","Button","clsx","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;AAwBO,SAASA,GAAS;AAAA,EACvB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,aAAAC;AACF,GAAkB;AAChB,QAAMC,IAAWC,EAAM,OAAyB,IAAI,GAC9C,CAACC,GAAkBC,CAAmB,IAC1CF,EAAM,SAAmC,IAAI,GACzCG,IAAkBF,KAAoB,MAEtC;AAAA,IACJ,WAAWG;AAAA,IACX,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,EAAA,IACEC,EAAA,GAEEC,IAAgBT,EAAiB,SAAS;AAEhD,WAASU,EAAgBC,GAAwC;AAC/D,IACEb,EADEC,IACkB,OAEAY,EAAE,aAFE;AAAA,EAI5B;AAEA,WAASC,IAAiB;AACxB,IAAAd,EAAoB,IAAI;AAAA,EAC1B;AAEA,WAASe,EAA4BC,GAAe;AAClD,IAAAF,EAAA,GACAL,EAAoB,EAAI,GACxBN,EAASa,CAAK;AAAA,EAChB;AAEA,QAAMC,IACJzB,GAAW,IAAI,CAAA0B,OAAY;AAAA,IACzB,OAAOA;AAAA,IACP,OAAOA;AAAA,EAAA,EACP,KAAK,CAAA;AAET,WAASC,EAAcC,GAAsB;AAC3C,IAAIA,MAAgB,UAClBb,EAAcD,CAAU,GACxBG,EAAoB,EAAI,GACxBN,EAAS,EAAE,GACXC,EAAYgB,KAA+B,IAAI;AAAA,EAEnD;AAEA,WAASC,EAAeL,GAAe;AACrC,IAAAT,EAAcS,CAAK,GACnBb,EAAS,OAAOa,CAAK,EAAE;AAAA,EACzB;AAEA,SAAAM,EAAgB,MAAM;AACpB,UAAMC,IAAQ1B,EAAS;AAEvB,IAAI0B,KAAS,QAAQ,CAACf,KAItB,sBAAsB,MAAM;AAC1B,MAAIe,EAAM,MAAM,SAAS,IACvBA,EAAM,OAAA,IAENA,EAAM,MAAA;AAAA,IAEV,CAAC;AAAA,EACH,GAAG,CAACf,CAAgB,CAAC,GAGnB,gBAAAgB,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAD,EAACE,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,UAAUT;AAAA,UACV,SAAAF;AAAA,UACA,UAAA1B;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAoC;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,KAAKhC;AAAA,UACL,OAAOS;AAAA,UACP,UAAAf;AAAA,UACA,UAAU8B;AAAA,UACV,MAAA5B;AAAA,UACA,cAAYC;AAAA,UACZ,WAAAC;AAAA,UACA,aAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDe,KACC,gBAAAgB;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,UAAAvC;AAAA,UACA,WAAWwC,EAAK,wBAAwB,6BAA6B;AAAA,UACrE,cAAY1B;AAAA,UACZ,SAASO;AAAA,UACT,MAAK;AAAA,UAEL,UAAA,gBAAAe,EAACK,GAAA,EAAa,MAAK,KAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAC1B,GAEJ;AAAA,IACA,gBAAAL;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,MAAMhC;AAAA,QACN,eAAeF;AAAA,QACf,gBAAgBgB;AAAA,QAChB,SAASD;AAAA,QACT,qBAAoB;AAAA,QAEnB,UAAAZ;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/inputs/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOlE,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5D,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAC/E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/inputs/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOlE,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5D,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAC/E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,oGA0IjB,CAAC"}
|
|
@@ -77,7 +77,7 @@ const he = F.forwardRef(function({
|
|
|
77
77
|
W,
|
|
78
78
|
{
|
|
79
79
|
ref: B,
|
|
80
|
-
className: L(T, "tcn-select", O.select),
|
|
80
|
+
className: L(T, "tcn-select", "tcn-control", O.select),
|
|
81
81
|
width: "100%",
|
|
82
82
|
...D,
|
|
83
83
|
hAlign: "start",
|
|
@@ -89,9 +89,10 @@ const he = F.forwardRef(function({
|
|
|
89
89
|
children: /* @__PURE__ */ u("span", { className: L(O.selectedLabel, "tcn-select-selected-label"), children: k })
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
|
-
|
|
92
|
+
/* @__PURE__ */ u(
|
|
93
93
|
Q,
|
|
94
94
|
{
|
|
95
|
+
open: y,
|
|
95
96
|
anchorElement: q,
|
|
96
97
|
onClose: N,
|
|
97
98
|
value: "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../../../src/inputs/select/select.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport { clsx } from 'clsx';\nimport React, { useRef, useState } from 'react';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { OptionProps } from '../options/option.js';\nimport { Button, type ButtonProps } from '../../actions/index.js';\nimport styles from './select.module.css';\n\nfunction findOptionFromValue(options: React.ReactElement<OptionProps>[], value: string) {\n return options.find(option => option.props.value === value);\n}\n\nexport interface SelectProps\n extends Omit<ButtonProps, 'children' | 'onChange' | 'value'> {\n children?: React.ReactElement<OptionProps>[] | React.ReactElement<OptionProps>;\n onChange?: (value: string) => void;\n value?: string | null;\n placeholder?: string;\n noOptionMatchedMessage?: React.ReactNode;\n trimCustomInput?: boolean;\n}\n\nexport const Select = React.forwardRef(function Select(\n {\n children = [],\n onKeyDown,\n onKeyUp,\n value,\n placeholder = '-- Select --',\n noOptionMatchedMessage,\n trimCustomInput = false,\n className,\n onMouseDown,\n onMouseUp,\n onChange,\n ...props\n }: SelectProps,\n ref: React.Ref<HTMLButtonElement>\n) {\n const safeChildren = React.Children.toArray(\n children\n ) as React.ReactElement<OptionProps>[];\n const keyPressedDownRef = useRef('');\n const isAlreadyFocusedRef = useRef(false);\n const isClosingRef = useRef(false);\n const [anchorElement, setAnchorElement] = useState<HTMLButtonElement | null>(null);\n const internalButtonRef = useRef<HTMLButtonElement | null>(null);\n const [isSuggestionsOpen, setIsSuggestionsOpen] = useState(false);\n const forkedRef = useForkRef(ref, internalButtonRef);\n const selectedOption = findOptionFromValue(safeChildren, value || '');\n const selectedLabel =\n selectedOption == null ? placeholder || '' : selectedOption.props.label;\n\n function openSuggestions() {\n setIsSuggestionsOpen(true);\n }\n\n function closeSuggestions() {\n setIsSuggestionsOpen(false);\n }\n\n function handleClose() {\n const button = internalButtonRef.current;\n\n if (button != null) {\n requestAnimationFrame(() => {\n button.focus();\n });\n }\n\n closeSuggestions();\n }\n\n function handleSelection(value: string, _: string | undefined, isSuggestion: boolean) {\n const button = internalButtonRef.current;\n\n if (button != null) {\n requestAnimationFrame(() => {\n if (isSuggestion) {\n onChange && onChange(value);\n }\n button.focus();\n });\n }\n\n closeSuggestions();\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {\n const key = event.key;\n keyPressedDownRef.current = key;\n onKeyDown && onKeyDown(event);\n }\n\n function handleKeyUp(event: React.KeyboardEvent<HTMLButtonElement>) {\n setAnchorElement(event.currentTarget);\n const isSameKey = (keyPressedDownRef.current = event.key);\n\n keyPressedDownRef.current = '';\n const key = event.key;\n\n if (isSameKey && (key === 'Enter' || key === ' ')) {\n if (isSuggestionsOpen) {\n closeSuggestions();\n } else {\n openSuggestions();\n }\n }\n\n onKeyUp && onKeyUp(event);\n }\n\n function handlMouseDown(event: React.MouseEvent<HTMLButtonElement>) {\n setAnchorElement(event.currentTarget);\n isAlreadyFocusedRef.current = document.activeElement === event.currentTarget;\n onMouseDown && onMouseDown(event);\n }\n\n function handleMouseUp(event: React.MouseEvent<HTMLButtonElement>) {\n if (isClosingRef.current) {\n isClosingRef.current = false;\n closeSuggestions();\n }\n\n openSuggestions();\n onMouseUp && onMouseUp(event);\n }\n\n return (\n <>\n <Button\n ref={forkedRef}\n className={clsx(className, 'tcn-select', styles.select)}\n width=\"100%\"\n {...props}\n hAlign=\"start\"\n value={selectedLabel}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onMouseDown={handlMouseDown}\n onMouseUp={handleMouseUp}\n >\n <span className={clsx(styles.selectedLabel, 'tcn-select-selected-label')}>\n {selectedLabel}\n </span>\n </Button>\n {isSuggestionsOpen
|
|
1
|
+
{"version":3,"file":"select.js","sources":["../../../src/inputs/select/select.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport { clsx } from 'clsx';\nimport React, { useRef, useState } from 'react';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { OptionProps } from '../options/option.js';\nimport { Button, type ButtonProps } from '../../actions/index.js';\nimport styles from './select.module.css';\n\nfunction findOptionFromValue(options: React.ReactElement<OptionProps>[], value: string) {\n return options.find(option => option.props.value === value);\n}\n\nexport interface SelectProps\n extends Omit<ButtonProps, 'children' | 'onChange' | 'value'> {\n children?: React.ReactElement<OptionProps>[] | React.ReactElement<OptionProps>;\n onChange?: (value: string) => void;\n value?: string | null;\n placeholder?: string;\n noOptionMatchedMessage?: React.ReactNode;\n trimCustomInput?: boolean;\n}\n\nexport const Select = React.forwardRef(function Select(\n {\n children = [],\n onKeyDown,\n onKeyUp,\n value,\n placeholder = '-- Select --',\n noOptionMatchedMessage,\n trimCustomInput = false,\n className,\n onMouseDown,\n onMouseUp,\n onChange,\n ...props\n }: SelectProps,\n ref: React.Ref<HTMLButtonElement>\n) {\n const safeChildren = React.Children.toArray(\n children\n ) as React.ReactElement<OptionProps>[];\n const keyPressedDownRef = useRef('');\n const isAlreadyFocusedRef = useRef(false);\n const isClosingRef = useRef(false);\n const [anchorElement, setAnchorElement] = useState<HTMLButtonElement | null>(null);\n const internalButtonRef = useRef<HTMLButtonElement | null>(null);\n const [isSuggestionsOpen, setIsSuggestionsOpen] = useState(false);\n const forkedRef = useForkRef(ref, internalButtonRef);\n const selectedOption = findOptionFromValue(safeChildren, value || '');\n const selectedLabel =\n selectedOption == null ? placeholder || '' : selectedOption.props.label;\n\n function openSuggestions() {\n setIsSuggestionsOpen(true);\n }\n\n function closeSuggestions() {\n setIsSuggestionsOpen(false);\n }\n\n function handleClose() {\n const button = internalButtonRef.current;\n\n if (button != null) {\n requestAnimationFrame(() => {\n button.focus();\n });\n }\n\n closeSuggestions();\n }\n\n function handleSelection(value: string, _: string | undefined, isSuggestion: boolean) {\n const button = internalButtonRef.current;\n\n if (button != null) {\n requestAnimationFrame(() => {\n if (isSuggestion) {\n onChange && onChange(value);\n }\n button.focus();\n });\n }\n\n closeSuggestions();\n }\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {\n const key = event.key;\n keyPressedDownRef.current = key;\n onKeyDown && onKeyDown(event);\n }\n\n function handleKeyUp(event: React.KeyboardEvent<HTMLButtonElement>) {\n setAnchorElement(event.currentTarget);\n const isSameKey = (keyPressedDownRef.current = event.key);\n\n keyPressedDownRef.current = '';\n const key = event.key;\n\n if (isSameKey && (key === 'Enter' || key === ' ')) {\n if (isSuggestionsOpen) {\n closeSuggestions();\n } else {\n openSuggestions();\n }\n }\n\n onKeyUp && onKeyUp(event);\n }\n\n function handlMouseDown(event: React.MouseEvent<HTMLButtonElement>) {\n setAnchorElement(event.currentTarget);\n isAlreadyFocusedRef.current = document.activeElement === event.currentTarget;\n onMouseDown && onMouseDown(event);\n }\n\n function handleMouseUp(event: React.MouseEvent<HTMLButtonElement>) {\n if (isClosingRef.current) {\n isClosingRef.current = false;\n closeSuggestions();\n }\n\n openSuggestions();\n onMouseUp && onMouseUp(event);\n }\n\n return (\n <>\n <Button\n ref={forkedRef}\n className={clsx(className, 'tcn-select', 'tcn-control', styles.select)}\n width=\"100%\"\n {...props}\n hAlign=\"start\"\n value={selectedLabel}\n onKeyDown={handleKeyDown}\n onKeyUp={handleKeyUp}\n onMouseDown={handlMouseDown}\n onMouseUp={handleMouseUp}\n >\n <span className={clsx(styles.selectedLabel, 'tcn-select-selected-label')}>\n {selectedLabel}\n </span>\n </Button>\n <SuggestionList\n open={isSuggestionsOpen}\n anchorElement={anchorElement}\n onClose={handleClose}\n value={''}\n scrollToValue={value || ''}\n trimCustomInput={trimCustomInput}\n onOptionSelect={handleSelection}\n noSuggestionMessage={noOptionMatchedMessage}\n >\n {children}\n </SuggestionList>\n </>\n );\n});\n"],"names":["findOptionFromValue","options","value","option","Select","React","children","onKeyDown","onKeyUp","placeholder","noOptionMatchedMessage","trimCustomInput","className","onMouseDown","onMouseUp","onChange","props","ref","safeChildren","keyPressedDownRef","useRef","isAlreadyFocusedRef","isClosingRef","anchorElement","setAnchorElement","useState","internalButtonRef","isSuggestionsOpen","setIsSuggestionsOpen","forkedRef","useForkRef","selectedOption","selectedLabel","openSuggestions","closeSuggestions","handleClose","button","handleSelection","_","isSuggestion","handleKeyDown","event","key","handleKeyUp","isSameKey","handlMouseDown","handleMouseUp","jsxs","Fragment","jsx","Button","clsx","styles","SuggestionList"],"mappings":"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"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface SuggestionListProps extends Omit<React.HTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
3
3
|
value?: string;
|
|
4
|
+
initialSearchValue?: string;
|
|
4
5
|
scrollToValue?: string;
|
|
5
6
|
anchorElement: HTMLElement | null;
|
|
7
|
+
open?: boolean;
|
|
6
8
|
children?: React.ReactNode;
|
|
7
9
|
onChange?: (value: string) => void;
|
|
8
10
|
onOptionSelect?: (value: string, label: string | undefined, isSuggestion: boolean, obfuscate: boolean) => void;
|
|
9
11
|
noSuggestionMessage?: React.ReactNode;
|
|
10
12
|
trimCustomInput?: boolean;
|
|
11
13
|
haveValueAsOption?: boolean;
|
|
14
|
+
restoreFocus?: boolean;
|
|
12
15
|
onClose?: (inputValue: string, cursorStartPosition: number | null, cursorEndPosition: number | null) => void;
|
|
13
16
|
}
|
|
14
|
-
export declare function SuggestionList({ value, scrollToValue, anchorElement, children, onOptionSelect, noSuggestionMessage, onClose, onChange, onKeyUp, onKeyDown, trimCustomInput, haveValueAsOption, ...props }: SuggestionListProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function SuggestionList({ value, initialSearchValue: searchValue, scrollToValue, anchorElement, open, children, onOptionSelect, noSuggestionMessage, onClose, onChange, onKeyUp, onKeyDown, trimCustomInput, haveValueAsOption, restoreFocus, ...props }: SuggestionListProps): import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
//# sourceMappingURL=suggestion_list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion_list.d.ts","sourceRoot":"","sources":["../../../src/inputs/suggestions/suggestion_list.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAazE,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,OAAO,EACrB,SAAS,EAAE,OAAO,KACf,IAAI,CAAC;IACV,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,CACR,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,KAC7B,IAAI,CAAC;CACX;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAU,EACV,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,mBAAwC,EACxC,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,eAAuB,EACvB,iBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"suggestion_list.d.ts","sourceRoot":"","sources":["../../../src/inputs/suggestions/suggestion_list.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAazE,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,OAAO,EACrB,SAAS,EAAE,OAAO,KACf,IAAI,CAAC;IACV,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,CACR,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,KAC7B,IAAI,CAAC;CACX;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAU,EACV,kBAAkB,EAAE,WAAW,EAC/B,aAAa,EACb,aAAa,EACb,IAAY,EACZ,QAAQ,EACR,cAAc,EACd,mBAAwC,EACxC,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,eAAuB,EACvB,iBAAyB,EACzB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,mBAAmB,2CAyYrB"}
|
|
@@ -1,82 +1,88 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { BodyText as
|
|
1
|
+
import { jsx as r, jsxs as P, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
+
import { BodyText as de } from "../../typography/body_text/body_text.js";
|
|
3
3
|
import "../../typography/callout/callout.js";
|
|
4
4
|
import "../../typography/caption/caption.js";
|
|
5
5
|
import "../../typography/footnote/footnote.js";
|
|
6
6
|
import "../../typography/headline/headline.js";
|
|
7
7
|
import "../../typography/subheadline/subheadline.js";
|
|
8
8
|
import "../../typography/title/title.js";
|
|
9
|
-
import { VStack as
|
|
10
|
-
import { ZStack as
|
|
11
|
-
import { clsx as
|
|
12
|
-
import { Children as
|
|
9
|
+
import { VStack as W } from "../../stacks/v_stack.js";
|
|
10
|
+
import { ZStack as ge } from "../../stacks/z_stack.js";
|
|
11
|
+
import { clsx as D } from "clsx";
|
|
12
|
+
import { Children as he, isValidElement as me, useState as a, useRef as F, useLayoutEffect as b } from "react";
|
|
13
13
|
import "../../utils/click_away_listener.js";
|
|
14
|
-
import { FocusRedirect as
|
|
14
|
+
import { FocusRedirect as we } 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 "../../utils/dnd/context.js";
|
|
18
18
|
import "../../draggable.module-BgelQsuJ.js";
|
|
19
|
-
import { SuggestionItem as
|
|
20
|
-
import { Option as
|
|
19
|
+
import { SuggestionItem as be } from "./suggestion_item.js";
|
|
20
|
+
import { Option as $ } from "../options/option.js";
|
|
21
21
|
import "../../actions/button/base_button/base_button.js";
|
|
22
22
|
import "../../actions/button/button_group/button_group.js";
|
|
23
23
|
import "../../actions/button/slim_button/slim_button.js";
|
|
24
|
-
import { Button as
|
|
24
|
+
import { Button as xe } from "../../actions/button/button/button.js";
|
|
25
25
|
import "../../actions/button/select_group/select_group.js";
|
|
26
26
|
import "../../actions/button/select_group/single_select_group.js";
|
|
27
27
|
import "../../actions/toggle/toggle.js";
|
|
28
|
-
import { Popper as
|
|
29
|
-
import '../../suggestion_list.css';const
|
|
30
|
-
function
|
|
31
|
-
value:
|
|
28
|
+
import { Popper as Le } from "../../overlay/popper/legacy/popper.js";
|
|
29
|
+
import '../../suggestion_list.css';const ke = "_suggestion-list_711fb17", ye = "_input_a0df060", H = { "suggestion-list": ke, input: ye }, I = 50, Se = 50;
|
|
30
|
+
function Qe({
|
|
31
|
+
value: _ = "",
|
|
32
|
+
initialSearchValue: B,
|
|
32
33
|
scrollToValue: g,
|
|
33
34
|
anchorElement: l,
|
|
34
|
-
|
|
35
|
+
open: M = !1,
|
|
36
|
+
children: j,
|
|
35
37
|
onOptionSelect: h,
|
|
36
|
-
noSuggestionMessage:
|
|
37
|
-
onClose:
|
|
38
|
-
onChange:
|
|
39
|
-
onKeyUp:
|
|
40
|
-
onKeyDown:
|
|
41
|
-
trimCustomInput:
|
|
42
|
-
haveValueAsOption:
|
|
43
|
-
|
|
38
|
+
noSuggestionMessage: q = "-- No Matches --",
|
|
39
|
+
onClose: x,
|
|
40
|
+
onChange: K,
|
|
41
|
+
onKeyUp: E,
|
|
42
|
+
onKeyDown: N,
|
|
43
|
+
trimCustomInput: Z = !1,
|
|
44
|
+
haveValueAsOption: X = !1,
|
|
45
|
+
restoreFocus: z = !0,
|
|
46
|
+
...G
|
|
44
47
|
}) {
|
|
45
|
-
const
|
|
46
|
-
(e) =>
|
|
47
|
-
), [
|
|
48
|
+
const L = he.toArray(j).filter(
|
|
49
|
+
(e) => me(e) && e.type === $
|
|
50
|
+
), [k, J] = a(() => {
|
|
48
51
|
if (g != null) {
|
|
49
|
-
const e =
|
|
52
|
+
const e = L.findIndex((i) => i.props.value === g);
|
|
50
53
|
if (e !== -1)
|
|
51
54
|
return e;
|
|
52
55
|
}
|
|
53
56
|
return -1;
|
|
54
|
-
}),
|
|
55
|
-
() =>
|
|
56
|
-
), [
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
}), C = F(""), v = F(!1), [Q, O] = a(I), [d, y] = a(k), [m, T] = a(_), c = F(null), [Y, ee] = a(L.length), [n, U] = a(
|
|
58
|
+
() => R(_, I)
|
|
59
|
+
), [te, se] = a(), [ne, ie] = a();
|
|
60
|
+
function oe(e) {
|
|
61
|
+
if (!v.current)
|
|
62
|
+
return;
|
|
63
|
+
v.current = !1;
|
|
64
|
+
const i = e.key, t = e.currentTarget, s = C.current = i;
|
|
65
|
+
if (C.current = "", s)
|
|
66
|
+
switch (i) {
|
|
61
67
|
case "Enter": {
|
|
62
|
-
if (n[
|
|
63
|
-
const p =
|
|
68
|
+
if (n[d] == null) {
|
|
69
|
+
const p = Z ? t.value.trim() : t.value;
|
|
64
70
|
if (p === "")
|
|
65
71
|
return;
|
|
66
|
-
const
|
|
67
|
-
(
|
|
68
|
-
),
|
|
72
|
+
const S = p.toLocaleLowerCase(), o = L.find(
|
|
73
|
+
(A) => A.props.value.toLocaleLowerCase() === S || A.props.label != null && A.props.label.toLocaleLowerCase() === S
|
|
74
|
+
), V = o != null, f = o?.props.label || p, pe = o?.props.value || p;
|
|
69
75
|
requestAnimationFrame(() => {
|
|
70
76
|
h && h(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
pe,
|
|
78
|
+
f,
|
|
79
|
+
V,
|
|
80
|
+
o?.props.obfuscate ?? !1
|
|
75
81
|
);
|
|
76
82
|
});
|
|
77
83
|
break;
|
|
78
84
|
}
|
|
79
|
-
const u = n[
|
|
85
|
+
const u = n[d].props;
|
|
80
86
|
if (u.disabled)
|
|
81
87
|
break;
|
|
82
88
|
requestAnimationFrame(() => {
|
|
@@ -90,17 +96,17 @@ function Xe({
|
|
|
90
96
|
break;
|
|
91
97
|
}
|
|
92
98
|
case "Escape": {
|
|
93
|
-
|
|
99
|
+
x && x(t.value, t.selectionStart, t.selectionEnd);
|
|
94
100
|
break;
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
|
-
|
|
103
|
+
E && E(e);
|
|
98
104
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
101
|
-
switch (
|
|
105
|
+
function re(e) {
|
|
106
|
+
const i = e.key;
|
|
107
|
+
switch (C.current = i, v.current = !0, i) {
|
|
102
108
|
case "ArrowDown": {
|
|
103
|
-
let t =
|
|
109
|
+
let t = d + 1;
|
|
104
110
|
for (; t < n.length && n[t]?.props.disabled; )
|
|
105
111
|
t++;
|
|
106
112
|
if (t === n.length) {
|
|
@@ -108,13 +114,13 @@ function Xe({
|
|
|
108
114
|
t++;
|
|
109
115
|
t === n.length && (t = -1);
|
|
110
116
|
}
|
|
111
|
-
|
|
117
|
+
y(t), e.preventDefault();
|
|
112
118
|
break;
|
|
113
119
|
}
|
|
114
120
|
case "Tab": {
|
|
115
121
|
let t = 1;
|
|
116
122
|
e.shiftKey && (t = -1);
|
|
117
|
-
let s =
|
|
123
|
+
let s = d + t;
|
|
118
124
|
if (t > 0)
|
|
119
125
|
for (; s < n.length && n[s]?.props.disabled; )
|
|
120
126
|
s++;
|
|
@@ -130,11 +136,11 @@ function Xe({
|
|
|
130
136
|
s--;
|
|
131
137
|
s === -1 && (s = -1);
|
|
132
138
|
}
|
|
133
|
-
|
|
139
|
+
y(s), e.preventDefault();
|
|
134
140
|
break;
|
|
135
141
|
}
|
|
136
142
|
case "ArrowUp": {
|
|
137
|
-
let t =
|
|
143
|
+
let t = d - 1;
|
|
138
144
|
for (; t >= 0 && n[t]?.props.disabled; )
|
|
139
145
|
t--;
|
|
140
146
|
if (t === -1) {
|
|
@@ -142,112 +148,115 @@ function Xe({
|
|
|
142
148
|
t--;
|
|
143
149
|
t === -1 && (t = -1);
|
|
144
150
|
}
|
|
145
|
-
|
|
151
|
+
y(t), e.preventDefault();
|
|
146
152
|
break;
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
|
-
|
|
155
|
+
N && N(e);
|
|
150
156
|
}
|
|
151
|
-
function
|
|
152
|
-
const t =
|
|
153
|
-
const w = s.props, u = String(w.label).toLocaleLowerCase(), p = w.keywords?.map((
|
|
154
|
-
return w.obfuscate ?? !1 ? u.includes(
|
|
157
|
+
function R(e, i) {
|
|
158
|
+
const t = L.filter((s) => {
|
|
159
|
+
const w = s.props, u = String(w.label).toLocaleLowerCase(), p = w.keywords?.map((f) => f.toLocaleLowerCase()) || [], S = String(w.value).toLocaleLowerCase(), o = e.toLocaleLowerCase();
|
|
160
|
+
return w.obfuscate ?? !1 ? u.includes(o) || p.some((f) => f.includes(o)) : u.includes(o) || p.some((f) => f.includes(o)) || S.includes(o);
|
|
155
161
|
});
|
|
156
|
-
return
|
|
157
|
-
/* @__PURE__ */ r(
|
|
158
|
-
),
|
|
162
|
+
return X && e.trim().length > 0 && !t.some((s) => s.props.value === e) && t.unshift(
|
|
163
|
+
/* @__PURE__ */ r($, { value: e, label: e, keywords: [e], children: e }, "value")
|
|
164
|
+
), ee(t.length), t.slice(0, i);
|
|
159
165
|
}
|
|
160
|
-
function
|
|
166
|
+
function le() {
|
|
161
167
|
const e = c.current;
|
|
162
168
|
e?.focus();
|
|
163
169
|
}
|
|
164
|
-
function
|
|
170
|
+
function ce() {
|
|
165
171
|
const e = c.current;
|
|
166
|
-
e != null &&
|
|
172
|
+
e != null && x && x(e.value, e.selectionStart, e.selectionEnd);
|
|
167
173
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const t =
|
|
172
|
-
|
|
174
|
+
function ae(e) {
|
|
175
|
+
const i = e.currentTarget;
|
|
176
|
+
O(I), T(e.target.value);
|
|
177
|
+
const t = R(i.value, I);
|
|
178
|
+
U(t), K && K(e.target.value);
|
|
173
179
|
}
|
|
174
|
-
function
|
|
175
|
-
const e =
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
180
|
+
function ue() {
|
|
181
|
+
const e = Q + Se;
|
|
182
|
+
O(e);
|
|
183
|
+
const i = R(m, e);
|
|
184
|
+
U(i);
|
|
179
185
|
}
|
|
180
|
-
return
|
|
186
|
+
return b(() => {
|
|
181
187
|
const e = c.current;
|
|
182
|
-
e != null && e.value.length > 0 ? e.select() : e?.focus();
|
|
183
|
-
}, []),
|
|
188
|
+
M && (e != null && e.value.length > 0 ? e.select() : e?.focus());
|
|
189
|
+
}, [M]), b(() => {
|
|
184
190
|
if (l != null) {
|
|
185
191
|
const e = l.getBoundingClientRect();
|
|
186
|
-
|
|
192
|
+
se(`${e.width}px`), ie(`${e.height}px`), c.current != null && l instanceof HTMLInputElement && (c.current.value = l.value, c.current.selectionStart = l.selectionStart, c.current.selectionEnd = l.selectionEnd);
|
|
187
193
|
}
|
|
188
|
-
}, [l]),
|
|
194
|
+
}, [l]), b(() => {
|
|
189
195
|
if (g != null) {
|
|
190
196
|
const e = n.findIndex(
|
|
191
|
-
(
|
|
197
|
+
(i) => i.props.value === g
|
|
192
198
|
);
|
|
193
|
-
|
|
199
|
+
J(e);
|
|
194
200
|
}
|
|
195
|
-
}, [n, g]),
|
|
196
|
-
|
|
197
|
-
}, [m,
|
|
198
|
-
|
|
201
|
+
}, [n, g]), b(() => {
|
|
202
|
+
y(m === "" ? k : -1);
|
|
203
|
+
}, [m, k]), b(() => {
|
|
204
|
+
T(B ?? "");
|
|
205
|
+
}, [B]), /* @__PURE__ */ r(
|
|
206
|
+
Le,
|
|
199
207
|
{
|
|
200
|
-
open:
|
|
208
|
+
open: M,
|
|
201
209
|
anchorElement: l,
|
|
202
|
-
onClose:
|
|
210
|
+
onClose: ce,
|
|
203
211
|
verticalAnchor: "top",
|
|
204
212
|
verticalOrigin: "top",
|
|
205
213
|
verticalOffset: -4,
|
|
206
|
-
|
|
207
|
-
|
|
214
|
+
restoreFocus: z,
|
|
215
|
+
children: /* @__PURE__ */ P(
|
|
216
|
+
W,
|
|
208
217
|
{
|
|
209
|
-
minHeight: `calc(${
|
|
218
|
+
minHeight: `calc(${ne}, 8px)`,
|
|
210
219
|
maxHeight: "300px",
|
|
211
|
-
minWidth:
|
|
220
|
+
minWidth: te,
|
|
212
221
|
width: "auto",
|
|
213
222
|
hAlign: "start",
|
|
214
|
-
className:
|
|
223
|
+
className: D(H["suggestion-list"], "tcn-suggestion-list"),
|
|
215
224
|
children: [
|
|
216
225
|
/* @__PURE__ */ r(
|
|
217
226
|
"input",
|
|
218
227
|
{
|
|
219
228
|
ref: c,
|
|
220
229
|
value: m,
|
|
221
|
-
onKeyUp:
|
|
222
|
-
onKeyDown:
|
|
223
|
-
onChange:
|
|
224
|
-
className:
|
|
225
|
-
...
|
|
230
|
+
onKeyUp: oe,
|
|
231
|
+
onKeyDown: re,
|
|
232
|
+
onChange: ae,
|
|
233
|
+
className: D(H.input, "tcn-suggestion-list-search-input"),
|
|
234
|
+
...G
|
|
226
235
|
},
|
|
227
236
|
-1
|
|
228
237
|
),
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
n.map((e,
|
|
231
|
-
|
|
238
|
+
/* @__PURE__ */ P(W, { children: [
|
|
239
|
+
n.map((e, i) => /* @__PURE__ */ r(
|
|
240
|
+
be,
|
|
232
241
|
{
|
|
233
242
|
option: e,
|
|
234
|
-
isSelected:
|
|
235
|
-
isFocused:
|
|
243
|
+
isSelected: i === k && m !== "",
|
|
244
|
+
isFocused: i === d,
|
|
236
245
|
onClick: h
|
|
237
246
|
},
|
|
238
|
-
|
|
247
|
+
i
|
|
239
248
|
)),
|
|
240
|
-
|
|
249
|
+
Y > n.length && /* @__PURE__ */ r(fe, { children: /* @__PURE__ */ r(xe, { marginBlock: "8px", hierarchy: "tertiary", onClick: ue, children: "Show More" }) })
|
|
241
250
|
] }),
|
|
242
251
|
n.length === 0 && /* @__PURE__ */ r(
|
|
243
|
-
|
|
252
|
+
ge,
|
|
244
253
|
{
|
|
245
254
|
padding: "8px",
|
|
246
|
-
className:
|
|
247
|
-
children: /* @__PURE__ */ r(
|
|
255
|
+
className: D(H["no-results"], "tcn-suggestion-list-no-results"),
|
|
256
|
+
children: /* @__PURE__ */ r(de, { children: q })
|
|
248
257
|
}
|
|
249
258
|
),
|
|
250
|
-
/* @__PURE__ */ r(
|
|
259
|
+
/* @__PURE__ */ r(we, { onRedirect: le }, n.length + 1)
|
|
251
260
|
]
|
|
252
261
|
}
|
|
253
262
|
)
|
|
@@ -255,6 +264,6 @@ function Xe({
|
|
|
255
264
|
);
|
|
256
265
|
}
|
|
257
266
|
export {
|
|
258
|
-
|
|
267
|
+
Qe as SuggestionList
|
|
259
268
|
};
|
|
260
269
|
//# sourceMappingURL=suggestion_list.js.map
|