@choice-ui/react 1.7.4 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/components/button/dist/index.d.ts +2 -9
  2. package/dist/components/button/dist/index.js +38 -19
  3. package/dist/components/button/src/button.d.ts +2 -9
  4. package/dist/components/button/src/button.js +22 -13
  5. package/dist/components/button/src/tv.d.ts +12 -0
  6. package/dist/components/button/src/tv.js +15 -5
  7. package/dist/components/comments/src/comment-item/tv.d.ts +3 -3
  8. package/dist/components/modal/dist/index.js +3 -2
  9. package/dist/components/modal/src/styles/style.module.css +4 -0
  10. package/dist/components/modal/src/styles/style.module.css.js +8 -0
  11. package/dist/components/modal/src/tv.d.ts +3 -3
  12. package/dist/components/modal/src/tv.js +3 -2
  13. package/dist/components/numeric-input/dist/index.js +4 -3
  14. package/dist/components/numeric-input/src/styles/style.module.css +45 -0
  15. package/dist/components/numeric-input/src/styles/style.module.css.js +12 -0
  16. package/dist/components/numeric-input/src/tv.js +4 -3
  17. package/dist/components/otp-input/src/otp-input.js +10 -31
  18. package/dist/components/otp-input/src/styles/style.module.css +15 -0
  19. package/dist/components/otp-input/src/styles/style.module.css.js +8 -0
  20. package/dist/components/otp-input/src/tv.d.ts +3 -3
  21. package/dist/components/otp-input/src/tv.js +2 -1
  22. package/dist/components/panel/dist/index.d.ts +16 -16
  23. package/dist/components/panel/src/components/panel-label.js +2 -1
  24. package/dist/components/panel/src/components/panel-previewer.js +2 -4
  25. package/dist/components/panel/src/components/panel-row-label.js +2 -4
  26. package/dist/components/panel/src/components/panel-row-many-icon.js +4 -5
  27. package/dist/components/panel/src/components/panel-row.d.ts +12 -12
  28. package/dist/components/panel/src/components/panel-row.js +3 -3
  29. package/dist/components/panel/src/components/panel-sortable-row.js +13 -12
  30. package/dist/components/panel/src/components/panel-sortable.d.ts +1 -1
  31. package/dist/components/panel/src/components/panel-sortable.js +21 -21
  32. package/dist/components/panel/src/components/panel-title.js +16 -19
  33. package/dist/components/panel/src/context/panel-context.d.ts +1 -2
  34. package/dist/components/panel/src/hooks/use-panel-drag-drop.js +7 -6
  35. package/dist/components/panel/src/panel.d.ts +2 -2
  36. package/dist/components/panel/src/panel.js +38 -37
  37. package/dist/components/panel/src/styles/style.module.css +103 -0
  38. package/dist/components/panel/src/styles/style.module.css.js +23 -0
  39. package/dist/components/panel/src/tv.d.ts +89 -0
  40. package/dist/components/panel/src/tv.js +52 -15
  41. package/dist/components/skeleton/src/styles/style.module.css +18 -0
  42. package/dist/components/skeleton/src/styles/style.module.css.js +8 -0
  43. package/dist/components/skeleton/src/tv.js +2 -1
  44. package/dist/components/splitter/dist/index.d.ts +1 -1
  45. package/dist/components/splitter/src/splitter.d.ts +2 -2
  46. package/dist/components/text-field/dist/index.js +2 -1
  47. package/dist/components/text-field/src/styles/style.module.css +31 -0
  48. package/dist/components/text-field/src/styles/style.module.css.js +8 -0
  49. package/dist/components/text-field/src/tv.js +2 -1
  50. package/dist/styles/components.css +0 -199
  51. package/package.json +1 -1
  52. package/dist/components/splitter/src/tv.d.ts +0 -7
@@ -1,22 +1,15 @@
1
1
  import { HTMLProps } from 'react';
2
- import { TooltipProps } from '../../tooltip/src';
3
2
  import * as react from 'react';
4
3
 
5
- interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement>, "size"> {
4
+ interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement | HTMLAnchorElement>, "size" | "as"> {
6
5
  active?: boolean;
6
+ as?: React.ElementType;
7
7
  asChild?: boolean;
8
8
  className?: string;
9
9
  focused?: boolean;
10
10
  loading?: boolean;
11
11
  readOnly?: boolean;
12
- /**
13
- * @default "default"
14
- */
15
12
  size?: "default" | "large";
16
- tooltip?: TooltipProps;
17
- /**
18
- * @default "primary"
19
- */
20
13
  variant?: "primary" | "secondary" | "solid" | "destructive" | "secondary-destruct" | "inverse" | "success" | "link" | "link-danger" | "ghost" | "dark" | "reset";
21
14
  }
22
15
  declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
@@ -1,10 +1,9 @@
1
- import { LoaderCircle } from "@choiceform/icons-react";
2
1
  import { Slot } from "../../slot/dist/index.js";
3
- import { Tooltip } from "../../tooltip/dist/index.js";
4
- import { forwardRef, isValidElement, cloneElement, useMemo } from "react";
2
+ import { LoaderCircle } from "@choiceform/icons-react";
3
+ import { forwardRef, useMemo, isValidElement, cloneElement } from "react";
5
4
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
6
- import { isMultiElement } from "../../../shared/utils/assertion.js";
7
5
  import { tcv, tcx } from "../../../shared/utils/tcx/tcx.js";
6
+ import { isMultiElement } from "../../../shared/utils/assertion.js";
8
7
  var buttonTv = tcv({
9
8
  slots: {
10
9
  button: [
@@ -75,6 +74,10 @@ var buttonTv = tcv({
75
74
  focused: {
76
75
  true: "",
77
76
  false: ""
77
+ },
78
+ multiElement: {
79
+ true: "",
80
+ false: ""
78
81
  }
79
82
  },
80
83
  compoundVariants: [
@@ -123,10 +126,15 @@ var buttonTv = tcv({
123
126
  variant: ["link", "link-danger", "ghost"],
124
127
  disabled: true,
125
128
  class: {
126
- button: [
127
- "text-disabled-foreground pointer-events-none",
128
- "data-[multi-element=true]:border-default-boundary"
129
- ]
129
+ button: ["text-disabled-foreground pointer-events-none"]
130
+ }
131
+ },
132
+ {
133
+ variant: ["link", "link-danger", "ghost"],
134
+ disabled: true,
135
+ multiElement: true,
136
+ class: {
137
+ button: ["border-default-boundary"]
130
138
  }
131
139
  },
132
140
  {
@@ -244,7 +252,8 @@ var buttonTv = tcv({
244
252
  active: false,
245
253
  disabled: false,
246
254
  loading: false,
247
- focused: false
255
+ focused: false,
256
+ multiElement: false
248
257
  }
249
258
  });
250
259
  var Button = forwardRef(function Button2(props, ref) {
@@ -259,13 +268,25 @@ var Button = forwardRef(function Button2(props, ref) {
259
268
  loading,
260
269
  asChild,
261
270
  children,
262
- tooltip,
271
+ as,
263
272
  "aria-label": ariaLabel,
264
273
  onClick,
265
274
  ...rest
266
275
  } = props;
267
- const Button3 = asChild ? Slot : "button";
268
- const tv = buttonTv({ variant, size, active, disabled, loading, focused, className });
276
+ const As = as ?? "button";
277
+ const AsComponent = asChild ? Slot : As;
278
+ const elementProps = !asChild && As === "button" ? { type: rest.type ?? "button" } : {};
279
+ const tv = useMemo(
280
+ () => buttonTv({
281
+ variant,
282
+ size,
283
+ active,
284
+ disabled,
285
+ loading,
286
+ focused
287
+ }),
288
+ [variant, size, active, disabled, loading, focused]
289
+ );
269
290
  const content = isValidElement(children) ? cloneElement(children, {
270
291
  children: children.props.children
271
292
  }) : loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -279,23 +300,21 @@ var Button = forwardRef(function Button2(props, ref) {
279
300
  return props["aria-label"];
280
301
  }, [children, props]);
281
302
  const handleClick = readOnly ? void 0 : onClick;
282
- const button = /* @__PURE__ */ jsx(
283
- Button3,
303
+ return /* @__PURE__ */ jsx(
304
+ AsComponent,
284
305
  {
285
- ...rest,
286
306
  ref,
287
- type: rest.type || "button",
307
+ className: tcx(tv.button({ multiElement: isMultiElement(content) }), className),
308
+ ...elementProps,
309
+ ...rest,
288
310
  disabled: disabled || loading,
289
311
  onClick: handleClick,
290
- className: tcx(tv.button(), className),
291
- "data-multi-element": isMultiElement(content),
292
312
  "aria-disabled": disabled || loading,
293
313
  "aria-busy": loading,
294
314
  "aria-label": ariaLabelProps,
295
315
  children: content
296
316
  }
297
317
  );
298
- return tooltip ? /* @__PURE__ */ jsx(Tooltip, { ...tooltip, children: button }) : button;
299
318
  });
300
319
  Button.displayName = "Button";
301
320
  export {
@@ -1,20 +1,13 @@
1
- import { TooltipProps } from '../../tooltip/src';
2
1
  import { HTMLProps } from 'react';
3
- export interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement>, "size"> {
2
+ export interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement | HTMLAnchorElement>, "size" | "as"> {
4
3
  active?: boolean;
4
+ as?: React.ElementType;
5
5
  asChild?: boolean;
6
6
  className?: string;
7
7
  focused?: boolean;
8
8
  loading?: boolean;
9
9
  readOnly?: boolean;
10
- /**
11
- * @default "default"
12
- */
13
10
  size?: "default" | "large";
14
- tooltip?: TooltipProps;
15
- /**
16
- * @default "primary"
17
- */
18
11
  variant?: "primary" | "secondary" | "solid" | "destructive" | "secondary-destruct" | "inverse" | "success" | "link" | "link-danger" | "ghost" | "dark" | "reset";
19
12
  }
20
13
  export declare const Button: import('react').ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,8 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { LoaderCircle } from "@choiceform/icons-react";
3
2
  import { Slot } from "../../slot/dist/index.js";
4
- import { Tooltip } from "../../tooltip/dist/index.js";
5
- import { forwardRef, isValidElement, cloneElement, useMemo } from "react";
3
+ import { LoaderCircle } from "@choiceform/icons-react";
4
+ import { forwardRef, useMemo, isValidElement, cloneElement } from "react";
6
5
  import { buttonTv } from "./tv.js";
7
6
  import { tcx } from "../../../shared/utils/tcx/tcx.js";
8
7
  import { isMultiElement } from "../../../shared/utils/assertion.js";
@@ -18,13 +17,25 @@ const Button = forwardRef(function Button2(props, ref) {
18
17
  loading,
19
18
  asChild,
20
19
  children,
21
- tooltip,
20
+ as,
22
21
  "aria-label": ariaLabel,
23
22
  onClick,
24
23
  ...rest
25
24
  } = props;
26
- const Button3 = asChild ? Slot : "button";
27
- const tv = buttonTv({ variant, size, active, disabled, loading, focused, className });
25
+ const As = as ?? "button";
26
+ const AsComponent = asChild ? Slot : As;
27
+ const elementProps = !asChild && As === "button" ? { type: rest.type ?? "button" } : {};
28
+ const tv = useMemo(
29
+ () => buttonTv({
30
+ variant,
31
+ size,
32
+ active,
33
+ disabled,
34
+ loading,
35
+ focused
36
+ }),
37
+ [variant, size, active, disabled, loading, focused]
38
+ );
28
39
  const content = isValidElement(children) ? cloneElement(children, {
29
40
  children: children.props.children
30
41
  }) : loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -38,23 +49,21 @@ const Button = forwardRef(function Button2(props, ref) {
38
49
  return props["aria-label"];
39
50
  }, [children, props]);
40
51
  const handleClick = readOnly ? void 0 : onClick;
41
- const button = /* @__PURE__ */ jsx(
42
- Button3,
52
+ return /* @__PURE__ */ jsx(
53
+ AsComponent,
43
54
  {
44
- ...rest,
45
55
  ref,
46
- type: rest.type || "button",
56
+ className: tcx(tv.button({ multiElement: isMultiElement(content) }), className),
57
+ ...elementProps,
58
+ ...rest,
47
59
  disabled: disabled || loading,
48
60
  onClick: handleClick,
49
- className: tcx(tv.button(), className),
50
- "data-multi-element": isMultiElement(content),
51
61
  "aria-disabled": disabled || loading,
52
62
  "aria-busy": loading,
53
63
  "aria-label": ariaLabelProps,
54
64
  children: content
55
65
  }
56
66
  );
57
- return tooltip ? /* @__PURE__ */ jsx(Tooltip, { ...tooltip, children: button }) : button;
58
67
  });
59
68
  Button.displayName = "Button";
60
69
  export {
@@ -61,6 +61,10 @@ export declare const buttonTv: import('tailwind-variants').TVReturnType<{
61
61
  true: string;
62
62
  false: string;
63
63
  };
64
+ multiElement: {
65
+ true: string;
66
+ false: string;
67
+ };
64
68
  }, {
65
69
  button: string[];
66
70
  spinner: string[];
@@ -128,6 +132,10 @@ export declare const buttonTv: import('tailwind-variants').TVReturnType<{
128
132
  true: string;
129
133
  false: string;
130
134
  };
135
+ multiElement: {
136
+ true: string;
137
+ false: string;
138
+ };
131
139
  }, {
132
140
  button: string[];
133
141
  spinner: string[];
@@ -195,6 +203,10 @@ export declare const buttonTv: import('tailwind-variants').TVReturnType<{
195
203
  true: string;
196
204
  false: string;
197
205
  };
206
+ multiElement: {
207
+ true: string;
208
+ false: string;
209
+ };
198
210
  }, {
199
211
  button: string[];
200
212
  spinner: string[];
@@ -69,6 +69,10 @@ const buttonTv = tcv({
69
69
  focused: {
70
70
  true: "",
71
71
  false: ""
72
+ },
73
+ multiElement: {
74
+ true: "",
75
+ false: ""
72
76
  }
73
77
  },
74
78
  compoundVariants: [
@@ -117,10 +121,15 @@ const buttonTv = tcv({
117
121
  variant: ["link", "link-danger", "ghost"],
118
122
  disabled: true,
119
123
  class: {
120
- button: [
121
- "text-disabled-foreground pointer-events-none",
122
- "data-[multi-element=true]:border-default-boundary"
123
- ]
124
+ button: ["text-disabled-foreground pointer-events-none"]
125
+ }
126
+ },
127
+ {
128
+ variant: ["link", "link-danger", "ghost"],
129
+ disabled: true,
130
+ multiElement: true,
131
+ class: {
132
+ button: ["border-default-boundary"]
124
133
  }
125
134
  },
126
135
  {
@@ -238,7 +247,8 @@ const buttonTv = tcv({
238
247
  active: false,
239
248
  disabled: false,
240
249
  loading: false,
241
- focused: false
250
+ focused: false,
251
+ multiElement: false
242
252
  }
243
253
  });
244
254
  export {
@@ -4,8 +4,8 @@ export declare const CommentItemTv: import('tailwind-variants').TVReturnType<{
4
4
  meta?: import('tailwind-merge').ClassNameValue;
5
5
  content?: import('tailwind-merge').ClassNameValue;
6
6
  date?: import('tailwind-merge').ClassNameValue;
7
- root?: import('tailwind-merge').ClassNameValue;
8
7
  name?: import('tailwind-merge').ClassNameValue;
8
+ root?: import('tailwind-merge').ClassNameValue;
9
9
  avatar?: import('tailwind-merge').ClassNameValue;
10
10
  actionMenu?: import('tailwind-merge').ClassNameValue;
11
11
  };
@@ -16,8 +16,8 @@ export declare const CommentItemTv: import('tailwind-variants').TVReturnType<{
16
16
  meta?: import('tailwind-merge').ClassNameValue;
17
17
  content?: import('tailwind-merge').ClassNameValue;
18
18
  date?: import('tailwind-merge').ClassNameValue;
19
- root?: import('tailwind-merge').ClassNameValue;
20
19
  name?: import('tailwind-merge').ClassNameValue;
20
+ root?: import('tailwind-merge').ClassNameValue;
21
21
  avatar?: import('tailwind-merge').ClassNameValue;
22
22
  actionMenu?: import('tailwind-merge').ClassNameValue;
23
23
  };
@@ -36,8 +36,8 @@ export declare const CommentItemTv: import('tailwind-variants').TVReturnType<{
36
36
  meta?: import('tailwind-merge').ClassNameValue;
37
37
  content?: import('tailwind-merge').ClassNameValue;
38
38
  date?: import('tailwind-merge').ClassNameValue;
39
- root?: import('tailwind-merge').ClassNameValue;
40
39
  name?: import('tailwind-merge').ClassNameValue;
40
+ root?: import('tailwind-merge').ClassNameValue;
41
41
  avatar?: import('tailwind-merge').ClassNameValue;
42
42
  actionMenu?: import('tailwind-merge').ClassNameValue;
43
43
  };
@@ -8,6 +8,7 @@ import { AnimatePresence, motion } from "framer-motion";
8
8
  import { Input } from "../../input/dist/index.js";
9
9
  import { Textarea } from "../../textarea/dist/index.js";
10
10
  import { tcv, tcx } from "../../../shared/utils/tcx/tcx.js";
11
+ var style_default = {};
11
12
  var ModalTv = tcv({
12
13
  slots: {
13
14
  root: "bg-default-background z-modals pointer-events-auto relative flex max-w-fit flex-col rounded-xl shadow-xl"
@@ -15,7 +16,7 @@ var ModalTv = tcv({
15
16
  });
16
17
  var ModalHeaderTv = tcv({
17
18
  slots: {
18
- root: "modal__header border-default-boundary w-full flex-none items-center border-b",
19
+ root: [style_default.header, "grid border-default-boundary w-full flex-none items-center border-b"],
19
20
  title: "text-body-medium flex min-w-0 items-center gap-2 p-2 font-strong [grid-area:title] select-none",
20
21
  close: "p-2 [grid-area:close]"
21
22
  },
@@ -30,7 +31,7 @@ var ModalHeaderTv = tcv({
30
31
  },
31
32
  close: {
32
33
  true: {
33
- root: "modal__header--action"
34
+ root: "grid-cols-[auto_1fr_2.5rem]"
34
35
  },
35
36
  false: {}
36
37
  }
@@ -0,0 +1,4 @@
1
+ ._header_15lpo_1 {
2
+ grid-template-rows: minmax(2.5rem, auto);
3
+ grid-template-areas: "title . close" "input input input";
4
+ }
@@ -0,0 +1,8 @@
1
+ import './style.module.css';const header = "_header_15lpo_1";
2
+ const s = {
3
+ header
4
+ };
5
+ export {
6
+ s as default,
7
+ header
8
+ };
@@ -39,7 +39,7 @@ export declare const ModalHeaderTv: import('tailwind-variants').TVReturnType<{
39
39
  false: {};
40
40
  };
41
41
  }, {
42
- root: string;
42
+ root: string[];
43
43
  title: string;
44
44
  close: string;
45
45
  }, undefined, {
@@ -58,7 +58,7 @@ export declare const ModalHeaderTv: import('tailwind-variants').TVReturnType<{
58
58
  false: {};
59
59
  };
60
60
  }, {
61
- root: string;
61
+ root: string[];
62
62
  title: string;
63
63
  close: string;
64
64
  }, import('tailwind-variants').TVReturnType<{
@@ -77,7 +77,7 @@ export declare const ModalHeaderTv: import('tailwind-variants').TVReturnType<{
77
77
  false: {};
78
78
  };
79
79
  }, {
80
- root: string;
80
+ root: string[];
81
81
  title: string;
82
82
  close: string;
83
83
  }, undefined, unknown, unknown, undefined>>;
@@ -1,3 +1,4 @@
1
+ import s from "./styles/style.module.css.js";
1
2
  import { tcv } from "../../../shared/utils/tcx/tcx.js";
2
3
  const ModalTv = tcv({
3
4
  slots: {
@@ -6,7 +7,7 @@ const ModalTv = tcv({
6
7
  });
7
8
  const ModalHeaderTv = tcv({
8
9
  slots: {
9
- root: "modal__header border-default-boundary w-full flex-none items-center border-b",
10
+ root: [s.header, "grid border-default-boundary w-full flex-none items-center border-b"],
10
11
  title: "text-body-medium flex min-w-0 items-center gap-2 p-2 font-strong [grid-area:title] select-none",
11
12
  close: "p-2 [grid-area:close]"
12
13
  },
@@ -21,7 +22,7 @@ const ModalHeaderTv = tcv({
21
22
  },
22
23
  close: {
23
24
  true: {
24
- root: "modal__header--action"
25
+ root: "grid-cols-[auto_1fr_2.5rem]"
25
26
  },
26
27
  false: {}
27
28
  }
@@ -20,9 +20,10 @@ function useNumericInputContext() {
20
20
  }
21
21
  return context;
22
22
  }
23
+ var style_default = {};
23
24
  var NumericInputTv = tcv({
24
25
  slots: {
25
- container: ["group/input grid before:border-transparent", "input__number"],
26
+ container: ["group/input grid before:border-transparent", style_default.input],
26
27
  input: ["peer", "w-full", "cursor-default appearance-none truncate"],
27
28
  tooltip: "col-span-3 col-start-1 row-start-1"
28
29
  },
@@ -41,12 +42,12 @@ var NumericInputTv = tcv({
41
42
  },
42
43
  size: {
43
44
  default: {
44
- container: ["h-6", "input__number--default"],
45
+ container: ["h-6", style_default.default],
45
46
  input: "h-6",
46
47
  tooltip: "h-6"
47
48
  },
48
49
  large: {
49
- container: ["h-8", "input__number--large"],
50
+ container: ["h-8", style_default.large],
50
51
  input: "h-8",
51
52
  tooltip: "h-8"
52
53
  }
@@ -0,0 +1,45 @@
1
+ /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
2
+ @layer properties {
3
+ @supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
4
+ *, :before, :after, ::backdrop {
5
+ --tw-border-style: solid;
6
+ }
7
+ }
8
+ }
9
+
10
+ ._input_irmph_10 {
11
+ grid-template-columns: auto auto 1fr auto auto;
12
+ grid-template-areas: "prefix-handler variable input action suffix-handler";
13
+ }
14
+
15
+ ._input_irmph_10:before {
16
+ pointer-events: none;
17
+ z-index: 3;
18
+ border-radius: var(--radius-md, .375rem);
19
+ border-style: var(--tw-border-style);
20
+ content: "";
21
+ border-width: 1px;
22
+ grid-area: 1 / 1 / 2 / 6;
23
+ }
24
+
25
+ ._default_irmph_25 {
26
+ grid-template-rows: 1.5rem;
27
+ }
28
+
29
+ ._default_irmph_25:before {
30
+ height: calc(var(--spacing, .25rem) * 6);
31
+ }
32
+
33
+ ._large_irmph_33 {
34
+ grid-template-rows: 2rem;
35
+ }
36
+
37
+ ._large_irmph_33:before {
38
+ height: calc(var(--spacing, .25rem) * 8);
39
+ }
40
+
41
+ @property --tw-border-style {
42
+ syntax: "*";
43
+ inherits: false;
44
+ initial-value: solid;
45
+ }
@@ -0,0 +1,12 @@
1
+ import './style.module.css';const input = "_input_irmph_10";
2
+ const large = "_large_irmph_33";
3
+ const s = {
4
+ input,
5
+ "default": "_default_irmph_25",
6
+ large
7
+ };
8
+ export {
9
+ s as default,
10
+ input,
11
+ large
12
+ };
@@ -1,7 +1,8 @@
1
+ import s from "./styles/style.module.css.js";
1
2
  import { tcv } from "../../../shared/utils/tcx/tcx.js";
2
3
  const NumericInputTv = tcv({
3
4
  slots: {
4
- container: ["group/input grid before:border-transparent", "input__number"],
5
+ container: ["group/input grid before:border-transparent", s.input],
5
6
  input: ["peer", "w-full", "cursor-default appearance-none truncate"],
6
7
  tooltip: "col-span-3 col-start-1 row-start-1"
7
8
  },
@@ -20,12 +21,12 @@ const NumericInputTv = tcv({
20
21
  },
21
22
  size: {
22
23
  default: {
23
- container: ["h-6", "input__number--default"],
24
+ container: ["h-6", s.default],
24
25
  input: "h-6",
25
26
  tooltip: "h-6"
26
27
  },
27
28
  large: {
28
- container: ["h-8", "input__number--large"],
29
+ container: ["h-8", s.large],
29
30
  input: "h-8",
30
31
  tooltip: "h-8"
31
32
  }
@@ -4,7 +4,6 @@ import { useMemo, createContext, useContext } from "react";
4
4
  import { otpInputTv } from "./tv.js";
5
5
  import { tcx } from "../../../shared/utils/tcx/tcx.js";
6
6
  const OTPInputCtx = createContext({
7
- styles: otpInputTv({}),
8
7
  slotProps: [],
9
8
  variant: "default",
10
9
  disabled: false,
@@ -32,30 +31,26 @@ function OTPInputRoot({
32
31
  autoComplete: "off",
33
32
  "data-disabled": disabled || void 0,
34
33
  "data-invalid": isInvalid || void 0,
35
- "data-slot": "otp-input",
36
34
  disabled,
37
- render: ({ slots: slotProps }) => /* @__PURE__ */ jsx(OTPInputCtx.Provider, { value: { styles: tv, slotProps, variant, disabled, isInvalid }, children }),
35
+ render: ({ slots: slotProps }) => /* @__PURE__ */ jsx(OTPInputCtx.Provider, { value: { slotProps, variant, disabled, isInvalid }, children }),
38
36
  ...props
39
37
  }
40
38
  );
41
39
  }
42
40
  function OTPInputGroup({ className, ...props }) {
43
- var _a;
44
- const { styles } = useContext(OTPInputCtx);
41
+ const tv = otpInputTv();
45
42
  return /* @__PURE__ */ jsx(
46
43
  "div",
47
44
  {
48
- className: (_a = styles == null ? void 0 : styles.group) == null ? void 0 : _a.call(styles, { className }),
49
- "data-slot": "otp-input-group",
45
+ className: tcx(tv.group(), className),
50
46
  ...props
51
47
  }
52
48
  );
53
49
  }
54
50
  function OTPInputSlot({ className, index, ...props }) {
55
- var _a, _b, _c, _d;
56
- const { styles, slotProps, variant, disabled, isInvalid } = useContext(OTPInputCtx);
51
+ const { slotProps, variant, disabled, isInvalid } = useContext(OTPInputCtx);
57
52
  const { char, hasFakeCaret, isActive } = (slotProps == null ? void 0 : slotProps[index]) ?? {};
58
- const slotStyles = otpInputTv({
53
+ const tv = otpInputTv({
59
54
  variant,
60
55
  selected: isActive,
61
56
  disabled,
@@ -65,40 +60,24 @@ function OTPInputSlot({ className, index, ...props }) {
65
60
  "div",
66
61
  {
67
62
  ...props,
68
- className: tcx((_a = styles == null ? void 0 : styles.slot) == null ? void 0 : _a.call(styles, { className }), (_b = slotStyles == null ? void 0 : slotStyles.slot) == null ? void 0 : _b.call(slotStyles)),
63
+ className: tcx(tv.slot(), className),
69
64
  "data-active": isActive || void 0,
70
65
  "data-disabled": disabled || void 0,
71
66
  "data-filled": !!char || void 0,
72
67
  "data-invalid": isInvalid || void 0,
73
- "data-slot": "otp-input-slot",
74
68
  children: [
75
- char ? /* @__PURE__ */ jsx(
76
- "div",
77
- {
78
- className: (_c = styles == null ? void 0 : styles.slotValue) == null ? void 0 : _c.call(styles),
79
- "data-slot": "otp-input-slot-value",
80
- children: char
81
- }
82
- ) : null,
83
- hasFakeCaret && isActive ? /* @__PURE__ */ jsx(
84
- "div",
85
- {
86
- className: tcx((_d = styles == null ? void 0 : styles.caret) == null ? void 0 : _d.call(styles), "otp-input__caret"),
87
- "data-slot": "otp-input-caret"
88
- }
89
- ) : null
69
+ char ? /* @__PURE__ */ jsx("div", { className: tv.slotValue(), children: char }) : null,
70
+ hasFakeCaret && isActive ? /* @__PURE__ */ jsx("div", { className: tv.caret() }) : null
90
71
  ]
91
72
  }
92
73
  );
93
74
  }
94
75
  function OTPInputSeparator({ className, children, ...props }) {
95
- var _a;
96
- const { styles } = useContext(OTPInputCtx);
76
+ const tv = otpInputTv();
97
77
  return /* @__PURE__ */ jsx(
98
78
  "div",
99
79
  {
100
- className: (_a = styles == null ? void 0 : styles.separator) == null ? void 0 : _a.call(styles, { className }),
101
- "data-slot": "otp-input-separator",
80
+ className: tcx(tv.separator(), className),
102
81
  ...props,
103
82
  children: children ?? /* @__PURE__ */ jsx("span", { children: "-" })
104
83
  }
@@ -0,0 +1,15 @@
1
+ ._caret_giwn8_1 {
2
+ animation: _otp-caret-blink_giwn8_1 1s ease-out infinite;
3
+ }
4
+
5
+ @keyframes _otp-caret-blink_giwn8_1 {
6
+ 0%,
7
+ 70%,
8
+ 100% {
9
+ opacity: 1;
10
+ }
11
+ 20%,
12
+ 50% {
13
+ opacity: 0;
14
+ }
15
+ }
@@ -0,0 +1,8 @@
1
+ import './style.module.css';const caret = "_caret_giwn8_1";
2
+ const s = {
3
+ caret
4
+ };
5
+ export {
6
+ caret,
7
+ s as default
8
+ };