@choice-ui/react 1.6.8 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/components/description/dist/index.d.ts +8 -0
  2. package/dist/components/description/dist/index.js +29 -0
  3. package/dist/components/description/src/description.d.ts +6 -0
  4. package/dist/components/description/src/description.js +18 -0
  5. package/dist/components/description/src/index.d.ts +2 -0
  6. package/dist/components/description/src/tv.d.ts +13 -0
  7. package/dist/components/description/src/tv.js +15 -0
  8. package/dist/components/description/tsup.config.d.ts +2 -0
  9. package/dist/components/emoji-picker/dist/index.d.ts +1 -0
  10. package/dist/components/emoji-picker/dist/index.js +4 -2
  11. package/dist/components/emoji-picker/src/emoji-picker.d.ts +1 -0
  12. package/dist/components/emoji-picker/src/emoji-picker.js +4 -2
  13. package/dist/components/error-message/dist/index.d.ts +8 -0
  14. package/dist/components/error-message/dist/index.js +30 -0
  15. package/dist/components/error-message/src/error-message.d.ts +6 -0
  16. package/dist/components/error-message/src/error-message.js +19 -0
  17. package/dist/components/error-message/src/index.d.ts +2 -0
  18. package/dist/components/error-message/src/tv.d.ts +13 -0
  19. package/dist/components/error-message/src/tv.js +15 -0
  20. package/dist/components/error-message/tsup.config.d.ts +2 -0
  21. package/dist/components/form/src/adapters/base-adapter.js +4 -2
  22. package/dist/components/form/src/tv.d.ts +0 -12
  23. package/dist/components/form/src/tv.js +1 -13
  24. package/dist/components/index.d.ts +3 -0
  25. package/dist/components/md-render/dist/index.d.ts +2 -1
  26. package/dist/components/md-render/dist/index.js +3 -1
  27. package/dist/components/md-render/src/md-render.js +3 -1
  28. package/dist/components/md-render/src/types.d.ts +2 -1
  29. package/dist/components/notifications/dist/index.d.ts +1 -5
  30. package/dist/components/notifications/src/notifications.d.ts +0 -1
  31. package/dist/components/notifications/src/notifications.js +0 -1
  32. package/dist/components/numeric-input/dist/index.d.ts +23 -9
  33. package/dist/components/numeric-input/dist/index.js +26 -3
  34. package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.js +4 -1
  35. package/dist/components/numeric-input/src/hooks/index.d.ts +1 -0
  36. package/dist/components/numeric-input/src/hooks/use-numeric-long-press.d.ts +13 -0
  37. package/dist/components/numeric-input/src/hooks/use-numeric-long-press.js +27 -0
  38. package/dist/components/numeric-input/src/index.d.ts +1 -0
  39. package/dist/components/numeric-input/src/tv.js +22 -2
  40. package/dist/components/picture-preview/dist/index.d.ts +5 -0
  41. package/dist/components/picture-preview/dist/index.js +287 -140
  42. package/dist/components/picture-preview/src/hooks/useWheelHandler.d.ts +6 -1
  43. package/dist/components/picture-preview/src/hooks/useWheelHandler.js +25 -7
  44. package/dist/components/picture-preview/src/picture-preview.d.ts +5 -0
  45. package/dist/components/picture-preview/src/picture-preview.js +214 -123
  46. package/dist/components/picture-preview/src/tv.d.ts +93 -3
  47. package/dist/components/picture-preview/src/tv.js +48 -10
  48. package/dist/components/separator/dist/index.d.ts +1 -8
  49. package/dist/components/separator/src/separator.d.ts +1 -8
  50. package/dist/components/separator/src/separator.js +33 -5
  51. package/dist/components/separator/src/tv.d.ts +39 -18
  52. package/dist/components/separator/src/tv.js +37 -7
  53. package/dist/components/text-field/dist/index.d.ts +2 -3
  54. package/dist/components/text-field/dist/index.js +4 -19
  55. package/dist/components/text-field/src/components/index.d.ts +0 -1
  56. package/dist/components/text-field/src/text-field.d.ts +3 -2
  57. package/dist/components/text-field/src/text-field.js +2 -2
  58. package/dist/components/text-field/src/tv.d.ts +3 -3
  59. package/dist/components/text-field/src/tv.js +1 -6
  60. package/dist/components/toast/dist/index.d.ts +260 -0
  61. package/dist/components/toast/src/components/index.d.ts +3 -0
  62. package/dist/components/toast/src/components/toast-progress-bar.d.ts +7 -0
  63. package/dist/components/toast/src/components/toast-progress-bar.js +53 -0
  64. package/dist/components/toast/src/components/toaster-item.d.ts +26 -0
  65. package/dist/components/toast/src/components/toaster-item.js +412 -0
  66. package/dist/components/toast/src/components/toaster-slots.d.ts +87 -0
  67. package/dist/components/toast/src/components/toaster-slots.js +38 -0
  68. package/dist/components/toast/src/index.d.ts +5 -0
  69. package/dist/components/toast/src/store.d.ts +113 -0
  70. package/dist/components/toast/src/store.js +204 -0
  71. package/dist/components/toast/src/toaster.d.ts +87 -0
  72. package/dist/components/toast/src/toaster.js +271 -0
  73. package/dist/components/toast/src/tv.d.ts +365 -0
  74. package/dist/components/toast/src/tv.js +412 -0
  75. package/dist/components/toast/src/types.d.ts +79 -0
  76. package/dist/components/toast/tsup.config.d.ts +2 -0
  77. package/dist/index.js +11 -2
  78. package/dist/styles/components.css +2 -0
  79. package/package.json +1 -1
  80. package/dist/components/text-field/src/components/field-description.d.ts +0 -2
  81. package/dist/components/text-field/src/components/field-description.js +0 -16
@@ -1,24 +1,30 @@
1
1
  import { tcv } from "../../../shared/utils/tcx/tcx.js";
2
2
  const PicturePreviewTv = tcv({
3
3
  slots: {
4
- root: ["relative flex flex-col overflow-hidden", "h-full w-full", "touch-none select-none"],
4
+ root: [
5
+ "group/picture-preview relative flex flex-col overflow-hidden",
6
+ "h-full w-full",
7
+ "touch-none select-none"
8
+ ],
5
9
  loading: [
6
10
  "text-secondary-foreground absolute inset-0 z-10 flex flex-col items-center justify-center gap-4"
7
11
  ],
8
12
  content: [
9
13
  "relative flex-1 overflow-hidden",
10
14
  "flex items-center justify-center",
11
- "bg-gray-100 dark:bg-gray-900"
15
+ "bg-gray-100 dark:bg-gray-900",
16
+ "[contain:layout_paint]"
12
17
  ],
13
18
  canvas: [
14
- "relative h-full w-full",
15
19
  "transform-gpu will-change-transform",
16
- "cursor-grab active:cursor-grabbing"
20
+ "cursor-grab active:cursor-grabbing",
21
+ "origin-center",
22
+ "flex items-center justify-center"
17
23
  ],
18
- image: ["pointer-events-none", "h-full w-full object-contain"],
24
+ image: ["pointer-events-none", "block w-auto h-auto"],
19
25
  controlGroup: [
20
26
  "overflow-hidden",
21
- "absolute right-2 bottom-2 flex items-center",
27
+ "absolute flex items-center",
22
28
  "bg-default-background",
23
29
  "rounded-md",
24
30
  "shadow-md"
@@ -27,20 +33,52 @@ const PicturePreviewTv = tcv({
27
33
  variants: {
28
34
  isLoading: {
29
35
  true: {
30
- image: "opacity-0 transition-opacity duration-300"
36
+ image: "opacity-0 scale-105 blur-sm transition-all duration-500 ease-out"
31
37
  },
32
- false: {}
38
+ false: {
39
+ image: "opacity-100 scale-100 blur-0 transition-all duration-500 ease-out"
40
+ }
33
41
  },
34
42
  isError: {
35
43
  true: {
36
- image: "opacity-0 transition-opacity duration-300"
44
+ image: "opacity-0"
45
+ },
46
+ false: {}
47
+ },
48
+ isMenuOpen: {
49
+ true: {
50
+ controlGroup: "opacity-100"
37
51
  },
38
52
  false: {}
53
+ },
54
+ controlPosition: {
55
+ "top-left": {
56
+ controlGroup: "top-2 left-2"
57
+ },
58
+ "top-right": {
59
+ controlGroup: "top-2 right-2"
60
+ },
61
+ "bottom-left": {
62
+ controlGroup: "bottom-2 left-2"
63
+ },
64
+ "bottom-right": {
65
+ controlGroup: "bottom-2 right-2"
66
+ }
67
+ },
68
+ controlShow: {
69
+ always: {
70
+ controlGroup: ""
71
+ },
72
+ hover: {
73
+ controlGroup: "group-hover/picture-preview:opacity-100 opacity-0 transition-opacity duration-200"
74
+ }
39
75
  }
40
76
  },
41
77
  defaultVariants: {
42
78
  isLoading: false,
43
- isError: false
79
+ isError: false,
80
+ isMenuOpen: false,
81
+ controlPosition: "bottom-right"
44
82
  }
45
83
  });
46
84
  export {
@@ -2,17 +2,10 @@ import * as react from 'react';
2
2
 
3
3
  type SeparatorOrientation = "horizontal" | "vertical";
4
4
  interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
5
- /**
6
- * Separator direction
7
- * @default "horizontal"
8
- */
9
5
  orientation?: SeparatorOrientation;
10
- /**
11
- * Whether to use decorative separator (not read by screen readers)
12
- * @default false
13
- */
14
6
  decorative?: boolean;
15
7
  variant?: "default" | "light" | "dark" | "reset";
8
+ children?: React.ReactNode;
16
9
  }
17
10
  /**
18
11
  * Separator - Separator component
@@ -1,16 +1,9 @@
1
1
  export type SeparatorOrientation = "horizontal" | "vertical";
2
2
  export interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
3
- /**
4
- * Separator direction
5
- * @default "horizontal"
6
- */
7
3
  orientation?: SeparatorOrientation;
8
- /**
9
- * Whether to use decorative separator (not read by screen readers)
10
- * @default false
11
- */
12
4
  decorative?: boolean;
13
5
  variant?: "default" | "light" | "dark" | "reset";
6
+ children?: React.ReactNode;
14
7
  }
15
8
  /**
16
9
  * Separator - Separator component
@@ -1,4 +1,4 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { memo, forwardRef } from "react";
3
3
  import { SeparatorTV } from "./tv.js";
4
4
  import { tcx } from "../../../shared/utils/tcx/tcx.js";
@@ -9,20 +9,48 @@ const Separator = memo(
9
9
  orientation = "horizontal",
10
10
  decorative = false,
11
11
  variant = "default",
12
+ children,
12
13
  ...rest
13
14
  } = props;
14
- const tv = SeparatorTV({ orientation, variant });
15
+ const tv = SeparatorTV({ orientation, variant, hasChildren: !!children });
15
16
  const semanticProps = decorative ? { role: "none" } : {
16
17
  role: "separator",
17
18
  "aria-orientation": orientation
18
19
  };
19
- return /* @__PURE__ */ jsx(
20
+ if (!children) {
21
+ return /* @__PURE__ */ jsx(
22
+ "div",
23
+ {
24
+ ref,
25
+ ...semanticProps,
26
+ ...rest,
27
+ className: tcx(tv.separator(), className)
28
+ }
29
+ );
30
+ }
31
+ return /* @__PURE__ */ jsxs(
20
32
  "div",
21
33
  {
22
34
  ref,
23
- ...semanticProps,
35
+ className: tcx(tv.root(), className),
24
36
  ...rest,
25
- className: tcx(tv.root(), className)
37
+ children: [
38
+ /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ ...semanticProps,
42
+ className: tv.separator()
43
+ }
44
+ ),
45
+ children,
46
+ /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ ...semanticProps,
50
+ className: tv.separator()
51
+ }
52
+ )
53
+ ]
26
54
  }
27
55
  );
28
56
  })
@@ -1,76 +1,97 @@
1
1
  export declare const SeparatorTV: import('tailwind-variants').TVReturnType<{
2
+ hasChildren: {
3
+ true: {
4
+ separator: string;
5
+ };
6
+ false: {};
7
+ };
2
8
  orientation: {
3
9
  horizontal: {
4
- root: string;
10
+ separator: string;
5
11
  };
6
12
  vertical: {
7
- root: string;
13
+ separator: string;
8
14
  };
9
15
  };
10
16
  variant: {
11
17
  default: {
12
- root: string;
18
+ separator: string;
13
19
  };
14
20
  light: {
15
- root: string;
21
+ separator: string;
16
22
  };
17
23
  dark: {
18
- root: string;
24
+ separator: string;
19
25
  };
20
26
  reset: {
21
- root: string;
27
+ separator: string;
22
28
  };
23
29
  };
24
30
  }, {
25
31
  root: string;
32
+ separator: string;
26
33
  }, undefined, {
34
+ hasChildren: {
35
+ true: {
36
+ separator: string;
37
+ };
38
+ false: {};
39
+ };
27
40
  orientation: {
28
41
  horizontal: {
29
- root: string;
42
+ separator: string;
30
43
  };
31
44
  vertical: {
32
- root: string;
45
+ separator: string;
33
46
  };
34
47
  };
35
48
  variant: {
36
49
  default: {
37
- root: string;
50
+ separator: string;
38
51
  };
39
52
  light: {
40
- root: string;
53
+ separator: string;
41
54
  };
42
55
  dark: {
43
- root: string;
56
+ separator: string;
44
57
  };
45
58
  reset: {
46
- root: string;
59
+ separator: string;
47
60
  };
48
61
  };
49
62
  }, {
50
63
  root: string;
64
+ separator: string;
51
65
  }, import('tailwind-variants').TVReturnType<{
66
+ hasChildren: {
67
+ true: {
68
+ separator: string;
69
+ };
70
+ false: {};
71
+ };
52
72
  orientation: {
53
73
  horizontal: {
54
- root: string;
74
+ separator: string;
55
75
  };
56
76
  vertical: {
57
- root: string;
77
+ separator: string;
58
78
  };
59
79
  };
60
80
  variant: {
61
81
  default: {
62
- root: string;
82
+ separator: string;
63
83
  };
64
84
  light: {
65
- root: string;
85
+ separator: string;
66
86
  };
67
87
  dark: {
68
- root: string;
88
+ separator: string;
69
89
  };
70
90
  reset: {
71
- root: string;
91
+ separator: string;
72
92
  };
73
93
  };
74
94
  }, {
75
95
  root: string;
96
+ separator: string;
76
97
  }, undefined, unknown, unknown, undefined>>;
@@ -1,21 +1,51 @@
1
1
  import { tcv } from "../../../shared/utils/tcx/tcx.js";
2
2
  const SeparatorTV = tcv({
3
3
  slots: {
4
- root: "shrink-0"
4
+ root: "flex items-center gap-2",
5
+ separator: "shrink-0"
5
6
  },
6
7
  variants: {
8
+ hasChildren: {
9
+ true: {
10
+ separator: "flex-1"
11
+ },
12
+ false: {}
13
+ },
7
14
  orientation: {
8
- horizontal: { root: "h-px w-full" },
9
- vertical: { root: "h-full w-px" }
15
+ horizontal: { separator: "h-px" },
16
+ vertical: { separator: "w-px" }
10
17
  },
11
18
  variant: {
12
- default: { root: "bg-default-boundary" },
13
- light: { root: "bg-gray-200" },
14
- dark: { root: "bg-gray-800" },
15
- reset: { root: "" }
19
+ default: { separator: "bg-default-boundary" },
20
+ light: { separator: "bg-gray-200" },
21
+ dark: { separator: "bg-gray-800" },
22
+ reset: { separator: "" }
16
23
  }
17
24
  },
25
+ compoundVariants: [
26
+ {
27
+ hasChildren: true,
28
+ orientation: "horizontal",
29
+ class: { root: "flex-row" }
30
+ },
31
+ {
32
+ hasChildren: true,
33
+ orientation: "vertical",
34
+ class: { root: "flex-col" }
35
+ },
36
+ {
37
+ hasChildren: false,
38
+ orientation: "horizontal",
39
+ class: { separator: "w-full" }
40
+ },
41
+ {
42
+ hasChildren: false,
43
+ orientation: "vertical",
44
+ class: { separator: "h-full" }
45
+ }
46
+ ],
18
47
  defaultVariants: {
48
+ hasChildren: false,
19
49
  orientation: "horizontal",
20
50
  variant: "default"
21
51
  }
@@ -1,3 +1,4 @@
1
+ import { Description } from '../../description/src';
1
2
  import { InputProps } from '../../input/src';
2
3
  import { Label } from '../../label/src';
3
4
  import { default as react__default, HTMLProps, ReactNode } from 'react';
@@ -10,13 +11,11 @@ interface FieldAddonProps extends HTMLProps<HTMLDivElement> {
10
11
  }
11
12
  declare const FieldAddon: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<FieldAddonProps, "ref"> & react.RefAttributes<HTMLDivElement>>>;
12
13
 
13
- declare const FieldDescription: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<HTMLProps<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>>;
14
-
15
14
  interface TextFieldProps extends Omit<InputProps, "children"> {
16
15
  children?: ReactNode;
17
16
  }
18
17
  interface TextFieldComponent extends react__default.ForwardRefExoticComponent<TextFieldProps & react__default.RefAttributes<HTMLInputElement>> {
19
- Description: typeof FieldDescription;
18
+ Description: typeof Description;
20
19
  Label: typeof Label;
21
20
  Prefix: typeof FieldAddon;
22
21
  Suffix: typeof FieldAddon;
@@ -1,6 +1,7 @@
1
+ import { Description } from "../../description/dist/index.js";
1
2
  import { Input } from "../../input/dist/index.js";
2
3
  import { Label } from "../../label/dist/index.js";
3
- import { forwardRef, memo, Children, isValidElement, useId, cloneElement } from "react";
4
+ import { forwardRef, Children, isValidElement, useId, cloneElement, memo } from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { tcv, tcx } from "../../../shared/utils/tcx/tcx.js";
6
7
  var FieldAddon = memo(
@@ -17,17 +18,6 @@ var FieldAddon = memo(
17
18
  })
18
19
  );
19
20
  FieldAddon.displayName = "FieldAddon";
20
- var FieldDescription = memo(
21
- forwardRef(function FieldDescription2(props, ref) {
22
- return /* @__PURE__ */ jsx(
23
- "div",
24
- {
25
- ref,
26
- ...props
27
- }
28
- );
29
- })
30
- );
31
21
  var TextFieldTv = tcv({
32
22
  slots: {
33
23
  container: ["flex min-w-0 flex-col items-start gap-2"],
@@ -41,12 +31,7 @@ var TextFieldTv = tcv({
41
31
  input: "[grid-area:input]",
42
32
  prefix: "[grid-area:prefix]",
43
33
  suffix: "[grid-area:suffix]",
44
- description: [
45
- "text-body-medium mt-1",
46
- "px-0.5",
47
- "break-words whitespace-pre-wrap",
48
- "text-secondary-foreground"
49
- ]
34
+ description: ""
50
35
  },
51
36
  variants: {
52
37
  variant: {
@@ -257,7 +242,7 @@ var TextField = Object.assign(TextFieldBase, {
257
242
  Prefix: PrefixComponent,
258
243
  Suffix: SuffixComponent,
259
244
  Label,
260
- Description: FieldDescription
245
+ Description
261
246
  });
262
247
  export {
263
248
  TextField
@@ -1,2 +1 @@
1
1
  export * from './field-addon';
2
- export * from './field-description';
@@ -1,12 +1,13 @@
1
+ import { Description } from '../../description/src';
1
2
  import { InputProps } from '../../input/src';
2
3
  import { Label } from '../../label/src';
3
4
  import { default as React, ReactNode } from 'react';
4
- import { FieldAddon, FieldDescription } from './components';
5
+ import { FieldAddon } from './components';
5
6
  export interface TextFieldProps extends Omit<InputProps, "children"> {
6
7
  children?: ReactNode;
7
8
  }
8
9
  interface TextFieldComponent extends React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>> {
9
- Description: typeof FieldDescription;
10
+ Description: typeof Description;
10
11
  Label: typeof Label;
11
12
  Prefix: typeof FieldAddon;
12
13
  Suffix: typeof FieldAddon;
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Description } from "../../description/dist/index.js";
2
3
  import { Input } from "../../input/dist/index.js";
3
4
  import { Label } from "../../label/dist/index.js";
4
5
  import { forwardRef, Children, isValidElement, useId, cloneElement } from "react";
5
6
  import { TextFieldTv } from "./tv.js";
6
- import { FieldDescription } from "./components/field-description.js";
7
7
  import { FieldAddon } from "./components/field-addon.js";
8
8
  import { tcx } from "../../../shared/utils/tcx/tcx.js";
9
9
  const TextFieldContent = ({
@@ -98,7 +98,7 @@ const TextField = Object.assign(TextFieldBase, {
98
98
  Prefix: PrefixComponent,
99
99
  Suffix: SuffixComponent,
100
100
  Label,
101
- Description: FieldDescription
101
+ Description
102
102
  });
103
103
  export {
104
104
  TextField
@@ -49,7 +49,7 @@ export declare const TextFieldTv: import('tailwind-variants').TVReturnType<{
49
49
  input: string;
50
50
  prefix: string;
51
51
  suffix: string;
52
- description: string[];
52
+ description: string;
53
53
  }, undefined, {
54
54
  variant: {
55
55
  default: {};
@@ -101,7 +101,7 @@ export declare const TextFieldTv: import('tailwind-variants').TVReturnType<{
101
101
  input: string;
102
102
  prefix: string;
103
103
  suffix: string;
104
- description: string[];
104
+ description: string;
105
105
  }, import('tailwind-variants').TVReturnType<{
106
106
  variant: {
107
107
  default: {};
@@ -153,5 +153,5 @@ export declare const TextFieldTv: import('tailwind-variants').TVReturnType<{
153
153
  input: string;
154
154
  prefix: string;
155
155
  suffix: string;
156
- description: string[];
156
+ description: string;
157
157
  }, undefined, unknown, unknown, undefined>>;
@@ -12,12 +12,7 @@ const TextFieldTv = tcv({
12
12
  input: "[grid-area:input]",
13
13
  prefix: "[grid-area:prefix]",
14
14
  suffix: "[grid-area:suffix]",
15
- description: [
16
- "text-body-medium mt-1",
17
- "px-0.5",
18
- "break-words whitespace-pre-wrap",
19
- "text-secondary-foreground"
20
- ]
15
+ description: ""
21
16
  },
22
17
  variants: {
23
18
  variant: {