@choice-ui/react 1.6.7 → 1.6.9
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/code-block/dist/index.d.ts +11 -14
- package/dist/components/code-block/dist/index.js +120 -93
- package/dist/components/code-block/src/code-block.d.ts +1 -2
- package/dist/components/code-block/src/code-block.js +11 -21
- package/dist/components/code-block/src/components/code-block-code.js +25 -13
- package/dist/components/code-block/src/components/code-block-content.d.ts +1 -1
- package/dist/components/code-block/src/components/code-block-content.js +14 -11
- package/dist/components/code-block/src/components/code-block-footer.js +4 -3
- package/dist/components/code-block/src/components/code-block-header.js +5 -6
- package/dist/components/code-block/src/hooks/index.d.ts +0 -1
- package/dist/components/code-block/src/hooks/use-code-block.js +26 -5
- package/dist/components/code-block/src/hooks/use-scroll-detection.d.ts +1 -2
- package/dist/components/code-block/src/hooks/use-scroll-detection.js +18 -12
- package/dist/components/code-block/src/types.d.ts +3 -5
- package/dist/components/code-block/src/utils/extract-code.js +23 -0
- package/dist/components/command/src/components/command-list.js +15 -3
- 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 +5 -9
- package/dist/components/md-render/src/components/markdown-components.js +1 -7
- package/dist/components/md-render/src/md-render.js +4 -2
- 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 +248 -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 +416 -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 +101 -0
- package/dist/components/toast/src/store.js +205 -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/code-block/src/hooks/use-line-count.d.ts +0 -2
- package/dist/components/code-block/src/hooks/use-line-count.js +0 -27
- 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
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
export declare const FormTv: import('tailwind-variants').TVReturnType<{
|
|
2
2
|
[key: string]: {
|
|
3
3
|
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
4
|
-
error?: import('tailwind-merge').ClassNameValue;
|
|
5
|
-
description?: import('tailwind-merge').ClassNameValue;
|
|
6
4
|
field?: import('tailwind-merge').ClassNameValue;
|
|
7
5
|
};
|
|
8
6
|
};
|
|
9
7
|
} | {
|
|
10
8
|
[x: string]: {
|
|
11
9
|
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
12
|
-
error?: import('tailwind-merge').ClassNameValue;
|
|
13
|
-
description?: import('tailwind-merge').ClassNameValue;
|
|
14
10
|
field?: import('tailwind-merge').ClassNameValue;
|
|
15
11
|
};
|
|
16
12
|
};
|
|
17
13
|
} | {}, {
|
|
18
14
|
field: string[];
|
|
19
|
-
error: string[];
|
|
20
|
-
description: string[];
|
|
21
15
|
}, undefined, {
|
|
22
16
|
[key: string]: {
|
|
23
17
|
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
24
|
-
error?: import('tailwind-merge').ClassNameValue;
|
|
25
|
-
description?: import('tailwind-merge').ClassNameValue;
|
|
26
18
|
field?: import('tailwind-merge').ClassNameValue;
|
|
27
19
|
};
|
|
28
20
|
};
|
|
29
21
|
} | {}, {
|
|
30
22
|
field: string[];
|
|
31
|
-
error: string[];
|
|
32
|
-
description: string[];
|
|
33
23
|
}, import('tailwind-variants').TVReturnType<unknown, {
|
|
34
24
|
field: string[];
|
|
35
|
-
error: string[];
|
|
36
|
-
description: string[];
|
|
37
25
|
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
2
2
|
const FormTv = tcv({
|
|
3
3
|
slots: {
|
|
4
|
-
field: ["flex min-w-0 flex-col gap-2"]
|
|
5
|
-
error: [
|
|
6
|
-
"text-body-medium",
|
|
7
|
-
"px-0.5",
|
|
8
|
-
"break-words whitespace-pre-wrap",
|
|
9
|
-
"text-danger-foreground"
|
|
10
|
-
],
|
|
11
|
-
description: [
|
|
12
|
-
"text-body-medium",
|
|
13
|
-
"px-0.5",
|
|
14
|
-
"break-words whitespace-pre-wrap",
|
|
15
|
-
"text-secondary-foreground"
|
|
16
|
-
]
|
|
4
|
+
field: ["flex min-w-0 flex-col gap-2"]
|
|
17
5
|
}
|
|
18
6
|
});
|
|
19
7
|
export {
|
|
@@ -15,9 +15,11 @@ export * from './comments/src';
|
|
|
15
15
|
export * from './conditions/src';
|
|
16
16
|
export * from './context-input/src';
|
|
17
17
|
export * from './context-menu/src';
|
|
18
|
+
export * from './description/src';
|
|
18
19
|
export * from './dialog/src';
|
|
19
20
|
export * from './dropdown/src';
|
|
20
21
|
export * from './emoji-picker/src';
|
|
22
|
+
export * from './error-message/src';
|
|
21
23
|
export * from './file-upload/src';
|
|
22
24
|
export * from './form/src';
|
|
23
25
|
export * from './hint/src';
|
|
@@ -61,6 +63,7 @@ export * from './table/src';
|
|
|
61
63
|
export * from './tabs/src';
|
|
62
64
|
export * from './text-field/src';
|
|
63
65
|
export * from './textarea/src';
|
|
66
|
+
export * from './toast/src';
|
|
64
67
|
export * from './toggle-button/src';
|
|
65
68
|
export * from './tooltip/src';
|
|
66
69
|
export * from './tree-list/src';
|
|
@@ -8,9 +8,10 @@ interface MentionItemProps {
|
|
|
8
8
|
}
|
|
9
9
|
interface MdRenderProps {
|
|
10
10
|
allowedPrefixes?: string[];
|
|
11
|
+
children?: string;
|
|
11
12
|
className?: string;
|
|
12
13
|
components?: Partial<Components>;
|
|
13
|
-
content
|
|
14
|
+
content?: string;
|
|
14
15
|
customColor?: {
|
|
15
16
|
codeBackground?: string;
|
|
16
17
|
defaultBackground?: string;
|
|
@@ -280,13 +280,7 @@ var createMarkdownComponents = (tv, MentionComponent, mentionItems) => {
|
|
|
280
280
|
{
|
|
281
281
|
className: tv.codeBlock(),
|
|
282
282
|
lineThreshold: void 0,
|
|
283
|
-
children: /* @__PURE__ */ jsx(
|
|
284
|
-
CodeBlock2.Code,
|
|
285
|
-
{
|
|
286
|
-
code: children,
|
|
287
|
-
language
|
|
288
|
-
}
|
|
289
|
-
)
|
|
283
|
+
children: /* @__PURE__ */ jsx(CodeBlock2.Code, { language, children })
|
|
290
284
|
}
|
|
291
285
|
);
|
|
292
286
|
},
|
|
@@ -409,7 +403,7 @@ var INITIAL_COMPONENTS = {
|
|
|
409
403
|
expandable: false,
|
|
410
404
|
children: [
|
|
411
405
|
/* @__PURE__ */ jsx(CodeBlock2.Header, { showLineCount: false }),
|
|
412
|
-
/* @__PURE__ */ jsx(CodeBlock2.Content, {
|
|
406
|
+
/* @__PURE__ */ jsx(CodeBlock2.Content, { children })
|
|
413
407
|
]
|
|
414
408
|
}
|
|
415
409
|
);
|
|
@@ -421,6 +415,7 @@ var MdRender = memo(
|
|
|
421
415
|
id,
|
|
422
416
|
components: customComponents,
|
|
423
417
|
content,
|
|
418
|
+
children,
|
|
424
419
|
className,
|
|
425
420
|
mentionRenderComponent,
|
|
426
421
|
mentionItems,
|
|
@@ -429,9 +424,10 @@ var MdRender = memo(
|
|
|
429
424
|
size = "default",
|
|
430
425
|
variant = "default"
|
|
431
426
|
} = props;
|
|
427
|
+
const markdownContent = content ?? children ?? "";
|
|
432
428
|
const generatedId = useId();
|
|
433
429
|
const blockId = id ?? generatedId;
|
|
434
|
-
const blocks = useMdBlocks(
|
|
430
|
+
const blocks = useMdBlocks(markdownContent);
|
|
435
431
|
const tv = useMemo(() => mdRenderTv({ size, variant }), [size, variant]);
|
|
436
432
|
const tvComponents = useMemo(
|
|
437
433
|
() => createMarkdownComponents(tv, mentionRenderComponent, mentionItems),
|
|
@@ -64,13 +64,7 @@ const createMarkdownComponents = (tv, MentionComponent, mentionItems) => {
|
|
|
64
64
|
{
|
|
65
65
|
className: tv.codeBlock(),
|
|
66
66
|
lineThreshold: void 0,
|
|
67
|
-
children: /* @__PURE__ */ jsx(
|
|
68
|
-
CodeBlock2.Code,
|
|
69
|
-
{
|
|
70
|
-
code: children,
|
|
71
|
-
language
|
|
72
|
-
}
|
|
73
|
-
)
|
|
67
|
+
children: /* @__PURE__ */ jsx(CodeBlock2.Code, { language, children })
|
|
74
68
|
}
|
|
75
69
|
);
|
|
76
70
|
},
|
|
@@ -25,7 +25,7 @@ const INITIAL_COMPONENTS = {
|
|
|
25
25
|
expandable: false,
|
|
26
26
|
children: [
|
|
27
27
|
/* @__PURE__ */ jsx(CodeBlock2.Header, { showLineCount: false }),
|
|
28
|
-
/* @__PURE__ */ jsx(CodeBlock2.Content, {
|
|
28
|
+
/* @__PURE__ */ jsx(CodeBlock2.Content, { children })
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
31
|
);
|
|
@@ -37,6 +37,7 @@ const MdRender = memo(
|
|
|
37
37
|
id,
|
|
38
38
|
components: customComponents,
|
|
39
39
|
content,
|
|
40
|
+
children,
|
|
40
41
|
className,
|
|
41
42
|
mentionRenderComponent,
|
|
42
43
|
mentionItems,
|
|
@@ -45,9 +46,10 @@ const MdRender = memo(
|
|
|
45
46
|
size = "default",
|
|
46
47
|
variant = "default"
|
|
47
48
|
} = props;
|
|
49
|
+
const markdownContent = content ?? children ?? "";
|
|
48
50
|
const generatedId = useId();
|
|
49
51
|
const blockId = id ?? generatedId;
|
|
50
|
-
const blocks = useMdBlocks(
|
|
52
|
+
const blocks = useMdBlocks(markdownContent);
|
|
51
53
|
const tv = useMemo(() => mdRenderTv({ size, variant }), [size, variant]);
|
|
52
54
|
const tvComponents = useMemo(
|
|
53
55
|
() => createMarkdownComponents(tv, mentionRenderComponent, mentionItems),
|
|
@@ -6,9 +6,10 @@ interface MentionItemProps {
|
|
|
6
6
|
}
|
|
7
7
|
export interface MdRenderProps {
|
|
8
8
|
allowedPrefixes?: string[];
|
|
9
|
+
children?: string;
|
|
9
10
|
className?: string;
|
|
10
11
|
components?: Partial<Components>;
|
|
11
|
-
content
|
|
12
|
+
content?: string;
|
|
12
13
|
customColor?: {
|
|
13
14
|
codeBackground?: string;
|
|
14
15
|
defaultBackground?: string;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { ToasterProps } from 'sonner';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
2
|
interface NotificationsProps extends Omit<ToasterProps, "id"> {
|
|
6
3
|
actions?: (id: string | number) => {
|
|
7
4
|
action?: {
|
|
@@ -20,7 +17,6 @@ interface NotificationsProps extends Omit<ToasterProps, "id"> {
|
|
|
20
17
|
text?: string;
|
|
21
18
|
toasterId?: string;
|
|
22
19
|
}
|
|
23
|
-
declare const Toast: react.MemoExoticComponent<(props: NotificationsProps) => react_jsx_runtime.JSX.Element>;
|
|
24
20
|
declare function notifications(toast: Omit<NotificationsProps, "id">): string | number;
|
|
25
21
|
|
|
26
|
-
export { type NotificationsProps,
|
|
22
|
+
export { type NotificationsProps, notifications };
|
|
@@ -17,5 +17,4 @@ export interface NotificationsProps extends Omit<ToasterProps, "id"> {
|
|
|
17
17
|
text?: string;
|
|
18
18
|
toasterId?: string;
|
|
19
19
|
}
|
|
20
|
-
export declare const Toast: import('react').MemoExoticComponent<(props: NotificationsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
21
20
|
export declare function notifications(toast: Omit<NotificationsProps, "id">): string | number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TooltipProps } from '../../tooltip/src';
|
|
2
|
-
import { default as
|
|
2
|
+
import { default as React__default, ReactNode, HTMLProps } from 'react';
|
|
3
3
|
import { IconButtonProps } from '../../icon-button/src';
|
|
4
4
|
import { PressMoveProps } from '../../../../../shared/src';
|
|
5
|
-
import * as
|
|
5
|
+
import * as React$1 from 'react';
|
|
6
6
|
|
|
7
7
|
type ElementType = "action" | "handler" | "menu";
|
|
8
8
|
interface NumericInputElementProps {
|
|
@@ -11,18 +11,18 @@ interface NumericInputElementProps {
|
|
|
11
11
|
position?: "prefix" | "suffix";
|
|
12
12
|
type?: ElementType;
|
|
13
13
|
}
|
|
14
|
-
declare const NumericInputElement:
|
|
14
|
+
declare const NumericInputElement: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<NumericInputElementProps & React$1.RefAttributes<HTMLDivElement>>>;
|
|
15
15
|
|
|
16
16
|
interface NumericInputMenuTriggerProps extends IconButtonProps {
|
|
17
17
|
className?: string;
|
|
18
18
|
type?: "menu" | "action";
|
|
19
19
|
}
|
|
20
|
-
declare const NumericInputMenuTrigger:
|
|
20
|
+
declare const NumericInputMenuTrigger: React$1.ForwardRefExoticComponent<Omit<NumericInputMenuTriggerProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
21
21
|
interface NumericInputMenuActionPromptProps extends HTMLProps<HTMLDivElement> {
|
|
22
22
|
children?: React.ReactNode;
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|
|
25
|
-
declare const NumericInputMenuActionPrompt:
|
|
25
|
+
declare const NumericInputMenuActionPrompt: React$1.ForwardRefExoticComponent<Omit<NumericInputMenuActionPromptProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
26
26
|
|
|
27
27
|
interface NumericInputVariableProps {
|
|
28
28
|
className?: string;
|
|
@@ -30,7 +30,7 @@ interface NumericInputVariableProps {
|
|
|
30
30
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
31
31
|
value?: number | null;
|
|
32
32
|
}
|
|
33
|
-
declare const NumericInputVariable:
|
|
33
|
+
declare const NumericInputVariable: React$1.ForwardRefExoticComponent<NumericInputVariableProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
34
34
|
|
|
35
35
|
type NumericInputValue = string | number | (string | number | undefined)[] | Record<string, number>;
|
|
36
36
|
type NumberResult = {
|
|
@@ -75,9 +75,9 @@ interface NumericInputProps extends NumericInputContextValue, Omit<HTMLProps<HTM
|
|
|
75
75
|
id?: string;
|
|
76
76
|
onChange?: (value: NumericInputValue, detail: NumericChangeDetail) => void;
|
|
77
77
|
tooltip?: TooltipProps;
|
|
78
|
-
triggerRef?:
|
|
78
|
+
triggerRef?: React__default.RefObject<HTMLDivElement> | ((el: HTMLDivElement | null) => void);
|
|
79
79
|
}
|
|
80
|
-
interface NumericInputComponent extends
|
|
80
|
+
interface NumericInputComponent extends React__default.ForwardRefExoticComponent<NumericInputProps & React__default.RefAttributes<HTMLInputElement>> {
|
|
81
81
|
ActionPrompt: typeof NumericInputMenuActionPrompt;
|
|
82
82
|
MenuTrigger: typeof NumericInputMenuTrigger;
|
|
83
83
|
Prefix: typeof NumericInputElement;
|
|
@@ -86,4 +86,18 @@ interface NumericInputComponent extends react__default.ForwardRefExoticComponent
|
|
|
86
86
|
}
|
|
87
87
|
declare const NumericInput: NumericInputComponent;
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Hook for handling long press on numeric input increment/decrement buttons.
|
|
91
|
+
* Triggers the callback immediately on press, then repeatedly after a delay.
|
|
92
|
+
*
|
|
93
|
+
* @param callback - Function to call on press and during long press
|
|
94
|
+
* @param delay - Interval between repeated calls (default: 150ms)
|
|
95
|
+
* @param initialDelay - Delay before starting repeated calls (default: 400ms)
|
|
96
|
+
*/
|
|
97
|
+
declare function useNumericLongPress(callback: () => void, delay?: number, initialDelay?: number): {
|
|
98
|
+
onMouseDown: () => void;
|
|
99
|
+
onMouseUp: () => void;
|
|
100
|
+
onMouseLeave: () => void;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { type NumberResult, type NumericChangeDetail, NumericInput, NumericInputElement, type NumericInputElementProps, NumericInputMenuTrigger, type NumericInputMenuTriggerProps, type NumericInputProps, type NumericInputValue, NumericInputVariable, type NumericInputVariableProps, useNumericLongPress };
|
|
@@ -345,8 +345,8 @@ var NumericInputElementTv = tcv({
|
|
|
345
345
|
variants: {
|
|
346
346
|
type: {
|
|
347
347
|
handler: "select-none",
|
|
348
|
-
action: "
|
|
349
|
-
menu: "
|
|
348
|
+
action: "",
|
|
349
|
+
menu: ""
|
|
350
350
|
},
|
|
351
351
|
position: {
|
|
352
352
|
prefix: "rounded-l-md",
|
|
@@ -378,6 +378,26 @@ var NumericInputElementTv = tcv({
|
|
|
378
378
|
position: "suffix",
|
|
379
379
|
class: "[grid-area:suffix-handler]"
|
|
380
380
|
},
|
|
381
|
+
{
|
|
382
|
+
type: "action",
|
|
383
|
+
position: "prefix",
|
|
384
|
+
class: "[grid-area:prefix-handler]"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
type: "action",
|
|
388
|
+
position: "suffix",
|
|
389
|
+
class: "[grid-area:action]"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
type: "menu",
|
|
393
|
+
position: "prefix",
|
|
394
|
+
class: "[grid-area:prefix-handler]"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
type: "menu",
|
|
398
|
+
position: "suffix",
|
|
399
|
+
class: "ml-px [grid-area:action]"
|
|
400
|
+
},
|
|
381
401
|
{
|
|
382
402
|
type: "handler",
|
|
383
403
|
disabled: false,
|
|
@@ -505,7 +525,10 @@ var NumericInputMenuActionPrompt = forwardRef((props, ref) => {
|
|
|
505
525
|
"div",
|
|
506
526
|
{
|
|
507
527
|
ref,
|
|
508
|
-
className: tcx(
|
|
528
|
+
className: tcx(
|
|
529
|
+
NumericInputMenuActionPromptTv({ size: context.size, disabled: context.disabled }),
|
|
530
|
+
className
|
|
531
|
+
),
|
|
509
532
|
...rest,
|
|
510
533
|
children
|
|
511
534
|
}
|
|
@@ -37,7 +37,10 @@ const NumericInputMenuActionPrompt = forwardRef((props, ref) => {
|
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
39
|
ref,
|
|
40
|
-
className: tcx(
|
|
40
|
+
className: tcx(
|
|
41
|
+
NumericInputMenuActionPromptTv({ size: context.size, disabled: context.disabled }),
|
|
42
|
+
className
|
|
43
|
+
),
|
|
41
44
|
...rest,
|
|
42
45
|
children
|
|
43
46
|
}
|
|
@@ -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
|
|