@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.
- package/README.md +38 -3
- 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/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_time_selector.js +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.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 +159 -153
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.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/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js.map +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 +18 -0
- package/dist/overlay/frame/frame.js.map +1 -0
- package/dist/overlay/index.d.ts +1 -0
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/index.js +4 -2
- package/dist/overlay/index.js.map +1 -1
- 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.map +1 -1
- package/dist/surfaces/index.d.ts +2 -2
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +22 -22
- package/dist/surfaces/modal/modal.d.ts +3 -2
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +14 -13
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/window/window.d.ts +3 -2
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +17 -7
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +69 -0
- package/dist/themes/themes/ergo/ergo_theme.js.map +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/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 +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +9 -3
- package/src/inputs/phone_number_input/phone_number_input.tsx +8 -0
- package/src/inputs/textarea/textarea.tsx +2 -2
- package/src/layouts/header/header.tsx +0 -1
- package/src/overlay/frame/frame.stories.tsx +40 -0
- package/src/overlay/frame/frame.tsx +34 -0
- package/src/overlay/frame/frame_stories.module.css +14 -0
- package/src/overlay/index.ts +1 -0
- package/src/stacks/box/box.tsx +8 -2
- package/src/surfaces/index.ts +2 -2
- package/src/surfaces/modal/__stories__/modal.stories.tsx +19 -27
- package/src/surfaces/modal/modal.tsx +13 -10
- package/src/surfaces/window/window.stories.tsx +37 -4
- package/src/surfaces/window/window.tsx +14 -6
- package/src/themes/themes/ergo/ergo_theme.css +69 -0
- package/src/typography/title/title.tsx +22 -18
- 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 +1 -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/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
|
|
8
|
-
- storybook
|
|
9
|
-
- 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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|