@choice-ui/react 1.9.7 → 1.9.8

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 (45) hide show
  1. package/dist/components/button/dist/index.d.ts +9 -2
  2. package/dist/components/button/dist/index.js +19 -45
  3. package/dist/components/checkbox/dist/index.d.ts +1 -10
  4. package/dist/components/checkbox/dist/index.js +5 -49
  5. package/dist/components/code-block/dist/index.d.ts +14 -11
  6. package/dist/components/code-block/dist/index.js +93 -120
  7. package/dist/components/colors/dist/index.d.ts +6 -39
  8. package/dist/components/colors/src/color-image-paint/color-image-paint.js +2 -2
  9. package/dist/components/dropdown/dist/index.d.ts +0 -6
  10. package/dist/components/dropdown/dist/index.js +10 -20
  11. package/dist/components/emoji-picker/dist/index.d.ts +1 -30
  12. package/dist/components/emoji-picker/dist/index.js +44 -148
  13. package/dist/components/form/src/adapters/range-adapter.js +2 -2
  14. package/dist/components/icon-button/dist/index.d.ts +1 -1
  15. package/dist/components/icon-button/dist/index.js +0 -39
  16. package/dist/components/list/dist/index.d.ts +1 -1
  17. package/dist/components/md-render/dist/index.d.ts +1 -2
  18. package/dist/components/md-render/dist/index.js +9 -5
  19. package/dist/components/menus/dist/index.d.ts +0 -5
  20. package/dist/components/menus/dist/index.js +3 -32
  21. package/dist/components/modal/dist/index.js +2 -2
  22. package/dist/components/notifications/dist/index.d.ts +5 -1
  23. package/dist/components/numeric-input/dist/index.d.ts +10 -27
  24. package/dist/components/numeric-input/dist/index.js +23 -108
  25. package/dist/components/panel/dist/index.d.ts +16 -16
  26. package/dist/components/picture-preview/dist/index.d.ts +0 -5
  27. package/dist/components/picture-preview/dist/index.js +140 -287
  28. package/dist/components/popover/dist/index.d.ts +0 -5
  29. package/dist/components/popover/dist/index.js +2 -21
  30. package/dist/components/radio/dist/index.d.ts +1 -9
  31. package/dist/components/radio/dist/index.js +6 -50
  32. package/dist/components/range/dist/index.d.ts +20 -276
  33. package/dist/components/range/dist/index.js +616 -1044
  34. package/dist/components/scroll-area/dist/index.d.ts +27 -4
  35. package/dist/components/scroll-area/dist/index.js +123 -96
  36. package/dist/components/separator/dist/index.d.ts +8 -1
  37. package/dist/components/splitter/dist/index.d.ts +1 -1
  38. package/dist/components/text-field/dist/index.d.ts +3 -2
  39. package/dist/components/text-field/dist/index.js +19 -4
  40. package/dist/components/textarea/dist/index.js +1 -3
  41. package/dist/components/tooltip/dist/index.d.ts +0 -2
  42. package/dist/components/tooltip/dist/index.js +5 -23
  43. package/package.json +1 -1
  44. package/dist/components/toast/dist/index.d.ts +0 -274
  45. package/dist/components/virtual-select/dist/index.d.ts +0 -48
@@ -1,13 +1,6 @@
1
1
  import { HTMLProps, ReactNode } from 'react';
2
2
  import * as react from 'react';
3
3
 
4
- interface RadioIconProps extends Omit<HTMLProps<HTMLDivElement>, "children"> {
5
- children?: ReactNode | ((props: {
6
- value?: boolean;
7
- }) => ReactNode);
8
- }
9
- declare const RadioIcon: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<RadioIconProps, "ref"> & react.RefAttributes<HTMLDivElement>>>;
10
-
11
4
  interface RadioLabelProps extends Omit<HTMLProps<HTMLLabelElement>, "htmlFor" | "id" | "disabled"> {
12
5
  children: ReactNode;
13
6
  }
@@ -26,7 +19,6 @@ interface RadioType {
26
19
  (props: RadioProps & {
27
20
  ref?: React.Ref<HTMLInputElement>;
28
21
  }): JSX.Element;
29
- Icon: typeof RadioIcon;
30
22
  Label: typeof RadioLabel;
31
23
  displayName?: string;
32
24
  }
@@ -58,4 +50,4 @@ interface RadioGroupType {
58
50
  }
59
51
  declare const RadioGroup: RadioGroupType;
60
52
 
61
- export { Radio, RadioGroup, type RadioGroupProps, type RadioIconProps, type RadioLabelProps, type RadioProps };
53
+ export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
@@ -1,5 +1,5 @@
1
1
  import { Dot } from "@choiceform/icons-react";
2
- import { memo, forwardRef, useId, useMemo, createContext, useContext, Children, isValidElement } from "react";
2
+ import { memo, forwardRef, useId, useMemo, createContext, useContext } from "react";
3
3
  import { useEventCallback } from "usehooks-ts";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { tcx, tcv } from "../../../shared/utils/tcx/tcx.js";
@@ -145,38 +145,6 @@ var radioTv = tcv({
145
145
  focused: false
146
146
  }
147
147
  });
148
- var RadioIcon = memo(
149
- forwardRef(function RadioIcon2(props, ref) {
150
- const { className, children, ...rest } = props;
151
- const { value, disabled, variant } = useRadioContext();
152
- const tv = radioTv({
153
- type: "radio",
154
- variant,
155
- disabled,
156
- checked: value
157
- });
158
- const renderIcon = () => {
159
- if (typeof children === "function") {
160
- return children({ value });
161
- }
162
- if (children !== void 0) {
163
- return children;
164
- }
165
- return value ? /* @__PURE__ */ jsx(Dot, {}) : null;
166
- };
167
- return /* @__PURE__ */ jsx(
168
- "div",
169
- {
170
- ref,
171
- className: tcx(tv.box(), className),
172
- "data-active": value,
173
- ...rest,
174
- children: renderIcon()
175
- }
176
- );
177
- })
178
- );
179
- RadioIcon.displayName = "Radio.Icon";
180
148
  var RadioLabel = memo(
181
149
  forwardRef(function RadioLabel2(props, ref) {
182
150
  const { children, className, ...rest } = props;
@@ -233,24 +201,13 @@ var RadioBase = forwardRef(function Radio(props, ref) {
233
201
  }
234
202
  onKeyDown == null ? void 0 : onKeyDown(e);
235
203
  });
236
- const isIconElement = (child) => {
237
- var _a;
238
- return isValidElement(child) && (child.type === RadioIcon || ((_a = child.type) == null ? void 0 : _a.displayName) === "Radio.Icon");
239
- };
240
- const childArray = Children.toArray(children);
241
- const iconChild = childArray.find(isIconElement);
242
- const otherChildren = childArray.filter((child) => !isIconElement(child));
243
204
  const renderChildren = () => {
244
- if (otherChildren.length === 1) {
245
- const child = otherChildren[0];
246
- if (typeof child === "string" || typeof child === "number") {
247
- return /* @__PURE__ */ jsx(RadioLabel, { children: child });
248
- }
205
+ if (typeof children === "string" || typeof children === "number") {
206
+ return /* @__PURE__ */ jsx(RadioLabel, { children });
249
207
  }
250
- return otherChildren;
208
+ return children;
251
209
  };
252
- const renderDefaultIcon = () => /* @__PURE__ */ jsx("div", { className: tv.box(), children: value && /* @__PURE__ */ jsx(Dot, {}) });
253
- return /* @__PURE__ */ jsx(RadioContext.Provider, { value: { id, descriptionId, disabled, value, variant }, children: /* @__PURE__ */ jsxs("div", { className: tcx(tv.root(), className), children: [
210
+ return /* @__PURE__ */ jsx(RadioContext.Provider, { value: { id, descriptionId, disabled }, children: /* @__PURE__ */ jsxs("div", { className: tcx(tv.root(), className), children: [
254
211
  /* @__PURE__ */ jsxs("div", { className: "pointer-events-none relative", children: [
255
212
  /* @__PURE__ */ jsx(
256
213
  "input",
@@ -272,14 +229,13 @@ var RadioBase = forwardRef(function Radio(props, ref) {
272
229
  ...rest
273
230
  }
274
231
  ),
275
- iconChild ?? renderDefaultIcon()
232
+ /* @__PURE__ */ jsx("div", { className: tv.box(), children: value && /* @__PURE__ */ jsx(Dot, {}) })
276
233
  ] }),
277
234
  renderChildren()
278
235
  ] }) });
279
236
  });
280
237
  var MemoizedRadio = memo(RadioBase);
281
238
  var Radio2 = MemoizedRadio;
282
- Radio2.Icon = RadioIcon;
283
239
  Radio2.Label = RadioLabel;
284
240
  Radio2.displayName = "Radio";
285
241
  var RadioGroupItem = memo(
@@ -1,60 +1,10 @@
1
- import { default as React__default } from 'react';
2
- import * as React$1 from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import * as tailwind_variants from 'tailwind-variants';
5
-
6
- interface RangeConnectsProps {
7
- className?: string;
8
- }
9
- declare const RangeConnects: React$1.ForwardRefExoticComponent<RangeConnectsProps & React$1.RefAttributes<HTMLDivElement>>;
10
- interface RangeContainerProps extends React.HTMLAttributes<HTMLDivElement> {
11
- children?: React.ReactNode;
12
- className?: string;
13
- height?: number;
14
- }
15
- declare function RangeContainer(props: RangeContainerProps): react_jsx_runtime.JSX.Element;
16
- declare namespace RangeContainer {
17
- var displayName: string;
18
- }
19
- interface RangeTupleConnectsProps extends React.HTMLAttributes<HTMLDivElement> {
20
- className?: string;
21
- }
22
- declare const RangeTupleConnects: React$1.ForwardRefExoticComponent<RangeTupleConnectsProps & React$1.RefAttributes<HTMLDivElement>>;
23
- interface RangeTupleContainerProps extends React.HTMLAttributes<HTMLDivElement> {
24
- children?: React.ReactNode;
25
- className?: string;
26
- height?: number;
27
- }
28
- declare function RangeTupleContainer(props: RangeTupleContainerProps): react_jsx_runtime.JSX.Element;
29
- declare namespace RangeTupleContainer {
30
- var displayName: string;
31
- }
32
-
33
- interface RangeThumbProps {
34
- className?: string;
35
- size?: number;
36
- }
37
- declare const RangeThumb: React__default.ForwardRefExoticComponent<RangeThumbProps & React__default.RefAttributes<HTMLDivElement>>;
38
- type ThumbIndex$1 = 0 | 1;
39
- interface RangeTupleThumbProps {
40
- className?: string;
41
- size?: number;
42
- index: ThumbIndex$1;
43
- }
44
- declare const RangeTupleThumb: React__default.ForwardRefExoticComponent<RangeTupleThumbProps & React__default.RefAttributes<HTMLDivElement>>;
45
-
46
- interface RangeDotProps extends React.HTMLAttributes<HTMLDivElement> {
47
- className?: string;
48
- }
49
- interface RangeTupleDotProps extends React.HTMLAttributes<HTMLDivElement> {
50
- className?: string;
51
- }
52
- declare const RangeDot: React$1.ForwardRefExoticComponent<RangeDotProps & React$1.RefAttributes<HTMLDivElement>>;
53
- declare const RangeTupleDot: React$1.ForwardRefExoticComponent<RangeTupleDotProps & React$1.RefAttributes<HTMLDivElement>>;
54
-
1
+ import { default as React } from 'react';
55
2
  interface RangeProps {
56
- children?: React__default.ReactNode;
57
3
  className?: string;
4
+ connectsClassName?: {
5
+ negative?: string;
6
+ positive?: string;
7
+ };
58
8
  defaultValue?: number;
59
9
  disabled?: boolean;
60
10
  max?: number;
@@ -65,24 +15,20 @@ interface RangeProps {
65
15
  readOnly?: boolean;
66
16
  step?: number;
67
17
  thumbSize?: number;
18
+ trackSize?: {
19
+ height?: number;
20
+ width?: number | "auto";
21
+ };
68
22
  value?: number;
69
- /**
70
- * Width of the range track in pixels.
71
- * If not provided (undefined), the width will be auto-calculated from the container.
72
- */
73
- width?: number | boolean;
74
- }
75
- interface RangeComponent extends React__default.ForwardRefExoticComponent<RangeProps & React__default.RefAttributes<HTMLDivElement>> {
76
- Container: typeof RangeContainer;
77
- Connects: typeof RangeConnects;
78
- Thumb: typeof RangeThumb;
79
- Dot: typeof RangeDot;
80
23
  }
81
- declare const Range: RangeComponent;
24
+ declare const Range: React.ForwardRefExoticComponent<RangeProps & React.RefAttributes<HTMLDivElement>>;
82
25
 
83
26
  interface RangeTupleProps {
84
- children?: React__default.ReactNode;
85
27
  className?: string;
28
+ connectsClassName?: {
29
+ negative?: string;
30
+ positive?: string;
31
+ };
86
32
  defaultValue?: [number, number];
87
33
  disabled?: boolean;
88
34
  max?: number;
@@ -93,214 +39,12 @@ interface RangeTupleProps {
93
39
  readOnly?: boolean;
94
40
  step?: number;
95
41
  thumbSize?: number;
96
- value?: [number, number];
97
- /**
98
- * Width of the range track in pixels.
99
- * If not provided (undefined) or set to false, the width will be auto-calculated from the container.
100
- */
101
- width?: number | boolean;
102
- }
103
- interface RangeTupleComponent extends React__default.ForwardRefExoticComponent<RangeTupleProps & React__default.RefAttributes<HTMLDivElement>> {
104
- Container: typeof RangeTupleContainer;
105
- Connects: typeof RangeTupleConnects;
106
- Thumb: typeof RangeTupleThumb;
107
- Dot: typeof RangeTupleDot;
108
- }
109
- declare const RangeTuple: RangeTupleComponent;
110
-
111
- declare const rangeTv: tailwind_variants.TVReturnType<{
112
- overStepValue: {
113
- true: {
114
- dot: string;
115
- };
116
- false: {
117
- dot: string;
118
- };
119
- };
120
- defaultStepValue: {
121
- true: {
122
- dot: string;
123
- };
124
- };
125
- hasStepOrDefault: {
126
- true: {};
127
- false: {};
128
- };
129
- currentDefaultValue: {
130
- true: {};
131
- false: {};
132
- };
133
- disabled: {
134
- true: {
135
- connect: string;
136
- thumb: string;
137
- };
138
- false: {
139
- connect: string;
140
- };
141
- };
142
- }, {
143
- container: string[];
144
- connect: string[];
145
- thumbWrapper: string[];
146
- thumb: string[];
147
- dotContainer: string;
148
- dot: string[];
149
- input: string;
150
- }, undefined, {
151
- overStepValue: {
152
- true: {
153
- dot: string;
154
- };
155
- false: {
156
- dot: string;
157
- };
158
- };
159
- defaultStepValue: {
160
- true: {
161
- dot: string;
162
- };
163
- };
164
- hasStepOrDefault: {
165
- true: {};
166
- false: {};
167
- };
168
- currentDefaultValue: {
169
- true: {};
170
- false: {};
171
- };
172
- disabled: {
173
- true: {
174
- connect: string;
175
- thumb: string;
176
- };
177
- false: {
178
- connect: string;
179
- };
42
+ trackSize?: {
43
+ height?: number;
44
+ width?: number | "auto";
180
45
  };
181
- }, {
182
- container: string[];
183
- connect: string[];
184
- thumbWrapper: string[];
185
- thumb: string[];
186
- dotContainer: string;
187
- dot: string[];
188
- input: string;
189
- }, tailwind_variants.TVReturnType<{
190
- overStepValue: {
191
- true: {
192
- dot: string;
193
- };
194
- false: {
195
- dot: string;
196
- };
197
- };
198
- defaultStepValue: {
199
- true: {
200
- dot: string;
201
- };
202
- };
203
- hasStepOrDefault: {
204
- true: {};
205
- false: {};
206
- };
207
- currentDefaultValue: {
208
- true: {};
209
- false: {};
210
- };
211
- disabled: {
212
- true: {
213
- connect: string;
214
- thumb: string;
215
- };
216
- false: {
217
- connect: string;
218
- };
219
- };
220
- }, {
221
- container: string[];
222
- connect: string[];
223
- thumbWrapper: string[];
224
- thumb: string[];
225
- dotContainer: string;
226
- dot: string[];
227
- input: string;
228
- }, undefined, unknown, unknown, undefined>>;
229
-
230
- interface RangeContextValue {
231
- currentValue: number;
232
- disabled: boolean;
233
- readOnly: boolean;
234
- min: number;
235
- max: number;
236
- step: number;
237
- thumbSize: number;
238
- trackHeight: number;
239
- transforms: {
240
- minTransform: number;
241
- maxTransform: number;
242
- transformX: number;
243
- };
244
- defaultStepValue: number | null;
245
- currentStepValue: number;
246
- dotsData: Array<{
247
- value: number;
248
- position: number;
249
- }> | null;
250
- defaultDotPosition: number | null;
251
- thumbRef: React.MutableRefObject<HTMLDivElement | null>;
252
- inputRef: React.MutableRefObject<HTMLInputElement | null>;
253
- isDragging: React.MutableRefObject<boolean>;
254
- handlePointerDown: (e: React.PointerEvent) => void;
255
- handleKeyDown: (e: React.KeyboardEvent) => void;
256
- tv: ReturnType<typeof rangeTv>;
257
- defaultValue?: number;
258
- hasCustomDot: boolean;
259
- hasCustomConnects: boolean;
260
- isDefaultValue?: boolean;
261
- }
262
- declare const RangeContext: React$1.Context<RangeContextValue | null>;
263
- declare function useRangeContext(): RangeContextValue;
264
-
265
- type ThumbIndex = 0 | 1;
266
- interface RangeTupleContextValue {
267
- currentValue: [number, number];
268
- disabled: boolean;
269
- readOnly: boolean;
270
- min: number;
271
- max: number;
272
- step: number;
273
- thumbSize: number;
274
- trackHeight: number;
275
- transforms: {
276
- minTransform: number;
277
- maxTransform: number;
278
- transformX0: number;
279
- transformX1: number;
280
- };
281
- defaultStepValue: [number, number] | null;
282
- currentStepValue: [number, number];
283
- dotsData: Array<{
284
- value: number;
285
- position: number;
286
- }> | null;
287
- defaultDotPositions: [number, number] | null;
288
- normalizedDefaultValue: [number, number] | undefined;
289
- thumb0Ref: React.RefObject<HTMLDivElement | null>;
290
- thumb1Ref: React.RefObject<HTMLDivElement | null>;
291
- input0Ref: React.RefObject<HTMLInputElement | null>;
292
- input1Ref: React.RefObject<HTMLInputElement | null>;
293
- isDragging: React.MutableRefObject<ThumbIndex | null>;
294
- handlePointerDown: (e: React.PointerEvent, thumbIndex: ThumbIndex) => void;
295
- handleKeyDown: (e: React.KeyboardEvent, thumbIndex: ThumbIndex) => void;
296
- tv: ReturnType<typeof rangeTv>;
297
- thumbTv0: ReturnType<typeof rangeTv>;
298
- thumbTv1: ReturnType<typeof rangeTv>;
299
- hasCustomDot: boolean;
300
- hasCustomConnects: boolean;
301
- isDefaultValue?: boolean;
46
+ value?: [number, number];
302
47
  }
303
- declare const RangeTupleContext: React$1.Context<RangeTupleContextValue | null>;
304
- declare function useRangeTupleContext(): RangeTupleContextValue;
48
+ declare const RangeTuple: React.ForwardRefExoticComponent<RangeTupleProps & React.RefAttributes<HTMLDivElement>>;
305
49
 
306
- export { Range, type RangeConnectsProps, type RangeContainerProps, RangeContext, type RangeContextValue, type RangeDotProps, type RangeProps, type RangeThumbProps, RangeTuple, type RangeTupleConnectsProps, type RangeTupleContainerProps, RangeTupleContext, type RangeTupleContextValue, type RangeTupleDotProps, type RangeTupleProps, type RangeTupleThumbProps, useRangeContext, useRangeTupleContext };
50
+ export { Range, type RangeProps, RangeTuple, type RangeTupleProps };