@destyler/tabs 0.0.7-beta.7 → 0.0.7-beta.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/index.d.cts DELETED
@@ -1,207 +0,0 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
3
- import * as _zag_js_core from '@zag-js/core';
4
- import { StateMachine, Machine } from '@zag-js/core';
5
-
6
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "list" | "trigger" | "content" | "indicator">;
7
-
8
- interface ValueChangeDetails {
9
- value: string;
10
- }
11
- interface FocusChangeDetails {
12
- focusedValue: string;
13
- }
14
- interface IntlTranslations {
15
- listLabel?: string | undefined;
16
- }
17
- type ElementIds = Partial<{
18
- root: string;
19
- trigger: string;
20
- list: string;
21
- content: string;
22
- indicator: string;
23
- }>;
24
- interface PublicContext extends DirectionProperty, CommonProperties {
25
- /**
26
- * The ids of the elements in the tabs. Useful for composition.
27
- */
28
- ids?: ElementIds | undefined;
29
- /**
30
- * Specifies the localized strings that identifies the accessibility elements and their states
31
- */
32
- translations?: IntlTranslations | undefined;
33
- /**
34
- * Whether the keyboard navigation will loop from last tab to first, and vice versa.
35
- * @default true
36
- */
37
- loopFocus: boolean;
38
- /**
39
- * The selected tab id
40
- */
41
- value: string | null;
42
- /**
43
- * The orientation of the tabs. Can be `horizontal` or `vertical`
44
- * - `horizontal`: only left and right arrow key navigation will work.
45
- * - `vertical`: only up and down arrow key navigation will work.
46
- *
47
- * @default "horizontal"
48
- */
49
- orientation?: 'horizontal' | 'vertical' | undefined;
50
- /**
51
- * The activation mode of the tabs. Can be `manual` or `automatic`
52
- * - `manual`: Tabs are activated when clicked or press `enter` key.
53
- * - `automatic`: Tabs are activated when receiving focus
54
- *
55
- * @default "automatic"
56
- */
57
- activationMode?: 'manual' | 'automatic' | undefined;
58
- /**
59
- * Callback to be called when the selected/active tab changes
60
- */
61
- onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
62
- /**
63
- * Callback to be called when the focused tab changes
64
- */
65
- onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
66
- /**
67
- * Whether the tab is composite
68
- */
69
- composite: boolean;
70
- /**
71
- * Whether the active tab can be deselected when clicking on it.
72
- */
73
- deselectable?: boolean | undefined;
74
- }
75
- type UserDefinedContext = RequiredBy<PublicContext, 'id'>;
76
- type ComputedContext = Readonly<{}>;
77
- interface IndicatorState {
78
- rendered: boolean;
79
- rect: Partial<{
80
- left: string;
81
- top: string;
82
- width: string;
83
- height: string;
84
- }>;
85
- transition: boolean;
86
- }
87
- interface PrivateContext {
88
- /**
89
- * @internal
90
- * The focused tab id
91
- */
92
- focusedValue: string | null;
93
- /**
94
- * @internal
95
- * The active tab indicator details
96
- */
97
- indicatorState: IndicatorState;
98
- /**
99
- * @internal
100
- * Function to clean up the observer for the active tab's rect
101
- */
102
- indicatorCleanup?: VoidFunction | null | undefined;
103
- /**
104
- * @internal
105
- * Whether the radio group is in server-side rendering
106
- */
107
- ssr: boolean;
108
- }
109
- interface MachineContext extends PublicContext, ComputedContext, PrivateContext {
110
- }
111
- interface MachineState {
112
- value: 'idle' | 'focused';
113
- }
114
- type State = StateMachine.State<MachineContext, MachineState>;
115
- type Send = StateMachine.Send<StateMachine.AnyEventObject>;
116
- type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
117
- interface TriggerProps {
118
- /**
119
- * The value of the tab
120
- */
121
- value: string;
122
- /**
123
- * Whether the tab is disabled
124
- */
125
- disabled?: boolean | undefined;
126
- }
127
- interface TriggerState {
128
- /**
129
- * Whether the tab is selected
130
- */
131
- selected: boolean;
132
- /**
133
- * Whether the tab is focused
134
- */
135
- focused: boolean;
136
- /**
137
- * Whether the tab is disabled
138
- */
139
- disabled: boolean;
140
- }
141
- interface ContentProps {
142
- /**
143
- * The value of the tab
144
- */
145
- value: string;
146
- }
147
- interface MachineApi<T extends PropTypes = PropTypes> {
148
- /**
149
- * The current value of the tabs.
150
- */
151
- value: string | null;
152
- /**
153
- * The value of the tab that is currently focused.
154
- */
155
- focusedValue: string | null;
156
- /**
157
- * Sets the value of the tabs.
158
- */
159
- setValue: (value: string) => void;
160
- /**
161
- * Clears the value of the tabs.
162
- */
163
- clearValue: () => void;
164
- /**
165
- * Sets the indicator rect to the tab with the given value
166
- */
167
- setIndicatorRect: (value: string) => void;
168
- /**
169
- * Synchronizes the tab index of the content element.
170
- * Useful when rendering tabs within a select or combobox
171
- */
172
- syncTabIndex: () => void;
173
- /**
174
- * Set focus on the selected tab trigger
175
- */
176
- focus: () => void;
177
- /**
178
- * Selects the next tab
179
- */
180
- selectNext: (fromValue?: string) => void;
181
- /**
182
- * Selects the previous tab
183
- */
184
- selectPrev: (fromValue?: string) => void;
185
- /**
186
- * Returns the state of the trigger with the given props
187
- */
188
- getTriggerState: (props: TriggerProps) => TriggerState;
189
- getRootProps: () => T['element'];
190
- getListProps: () => T['element'];
191
- getTriggerProps: (props: TriggerProps) => T['button'];
192
- getContentProps: (props: ContentProps) => T['element'];
193
- getIndicatorProps: () => T['element'];
194
- }
195
-
196
- declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>;
197
-
198
- declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
199
-
200
- declare const props: ("ids" | "translations" | "loopFocus" | "value" | "orientation" | "activationMode" | "onValueChange" | "onFocusChange" | "composite" | "deselectable" | "id" | "dir" | "getRootNode")[];
201
- declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "ids" | "translations" | "loopFocus" | "value" | "orientation" | "activationMode" | "onValueChange" | "onFocusChange" | "composite" | "deselectable" | "id" | "dir" | "getRootNode">];
202
- declare const triggerProps: (keyof TriggerProps)[];
203
- declare const splitTriggerProps: <Props extends TriggerProps>(props: Props) => [TriggerProps, Omit<Props, keyof TriggerProps>];
204
- declare const contentProps: "value"[];
205
- declare const splitContentProps: <Props extends ContentProps>(props: Props) => [ContentProps, Omit<Props, "value">];
206
-
207
- export { type MachineApi as Api, type ContentProps, type UserDefinedContext as Context, type ElementIds, type FocusChangeDetails, type IntlTranslations, type Service, type TriggerProps, type ValueChangeDetails, anatomy, connect, contentProps, machine, props, splitContentProps, splitProps, splitTriggerProps, triggerProps };
package/dist/index.d.mts DELETED
@@ -1,207 +0,0 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
3
- import * as _zag_js_core from '@zag-js/core';
4
- import { StateMachine, Machine } from '@zag-js/core';
5
-
6
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "list" | "trigger" | "content" | "indicator">;
7
-
8
- interface ValueChangeDetails {
9
- value: string;
10
- }
11
- interface FocusChangeDetails {
12
- focusedValue: string;
13
- }
14
- interface IntlTranslations {
15
- listLabel?: string | undefined;
16
- }
17
- type ElementIds = Partial<{
18
- root: string;
19
- trigger: string;
20
- list: string;
21
- content: string;
22
- indicator: string;
23
- }>;
24
- interface PublicContext extends DirectionProperty, CommonProperties {
25
- /**
26
- * The ids of the elements in the tabs. Useful for composition.
27
- */
28
- ids?: ElementIds | undefined;
29
- /**
30
- * Specifies the localized strings that identifies the accessibility elements and their states
31
- */
32
- translations?: IntlTranslations | undefined;
33
- /**
34
- * Whether the keyboard navigation will loop from last tab to first, and vice versa.
35
- * @default true
36
- */
37
- loopFocus: boolean;
38
- /**
39
- * The selected tab id
40
- */
41
- value: string | null;
42
- /**
43
- * The orientation of the tabs. Can be `horizontal` or `vertical`
44
- * - `horizontal`: only left and right arrow key navigation will work.
45
- * - `vertical`: only up and down arrow key navigation will work.
46
- *
47
- * @default "horizontal"
48
- */
49
- orientation?: 'horizontal' | 'vertical' | undefined;
50
- /**
51
- * The activation mode of the tabs. Can be `manual` or `automatic`
52
- * - `manual`: Tabs are activated when clicked or press `enter` key.
53
- * - `automatic`: Tabs are activated when receiving focus
54
- *
55
- * @default "automatic"
56
- */
57
- activationMode?: 'manual' | 'automatic' | undefined;
58
- /**
59
- * Callback to be called when the selected/active tab changes
60
- */
61
- onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
62
- /**
63
- * Callback to be called when the focused tab changes
64
- */
65
- onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
66
- /**
67
- * Whether the tab is composite
68
- */
69
- composite: boolean;
70
- /**
71
- * Whether the active tab can be deselected when clicking on it.
72
- */
73
- deselectable?: boolean | undefined;
74
- }
75
- type UserDefinedContext = RequiredBy<PublicContext, 'id'>;
76
- type ComputedContext = Readonly<{}>;
77
- interface IndicatorState {
78
- rendered: boolean;
79
- rect: Partial<{
80
- left: string;
81
- top: string;
82
- width: string;
83
- height: string;
84
- }>;
85
- transition: boolean;
86
- }
87
- interface PrivateContext {
88
- /**
89
- * @internal
90
- * The focused tab id
91
- */
92
- focusedValue: string | null;
93
- /**
94
- * @internal
95
- * The active tab indicator details
96
- */
97
- indicatorState: IndicatorState;
98
- /**
99
- * @internal
100
- * Function to clean up the observer for the active tab's rect
101
- */
102
- indicatorCleanup?: VoidFunction | null | undefined;
103
- /**
104
- * @internal
105
- * Whether the radio group is in server-side rendering
106
- */
107
- ssr: boolean;
108
- }
109
- interface MachineContext extends PublicContext, ComputedContext, PrivateContext {
110
- }
111
- interface MachineState {
112
- value: 'idle' | 'focused';
113
- }
114
- type State = StateMachine.State<MachineContext, MachineState>;
115
- type Send = StateMachine.Send<StateMachine.AnyEventObject>;
116
- type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
117
- interface TriggerProps {
118
- /**
119
- * The value of the tab
120
- */
121
- value: string;
122
- /**
123
- * Whether the tab is disabled
124
- */
125
- disabled?: boolean | undefined;
126
- }
127
- interface TriggerState {
128
- /**
129
- * Whether the tab is selected
130
- */
131
- selected: boolean;
132
- /**
133
- * Whether the tab is focused
134
- */
135
- focused: boolean;
136
- /**
137
- * Whether the tab is disabled
138
- */
139
- disabled: boolean;
140
- }
141
- interface ContentProps {
142
- /**
143
- * The value of the tab
144
- */
145
- value: string;
146
- }
147
- interface MachineApi<T extends PropTypes = PropTypes> {
148
- /**
149
- * The current value of the tabs.
150
- */
151
- value: string | null;
152
- /**
153
- * The value of the tab that is currently focused.
154
- */
155
- focusedValue: string | null;
156
- /**
157
- * Sets the value of the tabs.
158
- */
159
- setValue: (value: string) => void;
160
- /**
161
- * Clears the value of the tabs.
162
- */
163
- clearValue: () => void;
164
- /**
165
- * Sets the indicator rect to the tab with the given value
166
- */
167
- setIndicatorRect: (value: string) => void;
168
- /**
169
- * Synchronizes the tab index of the content element.
170
- * Useful when rendering tabs within a select or combobox
171
- */
172
- syncTabIndex: () => void;
173
- /**
174
- * Set focus on the selected tab trigger
175
- */
176
- focus: () => void;
177
- /**
178
- * Selects the next tab
179
- */
180
- selectNext: (fromValue?: string) => void;
181
- /**
182
- * Selects the previous tab
183
- */
184
- selectPrev: (fromValue?: string) => void;
185
- /**
186
- * Returns the state of the trigger with the given props
187
- */
188
- getTriggerState: (props: TriggerProps) => TriggerState;
189
- getRootProps: () => T['element'];
190
- getListProps: () => T['element'];
191
- getTriggerProps: (props: TriggerProps) => T['button'];
192
- getContentProps: (props: ContentProps) => T['element'];
193
- getIndicatorProps: () => T['element'];
194
- }
195
-
196
- declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>;
197
-
198
- declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
199
-
200
- declare const props: ("ids" | "translations" | "loopFocus" | "value" | "orientation" | "activationMode" | "onValueChange" | "onFocusChange" | "composite" | "deselectable" | "id" | "dir" | "getRootNode")[];
201
- declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "ids" | "translations" | "loopFocus" | "value" | "orientation" | "activationMode" | "onValueChange" | "onFocusChange" | "composite" | "deselectable" | "id" | "dir" | "getRootNode">];
202
- declare const triggerProps: (keyof TriggerProps)[];
203
- declare const splitTriggerProps: <Props extends TriggerProps>(props: Props) => [TriggerProps, Omit<Props, keyof TriggerProps>];
204
- declare const contentProps: "value"[];
205
- declare const splitContentProps: <Props extends ContentProps>(props: Props) => [ContentProps, Omit<Props, "value">];
206
-
207
- export { type MachineApi as Api, type ContentProps, type UserDefinedContext as Context, type ElementIds, type FocusChangeDetails, type IntlTranslations, type Service, type TriggerProps, type ValueChangeDetails, anatomy, connect, contentProps, machine, props, splitContentProps, splitProps, splitTriggerProps, triggerProps };