@tcn/ui 0.0.1 → 0.0.3
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/actions/button/button/button.d.ts.map +1 -1
- package/dist/actions/button/button/button.js +12 -4
- package/dist/actions/button/button/button.js.map +1 -1
- package/dist/drawer_bottom.css +1 -1
- package/dist/drawer_end.css +1 -1
- package/dist/drawer_start.css +1 -1
- package/dist/drawer_top.css +1 -1
- package/dist/form/field/common/status_input/status_input.js.map +1 -1
- package/dist/form/field/h_field/h_field.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/form/field_presenters/options_field_presenter.d.ts.map +1 -1
- package/dist/form/field_presenters/options_field_presenter.js.map +1 -1
- package/dist/form/form_field.d.ts.map +1 -1
- package/dist/form/form_field.js.map +1 -1
- package/dist/form/index.d.ts +14 -5
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +27 -8
- package/dist/form/index.js.map +1 -1
- package/dist/h_body.css +1 -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 +60 -51
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/layouts/body/h_body.d.ts +6 -0
- package/dist/layouts/body/h_body.d.ts.map +1 -0
- package/dist/layouts/body/h_body.js +21 -0
- package/dist/layouts/body/h_body.js.map +1 -0
- package/dist/layouts/body/v_body.d.ts +6 -0
- package/dist/layouts/body/v_body.d.ts.map +1 -0
- package/dist/layouts/body/v_body.js +21 -0
- package/dist/layouts/body/v_body.js.map +1 -0
- package/dist/layouts/divider/divider.d.ts +2 -2
- package/dist/layouts/divider/divider.d.ts.map +1 -1
- package/dist/layouts/divider/divider.js +17 -16
- package/dist/layouts/divider/divider.js.map +1 -1
- package/dist/layouts/footer/footer.d.ts +1 -1
- package/dist/layouts/footer/footer.d.ts.map +1 -1
- package/dist/layouts/footer/footer.js +5 -5
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/header/header.d.ts +1 -1
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js +10 -10
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +2 -4
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +20 -24
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.js +13 -8
- package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
- package/dist/overlay/index.d.ts +6 -0
- package/dist/overlay/index.d.ts.map +1 -0
- package/dist/overlay/index.js +14 -0
- package/dist/overlay/index.js.map +1 -0
- package/dist/panel.css +1 -1
- package/dist/panel.module-DwGKncon.js +5 -0
- package/dist/panel.module-DwGKncon.js.map +1 -0
- package/dist/stack.css +1 -1
- package/dist/stacks/types/styles.d.ts +2 -2
- package/dist/stacks/types/styles.d.ts.map +1 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.js +1 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js.map +1 -0
- package/dist/surfaces/drawers/drawer_end/drawer_end.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_end/drawer_end.js +2 -2
- package/dist/surfaces/drawers/drawer_end/drawer_end.js.map +1 -0
- package/dist/surfaces/drawers/drawer_start/drawer_start.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_start/drawer_start.js +1 -1
- package/dist/surfaces/drawers/drawer_start/drawer_start.js.map +1 -0
- package/dist/surfaces/drawers/drawer_top/drawer_top.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_top/drawer_top.js +1 -1
- package/dist/surfaces/drawers/drawer_top/drawer_top.js.map +1 -0
- package/dist/surfaces/index.d.ts +4 -0
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +20 -12
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/panel/h_panel.d.ts +1 -1
- package/dist/surfaces/panel/h_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/h_panel.js +44 -33
- package/dist/surfaces/panel/h_panel.js.map +1 -1
- package/dist/surfaces/panel/v_panel.d.ts +1 -1
- package/dist/surfaces/panel/v_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/v_panel.js +36 -31
- package/dist/surfaces/panel/v_panel.js.map +1 -1
- package/dist/themes/index.js +82 -20
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/typography/title/title.d.ts +1 -1
- package/dist/typography/title/title.d.ts.map +1 -1
- package/dist/typography/title/title.js +16 -16
- package/dist/typography/title/title.js.map +1 -1
- package/dist/v_body.css +1 -0
- package/package.json +3 -3
- package/src/actions/button/button/button.tsx +10 -4
- package/src/form/field/common/status_input/status_input.tsx +1 -1
- package/src/form/field/h_field/h_field.tsx +1 -1
- package/src/form/field/v_field/v_field.tsx +1 -1
- package/src/form/field_presenters/options_field_presenter.ts +1 -1
- package/src/form/form_field.tsx +1 -1
- package/src/form/index.ts +50 -5
- package/src/inputs/phone_number_input/phone_number_input.tsx +9 -4
- package/src/layouts/body/h_body.module.css +5 -0
- package/src/layouts/body/h_body.tsx +23 -0
- package/src/layouts/body/v_body.module.css +5 -0
- package/src/layouts/body/v_body.tsx +23 -0
- package/src/layouts/divider/divider.tsx +5 -4
- package/src/layouts/footer/footer.tsx +4 -4
- package/src/layouts/header/header.tsx +4 -4
- package/src/layouts/index.ts +2 -4
- package/src/layouts/utility_bar/utility_bar.tsx +9 -4
- package/src/overlay/index.ts +5 -0
- package/src/stacks/stack.module.css +54 -5
- package/src/stacks/stacks.mdx +28 -28
- package/src/stacks/types/styles.ts +2 -2
- package/src/surfaces/index.ts +4 -0
- package/src/surfaces/panel/__stories__/panel.stories.tsx +68 -0
- package/src/surfaces/panel/__stories__/panel_stories.module.css +13 -0
- package/src/surfaces/panel/h_panel.tsx +18 -6
- package/src/surfaces/panel/panel.module.css +2 -7
- package/src/surfaces/panel/v_panel.tsx +11 -5
- package/src/themes/themes/ergo/ergo_theme.css +72 -10
- package/src/typography/title/title.tsx +2 -2
- package/dist/form/field/form_field.d.ts +0 -6
- package/dist/form/field/form_field.d.ts.map +0 -1
- package/dist/form/field/form_field.js +0 -18
- package/dist/form/field/form_field.js.map +0 -1
- package/dist/layouts/drawers/drawer_bottom/drawer_bottom.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_bottom/drawer_bottom.js.map +0 -1
- package/dist/layouts/drawers/drawer_end/drawer_end.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_end/drawer_end.js.map +0 -1
- package/dist/layouts/drawers/drawer_start/drawer_start.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_start/drawer_start.js.map +0 -1
- package/dist/layouts/drawers/drawer_top/drawer_top.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_top/drawer_top.js.map +0 -1
- package/dist/panel.module-CtikcmYB.js +0 -5
- package/dist/panel.module-CtikcmYB.js.map +0 -1
- package/src/form/field/form_field.tsx +0 -29
- /package/dist/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_end/drawer_end.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_start/drawer_start.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_top/drawer_top.d.ts +0 -0
- /package/src/{layouts → surfaces}/drawers/__stories__/drawers.stories.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_end/drawer_end.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_end/drawer_end.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_start/drawer_start.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_start/drawer_start.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_top/drawer_top.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_top/drawer_top.tsx +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/actions/button/button/button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/actions/button/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGjF,MAAM,WAAW,WAAY,SAAQ,eAAe;CAAG;AAEvD,eAAO,MAAM,MAAM,oGAmBjB,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import b from "react";
|
|
2
3
|
import n from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { BaseButton as c } from "../base_button/base_button.js";
|
|
5
|
+
import '../../../button.css';const m = "_button_fd354ec", a = "_button-text_5989b5f", s = { button: m, "button-text": a }, _ = b.forwardRef(function({ children: t, className: e, ...u }, r) {
|
|
6
|
+
return /* @__PURE__ */ o(
|
|
7
|
+
c,
|
|
8
|
+
{
|
|
9
|
+
ref: r,
|
|
10
|
+
className: n(s.button, "button", "tcn-button", e),
|
|
11
|
+
...u,
|
|
12
|
+
children: typeof t == "string" ? /* @__PURE__ */ o("span", { className: n(s["button-text"], "button-text", "tcn-button-text"), children: t }) : t
|
|
13
|
+
}
|
|
14
|
+
);
|
|
7
15
|
});
|
|
8
16
|
export {
|
|
9
17
|
_ as Button
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../../../src/actions/button/button/button.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../../../src/actions/button/button/button.tsx"],"sourcesContent":["import React from 'react';\nimport cln from 'classnames';\nimport { BaseButton, type BaseButtonProps } from '../base_button/base_button.js';\nimport styles from './button.module.css';\n\nexport interface ButtonProps extends BaseButtonProps {}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { children, className, ...props },\n ref\n) {\n return (\n <BaseButton\n ref={ref}\n className={cln(styles.button, 'button', 'tcn-button', className)}\n {...props}\n >\n {typeof children === 'string' ? (\n <span className={cln(styles['button-text'], 'button-text', 'tcn-button-text')}>\n {children}\n </span>\n ) : (\n children\n )}\n </BaseButton>\n );\n});\n"],"names":["Button","React","children","className","props","ref","jsx","BaseButton","cln","styles"],"mappings":";;;;8FAOaA,IAASC,EAAM,WAA2C,SACrE,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,WAAWG,EAAIC,EAAO,QAAQ,UAAU,cAAcN,CAAS;AAAA,MAC9D,GAAGC;AAAA,MAEH,UAAA,OAAOF,KAAa,WACnB,gBAAAI,EAAC,UAAK,WAAWE,EAAIC,EAAO,aAAa,GAAG,eAAe,iBAAiB,GACzE,UAAAP,GACH,IAEAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
package/dist/drawer_bottom.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerBottom_9359033{background-color:var(--background-color-primary)}
|
package/dist/drawer_end.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerEnd_39acb27{background-color:var(--background-color-primary)}
|
package/dist/drawer_start.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerStart_3abbf56{background-color:var(--background-color-primary)}
|
package/dist/drawer_top.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._drawerBottom_7a0635a{background-color:var(--background-color-primary)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status_input.js","sources":["../../../../../src/form/field/common/status_input/status_input.tsx"],"sourcesContent":["import { AlertTriangleIcon } from '@tcn/icons/alert_triangle_icon.js';\nimport { LockTwoIcon } from '@tcn/icons/lock_two_icon.js';\nimport { HStack } from '../../../../stacks/h_stack.js';\nimport type { HStackOwnProps } from '../../../../stacks/h_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../../stacks/types/as.js';\nimport React from 'react';\nimport { Loading } from '../../../../feedback/index.js';\nimport classNames from 'classnames';\nimport styles from './status_input.module.css';\n\n/*\n TODO: I really want to make these
|
|
1
|
+
{"version":3,"file":"status_input.js","sources":["../../../../../src/form/field/common/status_input/status_input.tsx"],"sourcesContent":["import { AlertTriangleIcon } from '@tcn/icons/alert_triangle_icon.js';\nimport { LockTwoIcon } from '@tcn/icons/lock_two_icon.js';\nimport { HStack } from '../../../../stacks/h_stack.js';\nimport type { HStackOwnProps } from '../../../../stacks/h_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../../stacks/types/as.js';\nimport React from 'react';\nimport { Loading } from '../../../../feedback/index.js';\nimport classNames from 'classnames';\nimport styles from './status_input.module.css';\n\n/*\n TODO: I really want to make these themeable.\n The way we do that is simply put a div placeholder with\n a class that the theme can override. They can use svgs as \n backgrounds for icons. This would make it so the component\n library doesn't dictate the icon set used. \n*/\nconst LockedAdornment: React.FC = () => {\n return <LockTwoIcon className=\"field-lock\" size=\"lg\" />;\n};\n\nconst LoadingAdornment: React.FC = () => {\n return <Loading size=\"20px\" className=\"field-loader\" />;\n};\n\nconst ErroredAdornment: React.FC = () => {\n return (\n <AlertTriangleIcon\n className={classNames(styles['field-error'], 'field-error')}\n size=\"lg\"\n />\n );\n};\n\nexport const AdornmentMap: React.FC<{ state: StatusInputState }> = ({ state }) => {\n switch (state) {\n case 'locked':\n return <LockedAdornment />;\n case 'loading':\n return <LoadingAdornment />;\n case 'error':\n return <ErroredAdornment />;\n default:\n return null;\n }\n};\n\nexport type StatusInputState = 'locked' | 'loading' | 'error' | 'default';\nexport interface StatusInputOwnProps {\n children: React.ReactNode;\n state?: StatusInputState;\n}\n\nexport type StatusInputProps = WithDetailedHTMLProps<\n StatusInputOwnProps & HStackOwnProps,\n 'div'\n>;\n\nexport const FieldStatusInput = React.forwardRef(function StatusInput(\n { children: Control, state = 'default', className, ...props }: StatusInputProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const showControl = state === 'default' || state === 'error';\n\n return (\n <HStack\n ref={ref}\n data-state={state}\n className={classNames(\n 'field-status-input',\n styles['field-status-input'],\n className,\n 'field-status-input'\n )}\n vAlign=\"center\"\n hAlign=\"end\"\n gap=\"4px\"\n {...props}\n >\n {showControl && Control}\n <AdornmentMap state={state} />\n </HStack>\n );\n});\n"],"names":["LockedAdornment","jsx","LockTwoIcon","LoadingAdornment","Loading","ErroredAdornment","AlertTriangleIcon","classNames","styles","AdornmentMap","state","FieldStatusInput","React","Control","className","props","ref","showControl","jsxs","HStack"],"mappings":";;;;;;;;;;wHAiBMA,IAA4B,MACzB,gBAAAC,EAACC,GAAA,EAAY,WAAU,cAAa,MAAK,MAAK,GAGjDC,IAA6B,MAC1B,gBAAAF,EAACG,GAAA,EAAQ,MAAK,QAAO,WAAU,gBAAe,GAGjDC,IAA6B,MAE/B,gBAAAJ;AAAA,EAACK;AAAA,EAAA;AAAA,IACC,WAAWC,EAAWC,EAAO,aAAa,GAAG,aAAa;AAAA,IAC1D,MAAK;AAAA,EAAA;AAAA,GAKEC,IAAsD,CAAC,EAAE,OAAAC,QAAY;AAChF,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,+BAAQV,GAAA,EAAgB;AAAA,IAC1B,KAAK;AACH,+BAAQG,GAAA,EAAiB;AAAA,IAC3B,KAAK;AACH,+BAAQE,GAAA,EAAiB;AAAA,IAC3B;AACE,aAAO;AAAA,EAAA;AAEb,GAaaM,IAAmBC,EAAM,WAAW,SAC/C,EAAE,UAAUC,GAAS,OAAAH,IAAQ,WAAW,WAAAI,GAAW,GAAGC,EAAA,GACtDC,GACA;AACA,QAAMC,IAAcP,MAAU,aAAaA,MAAU;AAErD,SACE,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAH;AAAA,MACA,cAAYN;AAAA,MACZ,WAAWH;AAAA,QACT;AAAA,QACAC,EAAO,oBAAoB;AAAA,QAC3BM;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,QAAO;AAAA,MACP,QAAO;AAAA,MACP,KAAI;AAAA,MACH,GAAGC;AAAA,MAEH,UAAA;AAAA,QAAAE,KAAeJ;AAAA,QAChB,gBAAAZ,EAACQ,KAAa,OAAAC,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGlC,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h_field.d.ts","sourceRoot":"","sources":["../../../../src/form/field/h_field/h_field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"h_field.d.ts","sourceRoot":"","sources":["../../../../src/form/field/h_field/h_field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,MAAM,MAAM,WAAW,GAAG,qBAAqB,CAAC,cAAc,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC;AAGxF,eAAO,MAAM,MAAM,iGAmDjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h_field.js","sources":["../../../../src/form/field/h_field/h_field.tsx"],"sourcesContent":["import { HStack } from '../../../stacks/h_stack.js';\nimport type { HStackOwnProps } from '../../../stacks/h_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';\nimport classNames from 'classnames';\nimport React, { useState } from 'react';\nimport styles from './h_field.module.css';\nimport { FieldInput } from '../common/types.js';\nimport { FieldHeader } from '../common/field_header.js';\nimport { FieldControl } from '../common/field_control/field_control.js';\nimport { FieldStatusInput } from '../common/status_input/status_input.js';\n\nexport interface HFieldOwnProps extends FieldInput {\n labelWidth?: string;\n children: React.ReactNode;\n}\nexport type HFieldProps = WithDetailedHTMLProps<HFieldOwnProps, 'div'> & HStackOwnProps;\n\nlet idIndex = 0;\nexport const HField = React.forwardRef(function HField(\n {\n label,\n description,\n errorMessage,\n children: Control,\n labelWidth = '40%',\n locked = false,\n loading = false,\n className,\n id,\n required,\n ...props\n }: HFieldProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [finalId] = useState(() => id || `h-field-${idIndex++}`);\n const labelId = `${finalId}-label`;\n const descriptionId = `${finalId}-description`;\n const hasError = errorMessage ? true : false;\n const state = locked ? 'locked' : loading ? 'loading' : hasError ? 'error' : 'default';\n\n return (\n <HStack\n ref={ref}\n as=\"div\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n data-locked={locked}\n data-error={hasError}\n data-loading={loading}\n className={classNames('base-field', styles['h-field'], 'h-field', className)}\n vAlign=\"start\"\n hAlign=\"start\"\n height=\"auto\"\n gap=\"4px\"\n {...props}\n >\n <FieldHeader\n minWidth={labelWidth}\n width={labelWidth}\n id={finalId}\n label={label}\n description={description}\n required={required}\n />\n <FieldControl errorMessage={errorMessage} loading={loading} locked={locked}>\n <FieldStatusInput state={state}>{Control}</FieldStatusInput>\n </FieldControl>\n </HStack>\n );\n});\n"],"names":["idIndex","HField","React","label","description","errorMessage","Control","labelWidth","locked","loading","className","id","required","props","ref","finalId","useState","labelId","descriptionId","hasError","state","jsxs","HStack","classNames","styles","jsx","FieldHeader","FieldControl","FieldStatusInput"],"mappings":";;;;;;;;AAiBA,IAAIA,IAAU;AACP,MAAMC,IAASC,EAAM,WAAW,SACrC;AAAA,EACE,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAUC;AAAA,EACV,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAM,CAACC,CAAO,IAAIC,EAAS,MAAML,KAAM,WAAWX,GAAS,EAAE,GACvDiB,IAAU,GAAGF,CAAO,UACpBG,IAAgB,GAAGH,CAAO,gBAC1BI,IAAW,EAAAd,GACXe,IAAQZ,IAAS,WAAWC,IAAU,YAAYU,IAAW,UAAU;AAE7E,SACE,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAR;AAAA,MACA,IAAG;AAAA,MACH,mBAAiBG;AAAA,MACjB,oBAAkBC;AAAA,MAClB,eAAaV;AAAA,MACb,cAAYW;AAAA,MACZ,gBAAcV;AAAA,MACd,WAAWc,EAAW,cAAcC,EAAO,SAAS,GAAG,WAAWd,CAAS;AAAA,MAC3E,QAAO;AAAA,MACP,QAAO;AAAA,MACP,QAAO;AAAA,MACP,KAAI;AAAA,MACH,GAAGG;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,UAAUnB;AAAA,YACV,OAAOA;AAAA,YACP,IAAIQ;AAAA,YACJ,OAAAZ;AAAA,YACA,aAAAC;AAAA,YACA,UAAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAa,EAACE,KAAa,cAAAtB,GAA4B,SAAAI,GAAkB,QAAAD,GAC1D,UAAA,gBAAAiB,EAACG,GAAA,EAAiB,OAAAR,GAAe,UAAAd,EAAA,CAAQ,EAAA,CAC3C;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
1
|
+
{"version":3,"file":"h_field.js","sources":["../../../../src/form/field/h_field/h_field.tsx"],"sourcesContent":["import { HStack } from '../../../stacks/h_stack.js';\nimport type { HStackOwnProps } from '../../../stacks/h_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';\nimport classNames from 'classnames';\nimport React, { useState } from 'react';\nimport styles from './h_field.module.css';\nimport type { FieldInput } from '../common/types.js';\nimport { FieldHeader } from '../common/field_header.js';\nimport { FieldControl } from '../common/field_control/field_control.js';\nimport { FieldStatusInput } from '../common/status_input/status_input.js';\n\nexport interface HFieldOwnProps extends FieldInput {\n labelWidth?: string;\n children: React.ReactNode;\n}\nexport type HFieldProps = WithDetailedHTMLProps<HFieldOwnProps, 'div'> & HStackOwnProps;\n\nlet idIndex = 0;\nexport const HField = React.forwardRef(function HField(\n {\n label,\n description,\n errorMessage,\n children: Control,\n labelWidth = '40%',\n locked = false,\n loading = false,\n className,\n id,\n required,\n ...props\n }: HFieldProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [finalId] = useState(() => id || `h-field-${idIndex++}`);\n const labelId = `${finalId}-label`;\n const descriptionId = `${finalId}-description`;\n const hasError = errorMessage ? true : false;\n const state = locked ? 'locked' : loading ? 'loading' : hasError ? 'error' : 'default';\n\n return (\n <HStack\n ref={ref}\n as=\"div\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n data-locked={locked}\n data-error={hasError}\n data-loading={loading}\n className={classNames('base-field', styles['h-field'], 'h-field', className)}\n vAlign=\"start\"\n hAlign=\"start\"\n height=\"auto\"\n gap=\"4px\"\n {...props}\n >\n <FieldHeader\n minWidth={labelWidth}\n width={labelWidth}\n id={finalId}\n label={label}\n description={description}\n required={required}\n />\n <FieldControl errorMessage={errorMessage} loading={loading} locked={locked}>\n <FieldStatusInput state={state}>{Control}</FieldStatusInput>\n </FieldControl>\n </HStack>\n );\n});\n"],"names":["idIndex","HField","React","label","description","errorMessage","Control","labelWidth","locked","loading","className","id","required","props","ref","finalId","useState","labelId","descriptionId","hasError","state","jsxs","HStack","classNames","styles","jsx","FieldHeader","FieldControl","FieldStatusInput"],"mappings":";;;;;;;;AAiBA,IAAIA,IAAU;AACP,MAAMC,IAASC,EAAM,WAAW,SACrC;AAAA,EACE,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAUC;AAAA,EACV,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAM,CAACC,CAAO,IAAIC,EAAS,MAAML,KAAM,WAAWX,GAAS,EAAE,GACvDiB,IAAU,GAAGF,CAAO,UACpBG,IAAgB,GAAGH,CAAO,gBAC1BI,IAAW,EAAAd,GACXe,IAAQZ,IAAS,WAAWC,IAAU,YAAYU,IAAW,UAAU;AAE7E,SACE,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAR;AAAA,MACA,IAAG;AAAA,MACH,mBAAiBG;AAAA,MACjB,oBAAkBC;AAAA,MAClB,eAAaV;AAAA,MACb,cAAYW;AAAA,MACZ,gBAAcV;AAAA,MACd,WAAWc,EAAW,cAAcC,EAAO,SAAS,GAAG,WAAWd,CAAS;AAAA,MAC3E,QAAO;AAAA,MACP,QAAO;AAAA,MACP,QAAO;AAAA,MACP,KAAI;AAAA,MACH,GAAGG;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,UAAUnB;AAAA,YACV,OAAOA;AAAA,YACP,IAAIQ;AAAA,YACJ,OAAAZ;AAAA,YACA,aAAAC;AAAA,YACA,UAAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAa,EAACE,KAAa,cAAAtB,GAA4B,SAAAI,GAAkB,QAAAD,GAC1D,UAAA,gBAAAiB,EAACG,GAAA,EAAiB,OAAAR,GAAe,UAAAd,EAAA,CAAQ,EAAA,CAC3C;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v_field.d.ts","sourceRoot":"","sources":["../../../../src/form/field/v_field/v_field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"v_field.d.ts","sourceRoot":"","sources":["../../../../src/form/field/v_field/v_field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,qBAAqB,CAAC,cAAc,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC;AAExF,eAAO,MAAM,MAAM,iGAwDjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v_field.js","sources":["../../../../src/form/field/v_field/v_field.tsx"],"sourcesContent":["import { VStack } from '../../../stacks/v_stack.js';\nimport type { VStackOwnProps } from '../../../stacks/v_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';\nimport classNames from 'classnames';\nimport React, { useState } from 'react';\nimport styles from './v_field.module.css';\nimport { FieldControl } from '../common/field_control/field_control.js';\nimport { FieldHeader } from '../common/field_header.js';\nimport { FieldStatusInput } from '../common/status_input/status_input.js';\nimport { FieldInput } from '../common/types.js';\n\nexport interface VFieldOwnProps extends FieldInput {\n children: React.ReactNode;\n}\n\nexport type VFieldProps = WithDetailedHTMLProps<VFieldOwnProps, 'div'> & VStackOwnProps;\nlet idIndex = 0;\nexport const VField = React.forwardRef(function VField(\n {\n label,\n description,\n errorMessage,\n children: Control,\n locked = false,\n loading = false,\n maxWidth,\n minWidth,\n className,\n id,\n required,\n ...props\n }: VFieldProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [finalId] = useState(() => id || `v-field-${idIndex++}`);\n const hasError = errorMessage ? true : false;\n const labelId = `${finalId}-label`;\n const descriptionId = `${finalId}-description`;\n const state = locked ? 'locked' : loading ? 'loading' : hasError ? 'error' : 'default';\n return (\n <VStack\n ref={ref}\n as=\"div\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n data-locked={locked}\n data-error={hasError}\n data-loading={loading}\n className={classNames('base-field', styles['v-field'], 'v-field', className)}\n vAlign=\"start\"\n hAlign=\"start\"\n height=\"auto\"\n gap=\"4px\"\n {...props}\n >\n <FieldHeader\n id={finalId}\n label={label}\n description={description}\n required={required}\n />\n <FieldControl\n errorMessage={errorMessage}\n loading={loading}\n locked={locked}\n hAlign=\"start\"\n >\n <FieldStatusInput state={state} hAlign=\"start\">\n {Control}\n </FieldStatusInput>\n </FieldControl>\n </VStack>\n );\n});\n"],"names":["idIndex","VField","React","label","description","errorMessage","Control","locked","loading","maxWidth","minWidth","className","id","required","props","ref","finalId","useState","hasError","labelId","descriptionId","state","jsxs","VStack","classNames","styles","jsx","FieldHeader","FieldControl","FieldStatusInput"],"mappings":";;;;;;;;AAgBA,IAAIA,IAAU;AACP,MAAMC,IAASC,EAAM,WAAW,SACrC;AAAA,EACE,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAUC;AAAA,EACV,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAM,CAACC,CAAO,IAAIC,EAAS,MAAML,KAAM,WAAWZ,GAAS,EAAE,GACvDkB,IAAW,EAAAb,GACXc,IAAU,GAAGH,CAAO,UACpBI,IAAgB,GAAGJ,CAAO,gBAC1BK,IAAQd,IAAS,WAAWC,IAAU,YAAYU,IAAW,UAAU;AAC7E,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAR;AAAA,MACA,IAAG;AAAA,MACH,mBAAiBI;AAAA,MACjB,oBAAkBC;AAAA,MAClB,eAAab;AAAA,MACb,cAAYW;AAAA,MACZ,gBAAcV;AAAA,MACd,WAAWgB,EAAW,cAAcC,EAAO,SAAS,GAAG,WAAWd,CAAS;AAAA,MAC3E,QAAO;AAAA,MACP,QAAO;AAAA,MACP,QAAO;AAAA,MACP,KAAI;AAAA,MACH,GAAGG;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAIX;AAAA,YACJ,OAAAb;AAAA,YACA,aAAAC;AAAA,YACA,UAAAS;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAa;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,cAAAvB;AAAA,YACA,SAAAG;AAAA,YACA,QAAAD;AAAA,YACA,QAAO;AAAA,YAEP,UAAA,gBAAAmB,EAACG,GAAA,EAAiB,OAAAR,GAAc,QAAO,SACpC,UAAAf,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
1
|
+
{"version":3,"file":"v_field.js","sources":["../../../../src/form/field/v_field/v_field.tsx"],"sourcesContent":["import { VStack } from '../../../stacks/v_stack.js';\nimport type { VStackOwnProps } from '../../../stacks/v_stack.js';\nimport type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';\nimport classNames from 'classnames';\nimport React, { useState } from 'react';\nimport styles from './v_field.module.css';\nimport { FieldControl } from '../common/field_control/field_control.js';\nimport { FieldHeader } from '../common/field_header.js';\nimport { FieldStatusInput } from '../common/status_input/status_input.js';\nimport type { FieldInput } from '../common/types.js';\n\nexport interface VFieldOwnProps extends FieldInput {\n children: React.ReactNode;\n}\n\nexport type VFieldProps = WithDetailedHTMLProps<VFieldOwnProps, 'div'> & VStackOwnProps;\nlet idIndex = 0;\nexport const VField = React.forwardRef(function VField(\n {\n label,\n description,\n errorMessage,\n children: Control,\n locked = false,\n loading = false,\n maxWidth,\n minWidth,\n className,\n id,\n required,\n ...props\n }: VFieldProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const [finalId] = useState(() => id || `v-field-${idIndex++}`);\n const hasError = errorMessage ? true : false;\n const labelId = `${finalId}-label`;\n const descriptionId = `${finalId}-description`;\n const state = locked ? 'locked' : loading ? 'loading' : hasError ? 'error' : 'default';\n return (\n <VStack\n ref={ref}\n as=\"div\"\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n data-locked={locked}\n data-error={hasError}\n data-loading={loading}\n className={classNames('base-field', styles['v-field'], 'v-field', className)}\n vAlign=\"start\"\n hAlign=\"start\"\n height=\"auto\"\n gap=\"4px\"\n {...props}\n >\n <FieldHeader\n id={finalId}\n label={label}\n description={description}\n required={required}\n />\n <FieldControl\n errorMessage={errorMessage}\n loading={loading}\n locked={locked}\n hAlign=\"start\"\n >\n <FieldStatusInput state={state} hAlign=\"start\">\n {Control}\n </FieldStatusInput>\n </FieldControl>\n </VStack>\n );\n});\n"],"names":["idIndex","VField","React","label","description","errorMessage","Control","locked","loading","maxWidth","minWidth","className","id","required","props","ref","finalId","useState","hasError","labelId","descriptionId","state","jsxs","VStack","classNames","styles","jsx","FieldHeader","FieldControl","FieldStatusInput"],"mappings":";;;;;;;;AAgBA,IAAIA,IAAU;AACP,MAAMC,IAASC,EAAM,WAAW,SACrC;AAAA,EACE,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAUC;AAAA,EACV,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAM,CAACC,CAAO,IAAIC,EAAS,MAAML,KAAM,WAAWZ,GAAS,EAAE,GACvDkB,IAAW,EAAAb,GACXc,IAAU,GAAGH,CAAO,UACpBI,IAAgB,GAAGJ,CAAO,gBAC1BK,IAAQd,IAAS,WAAWC,IAAU,YAAYU,IAAW,UAAU;AAC7E,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAR;AAAA,MACA,IAAG;AAAA,MACH,mBAAiBI;AAAA,MACjB,oBAAkBC;AAAA,MAClB,eAAab;AAAA,MACb,cAAYW;AAAA,MACZ,gBAAcV;AAAA,MACd,WAAWgB,EAAW,cAAcC,EAAO,SAAS,GAAG,WAAWd,CAAS;AAAA,MAC3E,QAAO;AAAA,MACP,QAAO;AAAA,MACP,QAAO;AAAA,MACP,KAAI;AAAA,MACH,GAAGG;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAIX;AAAA,YACJ,OAAAb;AAAA,YACA,aAAAC;AAAA,YACA,UAAAS;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAa;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,cAAAvB;AAAA,YACA,SAAAG;AAAA,YACA,QAAAD;AAAA,YACA,QAAO;AAAA,YAEP,UAAA,gBAAAmB,EAACG,GAAA,EAAiB,OAAAR,GAAc,QAAO,SACpC,UAAAf,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options_field_presenter.d.ts","sourceRoot":"","sources":["../../../src/form/field_presenters/options_field_presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"options_field_presenter.d.ts","sourceRoot":"","sources":["../../../src/form/field_presenters/options_field_presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE1F,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,GAAG,MAAM,CAClE,SAAQ,UAAU,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,GAAG,MAAM,CACpE,SAAQ,YAAY,CAAC,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,qBAAa,qBAAqB,CAChC,MAAM,GAAG,MAAM,EACf,OAAO,GAAG,MAAM,CAChB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAC9B,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtC,IAAI,gBAAgB,+CAEnB;gBAGC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC;IAM/C,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE;CAG9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options_field_presenter.js","sources":["../../../src/form/field_presenters/options_field_presenter.ts"],"sourcesContent":["import { Signal } from '@tcn/state';\nimport { FieldOptions, FieldPresenter, FieldState } from './field_presenter.js';\n\nexport interface OptionsFieldState<TValue = string, TOption = string>\n extends FieldState<TValue> {\n options: TOption[];\n}\n\nexport interface OptionsFieldOptions<TValue = string, TOption = string>\n extends FieldOptions<TValue> {\n options?: TOption[];\n}\n\nexport class OptionsFieldPresenter<\n TValue = string,\n TOption = TValue,\n> extends FieldPresenter<TValue> {\n protected _options: Signal<TOption[]>;\n\n get optionsBroadcast() {\n return this._options.broadcast;\n }\n\n constructor(\n label: string,\n value: TValue,\n options: OptionsFieldOptions<TValue, TOption>\n ) {\n super(label, value, options);\n this._options = new Signal(options.options || []);\n }\n\n setOptions(options: TOption[]) {\n this._options.set(options);\n }\n}\n"],"names":["OptionsFieldPresenter","FieldPresenter","label","value","options","Signal"],"mappings":";;AAaO,MAAMA,UAGHC,EAAuB;AAAA,EACrB;AAAA,EAEV,IAAI,mBAAmB;AACrB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAAOC,GAAOC,CAAO,GAC3B,KAAK,WAAW,IAAIC,EAAOD,EAAQ,WAAW,CAAA,CAAE;AAAA,EAClD;AAAA,EAEA,WAAWA,GAAoB;AAC7B,SAAK,SAAS,IAAIA,CAAO;AAAA,EAC3B;AACF;"}
|
|
1
|
+
{"version":3,"file":"options_field_presenter.js","sources":["../../../src/form/field_presenters/options_field_presenter.ts"],"sourcesContent":["import { Signal } from '@tcn/state';\nimport { type FieldOptions, FieldPresenter, type FieldState } from './field_presenter.js';\n\nexport interface OptionsFieldState<TValue = string, TOption = string>\n extends FieldState<TValue> {\n options: TOption[];\n}\n\nexport interface OptionsFieldOptions<TValue = string, TOption = string>\n extends FieldOptions<TValue> {\n options?: TOption[];\n}\n\nexport class OptionsFieldPresenter<\n TValue = string,\n TOption = TValue,\n> extends FieldPresenter<TValue> {\n protected _options: Signal<TOption[]>;\n\n get optionsBroadcast() {\n return this._options.broadcast;\n }\n\n constructor(\n label: string,\n value: TValue,\n options: OptionsFieldOptions<TValue, TOption>\n ) {\n super(label, value, options);\n this._options = new Signal(options.options || []);\n }\n\n setOptions(options: TOption[]) {\n this._options.set(options);\n }\n}\n"],"names":["OptionsFieldPresenter","FieldPresenter","label","value","options","Signal"],"mappings":";;AAaO,MAAMA,UAGHC,EAAuB;AAAA,EACrB;AAAA,EAEV,IAAI,mBAAmB;AACrB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAAOC,GAAOC,CAAO,GAC3B,KAAK,WAAW,IAAIC,EAAOD,EAAQ,WAAW,CAAA,CAAE;AAAA,EAClD;AAAA,EAEA,WAAWA,GAAoB;AAC7B,SAAK,SAAS,IAAIA,CAAO;AAAA,EAC3B;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_field.d.ts","sourceRoot":"","sources":["../../src/form/form_field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"form_field.d.ts","sourceRoot":"","sources":["../../src/form/form_field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAExF,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAC3B,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACzB,QAAQ,EAAE,CACR,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC5B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAC1B,KAAK,CAAC,YAAY,CAAC;CACzB,0FAcA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_field.js","sources":["../../src/form/form_field.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { useSignalValue } from '@tcn/state';\nimport { FieldPresenter, FieldState } from './field_presenters/field_presenter.js';\n\nexport function FormField<T>({\n field,\n children,\n}: {\n field: FieldPresenter<T>;\n children: (\n state: FieldState<T>,\n setValue: (value: T) => void,\n validate: () => Promise<void>\n ) => React.ReactElement;\n}) {\n const state = useSignalValue(field.stateBroadcast);\n const setValue = useCallback(\n (value: T) => {\n field.setValue(value);\n },\n [field]\n );\n\n const validate = useCallback(() => {\n return field.validate();\n }, [field]);\n\n return children(state, setValue, validate);\n}\n"],"names":["FormField","field","children","state","useSignalValue","setValue","useCallback","value","validate"],"mappings":";;AAIO,SAASA,EAAa;AAAA,EAC3B,OAAAC;AAAA,EACA,UAAAC;AACF,GAOG;AACD,QAAMC,IAAQC,EAAeH,EAAM,cAAc,GAC3CI,IAAWC;AAAA,IACf,CAACC,MAAa;AACZ,MAAAN,EAAM,SAASM,CAAK;AAAA,IACtB;AAAA,IACA,CAACN,CAAK;AAAA,EAAA,GAGFO,IAAWF,EAAY,MACpBL,EAAM,SAAA,GACZ,CAACA,CAAK,CAAC;AAEV,SAAOC,EAASC,GAAOE,GAAUG,CAAQ;AAC3C;"}
|
|
1
|
+
{"version":3,"file":"form_field.js","sources":["../../src/form/form_field.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { useSignalValue } from '@tcn/state';\nimport { FieldPresenter, type FieldState } from './field_presenters/field_presenter.js';\n\nexport function FormField<T>({\n field,\n children,\n}: {\n field: FieldPresenter<T>;\n children: (\n state: FieldState<T>,\n setValue: (value: T) => void,\n validate: () => Promise<void>\n ) => React.ReactElement;\n}) {\n const state = useSignalValue(field.stateBroadcast);\n const setValue = useCallback(\n (value: T) => {\n field.setValue(value);\n },\n [field]\n );\n\n const validate = useCallback(() => {\n return field.validate();\n }, [field]);\n\n return children(state, setValue, validate);\n}\n"],"names":["FormField","field","children","state","useSignalValue","setValue","useCallback","value","validate"],"mappings":";;AAIO,SAASA,EAAa;AAAA,EAC3B,OAAAC;AAAA,EACA,UAAAC;AACF,GAOG;AACD,QAAMC,IAAQC,EAAeH,EAAM,cAAc,GAC3CI,IAAWC;AAAA,IACf,CAACC,MAAa;AACZ,MAAAN,EAAM,SAASM,CAAK;AAAA,IACtB;AAAA,IACA,CAACN,CAAK;AAAA,EAAA,GAGFO,IAAWF,EAAY,MACpBL,EAAM,SAAA,GACZ,CAACA,CAAK,CAAC;AAEV,SAAOC,EAASC,GAAOE,GAAUG,CAAQ;AAC3C;"}
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { type FieldControlOwnProps, type FieldControlProps, FieldControl, } from './field/common/field_control/field_control.js';
|
|
2
|
+
export { AdornmentMap, type StatusInputState, type StatusInputOwnProps, type StatusInputProps, FieldStatusInput, } from './field/common/status_input/status_input.js';
|
|
3
|
+
export { FieldDescription, type FieldDescriptionOwnProps, } from './field/common/field_description.js';
|
|
4
|
+
export { type FieldErrorMessageOwnProps, FieldErrorMessage, } from './field/common/field_error.js';
|
|
5
|
+
export { FieldHeader, type FieldHeaderProps, type FieldHeaderOwnProps, } from './field/common/field_header.js';
|
|
6
|
+
export { FieldLabel, type FieldLabelOwnProps } from './field/common/field_label.js';
|
|
7
|
+
export type { FieldInput } from './field/common/types.js';
|
|
8
|
+
export { HField, type HFieldProps, type HFieldOwnProps, } from './field/h_field/h_field.js';
|
|
9
|
+
export { VField, type VFieldProps, type VFieldOwnProps, } from './field/v_field/v_field.js';
|
|
10
|
+
export { Field, type FieldProps } from './field/field.js';
|
|
11
|
+
export { FieldPresenter, type FieldState, type FieldOptions, } from './field_presenters/field_presenter.js';
|
|
12
|
+
export { OptionsFieldPresenter, type OptionsFieldState, type OptionsFieldOptions, } from './field_presenters/options_field_presenter.js';
|
|
13
|
+
export { FieldSet, type FieldSetProps } from './field_set/field_set.js';
|
|
14
|
+
export { FormField } from './form_field.js';
|
|
6
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/form/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,YAAY,GACb,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,gBAAgB,GACjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,KAAK,wBAAwB,GAC9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,KAAK,yBAAyB,EAC9B,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACpF,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EACL,cAAc,EACd,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/form/index.js
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { FieldControl as o } from "./field/common/field_control/field_control.js";
|
|
2
|
+
import { AdornmentMap as p, FieldStatusInput as i } from "./field/common/status_input/status_input.js";
|
|
3
|
+
import { FieldDescription as l } from "./field/common/field_description.js";
|
|
4
|
+
import { FieldErrorMessage as F } from "./field/common/field_error.js";
|
|
5
|
+
import { FieldHeader as x } from "./field/common/field_header.js";
|
|
6
|
+
import { FieldLabel as s } from "./field/common/field_label.js";
|
|
7
|
+
import { HField as u } from "./field/h_field/h_field.js";
|
|
8
|
+
import { VField as M } from "./field/v_field/v_field.js";
|
|
9
|
+
import { Field as S } from "./field/field.js";
|
|
10
|
+
import { FieldPresenter as c } from "./field_presenters/field_presenter.js";
|
|
11
|
+
import { OptionsFieldPresenter as A } from "./field_presenters/options_field_presenter.js";
|
|
12
|
+
import { FieldSet as D } from "./field_set/field_set.js";
|
|
13
|
+
import { FormField as I } from "./form_field.js";
|
|
5
14
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
o as
|
|
9
|
-
|
|
15
|
+
p as AdornmentMap,
|
|
16
|
+
S as Field,
|
|
17
|
+
o as FieldControl,
|
|
18
|
+
l as FieldDescription,
|
|
19
|
+
F as FieldErrorMessage,
|
|
20
|
+
x as FieldHeader,
|
|
21
|
+
s as FieldLabel,
|
|
22
|
+
c as FieldPresenter,
|
|
23
|
+
D as FieldSet,
|
|
24
|
+
i as FieldStatusInput,
|
|
25
|
+
I as FormField,
|
|
26
|
+
u as HField,
|
|
27
|
+
A as OptionsFieldPresenter,
|
|
28
|
+
M as VField
|
|
10
29
|
};
|
|
11
30
|
//# sourceMappingURL=index.js.map
|
package/dist/form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/dist/h_body.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._h-body_d56f4f1{min-width:0;flex-grow:1;height:100%}
|
|
@@ -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;
|
|
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;AAuF3D,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,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,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,2FAsN3B,CAAC"}
|
|
@@ -22,17 +22,28 @@ import '../../phone_number_input.css';const me = "_phone-number-input_5c4483d",
|
|
|
22
22
|
value: o.code,
|
|
23
23
|
keywords: o.keywords
|
|
24
24
|
}));
|
|
25
|
-
O.sort((o,
|
|
25
|
+
O.sort((o, n) => parseInt(o.value) - parseInt(n.value));
|
|
26
26
|
const x = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
27
27
|
E.forEach((o) => {
|
|
28
28
|
h.set(o.code, o), x.has(o.prefix) ? x.get(o.prefix)?.push(o) : x.set(o.prefix, [o]);
|
|
29
29
|
});
|
|
30
30
|
function be(o) {
|
|
31
31
|
if (o != null) {
|
|
32
|
-
const
|
|
33
|
-
return o.forEach((
|
|
34
|
-
t
|
|
35
|
-
}), O.filter((
|
|
32
|
+
const n = {};
|
|
33
|
+
return o.forEach((t) => {
|
|
34
|
+
n[t] = !0;
|
|
35
|
+
}), O.filter((t) => !!n[t.value]).map((t) => /* @__PURE__ */ c(
|
|
36
|
+
L,
|
|
37
|
+
{
|
|
38
|
+
value: t.value,
|
|
39
|
+
label: t.selectedLabel,
|
|
40
|
+
keywords: t.keywords,
|
|
41
|
+
children: t.optionLabel
|
|
42
|
+
},
|
|
43
|
+
t.value
|
|
44
|
+
));
|
|
45
|
+
} else
|
|
46
|
+
return O.map((n) => /* @__PURE__ */ c(
|
|
36
47
|
L,
|
|
37
48
|
{
|
|
38
49
|
value: n.value,
|
|
@@ -40,27 +51,25 @@ function be(o) {
|
|
|
40
51
|
keywords: n.keywords,
|
|
41
52
|
children: n.optionLabel
|
|
42
53
|
},
|
|
43
|
-
|
|
54
|
+
n.value
|
|
44
55
|
));
|
|
45
|
-
} else
|
|
46
|
-
return O.map((t, n) => /* @__PURE__ */ c(L, { value: t.value, label: t.selectedLabel, keywords: t.keywords, children: t.optionLabel }, n));
|
|
47
56
|
}
|
|
48
|
-
function I(o,
|
|
49
|
-
for (let
|
|
50
|
-
const g = o.slice(0,
|
|
57
|
+
function I(o, n, t) {
|
|
58
|
+
for (let p = 5; p > 1; p--) {
|
|
59
|
+
const g = o.slice(0, p), m = x.get(g);
|
|
51
60
|
if (m != null) {
|
|
52
61
|
const s = m.find(
|
|
53
|
-
(f) => f.code ===
|
|
62
|
+
(f) => f.code === n
|
|
54
63
|
);
|
|
55
64
|
return s ?? m[0];
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
|
-
return h.get(
|
|
67
|
+
return h.get(t.toUpperCase()) || h.get("US");
|
|
59
68
|
}
|
|
60
69
|
const Re = ee.forwardRef(function({
|
|
61
|
-
value:
|
|
62
|
-
defaultCountry:
|
|
63
|
-
onChange:
|
|
70
|
+
value: n = "",
|
|
71
|
+
defaultCountry: t = "US",
|
|
72
|
+
onChange: p,
|
|
64
73
|
countrySelectRef: g,
|
|
65
74
|
phoneNumberInputRef: m,
|
|
66
75
|
disabled: s = !1,
|
|
@@ -68,75 +77,75 @@ const Re = ee.forwardRef(function({
|
|
|
68
77
|
children: V,
|
|
69
78
|
...W
|
|
70
79
|
}, q) {
|
|
71
|
-
const P = oe(
|
|
80
|
+
const P = oe(n), [R, S] = l(
|
|
72
81
|
null
|
|
73
|
-
), $ = R != null, [i, B] = l(
|
|
74
|
-
|
|
82
|
+
), $ = R != null, [i, B] = l(t), v = I(
|
|
83
|
+
n,
|
|
75
84
|
i,
|
|
76
|
-
|
|
85
|
+
t
|
|
77
86
|
), [b, M] = l(() => {
|
|
78
|
-
const e =
|
|
87
|
+
const e = n.split(v.prefix)[1];
|
|
79
88
|
return e == null ? "" : w(e);
|
|
80
|
-
}),
|
|
89
|
+
}), C = H(() => ne.toArray(V).filter(
|
|
81
90
|
(e) => te(e) && e.type === L
|
|
82
|
-
), [V]),
|
|
91
|
+
), [V]), F = C.length > 0, [U, d] = l(v.code), [D, k] = l([
|
|
83
92
|
...E[0].masks
|
|
84
93
|
]), G = H(() => be(f), [f]);
|
|
85
94
|
function J(e) {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
95
|
+
const r = h.get(e);
|
|
96
|
+
if (r == null || (d(r.code), k([...r.masks]), B(r.code), b == null))
|
|
88
97
|
return;
|
|
89
|
-
const
|
|
90
|
-
P.current =
|
|
98
|
+
const u = `${r.prefix}${w(b)}`;
|
|
99
|
+
P.current = u, p && p(u);
|
|
91
100
|
}
|
|
92
101
|
T(() => {
|
|
93
102
|
const e = I(
|
|
94
|
-
|
|
103
|
+
n,
|
|
95
104
|
i,
|
|
96
|
-
|
|
105
|
+
t
|
|
97
106
|
);
|
|
98
107
|
d(e.code), k([...e.masks]), B(e.code);
|
|
99
|
-
}, [
|
|
108
|
+
}, [n, i, t]);
|
|
100
109
|
function K(e) {
|
|
101
|
-
const
|
|
102
|
-
P.current = N, b !== e && M(e),
|
|
110
|
+
const r = h.get(U)?.prefix, u = w(e), N = r + u;
|
|
111
|
+
P.current = N, b !== e && M(e), p && p(N);
|
|
103
112
|
}
|
|
104
113
|
function Q(e) {
|
|
105
114
|
S($ ? null : e.currentTarget);
|
|
106
115
|
}
|
|
107
|
-
function
|
|
116
|
+
function j() {
|
|
108
117
|
S(null);
|
|
109
118
|
}
|
|
110
119
|
function X(e) {
|
|
111
|
-
_(e),
|
|
120
|
+
_(e), j();
|
|
112
121
|
}
|
|
113
122
|
function Y(e) {
|
|
114
123
|
if (e.startsWith("+")) {
|
|
115
|
-
const
|
|
124
|
+
const r = I(
|
|
116
125
|
e,
|
|
117
126
|
i,
|
|
118
|
-
|
|
127
|
+
t
|
|
119
128
|
);
|
|
120
|
-
d(
|
|
121
|
-
const
|
|
122
|
-
return M(
|
|
129
|
+
d(r.code), k([...r.masks]);
|
|
130
|
+
const u = e.split(r.prefix)[1];
|
|
131
|
+
return M(u), u;
|
|
123
132
|
}
|
|
124
133
|
return e;
|
|
125
134
|
}
|
|
126
135
|
const _ = re(
|
|
127
136
|
(e) => {
|
|
128
|
-
const
|
|
137
|
+
const r = P.current, u = I(
|
|
129
138
|
e,
|
|
130
139
|
i,
|
|
131
|
-
|
|
132
|
-
), N = e.split(
|
|
133
|
-
d(
|
|
140
|
+
t
|
|
141
|
+
), N = e.split(u.prefix)[1];
|
|
142
|
+
d(u.code), k([...u.masks]), B(u.code), r !== e && (M(N), p && p(e));
|
|
134
143
|
},
|
|
135
|
-
[
|
|
144
|
+
[t, i, p]
|
|
136
145
|
);
|
|
137
146
|
return T(() => {
|
|
138
|
-
_(
|
|
139
|
-
}, [
|
|
147
|
+
_(n);
|
|
148
|
+
}, [n, _]), /* @__PURE__ */ z(
|
|
140
149
|
A,
|
|
141
150
|
{
|
|
142
151
|
ref: q,
|
|
@@ -153,7 +162,7 @@ const Re = ee.forwardRef(function({
|
|
|
153
162
|
),
|
|
154
163
|
ref: g,
|
|
155
164
|
width: "auto",
|
|
156
|
-
value:
|
|
165
|
+
value: U,
|
|
157
166
|
onChange: J,
|
|
158
167
|
disabled: s,
|
|
159
168
|
"data-is-disabled": s,
|
|
@@ -169,12 +178,12 @@ const Re = ee.forwardRef(function({
|
|
|
169
178
|
onChange: K,
|
|
170
179
|
disabled: s,
|
|
171
180
|
"data-is-disabled": s,
|
|
172
|
-
"data-has-phone-book":
|
|
181
|
+
"data-has-phone-book": F,
|
|
173
182
|
className: y(a["phone-number-input"], "phone-number-input"),
|
|
174
183
|
preparePasteValue: Y
|
|
175
184
|
}
|
|
176
185
|
) }),
|
|
177
|
-
|
|
186
|
+
F && /* @__PURE__ */ z(Z, { children: [
|
|
178
187
|
/* @__PURE__ */ c(
|
|
179
188
|
ue,
|
|
180
189
|
{
|
|
@@ -193,9 +202,9 @@ const Re = ee.forwardRef(function({
|
|
|
193
202
|
{
|
|
194
203
|
anchorElement: R,
|
|
195
204
|
onOptionSelect: X,
|
|
196
|
-
onClose:
|
|
205
|
+
onClose: j,
|
|
197
206
|
noSuggestionMessage: "No phone numbers found",
|
|
198
|
-
children:
|
|
207
|
+
children: C
|
|
199
208
|
}
|
|
200
209
|
)
|
|
201
210
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport classNames from 'classnames';\nimport React, {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n Children,\n isValidElement,\n} from 'react';\nimport { SlimButton } from '../../actions/index.js';\nimport { Select } from '../select/select.js';\nimport { MaskInput } from '../mask_input/mask_input.js';\nimport {\n CountryPhoneInformation,\n countriesPhoneInformation,\n} from './countries_phone_information.js';\nimport styles from './phone_number_input.module.css';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { stripNonNumericAfterCountryCode } from './utils.js';\n\nconst countryList = countriesPhoneInformation.map(i => ({\n name: i.name,\n selectedLabel: i.prefix,\n optionLabel: `${i.prefix} (${i.code}) ${i.unicodeFlag}`,\n value: i.code,\n keywords: i.keywords,\n}));\n\ncountryList.sort((a, b) => parseInt(a.value) - parseInt(b.value));\n\nconst countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nconst countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nfunction createCountryOptions(allowedCountryCodes?: string[]) {\n if (allowedCountryCodes != null) {\n const allowedMap: Record<string, boolean> = {};\n allowedCountryCodes.forEach(c => {\n allowedMap[c] = true;\n });\n return countryList\n .filter(c => Boolean(allowedMap[c.value]))\n .map((i, index) => {\n return (\n <Option\n key={index}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n } else {\n return countryList.map((i, index) => {\n return (\n <Option key={index} value={i.value} label={i.selectedLabel} keywords={i.keywords}>\n {i.optionLabel}\n </Option>\n );\n });\n }\n}\n\nfunction getCountryCodeFromValue(\n value: string,\n previousCountry: string,\n defaultCountry: string\n) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(\n c => c.code === previousCountry\n );\n\n if (countryInformation != null) {\n return countryInformation;\n } else {\n return countriesInformation[0];\n }\n }\n }\n\n return (countryCodeMap.get(defaultCountry.toUpperCase()) ||\n countryCodeMap.get('US')) as CountryPhoneInformation;\n}\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n defaultCountry?: string;\n onChange?: (value: string) => void;\n countrySelectRef?: React.Ref<HTMLButtonElement>;\n phoneNumberInputRef?: React.Ref<HTMLInputElement>;\n disabled?: boolean;\n allowedCountryCodes?: string[];\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport const PhoneNumberInput = React.forwardRef(function PhoneNumberInput(\n {\n value = '',\n defaultCountry = 'US',\n onChange,\n countrySelectRef: countryRef,\n phoneNumberInputRef: numberRef,\n disabled = false,\n allowedCountryCodes,\n children,\n ...props\n }: PhoneNumberInputProps,\n ref: React.Ref<HTMLElement>\n) {\n const lastOutputValueRef = useRef(value);\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const [selectedCountry, setSelectedCountry] = useState(defaultCountry);\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const [phoneNumber, setPhoneNumber] = useState(() => {\n const phoneNumber = value.split(countryInformation.prefix)[1];\n\n return phoneNumber == null ? '' : stripNonNumericAfterCountryCode(phoneNumber);\n });\n\n // Extract valid Option components from children\n const phoneBookOptions = useMemo(() => {\n return Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const showPhoneBook = phoneBookOptions.length > 0;\n const [countryCode, setCountryCode] = useState(countryInformation.code);\n const [currentMasks, setCurrentMasks] = useState([\n ...countriesPhoneInformation[0].masks,\n ]);\n\n const countryOptions = useMemo(() => {\n return createCountryOptions(allowedCountryCodes);\n }, [allowedCountryCodes]);\n\n function changeCountry(countryCodeValue: string) {\n const countryInformation = countryCodeMap.get(countryCodeValue);\n\n if (countryInformation == null) {\n return;\n }\n\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (phoneNumber == null) {\n return;\n }\n\n const value = `${countryInformation.prefix}${stripNonNumericAfterCountryCode(phoneNumber)}`;\n lastOutputValueRef.current = value;\n onChange && onChange(value);\n }\n\n useLayoutEffect(() => {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n }, [value, selectedCountry, defaultCountry]);\n\n function transformValue(newPhoneNumber: string) {\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newPhoneNumber);\n const outputValue = countryPrefix + lineNumber;\n\n lastOutputValueRef.current = outputValue;\n phoneNumber !== newPhoneNumber && setPhoneNumber(newPhoneNumber);\n onChange && onChange(outputValue);\n }\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(value: string) {\n // Update the phone number with the selected value\n updatePhoneNumber(value);\n closePhoneBook();\n }\n\n function preparePasteValue(value: string) {\n if (value.startsWith('+')) {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setPhoneNumber(phoneNumber);\n\n return phoneNumber;\n }\n\n return value;\n }\n\n const updatePhoneNumber = useCallback(\n (value: string) => {\n const oldValue = lastOutputValueRef.current;\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (oldValue !== value) {\n setPhoneNumber(phoneNumber);\n onChange && onChange(value);\n }\n },\n [defaultCountry, selectedCountry, onChange]\n );\n\n useLayoutEffect(() => {\n updatePhoneNumber(value);\n }, [value, updatePhoneNumber]);\n\n return (\n <HStack\n ref={ref}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n height=\"auto\"\n {...props}\n >\n <Select\n className={classNames(\n styles['phone-number-input-select'],\n 'phone-number-input-select'\n )}\n ref={countryRef}\n width=\"auto\"\n value={countryCode}\n onChange={changeCountry}\n disabled={disabled}\n data-is-disabled={disabled}\n >\n {countryOptions}\n </Select>\n <HStack width=\"flex\" className={styles['phone-number-input-container']}>\n <MaskInput\n ref={numberRef}\n value={phoneNumber}\n mask={currentMasks}\n onChange={transformValue}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n preparePasteValue={preparePasteValue}\n />\n </HStack>\n {showPhoneBook && (\n <>\n <SlimButton\n disabled={disabled}\n className={classNames(\n styles['phone-number-input-phone-book'],\n 'phone-number-input-phone-book'\n )}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </SlimButton>\n\n {isPhoneBookOpen && (\n <SuggestionList\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n )}\n </>\n )}\n </HStack>\n );\n});\n"],"names":["countryList","countriesPhoneInformation","i","a","b","countryPrefixMap","countryCodeMap","createCountryOptions","allowedCountryCodes","allowedMap","c","index","jsx","Option","getCountryCodeFromValue","value","previousCountry","defaultCountry","x","prefix","countriesInformation","countryInformation","PhoneNumberInput","React","onChange","countryRef","numberRef","disabled","children","props","ref","lastOutputValueRef","useRef","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","selectedCountry","setSelectedCountry","phoneNumber","setPhoneNumber","stripNonNumericAfterCountryCode","phoneBookOptions","useMemo","Children","child","isValidElement","showPhoneBook","countryCode","setCountryCode","currentMasks","setCurrentMasks","countryOptions","changeCountry","countryCodeValue","useLayoutEffect","transformValue","newPhoneNumber","countryPrefix","lineNumber","outputValue","togglePhoneBook","closePhoneBook","handlePhoneBookOptionSelect","updatePhoneNumber","preparePasteValue","useCallback","oldValue","jsxs","HStack","classNames","styles","Select","MaskInput","Fragment","SlimButton","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;;0ZAwBMA,IAAcC,EAA0B,IAAI,CAAAC,OAAM;AAAA,EACtD,MAAMA,EAAE;AAAA,EACR,eAAeA,EAAE;AAAA,EACjB,aAAa,GAAGA,EAAE,MAAM,KAAKA,EAAE,IAAI,KAAKA,EAAE,WAAW;AAAA,EACrD,OAAOA,EAAE;AAAA,EACT,UAAUA,EAAE;AACd,EAAE;AAEFF,EAAY,KAAK,CAACG,GAAGC,MAAM,SAASD,EAAE,KAAK,IAAI,SAASC,EAAE,KAAK,CAAC;AAEhE,MAAMC,wBAA+D,IAAA,GAC/DC,wBAA2D,IAAA;AACjEL,EAA0B,QAAQ,CAAAC,MAAK;AACrC,EAAAI,EAAe,IAAIJ,EAAE,MAAMA,CAAC,GACxBG,EAAiB,IAAIH,EAAE,MAAM,IAC/BG,EAAiB,IAAIH,EAAE,MAAM,GAAG,KAAKA,CAAC,IAEtCG,EAAiB,IAAIH,EAAE,QAAQ,CAACA,CAAC,CAAC;AAEtC,CAAC;AAED,SAASK,GAAqBC,GAAgC;AAC5D,MAAIA,KAAuB,MAAM;AAC/B,UAAMC,IAAsC,CAAA;AAC5C,WAAAD,EAAoB,QAAQ,CAAAE,MAAK;AAC/B,MAAAD,EAAWC,CAAC,IAAI;AAAA,IAClB,CAAC,GACMV,EACJ,OAAO,CAAAU,MAAK,EAAQD,EAAWC,EAAE,KAAK,CAAE,EACxC,IAAI,CAACR,GAAGS,MAEL,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,OAAOX,EAAE;AAAA,QACT,OAAOA,EAAE;AAAA,QACT,UAAUA,EAAE;AAAA,QAEX,UAAAA,EAAE;AAAA,MAAA;AAAA,MALES;AAAA,IAAA,CAQV;AAAA,EACL;AACE,WAAOX,EAAY,IA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AA,cAEnB,UAAApB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"phone_number_input.js","sources":["../../../src/inputs/phone_number_input/phone_number_input.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport classNames from 'classnames';\nimport React, {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n Children,\n isValidElement,\n} from 'react';\nimport { SlimButton } from '../../actions/index.js';\nimport { Select } from '../select/select.js';\nimport { MaskInput } from '../mask_input/mask_input.js';\nimport {\n CountryPhoneInformation,\n countriesPhoneInformation,\n} from './countries_phone_information.js';\nimport styles from './phone_number_input.module.css';\nimport { NotebookIcon } from '@tcn/icons/notebook_icon.js';\nimport { Option, OptionProps } from '../options/option.js';\nimport { SuggestionList } from '../suggestions/suggestion_list.js';\nimport { stripNonNumericAfterCountryCode } from './utils.js';\n\nconst countryList = countriesPhoneInformation.map(i => ({\n name: i.name,\n selectedLabel: i.prefix,\n optionLabel: `${i.prefix} (${i.code}) ${i.unicodeFlag}`,\n value: i.code,\n keywords: i.keywords,\n}));\n\ncountryList.sort((a, b) => parseInt(a.value) - parseInt(b.value));\n\nconst countryPrefixMap: Map<string, CountryPhoneInformation[]> = new Map();\nconst countryCodeMap: Map<string, CountryPhoneInformation> = new Map();\ncountriesPhoneInformation.forEach(i => {\n countryCodeMap.set(i.code, i);\n if (countryPrefixMap.has(i.prefix)) {\n countryPrefixMap.get(i.prefix)?.push(i);\n } else {\n countryPrefixMap.set(i.prefix, [i]);\n }\n});\n\nfunction createCountryOptions(allowedCountryCodes?: string[]) {\n if (allowedCountryCodes != null) {\n const allowedMap: Record<string, boolean> = {};\n allowedCountryCodes.forEach(c => {\n allowedMap[c] = true;\n });\n return countryList\n .filter(c => Boolean(allowedMap[c.value]))\n .map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n } else {\n return countryList.map(i => {\n return (\n <Option\n key={i.value}\n value={i.value}\n label={i.selectedLabel}\n keywords={i.keywords}\n >\n {i.optionLabel}\n </Option>\n );\n });\n }\n}\n\nfunction getCountryCodeFromValue(\n value: string,\n previousCountry: string,\n defaultCountry: string\n) {\n for (let x = 5; x > 1; x--) {\n const prefix = value.slice(0, x);\n const countriesInformation = countryPrefixMap.get(prefix);\n\n if (countriesInformation != null) {\n const countryInformation = countriesInformation.find(\n c => c.code === previousCountry\n );\n\n if (countryInformation != null) {\n return countryInformation;\n } else {\n return countriesInformation[0];\n }\n }\n }\n\n return (countryCodeMap.get(defaultCountry.toUpperCase()) ||\n countryCodeMap.get('US')) as CountryPhoneInformation;\n}\n\nexport interface PhoneNumberInputProps\n extends Omit<HStackProps, 'onChange' | 'children'> {\n value?: string;\n defaultCountry?: string;\n onChange?: (value: string) => void;\n countrySelectRef?: React.Ref<HTMLButtonElement>;\n phoneNumberInputRef?: React.Ref<HTMLInputElement>;\n disabled?: boolean;\n allowedCountryCodes?: string[];\n children?: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];\n}\n\nexport const PhoneNumberInput = React.forwardRef(function PhoneNumberInput(\n {\n value = '',\n defaultCountry = 'US',\n onChange,\n countrySelectRef: countryRef,\n phoneNumberInputRef: numberRef,\n disabled = false,\n allowedCountryCodes,\n children,\n ...props\n }: PhoneNumberInputProps,\n ref: React.Ref<HTMLElement>\n) {\n const lastOutputValueRef = useRef(value);\n const [phoneBookElement, setPhoneBookElement] = useState<HTMLButtonElement | null>(\n null\n );\n const isPhoneBookOpen = phoneBookElement != null;\n const [selectedCountry, setSelectedCountry] = useState(defaultCountry);\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const [phoneNumber, setPhoneNumber] = useState(() => {\n const phoneNumber = value.split(countryInformation.prefix)[1];\n\n return phoneNumber == null ? '' : stripNonNumericAfterCountryCode(phoneNumber);\n });\n\n // Extract valid Option components from children\n const phoneBookOptions = useMemo(() => {\n return Children.toArray(children).filter(\n (child): child is React.ReactElement<OptionProps> =>\n isValidElement(child) && child.type === Option\n );\n }, [children]);\n\n const showPhoneBook = phoneBookOptions.length > 0;\n const [countryCode, setCountryCode] = useState(countryInformation.code);\n const [currentMasks, setCurrentMasks] = useState([\n ...countriesPhoneInformation[0].masks,\n ]);\n\n const countryOptions = useMemo(() => {\n return createCountryOptions(allowedCountryCodes);\n }, [allowedCountryCodes]);\n\n function changeCountry(countryCodeValue: string) {\n const countryInformation = countryCodeMap.get(countryCodeValue);\n\n if (countryInformation == null) {\n return;\n }\n\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (phoneNumber == null) {\n return;\n }\n\n const value = `${countryInformation.prefix}${stripNonNumericAfterCountryCode(phoneNumber)}`;\n lastOutputValueRef.current = value;\n onChange && onChange(value);\n }\n\n useLayoutEffect(() => {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n }, [value, selectedCountry, defaultCountry]);\n\n function transformValue(newPhoneNumber: string) {\n const countryPrefix = countryCodeMap.get(countryCode)?.prefix;\n const lineNumber = stripNonNumericAfterCountryCode(newPhoneNumber);\n const outputValue = countryPrefix + lineNumber;\n\n lastOutputValueRef.current = outputValue;\n phoneNumber !== newPhoneNumber && setPhoneNumber(newPhoneNumber);\n onChange && onChange(outputValue);\n }\n\n function togglePhoneBook(e: React.MouseEvent<HTMLButtonElement>) {\n if (isPhoneBookOpen) {\n setPhoneBookElement(null);\n } else {\n setPhoneBookElement(e.currentTarget);\n }\n }\n\n function closePhoneBook() {\n setPhoneBookElement(null);\n }\n\n function handlePhoneBookOptionSelect(value: string) {\n // Update the phone number with the selected value\n updatePhoneNumber(value);\n closePhoneBook();\n }\n\n function preparePasteValue(value: string) {\n if (value.startsWith('+')) {\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setPhoneNumber(phoneNumber);\n\n return phoneNumber;\n }\n\n return value;\n }\n\n const updatePhoneNumber = useCallback(\n (value: string) => {\n const oldValue = lastOutputValueRef.current;\n const countryInformation = getCountryCodeFromValue(\n value,\n selectedCountry,\n defaultCountry\n );\n const phoneNumber = value.split(countryInformation.prefix)[1];\n setCountryCode(countryInformation.code);\n setCurrentMasks([...countryInformation.masks]);\n setSelectedCountry(countryInformation.code);\n\n if (oldValue !== value) {\n setPhoneNumber(phoneNumber);\n onChange && onChange(value);\n }\n },\n [defaultCountry, selectedCountry, onChange]\n );\n\n useLayoutEffect(() => {\n updatePhoneNumber(value);\n }, [value, updatePhoneNumber]);\n\n return (\n <HStack\n ref={ref}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n height=\"auto\"\n {...props}\n >\n <Select\n className={classNames(\n styles['phone-number-input-select'],\n 'phone-number-input-select'\n )}\n ref={countryRef}\n width=\"auto\"\n value={countryCode}\n onChange={changeCountry}\n disabled={disabled}\n data-is-disabled={disabled}\n >\n {countryOptions}\n </Select>\n <HStack width=\"flex\" className={styles['phone-number-input-container']}>\n <MaskInput\n ref={numberRef}\n value={phoneNumber}\n mask={currentMasks}\n onChange={transformValue}\n disabled={disabled}\n data-is-disabled={disabled}\n data-has-phone-book={showPhoneBook}\n className={classNames(styles['phone-number-input'], 'phone-number-input')}\n preparePasteValue={preparePasteValue}\n />\n </HStack>\n {showPhoneBook && (\n <>\n <SlimButton\n disabled={disabled}\n className={classNames(\n styles['phone-number-input-phone-book'],\n 'phone-number-input-phone-book'\n )}\n onClick={togglePhoneBook}\n size=\"md\"\n >\n <NotebookIcon size=\"md\" />\n </SlimButton>\n\n {isPhoneBookOpen && (\n <SuggestionList\n anchorElement={phoneBookElement}\n onOptionSelect={handlePhoneBookOptionSelect}\n onClose={closePhoneBook}\n noSuggestionMessage=\"No phone numbers found\"\n >\n {phoneBookOptions}\n </SuggestionList>\n )}\n </>\n )}\n </HStack>\n );\n});\n"],"names":["countryList","countriesPhoneInformation","i","a","b","countryPrefixMap","countryCodeMap","createCountryOptions","allowedCountryCodes","allowedMap","c","jsx","Option","getCountryCodeFromValue","value","previousCountry","defaultCountry","x","prefix","countriesInformation","countryInformation","PhoneNumberInput","React","onChange","countryRef","numberRef","disabled","children","props","ref","lastOutputValueRef","useRef","phoneBookElement","setPhoneBookElement","useState","isPhoneBookOpen","selectedCountry","setSelectedCountry","phoneNumber","setPhoneNumber","stripNonNumericAfterCountryCode","phoneBookOptions","useMemo","Children","child","isValidElement","showPhoneBook","countryCode","setCountryCode","currentMasks","setCurrentMasks","countryOptions","changeCountry","countryCodeValue","useLayoutEffect","transformValue","newPhoneNumber","countryPrefix","lineNumber","outputValue","togglePhoneBook","closePhoneBook","handlePhoneBookOptionSelect","updatePhoneNumber","preparePasteValue","useCallback","oldValue","jsxs","HStack","classNames","styles","Select","MaskInput","Fragment","SlimButton","NotebookIcon","SuggestionList"],"mappings":";;;;;;;;;;;;;;;;;0ZAwBMA,IAAcC,EAA0B,IAAI,CAAAC,OAAM;AAAA,EACtD,MAAMA,EAAE;AAAA,EACR,eAAeA,EAAE;AAAA,EACjB,aAAa,GAAGA,EAAE,MAAM,KAAKA,EAAE,IAAI,KAAKA,EAAE,WAAW;AAAA,EACrD,OAAOA,EAAE;AAAA,EACT,UAAUA,EAAE;AACd,EAAE;AAEFF,EAAY,KAAK,CAACG,GAAGC,MAAM,SAASD,EAAE,KAAK,IAAI,SAASC,EAAE,KAAK,CAAC;AAEhE,MAAMC,wBAA+D,IAAA,GAC/DC,wBAA2D,IAAA;AACjEL,EAA0B,QAAQ,CAAAC,MAAK;AACrC,EAAAI,EAAe,IAAIJ,EAAE,MAAMA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AAAA,YACC,KAAK/C;AAAA,YACL,OAAOa;AAAA,YACP,MAAMW;AAAA,YACN,UAAUM;AAAA,YACV,UAAA7B;AAAA,YACA,oBAAkBA;AAAA,YAClB,uBAAqBoB;AAAA,YACrB,WAAWuB,EAAWC,EAAO,oBAAoB,GAAG,oBAAoB;AAAA,YACxE,mBAAAN;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QACClB,KACC,gBAAAqB,EAAAM,GAAA,EACE,UAAA;AAAA,UAAA,gBAAA9D;AAAA,YAAC+D;AAAA,YAAA;AAAA,cACC,UAAAhD;AAAA,cACA,WAAW2C;AAAA,gBACTC,EAAO,+BAA+B;AAAA,gBACtC;AAAA,cAAA;AAAA,cAEF,SAASV;AAAA,cACT,MAAK;AAAA,cAEL,UAAA,gBAAAjD,EAACgE,IAAA,EAAa,MAAK,KAAA,CAAK;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzBxC,KACC,gBAAAxB;AAAA,YAACiE;AAAA,YAAA;AAAA,cACC,eAAe5C;AAAA,cACf,gBAAgB8B;AAAA,cAChB,SAASD;AAAA,cACT,qBAAoB;AAAA,cAEnB,UAAApB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface HBodyProps extends Omit<HStackProps, 'as'> {
|
|
4
|
+
}
|
|
5
|
+
export declare const HBody: React.ForwardRefExoticComponent<HBodyProps & React.RefAttributes<HTMLElement>>;
|
|
6
|
+
//# sourceMappingURL=h_body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h_body.d.ts","sourceRoot":"","sources":["../../../src/layouts/body/h_body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;CAAG;AAE9D,eAAO,MAAM,KAAK,gFAehB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { HStack as a } from "../../stacks/h_stack.js";
|
|
3
|
+
import c from "react";
|
|
4
|
+
import f from "classnames";
|
|
5
|
+
import '../../h_body.css';const y = "_h-body_d56f4f1", e = { "h-body": y }, l = c.forwardRef(function({ children: o, className: t, overflowX: r = "auto", ...s }, d) {
|
|
6
|
+
return /* @__PURE__ */ m(
|
|
7
|
+
a,
|
|
8
|
+
{
|
|
9
|
+
ref: d,
|
|
10
|
+
as: "div",
|
|
11
|
+
overflowX: r,
|
|
12
|
+
className: f(e["h-body"], t, "tcn-h-body", "body"),
|
|
13
|
+
...s,
|
|
14
|
+
children: o
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
l as HBody
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=h_body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h_body.js","sources":["../../../src/layouts/body/h_body.tsx"],"sourcesContent":["import { HStack, type HStackProps } from '../../stacks/h_stack.js';\nimport React from 'react';\nimport classNames from 'classnames';\nimport styles from './h_body.module.css';\n\nexport interface HBodyProps extends Omit<HStackProps, 'as'> {}\n\nexport const HBody = React.forwardRef<HTMLElement, HBodyProps>(function HBody(\n { children, className, overflowX = 'auto', ...props }: HBodyProps,\n ref\n) {\n return (\n <HStack\n ref={ref}\n as=\"div\"\n overflowX={overflowX}\n className={classNames(styles['h-body'], className, 'tcn-h-body', 'body')}\n {...props}\n >\n {children}\n </HStack>\n );\n});\n"],"names":["HBody","React","children","className","overflowX","props","ref","jsx","HStack","classNames","styles"],"mappings":";;;;kDAOaA,IAAQC,EAAM,WAAoC,SAC7D,EAAE,UAAAC,GAAU,WAAAC,GAAW,WAAAC,IAAY,QAAQ,GAAGC,EAAA,GAC9CC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,IAAG;AAAA,MACH,WAAAF;AAAA,MACA,WAAWK,EAAWC,EAAO,QAAQ,GAAGP,GAAW,cAAc,MAAM;AAAA,MACtE,GAAGE;AAAA,MAEH,UAAAH;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VStackProps } from '../../stacks/v_stack.js';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface VBodyProps extends Omit<VStackProps, 'as'> {
|
|
4
|
+
}
|
|
5
|
+
export declare const VBody: React.ForwardRefExoticComponent<VBodyProps & React.RefAttributes<HTMLElement>>;
|
|
6
|
+
//# sourceMappingURL=v_body.d.ts.map
|