@tcn/ui 0.1.1 → 0.2.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.
Files changed (107) hide show
  1. package/README.md +38 -3
  2. package/dist/draggable.css +1 -0
  3. package/dist/feedback/progress/progress_bar.js +1 -1
  4. package/dist/form/field/common/field_description.js +1 -1
  5. package/dist/form/field/common/field_error.js +1 -1
  6. package/dist/form/field/common/field_label.js +1 -1
  7. package/dist/inputs/date_picker/date_picker_date.js +1 -1
  8. package/dist/inputs/date_picker/date_picker_day.js +1 -1
  9. package/dist/inputs/date_picker/date_picker_time_selector.js +1 -1
  10. package/dist/inputs/date_picker/date_picker_year_selector.js +1 -1
  11. package/dist/inputs/phone_number_input/phone_number_input.d.ts +2 -0
  12. package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
  13. package/dist/inputs/phone_number_input/phone_number_input.js +159 -153
  14. package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
  15. package/dist/inputs/suggestions/suggestion_list.js +1 -1
  16. package/dist/inputs/textarea/textarea.d.ts +2 -2
  17. package/dist/inputs/textarea/textarea.d.ts.map +1 -1
  18. package/dist/inputs/textarea/textarea.js.map +1 -1
  19. package/dist/layouts/header/header.d.ts.map +1 -1
  20. package/dist/layouts/header/header.js.map +1 -1
  21. package/dist/overlay/frame/frame.d.ts +11 -0
  22. package/dist/overlay/frame/frame.d.ts.map +1 -0
  23. package/dist/overlay/frame/frame.js +18 -0
  24. package/dist/overlay/frame/frame.js.map +1 -0
  25. package/dist/overlay/index.d.ts +1 -0
  26. package/dist/overlay/index.d.ts.map +1 -1
  27. package/dist/overlay/index.js +4 -2
  28. package/dist/overlay/index.js.map +1 -1
  29. package/dist/stacks/box/box.d.ts +1 -1
  30. package/dist/stacks/box/box.d.ts.map +1 -1
  31. package/dist/stacks/box/box.js.map +1 -1
  32. package/dist/surfaces/index.d.ts +2 -2
  33. package/dist/surfaces/index.d.ts.map +1 -1
  34. package/dist/surfaces/index.js +22 -22
  35. package/dist/surfaces/modal/modal.d.ts +3 -2
  36. package/dist/surfaces/modal/modal.d.ts.map +1 -1
  37. package/dist/surfaces/modal/modal.js +14 -13
  38. package/dist/surfaces/modal/modal.js.map +1 -1
  39. package/dist/surfaces/window/window.d.ts +3 -2
  40. package/dist/surfaces/window/window.d.ts.map +1 -1
  41. package/dist/surfaces/window/window.js +17 -7
  42. package/dist/surfaces/window/window.js.map +1 -1
  43. package/dist/themes/themes/ergo/ergo_theme.js +69 -0
  44. package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
  45. package/dist/typography/title/title.d.ts +2 -1
  46. package/dist/typography/title/title.d.ts.map +1 -1
  47. package/dist/typography/title/title.js +23 -22
  48. package/dist/typography/title/title.js.map +1 -1
  49. package/dist/utils/dnd/context.d.ts +4 -0
  50. package/dist/utils/dnd/context.d.ts.map +1 -0
  51. package/dist/utils/dnd/context.js +20 -0
  52. package/dist/utils/dnd/context.js.map +1 -0
  53. package/dist/utils/dnd/draggable/draggable.d.ts +7 -0
  54. package/dist/utils/dnd/draggable/draggable.d.ts.map +1 -0
  55. package/dist/utils/dnd/draggable/draggable.js +27 -0
  56. package/dist/utils/dnd/draggable/draggable.js.map +1 -0
  57. package/dist/utils/dnd/handle.d.ts +6 -0
  58. package/dist/utils/dnd/handle.d.ts.map +1 -0
  59. package/dist/utils/dnd/handle.js +22 -0
  60. package/dist/utils/dnd/handle.js.map +1 -0
  61. package/dist/utils/dnd/hooks/use_drag_container.d.ts +7 -0
  62. package/dist/utils/dnd/hooks/use_drag_container.d.ts.map +1 -0
  63. package/dist/utils/dnd/hooks/use_drag_container.js +30 -0
  64. package/dist/utils/dnd/hooks/use_drag_container.js.map +1 -0
  65. package/dist/utils/{hooks → dnd/hooks}/use_draggable.d.ts +3 -3
  66. package/dist/utils/dnd/hooks/use_draggable.d.ts.map +1 -0
  67. package/dist/utils/dnd/hooks/use_draggable.js +41 -0
  68. package/dist/utils/dnd/hooks/use_draggable.js.map +1 -0
  69. package/dist/utils/dnd/types.d.ts +10 -0
  70. package/dist/utils/dnd/types.d.ts.map +1 -0
  71. package/dist/utils/dnd/types.js +2 -0
  72. package/dist/utils/dnd/types.js.map +1 -0
  73. package/dist/utils/index.d.ts +1 -1
  74. package/dist/utils/index.d.ts.map +1 -1
  75. package/dist/utils/index.js +1 -1
  76. package/package.json +9 -3
  77. package/src/inputs/phone_number_input/phone_number_input.tsx +8 -0
  78. package/src/inputs/textarea/textarea.tsx +2 -2
  79. package/src/layouts/header/header.tsx +0 -1
  80. package/src/overlay/frame/frame.stories.tsx +40 -0
  81. package/src/overlay/frame/frame.tsx +34 -0
  82. package/src/overlay/frame/frame_stories.module.css +14 -0
  83. package/src/overlay/index.ts +1 -0
  84. package/src/stacks/box/box.tsx +8 -2
  85. package/src/surfaces/index.ts +2 -2
  86. package/src/surfaces/modal/__stories__/modal.stories.tsx +19 -27
  87. package/src/surfaces/modal/modal.tsx +13 -10
  88. package/src/surfaces/window/window.stories.tsx +37 -4
  89. package/src/surfaces/window/window.tsx +14 -6
  90. package/src/themes/themes/ergo/ergo_theme.css +69 -0
  91. package/src/typography/title/title.tsx +22 -18
  92. package/src/utils/dnd/__stories__/draggable.stories.tsx +48 -0
  93. package/src/utils/dnd/__stories__/draggable_stories.module.css +21 -0
  94. package/src/utils/{__stories__ → dnd/__stories__}/use_draggable.stories.tsx +15 -10
  95. package/src/utils/dnd/context.ts +24 -0
  96. package/src/utils/dnd/draggable/draggable.module.css +8 -0
  97. package/src/utils/dnd/draggable/draggable.tsx +42 -0
  98. package/src/utils/dnd/handle.tsx +32 -0
  99. package/src/utils/dnd/hooks/use_drag_container.ts +42 -0
  100. package/src/utils/{hooks → dnd/hooks}/use_draggable.ts +23 -17
  101. package/src/utils/dnd/types.ts +6 -0
  102. package/src/utils/index.ts +1 -1
  103. package/dist/title.module-B16de2jd.js +0 -5
  104. package/dist/title.module-B16de2jd.js.map +0 -1
  105. package/dist/utils/hooks/use_draggable.d.ts.map +0 -1
  106. package/dist/utils/hooks/use_draggable.js +0 -30
  107. package/dist/utils/hooks/use_draggable.js.map +0 -1
package/README.md CHANGED
@@ -1,11 +1,46 @@
1
1
  # @tcn/ui
2
2
 
3
+ A comprehensive React component library providing a complete set of UI components for building modern web applications.
3
4
 
5
+ ## Overview
6
+
7
+ `@tcn/ui` is the main UI component package in the Blackcat design system. It provides a unified API with organized sub-exports for different component categories.
8
+
9
+ ## Usage
10
+
11
+ Import components from the main package or use sub-exports for better tree-shaking:
12
+
13
+ ```tsx
14
+ // Use sub-exports for better tree-shaking
15
+ import { Button } from '@tcn/ui/actions';
16
+ import { Input } from '@tcn/ui/inputs';
17
+ import { VStack } from '@tcn/ui/stacks';
18
+ ```
19
+
20
+ ## Available Sub-exports
21
+
22
+ - **`@tcn/ui/actions`** - Buttons, button groups, and action elements
23
+ - **`@tcn/ui/inputs`** - Text inputs, selects, date pickers, checkboxes, switches, and more
24
+ - **`@tcn/ui/form`** - Form fields, field sets, and form components
25
+ - **`@tcn/ui/layouts`** - Grid, columns, lists, headers, footers, and page structure
26
+ - **`@tcn/ui/stacks`** - Horizontal, vertical, and z-stack components
27
+ - **`@tcn/ui/overlay`** - Modals, tooltips, popovers, menus, and portals
28
+ - **`@tcn/ui/feedback`** - Loading indicators and progress bars
29
+ - **`@tcn/ui/surfaces`** - Cards, panels, drawers, modals, and windows
30
+ - **`@tcn/ui/typography`** - Text components, headings, and typography utilities
31
+ - **`@tcn/ui/tokens`** - Badges, bubbles, and chips
32
+ - **`@tcn/ui/themes`** - Theme system and preconfigured themes
33
+ - **`@tcn/ui/utils`** - Utility functions, hooks, and helpers
34
+ - **`@tcn/ui/dnd`** - Drag and drop utilities
4
35
 
5
36
  ## Scripts
6
37
 
7
- - build: `pnpm ws ui build`
8
- - storybook: `pnpm ws ui storybook`
9
- - test: `pnpm ws ui test`
38
+ - **build**: `pnpm ws ui build` - Build the package
39
+ - **storybook**: `pnpm ws ui start` - Start Storybook development server
40
+ - **test**: `pnpm ws ui test` - Run tests
41
+ - **check-all**: `pnpm ws ui check-all` - Run all checks (types, lint, format)
42
+
43
+ ## Development
10
44
 
45
+ Each component category is organized in its own directory under `src/` with its own index file for clean sub-exports. The package uses Vite for building and Storybook for component documentation.
11
46
 
@@ -0,0 +1 @@
1
+ ._draggable_db40376{position:relative}._draggable_db40376[data-is-draggable=true]{left:var(--position-x);top:var(--position-y)}
@@ -7,7 +7,7 @@ import "../../caption.module-DDq0H4xZ.js";
7
7
  import "../../footnote.module-DEyFuqOr.js";
8
8
  import "../../headline.module-BiwHBtGf.js";
9
9
  import "../../subheadline.module-C-v7zMkQ.js";
10
- import "../../title.module-B16de2jd.js";
10
+ import "../../typography/title/title.js";
11
11
  import { HStack as l } from "../../stacks/h_stack.js";
12
12
  import { Spacer as a } from "../../stacks/spacer.js";
13
13
  import { VStack as d } from "../../stacks/v_stack.js";
@@ -6,7 +6,7 @@ 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.module-B16de2jd.js";
9
+ import "../../../typography/title/title.js";
10
10
  const y = ({ children: r, id: t }) => r ? typeof r == "string" ? /* @__PURE__ */ o(
11
11
  i,
12
12
  {
@@ -6,7 +6,7 @@ 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.module-B16de2jd.js";
9
+ import "../../../typography/title/title.js";
10
10
  import { theme as i } from "../../../themes/theme_variables.js";
11
11
  import "react";
12
12
  import "../../../themes/stylesheets/reset.js";
@@ -6,7 +6,7 @@ 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.module-B16de2jd.js";
9
+ import "../../../typography/title/title.js";
10
10
  const x = ({ children: r, id: e, required: i }) => r ? typeof r == "string" ? /* @__PURE__ */ o(
11
11
  t,
12
12
  {
@@ -7,7 +7,7 @@ import "../../caption.module-DDq0H4xZ.js";
7
7
  import "../../footnote.module-DEyFuqOr.js";
8
8
  import "../../headline.module-BiwHBtGf.js";
9
9
  import "../../subheadline.module-C-v7zMkQ.js";
10
- import "../../title.module-B16de2jd.js";
10
+ import "../../typography/title/title.js";
11
11
  import { ZStack as M } from "../../stacks/z_stack.js";
12
12
  import '../../date_picker_date.css';const B = "_date-picker-date_38d540e", _ = "_date-picker-today_af9d1ab", k = { "date-picker-date": B, "date-picker-today": _ };
13
13
  function C({ presenter: i, date: t }) {
@@ -6,7 +6,7 @@ import "../../caption.module-DDq0H4xZ.js";
6
6
  import "../../footnote.module-DEyFuqOr.js";
7
7
  import { Headline as m } from "../../typography/headline/headline.js";
8
8
  import "../../subheadline.module-C-v7zMkQ.js";
9
- import "../../title.module-B16de2jd.js";
9
+ import "../../typography/title/title.js";
10
10
  import { ZStack as p } from "../../stacks/z_stack.js";
11
11
  import { useMemo as s } from "react";
12
12
  import '../../date_picker_day.css';const c = "_date-picker-day_2945845", r = { "date-picker-day": c };
@@ -14,7 +14,7 @@ import "../../caption.module-DDq0H4xZ.js";
14
14
  import "../../footnote.module-DEyFuqOr.js";
15
15
  import "../../headline.module-BiwHBtGf.js";
16
16
  import "../../subheadline.module-C-v7zMkQ.js";
17
- import "../../title.module-B16de2jd.js";
17
+ import "../../typography/title/title.js";
18
18
  import { ClockIcon as j } from "@tcn/icons/clock_icon.js";
19
19
  import '../../date_picker_time_selector.css';const z = "_time-box_f3145be", P = "_time-box-title_6cc801b", Z = "_time-box-title-container_22add52", v = "_selected-time_33e3aa3", s = { "time-box": z, "time-box-title": P, "time-box-title-container": Z, "selected-time": v };
20
20
  function it({
@@ -19,7 +19,7 @@ import "../../caption.module-DDq0H4xZ.js";
19
19
  import "../../footnote.module-DEyFuqOr.js";
20
20
  import { Headline as M } from "../../typography/headline/headline.js";
21
21
  import "../../subheadline.module-C-v7zMkQ.js";
22
- import "../../title.module-B16de2jd.js";
22
+ import "../../typography/title/title.js";
23
23
  import { FocusRedirect as T } from "../../utils/focus_redirect.js";
24
24
  import "../../utils/click_away_listener.js";
25
25
  import "../../utils/scroll_away_listener.js";
@@ -3,6 +3,8 @@ import { default as React } from 'react';
3
3
  import { OptionProps } from '../options/option.js';
4
4
  export interface PhoneNumberInputProps extends Omit<HStackProps, 'onChange' | 'children'> {
5
5
  value?: string;
6
+ name?: string;
7
+ autoComplete?: string;
6
8
  defaultCountry?: string;
7
9
  /**
8
10
  * Callback fired when the phone number value changes.
@@ -1 +1 @@
1
- {"version":3,"file":"phone_number_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAU,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiG3D,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,gBAAgB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;CAChF;AAED,eAAO,MAAM,gBAAgB,2FAkR3B,CAAC"}
1
+ {"version":3,"file":"phone_number_input.d.ts","sourceRoot":"","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAU,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiG3D,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,gBAAgB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;CAChF;AAED,eAAO,MAAM,gBAAgB,2FAwR3B,CAAC"}
@@ -1,62 +1,62 @@
1
- import { jsxs as J, jsx as i, Fragment as ae } from "react/jsx-runtime";
2
- import { HStack as K } from "../../stacks/h_stack.js";
3
- import { clsx as h } from "clsx";
4
- import ie, { useRef as Q, useState as l, useMemo as X, Children as le, isValidElement as me, useLayoutEffect as w, useCallback as fe } from "react";
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 he } from "../../actions/button/slim_button/slim_button.js";
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 be } from "../select/select.js";
12
- import { MaskInput as Y } from "../mask_input/mask_input.js";
13
- import { countriesPhoneInformation as v } from "./countries_phone_information.js";
14
- import { NotebookIcon as de } from "@tcn/icons/notebook_icon.js";
15
- import { Option as A } from "../options/option.js";
16
- import { SuggestionList as ke } from "../suggestions/suggestion_list.js";
17
- import { stripNonNumericAfterCountryCode as P } from "./utils.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";
18
18
  import "../../utils/focus_redirect.js";
19
19
  import "../../utils/click_away_listener.js";
20
20
  import "../../utils/scroll_away_listener.js";
21
- import { useForkRef as Ie } from "../../utils/hooks/use_fork_ref.js";
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 Ne = "_phone-number-input_5c4483d", ye = "_phone-number-input-select_a7b33ac", xe = "_phone-number-input-input_5b14556", ge = "_phone-number-input-phone-book-popover_1511f35", Pe = "_phone-number-input-phone-book_7999ca1", Se = "_phone-number-input-obfuscated_5a0ed8c", m = { "phone-number-input": Ne, "phone-number-input-select": ye, "phone-number-input-input": xe, "phone-number-input-phone-book-popover": ge, "phone-number-input-phone-book": Pe, "phone-number-input-obfuscated": Se }, _e = "•";
24
- function Be(o) {
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, _e)
27
+ placeholder: n.mask.replace(/[9a*]/g, Oe)
28
28
  }));
29
29
  }
30
- const F = v.map((o) => ({
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
- F.sort((o, n) => parseInt(o.value) - parseInt(n.value));
38
- const _ = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
39
- v.forEach((o) => {
40
- b.set(o.code, o), _.has(o.prefix) ? _.get(o.prefix)?.push(o) : _.set(o.prefix, [o]);
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 Oe(o) {
42
+ function Me(o) {
43
43
  if (o != null) {
44
44
  const n = {};
45
- return o.forEach((t) => {
46
- n[t] = !0;
47
- }), F.filter((t) => !!n[t.value]).map((t) => /* @__PURE__ */ i(
48
- A,
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: t.value,
51
- label: t.selectedLabel,
52
- keywords: t.keywords,
53
- children: t.optionLabel
50
+ value: r.value,
51
+ label: r.selectedLabel,
52
+ keywords: r.keywords,
53
+ children: r.optionLabel
54
54
  },
55
- t.value
55
+ r.value
56
56
  ));
57
57
  } else
58
- return F.map((n) => /* @__PURE__ */ i(
59
- A,
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 S(o, n, t) {
70
- for (let u = 5; u > 1; u--) {
71
- const B = o.slice(0, u), d = _.get(B);
72
- if (d != null) {
73
- const c = d.find(
74
- (k) => k.code === n
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 c ?? d[0];
76
+ return I ?? u[0];
77
77
  }
78
78
  }
79
- return b.get(t.toUpperCase()) || b.get("US");
79
+ return k.get(r.toUpperCase()) || k.get("US");
80
80
  }
81
- const Qe = ie.forwardRef(function({
81
+ const Ye = me.forwardRef(function({
82
82
  value: n = "",
83
- defaultCountry: t = "US",
83
+ name: r,
84
+ autoComplete: h,
85
+ defaultCountry: c = "US",
84
86
  onChange: u,
85
- countrySelectRef: B,
86
- phoneNumberInputRef: d,
87
- disabled: c = !1,
88
- allowedCountryCodes: k,
89
- children: $,
90
- ...Z
91
- }, ee) {
92
- const I = Q(n), [U, O] = l(
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
- ), T = U != null, [f, V] = l(t), j = S(
96
+ ), z = j != null, [b, M] = m(c), H = _(
95
97
  n,
96
- f,
97
- t
98
- ), [N, y] = l(() => {
99
- const e = n.split(j.prefix)[1];
100
- return e == null ? "" : P(e);
101
- }), z = X(() => le.toArray($).filter(
102
- (e) => me(e) && e.type === A
103
- ), [$]), C = z.length > 0, [M, x] = l(j.code), [H, g] = l([
104
- ...v[0].masks
105
- ]), [a, R] = l(!1), [D, W] = l(!1), E = Q(null), q = Ie(d, E), oe = X(() => Oe(k), [k]);
106
- function ne(e) {
107
- const r = b.get(e);
108
- if (r == null || (x(r.code), g([...r.masks]), V(r.code), N == null))
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 = `${r.prefix}${P(N)}`;
111
- I.current = p, u && u(p, !1);
112
+ const p = `${t.prefix}${S(y)}`;
113
+ N.current = p, u && u(p, !1);
112
114
  }
113
- w(() => {
114
- const e = S(
115
+ A(() => {
116
+ const e = _(
115
117
  n,
116
- f,
117
- t
118
+ b,
119
+ c
118
120
  );
119
- x(e.code), g([...e.masks]), V(e.code);
120
- }, [n, f, t]);
121
- function te(e) {
122
- const r = b.get(M)?.prefix, p = P(e), s = r + p;
123
- a && R(!1), I.current = s, N !== e && y(e), u && u(s, !1);
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 re(e) {
126
- O(T ? null : e.currentTarget);
127
+ function se(e) {
128
+ V(z ? null : e.currentTarget);
127
129
  }
128
- function G() {
129
- O(null);
130
+ function K() {
131
+ V(null);
130
132
  }
131
- function ue(e, r, p, s) {
132
- R(s), L(e, s), G();
133
+ function pe(e, t, p, s) {
134
+ E(s), w(e, s), K();
133
135
  }
134
- function se(e) {
136
+ function ce(e) {
135
137
  if (e.startsWith("+")) {
136
- const r = S(
138
+ const t = _(
137
139
  e,
138
- f,
139
- t
140
+ b,
141
+ c
140
142
  );
141
- x(r.code), g([...r.masks]);
142
- const p = e.split(r.prefix)[1];
143
- return y(p), p;
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 pe(e) {
148
- W(!0), R(!1), y(e);
149
- const r = b.get(M)?.prefix, p = P(e), s = r + p;
150
- I.current = s, u && u(s, !1);
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 L = fe(
153
- (e, r = !1) => {
154
- const p = I.current, s = S(
154
+ const w = be(
155
+ (e, t = !1) => {
156
+ const p = N.current, s = _(
155
157
  e,
156
- f,
157
- t
158
- ), ce = e.split(s.prefix)[1];
159
- x(s.code), g([...s.masks]), V(s.code), p !== e && (y(ce), u && u(e, r));
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
- [t, f, u]
163
+ [c, b, u]
162
164
  );
163
- return w(() => {
164
- L(n);
165
- }, [n, L]), w(() => {
166
- D && !a && E.current && (E.current.focus(), W(!1));
167
- }, [D, a]), /* @__PURE__ */ J(
168
- K,
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: ee,
171
- className: h(m["phone-number-input"], "phone-number-input"),
172
+ ref: ne,
173
+ className: d(f["phone-number-input"], "phone-number-input"),
172
174
  height: "auto",
173
- ...Z,
175
+ ...oe,
174
176
  children: [
175
177
  /* @__PURE__ */ i(
176
- be,
178
+ ke,
177
179
  {
178
- className: h(m["phone-number-input-select"], "phone-number-input-select"),
179
- ref: B,
180
+ className: d(f["phone-number-input-select"], "phone-number-input-select"),
181
+ ref: I,
180
182
  width: "auto",
181
- value: a ? "" : M,
182
- onChange: ne,
183
- disabled: c || a,
184
- "data-is-disabled": c || a,
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: oe
189
+ children: te
188
190
  }
189
191
  ),
190
- /* @__PURE__ */ i(K, { width: "flex", className: h(m["phone-number-input-container"]), children: a ? /* @__PURE__ */ i(
191
- Y,
192
+ /* @__PURE__ */ i(X, { width: "flex", className: d(f["phone-number-input-container"]), children: a ? /* @__PURE__ */ i(
193
+ ee,
192
194
  {
193
- ref: q,
195
+ name: r,
196
+ autoComplete: h,
197
+ ref: J,
194
198
  value: "",
195
- mask: Be(H),
196
- onChange: pe,
197
- disabled: c,
198
- "data-is-disabled": c,
199
- "data-has-phone-book": C,
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: h(
202
- m["phone-number-input"],
203
- m["phone-number-input-obfuscated"],
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
- Y,
216
+ ee,
213
217
  {
214
- ref: q,
215
- value: N,
216
- mask: H,
217
- onChange: te,
218
- disabled: c,
219
- "data-is-disabled": c,
220
- "data-has-phone-book": C,
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: h(m["phone-number-input"], "phone-number-input"),
223
- preparePasteValue: se
228
+ className: d(f["phone-number-input"], "phone-number-input"),
229
+ preparePasteValue: ce
224
230
  },
225
231
  "normal"
226
232
  ) }),
227
- C && /* @__PURE__ */ J(ae, { children: [
233
+ R && /* @__PURE__ */ Q(le, { children: [
228
234
  /* @__PURE__ */ i(
229
- he,
235
+ de,
230
236
  {
231
- disabled: c,
232
- className: h(
233
- m["phone-number-input-phone-book"],
237
+ disabled: l,
238
+ className: d(
239
+ f["phone-number-input-phone-book"],
234
240
  "phone-number-input-phone-book"
235
241
  ),
236
- onClick: re,
242
+ onClick: se,
237
243
  size: "md",
238
- children: /* @__PURE__ */ i(de, { size: "md" })
244
+ children: /* @__PURE__ */ i(Ie, { size: "md" })
239
245
  }
240
246
  ),
241
- T && /* @__PURE__ */ i(
242
- ke,
247
+ z && /* @__PURE__ */ i(
248
+ Ne,
243
249
  {
244
- anchorElement: U,
245
- onOptionSelect: ue,
246
- onClose: G,
250
+ anchorElement: j,
251
+ onOptionSelect: pe,
252
+ onClose: K,
247
253
  noSuggestionMessage: "No phone numbers found",
248
- children: z
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
- Qe as PhoneNumberInput
263
+ Ye as PhoneNumberInput
258
264
  };
259
265
  //# sourceMappingURL=phone_number_input.js.map