@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.
- package/dist/components/description/dist/index.d.ts +8 -0
- package/dist/components/description/dist/index.js +29 -0
- package/dist/components/description/src/description.d.ts +6 -0
- package/dist/components/description/src/description.js +18 -0
- package/dist/components/description/src/index.d.ts +2 -0
- package/dist/components/description/src/tv.d.ts +13 -0
- package/dist/components/description/src/tv.js +15 -0
- package/dist/components/description/tsup.config.d.ts +2 -0
- package/dist/components/emoji-picker/dist/index.d.ts +1 -0
- package/dist/components/emoji-picker/dist/index.js +4 -2
- package/dist/components/emoji-picker/src/emoji-picker.d.ts +1 -0
- package/dist/components/emoji-picker/src/emoji-picker.js +4 -2
- package/dist/components/error-message/dist/index.d.ts +8 -0
- package/dist/components/error-message/dist/index.js +30 -0
- package/dist/components/error-message/src/error-message.d.ts +6 -0
- package/dist/components/error-message/src/error-message.js +19 -0
- package/dist/components/error-message/src/index.d.ts +2 -0
- package/dist/components/error-message/src/tv.d.ts +13 -0
- package/dist/components/error-message/src/tv.js +15 -0
- package/dist/components/error-message/tsup.config.d.ts +2 -0
- package/dist/components/form/src/adapters/base-adapter.js +4 -2
- package/dist/components/form/src/tv.d.ts +0 -12
- package/dist/components/form/src/tv.js +1 -13
- package/dist/components/index.d.ts +3 -0
- package/dist/components/md-render/dist/index.d.ts +2 -1
- package/dist/components/md-render/dist/index.js +3 -1
- package/dist/components/md-render/src/md-render.js +3 -1
- package/dist/components/md-render/src/types.d.ts +2 -1
- package/dist/components/notifications/dist/index.d.ts +1 -5
- package/dist/components/notifications/src/notifications.d.ts +0 -1
- package/dist/components/notifications/src/notifications.js +0 -1
- package/dist/components/numeric-input/dist/index.d.ts +23 -9
- package/dist/components/numeric-input/dist/index.js +26 -3
- package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.js +4 -1
- package/dist/components/numeric-input/src/hooks/index.d.ts +1 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.d.ts +13 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.js +27 -0
- package/dist/components/numeric-input/src/index.d.ts +1 -0
- package/dist/components/numeric-input/src/tv.js +22 -2
- package/dist/components/picture-preview/dist/index.d.ts +5 -0
- package/dist/components/picture-preview/dist/index.js +287 -140
- package/dist/components/picture-preview/src/hooks/useWheelHandler.d.ts +6 -1
- package/dist/components/picture-preview/src/hooks/useWheelHandler.js +25 -7
- package/dist/components/picture-preview/src/picture-preview.d.ts +5 -0
- package/dist/components/picture-preview/src/picture-preview.js +214 -123
- package/dist/components/picture-preview/src/tv.d.ts +93 -3
- package/dist/components/picture-preview/src/tv.js +48 -10
- package/dist/components/separator/dist/index.d.ts +1 -8
- package/dist/components/separator/src/separator.d.ts +1 -8
- package/dist/components/separator/src/separator.js +33 -5
- package/dist/components/separator/src/tv.d.ts +39 -18
- package/dist/components/separator/src/tv.js +37 -7
- package/dist/components/text-field/dist/index.d.ts +2 -3
- package/dist/components/text-field/dist/index.js +4 -19
- package/dist/components/text-field/src/components/index.d.ts +0 -1
- package/dist/components/text-field/src/text-field.d.ts +3 -2
- package/dist/components/text-field/src/text-field.js +2 -2
- package/dist/components/text-field/src/tv.d.ts +3 -3
- package/dist/components/text-field/src/tv.js +1 -6
- package/dist/components/toast/dist/index.d.ts +260 -0
- package/dist/components/toast/src/components/index.d.ts +3 -0
- package/dist/components/toast/src/components/toast-progress-bar.d.ts +7 -0
- package/dist/components/toast/src/components/toast-progress-bar.js +53 -0
- package/dist/components/toast/src/components/toaster-item.d.ts +26 -0
- package/dist/components/toast/src/components/toaster-item.js +412 -0
- package/dist/components/toast/src/components/toaster-slots.d.ts +87 -0
- package/dist/components/toast/src/components/toaster-slots.js +38 -0
- package/dist/components/toast/src/index.d.ts +5 -0
- package/dist/components/toast/src/store.d.ts +113 -0
- package/dist/components/toast/src/store.js +204 -0
- package/dist/components/toast/src/toaster.d.ts +87 -0
- package/dist/components/toast/src/toaster.js +271 -0
- package/dist/components/toast/src/tv.d.ts +365 -0
- package/dist/components/toast/src/tv.js +412 -0
- package/dist/components/toast/src/types.d.ts +79 -0
- package/dist/components/toast/tsup.config.d.ts +2 -0
- package/dist/index.js +11 -2
- package/dist/styles/components.css +2 -0
- package/package.json +1 -1
- package/dist/components/text-field/src/components/field-description.d.ts +0 -2
- package/dist/components/text-field/src/components/field-description.js +0 -16
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for handling long press on numeric input increment/decrement buttons.
|
|
3
|
+
* Triggers the callback immediately on press, then repeatedly after a delay.
|
|
4
|
+
*
|
|
5
|
+
* @param callback - Function to call on press and during long press
|
|
6
|
+
* @param delay - Interval between repeated calls (default: 150ms)
|
|
7
|
+
* @param initialDelay - Delay before starting repeated calls (default: 400ms)
|
|
8
|
+
*/
|
|
9
|
+
export declare function useNumericLongPress(callback: () => void, delay?: number, initialDelay?: number): {
|
|
10
|
+
onMouseDown: () => void;
|
|
11
|
+
onMouseUp: () => void;
|
|
12
|
+
onMouseLeave: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useRef, useCallback } from "react";
|
|
2
|
+
function useNumericLongPress(callback, delay = 50, initialDelay = 400) {
|
|
3
|
+
const intervalRef = useRef(null);
|
|
4
|
+
const timeoutRef = useRef(null);
|
|
5
|
+
const clear = useCallback(() => {
|
|
6
|
+
if (timeoutRef.current) {
|
|
7
|
+
clearTimeout(timeoutRef.current);
|
|
8
|
+
timeoutRef.current = null;
|
|
9
|
+
}
|
|
10
|
+
if (intervalRef.current) {
|
|
11
|
+
clearInterval(intervalRef.current);
|
|
12
|
+
intervalRef.current = null;
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
15
|
+
const onMouseDown = useCallback(() => {
|
|
16
|
+
callback();
|
|
17
|
+
timeoutRef.current = setTimeout(() => {
|
|
18
|
+
intervalRef.current = setInterval(callback, delay);
|
|
19
|
+
}, initialDelay);
|
|
20
|
+
}, [callback, delay, initialDelay]);
|
|
21
|
+
const onMouseUp = clear;
|
|
22
|
+
const onMouseLeave = clear;
|
|
23
|
+
return { onMouseDown, onMouseUp, onMouseLeave };
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
useNumericLongPress
|
|
27
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { NumericInput } from './numeric-input';
|
|
2
2
|
export { NumericInputElement, NumericInputMenuTrigger, NumericInputVariable } from './components';
|
|
3
|
+
export { useNumericLongPress } from './hooks';
|
|
3
4
|
export type { NumericInputProps } from './numeric-input';
|
|
4
5
|
export type { NumericInputElementProps, NumericInputMenuTriggerProps, NumericInputVariableProps, } from './components';
|
|
5
6
|
export type { NumberResult, NumericChangeDetail, NumericInputValue } from './types';
|
|
@@ -324,8 +324,8 @@ const NumericInputElementTv = tcv({
|
|
|
324
324
|
variants: {
|
|
325
325
|
type: {
|
|
326
326
|
handler: "select-none",
|
|
327
|
-
action: "
|
|
328
|
-
menu: "
|
|
327
|
+
action: "",
|
|
328
|
+
menu: ""
|
|
329
329
|
},
|
|
330
330
|
position: {
|
|
331
331
|
prefix: "rounded-l-md",
|
|
@@ -357,6 +357,26 @@ const NumericInputElementTv = tcv({
|
|
|
357
357
|
position: "suffix",
|
|
358
358
|
class: "[grid-area:suffix-handler]"
|
|
359
359
|
},
|
|
360
|
+
{
|
|
361
|
+
type: "action",
|
|
362
|
+
position: "prefix",
|
|
363
|
+
class: "[grid-area:prefix-handler]"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
type: "action",
|
|
367
|
+
position: "suffix",
|
|
368
|
+
class: "[grid-area:action]"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
type: "menu",
|
|
372
|
+
position: "prefix",
|
|
373
|
+
class: "[grid-area:prefix-handler]"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
type: "menu",
|
|
377
|
+
position: "suffix",
|
|
378
|
+
class: "ml-px [grid-area:action]"
|
|
379
|
+
},
|
|
360
380
|
{
|
|
361
381
|
type: "handler",
|
|
362
382
|
disabled: false,
|
|
@@ -14,6 +14,11 @@ interface PicturePreviewProps extends HTMLProps<HTMLDivElement> {
|
|
|
14
14
|
fileName?: string;
|
|
15
15
|
onClose?: () => void;
|
|
16
16
|
src: string;
|
|
17
|
+
control?: {
|
|
18
|
+
enable?: boolean;
|
|
19
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
20
|
+
show?: "always" | "hover";
|
|
21
|
+
};
|
|
17
22
|
}
|
|
18
23
|
declare const PicturePreview: react.ForwardRefExoticComponent<Omit<PicturePreviewProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
19
24
|
|