@zag-js/clipboard 1.34.1 → 1.35.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.
@@ -0,0 +1,10 @@
1
+ import { ClipboardProps, IndicatorProps } from './clipboard.types.js';
2
+ import '@zag-js/core';
3
+ import '@zag-js/types';
4
+
5
+ declare const props: (keyof ClipboardProps)[];
6
+ declare const contextProps: <Props extends ClipboardProps>(props: Props) => [ClipboardProps, Omit<Props, keyof ClipboardProps>];
7
+ declare const indicatorProps: "copied"[];
8
+ declare const splitIndicatorProps: <Props extends IndicatorProps>(props: Props) => [IndicatorProps, Omit<Props, "copied">];
9
+
10
+ export { contextProps, indicatorProps, props, splitIndicatorProps };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/clipboard.props.ts
21
+ var clipboard_props_exports = {};
22
+ __export(clipboard_props_exports, {
23
+ contextProps: () => contextProps,
24
+ indicatorProps: () => indicatorProps,
25
+ props: () => props,
26
+ splitIndicatorProps: () => splitIndicatorProps
27
+ });
28
+ module.exports = __toCommonJS(clipboard_props_exports);
29
+ var import_types = require("@zag-js/types");
30
+ var import_utils = require("@zag-js/utils");
31
+ var props = (0, import_types.createProps)()([
32
+ "getRootNode",
33
+ "id",
34
+ "ids",
35
+ "value",
36
+ "defaultValue",
37
+ "timeout",
38
+ "onStatusChange",
39
+ "onValueChange"
40
+ ]);
41
+ var contextProps = (0, import_utils.createSplitProps)(props);
42
+ var indicatorProps = (0, import_types.createProps)()(["copied"]);
43
+ var splitIndicatorProps = (0, import_utils.createSplitProps)(indicatorProps);
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ contextProps,
47
+ indicatorProps,
48
+ props,
49
+ splitIndicatorProps
50
+ });
@@ -0,0 +1,22 @@
1
+ // src/clipboard.props.ts
2
+ import { createProps } from "@zag-js/types";
3
+ import { createSplitProps } from "@zag-js/utils";
4
+ var props = createProps()([
5
+ "getRootNode",
6
+ "id",
7
+ "ids",
8
+ "value",
9
+ "defaultValue",
10
+ "timeout",
11
+ "onStatusChange",
12
+ "onValueChange"
13
+ ]);
14
+ var contextProps = createSplitProps(props);
15
+ var indicatorProps = createProps()(["copied"]);
16
+ var splitIndicatorProps = createSplitProps(indicatorProps);
17
+ export {
18
+ contextProps,
19
+ indicatorProps,
20
+ props,
21
+ splitIndicatorProps
22
+ };
@@ -0,0 +1,83 @@
1
+ import { Service, Machine } from '@zag-js/core';
2
+ import { RequiredBy, CommonProperties, PropTypes } from '@zag-js/types';
3
+
4
+ interface CopyStatusDetails {
5
+ copied: boolean;
6
+ }
7
+ interface ValueChangeDetails {
8
+ value: string;
9
+ }
10
+ type ElementIds = Partial<{
11
+ root: string;
12
+ input: string;
13
+ label: string;
14
+ }>;
15
+ interface ClipboardProps extends CommonProperties {
16
+ /**
17
+ * The ids of the elements in the clipboard. Useful for composition.
18
+ */
19
+ ids?: ElementIds | undefined;
20
+ /**
21
+ * The controlled value of the clipboard
22
+ */
23
+ value?: string | undefined;
24
+ /**
25
+ * The initial value to be copied to the clipboard when rendered.
26
+ * Use when you don't need to control the value of the clipboard.
27
+ */
28
+ defaultValue?: string | undefined;
29
+ /**
30
+ * The function to be called when the value changes
31
+ */
32
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
33
+ /**
34
+ * The function to be called when the value is copied to the clipboard
35
+ */
36
+ onStatusChange?: ((details: CopyStatusDetails) => void) | undefined;
37
+ /**
38
+ * The timeout for the copy operation
39
+ * @default 3000
40
+ */
41
+ timeout?: number | undefined;
42
+ }
43
+ interface ClipboardSchema {
44
+ state: "idle" | "copied";
45
+ props: RequiredBy<ClipboardProps, "timeout">;
46
+ context: {
47
+ value: string;
48
+ };
49
+ effect: string;
50
+ action: string;
51
+ guard: string;
52
+ }
53
+ type ClipboardService = Service<ClipboardSchema>;
54
+ type ClipboardMachine = Machine<ClipboardSchema>;
55
+ interface IndicatorProps {
56
+ copied: boolean;
57
+ }
58
+ interface ClipboardApi<T extends PropTypes = PropTypes> {
59
+ /**
60
+ * Whether the value has been copied to the clipboard
61
+ */
62
+ copied: boolean;
63
+ /**
64
+ * The value to be copied to the clipboard
65
+ */
66
+ value: string;
67
+ /**
68
+ * Set the value to be copied to the clipboard
69
+ */
70
+ setValue: (value: string) => void;
71
+ /**
72
+ * Copy the value to the clipboard
73
+ */
74
+ copy: VoidFunction;
75
+ getRootProps: () => T["element"];
76
+ getLabelProps: () => T["label"];
77
+ getControlProps: () => T["element"];
78
+ getTriggerProps: () => T["button"];
79
+ getInputProps: () => T["input"];
80
+ getIndicatorProps: (props: IndicatorProps) => T["element"];
81
+ }
82
+
83
+ export type { ClipboardApi, ClipboardMachine, ClipboardProps, ClipboardSchema, ClipboardService, CopyStatusDetails, ElementIds, IndicatorProps, ValueChangeDetails };
@@ -0,0 +1,83 @@
1
+ import { Service, Machine } from '@zag-js/core';
2
+ import { RequiredBy, CommonProperties, PropTypes } from '@zag-js/types';
3
+
4
+ interface CopyStatusDetails {
5
+ copied: boolean;
6
+ }
7
+ interface ValueChangeDetails {
8
+ value: string;
9
+ }
10
+ type ElementIds = Partial<{
11
+ root: string;
12
+ input: string;
13
+ label: string;
14
+ }>;
15
+ interface ClipboardProps extends CommonProperties {
16
+ /**
17
+ * The ids of the elements in the clipboard. Useful for composition.
18
+ */
19
+ ids?: ElementIds | undefined;
20
+ /**
21
+ * The controlled value of the clipboard
22
+ */
23
+ value?: string | undefined;
24
+ /**
25
+ * The initial value to be copied to the clipboard when rendered.
26
+ * Use when you don't need to control the value of the clipboard.
27
+ */
28
+ defaultValue?: string | undefined;
29
+ /**
30
+ * The function to be called when the value changes
31
+ */
32
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
33
+ /**
34
+ * The function to be called when the value is copied to the clipboard
35
+ */
36
+ onStatusChange?: ((details: CopyStatusDetails) => void) | undefined;
37
+ /**
38
+ * The timeout for the copy operation
39
+ * @default 3000
40
+ */
41
+ timeout?: number | undefined;
42
+ }
43
+ interface ClipboardSchema {
44
+ state: "idle" | "copied";
45
+ props: RequiredBy<ClipboardProps, "timeout">;
46
+ context: {
47
+ value: string;
48
+ };
49
+ effect: string;
50
+ action: string;
51
+ guard: string;
52
+ }
53
+ type ClipboardService = Service<ClipboardSchema>;
54
+ type ClipboardMachine = Machine<ClipboardSchema>;
55
+ interface IndicatorProps {
56
+ copied: boolean;
57
+ }
58
+ interface ClipboardApi<T extends PropTypes = PropTypes> {
59
+ /**
60
+ * Whether the value has been copied to the clipboard
61
+ */
62
+ copied: boolean;
63
+ /**
64
+ * The value to be copied to the clipboard
65
+ */
66
+ value: string;
67
+ /**
68
+ * Set the value to be copied to the clipboard
69
+ */
70
+ setValue: (value: string) => void;
71
+ /**
72
+ * Copy the value to the clipboard
73
+ */
74
+ copy: VoidFunction;
75
+ getRootProps: () => T["element"];
76
+ getLabelProps: () => T["label"];
77
+ getControlProps: () => T["element"];
78
+ getTriggerProps: () => T["button"];
79
+ getInputProps: () => T["input"];
80
+ getIndicatorProps: (props: IndicatorProps) => T["element"];
81
+ }
82
+
83
+ export type { ClipboardApi, ClipboardMachine, ClipboardProps, ClipboardSchema, ClipboardService, CopyStatusDetails, ElementIds, IndicatorProps, ValueChangeDetails };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/clipboard.types.ts
17
+ var clipboard_types_exports = {};
18
+ module.exports = __toCommonJS(clipboard_types_exports);
File without changes
package/dist/index.d.mts CHANGED
@@ -1,96 +1,8 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { PropTypes, RequiredBy, CommonProperties, NormalizeProps } from '@zag-js/types';
3
- import * as _zag_js_core from '@zag-js/core';
4
- import { Machine, Service } from '@zag-js/core';
5
-
6
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "control" | "trigger" | "indicator" | "input" | "label">;
7
-
8
- interface CopyStatusDetails {
9
- copied: boolean;
10
- }
11
- interface ValueChangeDetails {
12
- value: string;
13
- }
14
- type ElementIds = Partial<{
15
- root: string;
16
- input: string;
17
- label: string;
18
- }>;
19
- interface ClipboardProps extends CommonProperties {
20
- /**
21
- * The ids of the elements in the clipboard. Useful for composition.
22
- */
23
- ids?: ElementIds | undefined;
24
- /**
25
- * The controlled value of the clipboard
26
- */
27
- value?: string | undefined;
28
- /**
29
- * The initial value to be copied to the clipboard when rendered.
30
- * Use when you don't need to control the value of the clipboard.
31
- */
32
- defaultValue?: string | undefined;
33
- /**
34
- * The function to be called when the value changes
35
- */
36
- onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
37
- /**
38
- * The function to be called when the value is copied to the clipboard
39
- */
40
- onStatusChange?: ((details: CopyStatusDetails) => void) | undefined;
41
- /**
42
- * The timeout for the copy operation
43
- * @default 3000
44
- */
45
- timeout?: number | undefined;
46
- }
47
- interface ClipboardSchema {
48
- state: "idle" | "copied";
49
- props: RequiredBy<ClipboardProps, "timeout">;
50
- context: {
51
- value: string;
52
- };
53
- effect: string;
54
- action: string;
55
- guard: string;
56
- }
57
- type ClipboardService = Service<ClipboardSchema>;
58
- type ClipboardMachine = Machine<ClipboardSchema>;
59
- interface IndicatorProps {
60
- copied: boolean;
61
- }
62
- interface ClipboardApi<T extends PropTypes = PropTypes> {
63
- /**
64
- * Whether the value has been copied to the clipboard
65
- */
66
- copied: boolean;
67
- /**
68
- * The value to be copied to the clipboard
69
- */
70
- value: string;
71
- /**
72
- * Set the value to be copied to the clipboard
73
- */
74
- setValue: (value: string) => void;
75
- /**
76
- * Copy the value to the clipboard
77
- */
78
- copy: VoidFunction;
79
- getRootProps: () => T["element"];
80
- getLabelProps: () => T["label"];
81
- getControlProps: () => T["element"];
82
- getTriggerProps: () => T["button"];
83
- getInputProps: () => T["input"];
84
- getIndicatorProps: (props: IndicatorProps) => T["element"];
85
- }
86
-
87
- declare function connect<T extends PropTypes>(service: ClipboardService, normalize: NormalizeProps<T>): ClipboardApi<T>;
88
-
89
- declare const machine: _zag_js_core.Machine<ClipboardSchema>;
90
-
91
- declare const props: (keyof ClipboardProps)[];
92
- declare const contextProps: <Props extends ClipboardProps>(props: Props) => [ClipboardProps, Omit<Props, keyof ClipboardProps>];
93
- declare const indicatorProps: "copied"[];
94
- declare const splitIndicatorProps: <Props extends IndicatorProps>(props: Props) => [IndicatorProps, Omit<Props, "copied">];
95
-
96
- export { type ClipboardApi as Api, type CopyStatusDetails, type ElementIds, type IndicatorProps, type ClipboardMachine as Machine, type ClipboardProps as Props, type ClipboardService as Service, type ValueChangeDetails, anatomy, connect, contextProps, indicatorProps, machine, props, splitIndicatorProps };
1
+ export { anatomy } from './clipboard.anatomy.mjs';
2
+ export { connect } from './clipboard.connect.mjs';
3
+ export { machine } from './clipboard.machine.mjs';
4
+ export { contextProps, indicatorProps, props, splitIndicatorProps } from './clipboard.props.mjs';
5
+ export { ClipboardApi as Api, CopyStatusDetails, ElementIds, IndicatorProps, ClipboardMachine as Machine, ClipboardProps as Props, ClipboardService as Service, ValueChangeDetails } from './clipboard.types.mjs';
6
+ import '@zag-js/anatomy';
7
+ import '@zag-js/types';
8
+ import '@zag-js/core';
package/dist/index.d.ts CHANGED
@@ -1,96 +1,8 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { PropTypes, RequiredBy, CommonProperties, NormalizeProps } from '@zag-js/types';
3
- import * as _zag_js_core from '@zag-js/core';
4
- import { Machine, Service } from '@zag-js/core';
5
-
6
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "control" | "trigger" | "indicator" | "input" | "label">;
7
-
8
- interface CopyStatusDetails {
9
- copied: boolean;
10
- }
11
- interface ValueChangeDetails {
12
- value: string;
13
- }
14
- type ElementIds = Partial<{
15
- root: string;
16
- input: string;
17
- label: string;
18
- }>;
19
- interface ClipboardProps extends CommonProperties {
20
- /**
21
- * The ids of the elements in the clipboard. Useful for composition.
22
- */
23
- ids?: ElementIds | undefined;
24
- /**
25
- * The controlled value of the clipboard
26
- */
27
- value?: string | undefined;
28
- /**
29
- * The initial value to be copied to the clipboard when rendered.
30
- * Use when you don't need to control the value of the clipboard.
31
- */
32
- defaultValue?: string | undefined;
33
- /**
34
- * The function to be called when the value changes
35
- */
36
- onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
37
- /**
38
- * The function to be called when the value is copied to the clipboard
39
- */
40
- onStatusChange?: ((details: CopyStatusDetails) => void) | undefined;
41
- /**
42
- * The timeout for the copy operation
43
- * @default 3000
44
- */
45
- timeout?: number | undefined;
46
- }
47
- interface ClipboardSchema {
48
- state: "idle" | "copied";
49
- props: RequiredBy<ClipboardProps, "timeout">;
50
- context: {
51
- value: string;
52
- };
53
- effect: string;
54
- action: string;
55
- guard: string;
56
- }
57
- type ClipboardService = Service<ClipboardSchema>;
58
- type ClipboardMachine = Machine<ClipboardSchema>;
59
- interface IndicatorProps {
60
- copied: boolean;
61
- }
62
- interface ClipboardApi<T extends PropTypes = PropTypes> {
63
- /**
64
- * Whether the value has been copied to the clipboard
65
- */
66
- copied: boolean;
67
- /**
68
- * The value to be copied to the clipboard
69
- */
70
- value: string;
71
- /**
72
- * Set the value to be copied to the clipboard
73
- */
74
- setValue: (value: string) => void;
75
- /**
76
- * Copy the value to the clipboard
77
- */
78
- copy: VoidFunction;
79
- getRootProps: () => T["element"];
80
- getLabelProps: () => T["label"];
81
- getControlProps: () => T["element"];
82
- getTriggerProps: () => T["button"];
83
- getInputProps: () => T["input"];
84
- getIndicatorProps: (props: IndicatorProps) => T["element"];
85
- }
86
-
87
- declare function connect<T extends PropTypes>(service: ClipboardService, normalize: NormalizeProps<T>): ClipboardApi<T>;
88
-
89
- declare const machine: _zag_js_core.Machine<ClipboardSchema>;
90
-
91
- declare const props: (keyof ClipboardProps)[];
92
- declare const contextProps: <Props extends ClipboardProps>(props: Props) => [ClipboardProps, Omit<Props, keyof ClipboardProps>];
93
- declare const indicatorProps: "copied"[];
94
- declare const splitIndicatorProps: <Props extends IndicatorProps>(props: Props) => [IndicatorProps, Omit<Props, "copied">];
95
-
96
- export { type ClipboardApi as Api, type CopyStatusDetails, type ElementIds, type IndicatorProps, type ClipboardMachine as Machine, type ClipboardProps as Props, type ClipboardService as Service, type ValueChangeDetails, anatomy, connect, contextProps, indicatorProps, machine, props, splitIndicatorProps };
1
+ export { anatomy } from './clipboard.anatomy.js';
2
+ export { connect } from './clipboard.connect.js';
3
+ export { machine } from './clipboard.machine.js';
4
+ export { contextProps, indicatorProps, props, splitIndicatorProps } from './clipboard.props.js';
5
+ export { ClipboardApi as Api, CopyStatusDetails, ElementIds, IndicatorProps, ClipboardMachine as Machine, ClipboardProps as Props, ClipboardService as Service, ValueChangeDetails } from './clipboard.types.js';
6
+ import '@zag-js/anatomy';
7
+ import '@zag-js/types';
8
+ import '@zag-js/core';