@ark-ui/react 0.11.0 → 0.13.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/CHANGELOG.md +30 -11
- package/checkbox/checkbox.cjs +1 -0
- package/checkbox/checkbox.d.ts +1 -1
- package/checkbox/checkbox.mjs +1 -0
- package/checkbox/index.d.ts +2 -2
- package/checkbox/use-checkbox.cjs +8 -3
- package/checkbox/use-checkbox.d.ts +3 -1
- package/checkbox/use-checkbox.mjs +8 -3
- package/editable/editable-cancel-trigger.cjs +1 -1
- package/editable/editable-cancel-trigger.mjs +1 -1
- package/index.cjs +5 -6
- package/index.d.ts +1 -0
- package/index.mjs +2 -3
- package/package.json +41 -41
- package/radio-group/index.cjs +0 -3
- package/radio-group/index.d.ts +3 -9
- package/radio-group/index.mjs +1 -3
- package/radio-group/radio-control.cjs +5 -2
- package/radio-group/radio-control.mjs +6 -3
- package/segment-group/index.cjs +3 -6
- package/segment-group/index.d.ts +9 -15
- package/segment-group/index.mjs +3 -5
- package/segment-group/segment-control.cjs +5 -2
- package/segment-group/segment-control.mjs +6 -3
- package/segment-group/segment-group-indicator.cjs +22 -0
- package/segment-group/{segment-indicator.d.ts → segment-group-indicator.d.ts} +2 -2
- package/segment-group/segment-group-indicator.mjs +18 -0
- package/segment-group/segment-group.anatomy.d.ts +2 -2
- package/switch/switch.cjs +1 -0
- package/switch/switch.mjs +1 -0
- package/switch/use-switch.cjs +8 -3
- package/switch/use-switch.d.ts +3 -1
- package/switch/use-switch.mjs +8 -3
- package/radio-group/radio-input.cjs +0 -21
- package/radio-group/radio-input.d.ts +0 -8
- package/radio-group/radio-input.mjs +0 -17
- package/segment-group/segment-indicator.cjs +0 -20
- package/segment-group/segment-indicator.mjs +0 -16
- package/segment-group/segment-input.cjs +0 -22
- package/segment-group/segment-input.d.ts +0 -8
- package/segment-group/segment-input.mjs +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -6,24 +6,30 @@ description: All notable changes to this project will be documented in this file
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
## [0.
|
|
9
|
+
## [0.13.0] - 2023-08-13
|
|
10
10
|
|
|
11
11
|
### Changed
|
|
12
12
|
|
|
13
|
-
- BREAKING: Renamed `
|
|
13
|
+
- BREAKING: Renamed `SegmentIndicator` to `SegmentGroupIndicator` to match the naming convention of other components.
|
|
14
14
|
|
|
15
|
-
## [0.
|
|
15
|
+
## [0.12.0] - 2023-08-13
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### Added
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
19
|
+
- Added supoort for `defaultChecked` to `Checkbox` component.
|
|
20
|
+
- Added supoort for `defaultChecked` to `Switch` component.
|
|
21
|
+
- Exposed `ark` factory function.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Fixed the display name for `EditableCancelTrigger` component.
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
### Removed
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
- BREAKING: Removed `RadioInput`. This component is no longer required.
|
|
30
|
+
- BREAKING: Removed `SegmentInput`. This component is no longer required.
|
|
31
|
+
|
|
32
|
+
## [0.11.0] - 2023-08-08
|
|
27
33
|
|
|
28
34
|
### Added
|
|
29
35
|
|
|
@@ -31,6 +37,12 @@ description: All notable changes to this project will be documented in this file
|
|
|
31
37
|
- Added `DatePickerPositioner` component to the `DatePicker` component to help with positioning the calendar.
|
|
32
38
|
- Added `ComboboxOptionGroupLabel` to the `Combobox` component. This component can be used to render a label for a group of options in the `ComboboxOptionGroup` component.
|
|
33
39
|
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- BREAKING: Renamed `TagsInputField` to `TagsInputInput` to match the naming convention of other input components.
|
|
43
|
+
- BREAKING: Renamed `NumberInputField` to `NumberInputInput` to match the naming convention of other input components.
|
|
44
|
+
- BREAKING: Renamed `PinInputField` to `PinInputInput` to match the naming convention of other input components.
|
|
45
|
+
|
|
34
46
|
### Removed
|
|
35
47
|
|
|
36
48
|
- BREAKING: Removed `CheckboxInput`. This component is no longer required.
|
|
@@ -173,7 +185,7 @@ description: All notable changes to this project will be documented in this file
|
|
|
173
185
|
- Add `Toast`
|
|
174
186
|
- Add `Tooltip`
|
|
175
187
|
|
|
176
|
-
[unreleased]: https://github.com/chakra-ui/ark/compare/@ark-ui/react@0.
|
|
188
|
+
[unreleased]: https://github.com/chakra-ui/ark/compare/@ark-ui/react@0.13.0...HEAD
|
|
177
189
|
[0.1.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.1.0
|
|
178
190
|
[0.2.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.2.0
|
|
179
191
|
[0.3.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.3.0
|
|
@@ -191,5 +203,12 @@ description: All notable changes to this project will be documented in this file
|
|
|
191
203
|
[0.11.0-beta.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.11.0-beta.0
|
|
192
204
|
[0.11.0-beta.1]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.11.0-beta.1
|
|
193
205
|
[0.11.0-beta.2]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.11.0-beta.2
|
|
194
|
-
|
|
195
206
|
[0.11.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.11.0
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
[0.12.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.12.0
|
|
213
|
+
|
|
214
|
+
[0.13.0]: https://github.com/chakra-ui/ark/releases/tag/@ark-ui/react@0.13.0
|
package/checkbox/checkbox.cjs
CHANGED
package/checkbox/checkbox.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare const Checkbox: ForwardRefExoticComponent<Omit<Omit<Omit<Detailed
|
|
|
10
10
|
ref?: ((instance: HTMLLabelElement | null) => void) | RefObject<HTMLLabelElement> | null | undefined;
|
|
11
11
|
} & {
|
|
12
12
|
asChild?: boolean | undefined;
|
|
13
|
-
}, "ref">, "name" | "value" | "children" | "getRootNode" | "form" | "id" | "ids" | "disabled" | "onChange" | "dir" | "checked" | "required" | "invalid"> & Omit<UseCheckboxProps, "children"> & {
|
|
13
|
+
}, "ref">, "name" | "value" | "children" | "getRootNode" | "form" | "id" | "ids" | "disabled" | "onChange" | "defaultChecked" | "dir" | "checked" | "required" | "invalid"> & Omit<UseCheckboxProps, "children"> & {
|
|
14
14
|
children: ReactNode | ((pages: CheckboxContext) => ReactNode);
|
|
15
15
|
} & RefAttributes<HTMLLabelElement>>;
|
package/checkbox/checkbox.mjs
CHANGED
package/checkbox/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const Checkbox: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLPro
|
|
|
11
11
|
ref?: ((instance: HTMLLabelElement | null) => void) | RefObject<HTMLLabelElement> | null | undefined;
|
|
12
12
|
} & {
|
|
13
13
|
asChild?: boolean | undefined;
|
|
14
|
-
}, "ref">, "name" | "value" | "children" | "getRootNode" | "form" | "id" | "ids" | "disabled" | "onChange" | "dir" | "checked" | "required" | "invalid"> & Omit<UseCheckboxProps, "children"> & {
|
|
14
|
+
}, "ref">, "name" | "value" | "children" | "getRootNode" | "form" | "id" | "ids" | "disabled" | "onChange" | "defaultChecked" | "dir" | "checked" | "required" | "invalid"> & Omit<UseCheckboxProps, "children"> & {
|
|
15
15
|
children: ReactNode | ((pages: PublicApi<JSX.IntrinsicElements & {
|
|
16
16
|
element: HTMLAttributes<HTMLElement>;
|
|
17
17
|
style: CSSProperties;
|
|
@@ -21,7 +21,7 @@ declare const Checkbox: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLPro
|
|
|
21
21
|
ref?: ((instance: HTMLLabelElement | null) => void) | RefObject<HTMLLabelElement> | null | undefined;
|
|
22
22
|
} & {
|
|
23
23
|
asChild?: boolean | undefined;
|
|
24
|
-
}, "ref">, "name" | "value" | "children" | "getRootNode" | "form" | "id" | "ids" | "disabled" | "onChange" | "dir" | "checked" | "required" | "invalid"> & Omit<UseCheckboxProps, "children"> & {
|
|
24
|
+
}, "ref">, "name" | "value" | "children" | "getRootNode" | "form" | "id" | "ids" | "disabled" | "onChange" | "defaultChecked" | "dir" | "checked" | "required" | "invalid"> & Omit<UseCheckboxProps, "children"> & {
|
|
25
25
|
children: ReactNode | ((pages: PublicApi<JSX.IntrinsicElements & {
|
|
26
26
|
element: HTMLAttributes<HTMLElement>;
|
|
27
27
|
style: CSSProperties;
|
|
@@ -30,12 +30,17 @@ const checkbox__namespace = /*#__PURE__*/_interopNamespaceDefault(checkbox);
|
|
|
30
30
|
|
|
31
31
|
const useCheckbox = (props) => {
|
|
32
32
|
const getRootNode = environmentContext.useEnvironmentContext();
|
|
33
|
-
const
|
|
33
|
+
const initialContext = {
|
|
34
34
|
id: react.useId(),
|
|
35
35
|
getRootNode,
|
|
36
|
-
...props
|
|
36
|
+
...props,
|
|
37
|
+
checked: props.defaultChecked
|
|
38
|
+
};
|
|
39
|
+
const context = {
|
|
40
|
+
...initialContext,
|
|
41
|
+
checked: props.checked
|
|
37
42
|
};
|
|
38
|
-
const [state, send] = react$1.useMachine(checkbox__namespace.machine(
|
|
43
|
+
const [state, send] = react$1.useMachine(checkbox__namespace.machine(initialContext), { context });
|
|
39
44
|
return checkbox__namespace.connect(state, send, react$1.normalizeProps);
|
|
40
45
|
};
|
|
41
46
|
|
|
@@ -2,7 +2,9 @@ import { HTMLAttributes, CSSProperties } from 'react';
|
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import * as checkbox from '@zag-js/checkbox';
|
|
4
4
|
import { type Optional } from '../types';
|
|
5
|
-
export type UseCheckboxProps = Optional<checkbox.Context, 'id'
|
|
5
|
+
export type UseCheckboxProps = Optional<checkbox.Context, 'id'> & {
|
|
6
|
+
defaultChecked?: boolean;
|
|
7
|
+
};
|
|
6
8
|
export type UseCheckboxReturn = ReturnType<typeof useCheckbox>;
|
|
7
9
|
export declare const useCheckbox: (props: UseCheckboxProps) => checkbox.PublicApi<JSX.IntrinsicElements & {
|
|
8
10
|
element: HTMLAttributes<HTMLElement>;
|
|
@@ -7,12 +7,17 @@ import { useEnvironmentContext } from '../environment/environment-context.mjs';
|
|
|
7
7
|
|
|
8
8
|
const useCheckbox = (props) => {
|
|
9
9
|
const getRootNode = useEnvironmentContext();
|
|
10
|
-
const
|
|
10
|
+
const initialContext = {
|
|
11
11
|
id: useId(),
|
|
12
12
|
getRootNode,
|
|
13
|
-
...props
|
|
13
|
+
...props,
|
|
14
|
+
checked: props.defaultChecked
|
|
15
|
+
};
|
|
16
|
+
const context = {
|
|
17
|
+
...initialContext,
|
|
18
|
+
checked: props.checked
|
|
14
19
|
};
|
|
15
|
-
const [state, send] = useMachine(checkbox.machine(
|
|
20
|
+
const [state, send] = useMachine(checkbox.machine(initialContext), { context });
|
|
16
21
|
return checkbox.connect(state, send, normalizeProps);
|
|
17
22
|
};
|
|
18
23
|
|
|
@@ -16,6 +16,6 @@ const EditableCancelTrigger = react.forwardRef(
|
|
|
16
16
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
|
-
EditableCancelTrigger.displayName = "
|
|
19
|
+
EditableCancelTrigger.displayName = "EditableCancelTrigger";
|
|
20
20
|
|
|
21
21
|
exports.EditableCancelTrigger = EditableCancelTrigger;
|
|
@@ -12,6 +12,6 @@ const EditableCancelTrigger = forwardRef(
|
|
|
12
12
|
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
|
-
EditableCancelTrigger.displayName = "
|
|
15
|
+
EditableCancelTrigger.displayName = "EditableCancelTrigger";
|
|
16
16
|
|
|
17
17
|
export { EditableCancelTrigger };
|
package/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const index$6 = require('./date-picker/index.cjs');
|
|
|
14
14
|
const index$7 = require('./dialog/index.cjs');
|
|
15
15
|
const index$8 = require('./editable/index.cjs');
|
|
16
16
|
const index$9 = require('./environment/index.cjs');
|
|
17
|
+
const factory = require('./factory.cjs');
|
|
17
18
|
const index$a = require('./hover-card/index.cjs');
|
|
18
19
|
const index$b = require('./menu/index.cjs');
|
|
19
20
|
const index$c = require('./number-input/index.cjs');
|
|
@@ -190,7 +191,6 @@ const usePressable = require('./pressable/use-pressable.cjs');
|
|
|
190
191
|
const radio = require('./radio-group/radio.cjs');
|
|
191
192
|
const radioControl = require('./radio-group/radio-control.cjs');
|
|
192
193
|
const radioGroupLabel = require('./radio-group/radio-group-label.cjs');
|
|
193
|
-
const radioInput = require('./radio-group/radio-input.cjs');
|
|
194
194
|
const radioLabel = require('./radio-group/radio-label.cjs');
|
|
195
195
|
const radio$1 = require('@zag-js/radio-group');
|
|
196
196
|
const radioContext = require('./radio-group/radio-context.cjs');
|
|
@@ -213,9 +213,8 @@ const ratingContext = require('./rating-group/rating-context.cjs');
|
|
|
213
213
|
const ratingGroupContext = require('./rating-group/rating-group-context.cjs');
|
|
214
214
|
const segment = require('./segment-group/segment.cjs');
|
|
215
215
|
const segmentControl = require('./segment-group/segment-control.cjs');
|
|
216
|
+
const segmentGroupIndicator = require('./segment-group/segment-group-indicator.cjs');
|
|
216
217
|
const segmentGroupLabel = require('./segment-group/segment-group-label.cjs');
|
|
217
|
-
const segmentIndicator = require('./segment-group/segment-indicator.cjs');
|
|
218
|
-
const segmentInput = require('./segment-group/segment-input.cjs');
|
|
219
218
|
const segmentLabel = require('./segment-group/segment-label.cjs');
|
|
220
219
|
const segmentGroup_anatomy = require('./segment-group/segment-group.anatomy.cjs');
|
|
221
220
|
const segmentContext = require('./segment-group/segment-context.cjs');
|
|
@@ -301,6 +300,8 @@ exports.DatePicker = index$6.DatePicker;
|
|
|
301
300
|
exports.Dialog = index$7.Dialog;
|
|
302
301
|
exports.Editable = index$8.Editable;
|
|
303
302
|
exports.Environment = index$9.Environment;
|
|
303
|
+
exports.ark = factory.ark;
|
|
304
|
+
exports.jsxFactory = factory.jsxFactory;
|
|
304
305
|
exports.HoverCard = index$a.HoverCard;
|
|
305
306
|
exports.Menu = index$b.Menu;
|
|
306
307
|
exports.NumberInput = index$c.NumberInput;
|
|
@@ -510,7 +511,6 @@ exports.usePressable = usePressable.usePressable;
|
|
|
510
511
|
exports.Radio = radio.Radio;
|
|
511
512
|
exports.RadioControl = radioControl.RadioControl;
|
|
512
513
|
exports.RadioGroupLabel = radioGroupLabel.RadioGroupLabel;
|
|
513
|
-
exports.RadioInput = radioInput.RadioInput;
|
|
514
514
|
exports.RadioLabel = radioLabel.RadioLabel;
|
|
515
515
|
Object.defineProperty(exports, 'radioGroupAnatomy', {
|
|
516
516
|
enumerable: true,
|
|
@@ -542,9 +542,8 @@ exports.useRatingContext = ratingContext.useRatingContext;
|
|
|
542
542
|
exports.useRatingGroupContext = ratingGroupContext.useRatingGroupContext;
|
|
543
543
|
exports.Segment = segment.Segment;
|
|
544
544
|
exports.SegmentControl = segmentControl.SegmentControl;
|
|
545
|
+
exports.SegmentGroupIndicator = segmentGroupIndicator.SegmentGroupIndicator;
|
|
545
546
|
exports.SegmentGroupLabel = segmentGroupLabel.SegmentGroupLabel;
|
|
546
|
-
exports.SegmentIndicator = segmentIndicator.SegmentIndicator;
|
|
547
|
-
exports.SegmentInput = segmentInput.SegmentInput;
|
|
548
547
|
exports.SegmentLabel = segmentLabel.SegmentLabel;
|
|
549
548
|
exports.segmentGroupAnatomy = segmentGroup_anatomy.segmentGroupAnatomy;
|
|
550
549
|
exports.useSegmentContext = segmentContext.useSegmentContext;
|
package/index.d.ts
CHANGED
package/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ export { DatePicker } from './date-picker/index.mjs';
|
|
|
10
10
|
export { Dialog } from './dialog/index.mjs';
|
|
11
11
|
export { Editable } from './editable/index.mjs';
|
|
12
12
|
export { Environment } from './environment/index.mjs';
|
|
13
|
+
export { ark, jsxFactory } from './factory.mjs';
|
|
13
14
|
export { HoverCard } from './hover-card/index.mjs';
|
|
14
15
|
export { Menu } from './menu/index.mjs';
|
|
15
16
|
export { NumberInput } from './number-input/index.mjs';
|
|
@@ -186,7 +187,6 @@ export { usePressable } from './pressable/use-pressable.mjs';
|
|
|
186
187
|
export { Radio } from './radio-group/radio.mjs';
|
|
187
188
|
export { RadioControl } from './radio-group/radio-control.mjs';
|
|
188
189
|
export { RadioGroupLabel } from './radio-group/radio-group-label.mjs';
|
|
189
|
-
export { RadioInput } from './radio-group/radio-input.mjs';
|
|
190
190
|
export { RadioLabel } from './radio-group/radio-label.mjs';
|
|
191
191
|
export { anatomy as radioGroupAnatomy } from '@zag-js/radio-group';
|
|
192
192
|
export { useRadioContext } from './radio-group/radio-context.mjs';
|
|
@@ -209,9 +209,8 @@ export { useRatingContext } from './rating-group/rating-context.mjs';
|
|
|
209
209
|
export { useRatingGroupContext } from './rating-group/rating-group-context.mjs';
|
|
210
210
|
export { Segment } from './segment-group/segment.mjs';
|
|
211
211
|
export { SegmentControl } from './segment-group/segment-control.mjs';
|
|
212
|
+
export { SegmentGroupIndicator } from './segment-group/segment-group-indicator.mjs';
|
|
212
213
|
export { SegmentGroupLabel } from './segment-group/segment-group-label.mjs';
|
|
213
|
-
export { SegmentIndicator } from './segment-group/segment-indicator.mjs';
|
|
214
|
-
export { SegmentInput } from './segment-group/segment-input.mjs';
|
|
215
214
|
export { SegmentLabel } from './segment-group/segment-label.mjs';
|
|
216
215
|
export { segmentGroupAnatomy } from './segment-group/segment-group.anatomy.mjs';
|
|
217
216
|
export { useSegmentContext } from './segment-group/segment-context.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accordion",
|
|
@@ -60,47 +60,47 @@
|
|
|
60
60
|
"release-it": "release-it --config ../../release-it.json"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@zag-js/accordion": "0.
|
|
64
|
-
"@zag-js/anatomy": "0.
|
|
65
|
-
"@zag-js/avatar": "0.
|
|
66
|
-
"@zag-js/carousel": "0.
|
|
67
|
-
"@zag-js/checkbox": "0.
|
|
68
|
-
"@zag-js/color-picker": "0.
|
|
69
|
-
"@zag-js/color-utils": "0.
|
|
70
|
-
"@zag-js/combobox": "0.
|
|
71
|
-
"@zag-js/date-picker": "0.
|
|
72
|
-
"@zag-js/date-utils": "0.
|
|
73
|
-
"@zag-js/dialog": "0.
|
|
74
|
-
"@zag-js/editable": "0.
|
|
75
|
-
"@zag-js/hover-card": "0.
|
|
76
|
-
"@zag-js/menu": "0.
|
|
77
|
-
"@zag-js/number-input": "0.
|
|
78
|
-
"@zag-js/pagination": "0.
|
|
79
|
-
"@zag-js/pin-input": "0.
|
|
80
|
-
"@zag-js/popover": "0.
|
|
81
|
-
"@zag-js/presence": "0.
|
|
82
|
-
"@zag-js/pressable": "0.
|
|
83
|
-
"@zag-js/radio-group": "0.
|
|
84
|
-
"@zag-js/range-slider": "0.
|
|
85
|
-
"@zag-js/rating-group": "0.
|
|
86
|
-
"@zag-js/react": "0.
|
|
87
|
-
"@zag-js/select": "0.
|
|
88
|
-
"@zag-js/slider": "0.
|
|
89
|
-
"@zag-js/splitter": "0.
|
|
90
|
-
"@zag-js/switch": "0.
|
|
91
|
-
"@zag-js/tabs": "0.
|
|
92
|
-
"@zag-js/tags-input": "0.
|
|
93
|
-
"@zag-js/toast": "0.
|
|
94
|
-
"@zag-js/tooltip": "0.
|
|
95
|
-
"@zag-js/types": "0.
|
|
63
|
+
"@zag-js/accordion": "0.16.0",
|
|
64
|
+
"@zag-js/anatomy": "0.16.0",
|
|
65
|
+
"@zag-js/avatar": "0.16.0",
|
|
66
|
+
"@zag-js/carousel": "0.16.0",
|
|
67
|
+
"@zag-js/checkbox": "0.16.0",
|
|
68
|
+
"@zag-js/color-picker": "0.16.0",
|
|
69
|
+
"@zag-js/color-utils": "0.16.0",
|
|
70
|
+
"@zag-js/combobox": "0.16.0",
|
|
71
|
+
"@zag-js/date-picker": "0.16.0",
|
|
72
|
+
"@zag-js/date-utils": "0.16.0",
|
|
73
|
+
"@zag-js/dialog": "0.16.0",
|
|
74
|
+
"@zag-js/editable": "0.16.0",
|
|
75
|
+
"@zag-js/hover-card": "0.16.0",
|
|
76
|
+
"@zag-js/menu": "0.16.0",
|
|
77
|
+
"@zag-js/number-input": "0.16.0",
|
|
78
|
+
"@zag-js/pagination": "0.16.0",
|
|
79
|
+
"@zag-js/pin-input": "0.16.0",
|
|
80
|
+
"@zag-js/popover": "0.16.0",
|
|
81
|
+
"@zag-js/presence": "0.16.0",
|
|
82
|
+
"@zag-js/pressable": "0.16.0",
|
|
83
|
+
"@zag-js/radio-group": "0.16.0",
|
|
84
|
+
"@zag-js/range-slider": "0.16.0",
|
|
85
|
+
"@zag-js/rating-group": "0.16.0",
|
|
86
|
+
"@zag-js/react": "0.16.0",
|
|
87
|
+
"@zag-js/select": "0.16.0",
|
|
88
|
+
"@zag-js/slider": "0.16.0",
|
|
89
|
+
"@zag-js/splitter": "0.16.0",
|
|
90
|
+
"@zag-js/switch": "0.16.0",
|
|
91
|
+
"@zag-js/tabs": "0.16.0",
|
|
92
|
+
"@zag-js/tags-input": "0.16.0",
|
|
93
|
+
"@zag-js/toast": "0.16.0",
|
|
94
|
+
"@zag-js/tooltip": "0.16.0",
|
|
95
|
+
"@zag-js/types": "0.16.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@release-it/keep-a-changelog": "4.0.0",
|
|
99
|
-
"@storybook/addon-a11y": "7.2.
|
|
100
|
-
"@storybook/addon-essentials": "7.2.
|
|
101
|
-
"@storybook/addons": "7.2.
|
|
102
|
-
"@storybook/react": "7.2.
|
|
103
|
-
"@storybook/react-vite": "7.2.
|
|
99
|
+
"@storybook/addon-a11y": "7.2.2",
|
|
100
|
+
"@storybook/addon-essentials": "7.2.2",
|
|
101
|
+
"@storybook/addons": "7.2.2",
|
|
102
|
+
"@storybook/react": "7.2.2",
|
|
103
|
+
"@storybook/react-vite": "7.2.2",
|
|
104
104
|
"@testing-library/dom": "9.3.1",
|
|
105
105
|
"@testing-library/jest-dom": "5.17.0",
|
|
106
106
|
"@testing-library/react": "14.0.0",
|
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
"react": "18.2.0",
|
|
122
122
|
"react-dom": "18.2.0",
|
|
123
123
|
"react-frame-component": "5.2.6",
|
|
124
|
-
"release-it": "16.1.
|
|
124
|
+
"release-it": "16.1.4",
|
|
125
125
|
"resize-observer-polyfill": "1.5.1",
|
|
126
|
-
"storybook": "7.2.
|
|
126
|
+
"storybook": "7.2.2",
|
|
127
127
|
"typescript": "5.1.6",
|
|
128
128
|
"vite": "4.4.9",
|
|
129
129
|
"vite-plugin-dts": "3.5.1",
|
package/radio-group/index.cjs
CHANGED
|
@@ -8,7 +8,6 @@ const radioControl = require('./radio-control.cjs');
|
|
|
8
8
|
const radioGroup = require('./radio-group.cjs');
|
|
9
9
|
const radioGroupContext = require('./radio-group-context.cjs');
|
|
10
10
|
const radioGroupLabel = require('./radio-group-label.cjs');
|
|
11
|
-
const radioInput = require('./radio-input.cjs');
|
|
12
11
|
const radioLabel = require('./radio-label.cjs');
|
|
13
12
|
const radio$1 = require('@zag-js/radio-group');
|
|
14
13
|
|
|
@@ -16,7 +15,6 @@ const RadioGroup = Object.assign(radioGroup.RadioGroup, {
|
|
|
16
15
|
Root: radioGroup.RadioGroup,
|
|
17
16
|
Label: radioGroupLabel.RadioGroupLabel,
|
|
18
17
|
Radio: radio.Radio,
|
|
19
|
-
RadioInput: radioInput.RadioInput,
|
|
20
18
|
RadioLabel: radioLabel.RadioLabel,
|
|
21
19
|
RadioControl: radioControl.RadioControl
|
|
22
20
|
});
|
|
@@ -26,7 +24,6 @@ exports.useRadioContext = radioContext.useRadioContext;
|
|
|
26
24
|
exports.RadioControl = radioControl.RadioControl;
|
|
27
25
|
exports.useRadioGroupContext = radioGroupContext.useRadioGroupContext;
|
|
28
26
|
exports.RadioGroupLabel = radioGroupLabel.RadioGroupLabel;
|
|
29
|
-
exports.RadioInput = radioInput.RadioInput;
|
|
30
27
|
exports.RadioLabel = radioLabel.RadioLabel;
|
|
31
28
|
Object.defineProperty(exports, 'radioGroupAnatomy', {
|
|
32
29
|
enumerable: true,
|
package/radio-group/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from '@zag-js/radio-group';
|
|
2
|
-
import { ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefObject, RefAttributes, LabelHTMLAttributes
|
|
2
|
+
import { ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefObject, RefAttributes, LabelHTMLAttributes } from 'react';
|
|
3
3
|
/// <reference types="react" />
|
|
4
4
|
import { Radio, type RadioProps } from './radio';
|
|
5
5
|
import { useRadioContext } from './radio-context';
|
|
@@ -8,7 +8,6 @@ import { type RadioGroupProps } from './radio-group';
|
|
|
8
8
|
import { useRadioGroupContext } from './radio-group-context';
|
|
9
9
|
import { RadioGroupLabel, type RadioGroupLabelProps } from './radio-group-label';
|
|
10
10
|
import { radioGroupAnatomy } from './radio-group.anatomy';
|
|
11
|
-
import { RadioInput, type RadioInputProps } from './radio-input';
|
|
12
11
|
import { RadioLabel, type RadioLabelProps } from './radio-label';
|
|
13
12
|
declare const RadioGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
13
|
ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -44,11 +43,6 @@ declare const RadioGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLP
|
|
|
44
43
|
readOnly?: boolean | undefined;
|
|
45
44
|
invalid?: boolean | undefined;
|
|
46
45
|
} & RefAttributes<HTMLLabelElement>>;
|
|
47
|
-
RadioInput: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
48
|
-
ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
|
|
49
|
-
} & {
|
|
50
|
-
asChild?: boolean | undefined;
|
|
51
|
-
}, "ref"> & RefAttributes<HTMLInputElement>>;
|
|
52
46
|
RadioLabel: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
53
47
|
ref?: RefObject<HTMLSpanElement> | ((instance: HTMLSpanElement | null) => void) | null | undefined;
|
|
54
48
|
} & {
|
|
@@ -60,5 +54,5 @@ declare const RadioGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLP
|
|
|
60
54
|
asChild?: boolean | undefined;
|
|
61
55
|
}, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
62
56
|
};
|
|
63
|
-
export { Radio, RadioControl, RadioGroup, RadioGroupLabel,
|
|
64
|
-
export type { RadioControlProps, RadioGroupLabelProps, RadioGroupProps,
|
|
57
|
+
export { Radio, RadioControl, RadioGroup, RadioGroupLabel, RadioLabel, radioGroupAnatomy, useRadioContext, useRadioGroupContext, };
|
|
58
|
+
export type { RadioControlProps, RadioGroupLabelProps, RadioGroupProps, RadioLabelProps, RadioProps, };
|
package/radio-group/index.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { RadioControl } from './radio-control.mjs';
|
|
|
4
4
|
import { RadioGroup as RadioGroup$1 } from './radio-group.mjs';
|
|
5
5
|
export { useRadioGroupContext } from './radio-group-context.mjs';
|
|
6
6
|
import { RadioGroupLabel } from './radio-group-label.mjs';
|
|
7
|
-
import { RadioInput } from './radio-input.mjs';
|
|
8
7
|
import { RadioLabel } from './radio-label.mjs';
|
|
9
8
|
export { anatomy as radioGroupAnatomy } from '@zag-js/radio-group';
|
|
10
9
|
|
|
@@ -12,9 +11,8 @@ const RadioGroup = Object.assign(RadioGroup$1, {
|
|
|
12
11
|
Root: RadioGroup$1,
|
|
13
12
|
Label: RadioGroupLabel,
|
|
14
13
|
Radio,
|
|
15
|
-
RadioInput,
|
|
16
14
|
RadioLabel,
|
|
17
15
|
RadioControl
|
|
18
16
|
});
|
|
19
17
|
|
|
20
|
-
export { Radio, RadioControl, RadioGroup, RadioGroupLabel,
|
|
18
|
+
export { Radio, RadioControl, RadioGroup, RadioGroupLabel, RadioLabel };
|
|
@@ -11,10 +11,13 @@ const radioContext = require('./radio-context.cjs');
|
|
|
11
11
|
const radioGroupContext = require('./radio-group-context.cjs');
|
|
12
12
|
|
|
13
13
|
const RadioControl = react.forwardRef((props, ref) => {
|
|
14
|
-
const { getRadioControlProps } = radioGroupContext.useRadioGroupContext();
|
|
14
|
+
const { getRadioControlProps, getRadioHiddenInputProps } = radioGroupContext.useRadioGroupContext();
|
|
15
15
|
const context = radioContext.useRadioContext();
|
|
16
16
|
const mergedProps = react$1.mergeProps(getRadioControlProps(context), props);
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }),
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { ...getRadioHiddenInputProps(context) })
|
|
20
|
+
] });
|
|
18
21
|
});
|
|
19
22
|
RadioControl.displayName = "RadioControl";
|
|
20
23
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { mergeProps } from '@zag-js/react';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { ark } from '../factory.mjs';
|
|
@@ -7,10 +7,13 @@ import { useRadioContext } from './radio-context.mjs';
|
|
|
7
7
|
import { useRadioGroupContext } from './radio-group-context.mjs';
|
|
8
8
|
|
|
9
9
|
const RadioControl = forwardRef((props, ref) => {
|
|
10
|
-
const { getRadioControlProps } = useRadioGroupContext();
|
|
10
|
+
const { getRadioControlProps, getRadioHiddenInputProps } = useRadioGroupContext();
|
|
11
11
|
const context = useRadioContext();
|
|
12
12
|
const mergedProps = mergeProps(getRadioControlProps(context), props);
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }),
|
|
15
|
+
/* @__PURE__ */ jsx("input", { ...getRadioHiddenInputProps(context) })
|
|
16
|
+
] });
|
|
14
17
|
});
|
|
15
18
|
RadioControl.displayName = "RadioControl";
|
|
16
19
|
|
package/segment-group/index.cjs
CHANGED
|
@@ -7,18 +7,16 @@ const segmentContext = require('./segment-context.cjs');
|
|
|
7
7
|
const segmentControl = require('./segment-control.cjs');
|
|
8
8
|
const segmentGroup = require('./segment-group.cjs');
|
|
9
9
|
const segmentGroupContext = require('./segment-group-context.cjs');
|
|
10
|
+
const segmentGroupIndicator = require('./segment-group-indicator.cjs');
|
|
10
11
|
const segmentGroupLabel = require('./segment-group-label.cjs');
|
|
11
12
|
const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
|
|
12
|
-
const segmentIndicator = require('./segment-indicator.cjs');
|
|
13
|
-
const segmentInput = require('./segment-input.cjs');
|
|
14
13
|
const segmentLabel = require('./segment-label.cjs');
|
|
15
14
|
|
|
16
15
|
const SegmentGroup = Object.assign(segmentGroup.SegmentGroup, {
|
|
17
16
|
Root: segmentGroup.SegmentGroup,
|
|
18
17
|
Label: segmentGroupLabel.SegmentGroupLabel,
|
|
18
|
+
Indicator: segmentGroupIndicator.SegmentGroupIndicator,
|
|
19
19
|
Segment: segment.Segment,
|
|
20
|
-
SegmentIndicator: segmentIndicator.SegmentIndicator,
|
|
21
|
-
SegmentInput: segmentInput.SegmentInput,
|
|
22
20
|
SegmentLabel: segmentLabel.SegmentLabel,
|
|
23
21
|
SegmentControl: segmentControl.SegmentControl
|
|
24
22
|
});
|
|
@@ -27,9 +25,8 @@ exports.Segment = segment.Segment;
|
|
|
27
25
|
exports.useSegmentContext = segmentContext.useSegmentContext;
|
|
28
26
|
exports.SegmentControl = segmentControl.SegmentControl;
|
|
29
27
|
exports.useSegmentGroupContext = segmentGroupContext.useSegmentGroupContext;
|
|
28
|
+
exports.SegmentGroupIndicator = segmentGroupIndicator.SegmentGroupIndicator;
|
|
30
29
|
exports.SegmentGroupLabel = segmentGroupLabel.SegmentGroupLabel;
|
|
31
30
|
exports.segmentGroupAnatomy = segmentGroup_anatomy.segmentGroupAnatomy;
|
|
32
|
-
exports.SegmentIndicator = segmentIndicator.SegmentIndicator;
|
|
33
|
-
exports.SegmentInput = segmentInput.SegmentInput;
|
|
34
31
|
exports.SegmentLabel = segmentLabel.SegmentLabel;
|
|
35
32
|
exports.SegmentGroup = SegmentGroup;
|
package/segment-group/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { Context } from '@zag-js/radio-group';
|
|
2
|
-
import { ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefObject, RefAttributes, LabelHTMLAttributes
|
|
2
|
+
import { ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefObject, RefAttributes, LabelHTMLAttributes } from 'react';
|
|
3
3
|
/// <reference types="react" />
|
|
4
4
|
import { Segment, type SegmentProps } from './segment';
|
|
5
5
|
import { useSegmentContext } from './segment-context';
|
|
6
6
|
import { SegmentControl, type SegmentControlProps } from './segment-control';
|
|
7
7
|
import { type SegmentGroupProps } from './segment-group';
|
|
8
8
|
import { useSegmentGroupContext } from './segment-group-context';
|
|
9
|
+
import { SegmentGroupIndicator, type SegmentGroupIndicatorProps } from './segment-group-indicator';
|
|
9
10
|
import { SegmentGroupLabel, type SegmentGroupLabelProps } from './segment-group-label';
|
|
10
11
|
import { segmentGroupAnatomy } from './segment-group.anatomy';
|
|
11
|
-
import { SegmentIndicator, type SegmentIndicatorProps } from './segment-indicator';
|
|
12
|
-
import { SegmentInput, type SegmentInputProps } from './segment-input';
|
|
13
12
|
import { SegmentLabel, type SegmentLabelProps } from './segment-label';
|
|
14
13
|
declare const SegmentGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
15
14
|
ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -30,6 +29,11 @@ declare const SegmentGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTM
|
|
|
30
29
|
} & {
|
|
31
30
|
asChild?: boolean | undefined;
|
|
32
31
|
}, "ref"> & RefAttributes<HTMLLabelElement>>;
|
|
32
|
+
Indicator: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
33
|
+
ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
|
|
34
|
+
} & {
|
|
35
|
+
asChild?: boolean | undefined;
|
|
36
|
+
}, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
33
37
|
Segment: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
|
|
34
38
|
ref?: ((instance: HTMLLabelElement | null) => void) | RefObject<HTMLLabelElement> | null | undefined;
|
|
35
39
|
} & {
|
|
@@ -45,16 +49,6 @@ declare const SegmentGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTM
|
|
|
45
49
|
readOnly?: boolean | undefined;
|
|
46
50
|
invalid?: boolean | undefined;
|
|
47
51
|
} & RefAttributes<HTMLLabelElement>>;
|
|
48
|
-
SegmentIndicator: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
49
|
-
ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
|
|
50
|
-
} & {
|
|
51
|
-
asChild?: boolean | undefined;
|
|
52
|
-
}, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
53
|
-
SegmentInput: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
54
|
-
ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
|
|
55
|
-
} & {
|
|
56
|
-
asChild?: boolean | undefined;
|
|
57
|
-
}, "ref"> & RefAttributes<HTMLInputElement>>;
|
|
58
52
|
SegmentLabel: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
59
53
|
ref?: RefObject<HTMLSpanElement> | ((instance: HTMLSpanElement | null) => void) | null | undefined;
|
|
60
54
|
} & {
|
|
@@ -66,5 +60,5 @@ declare const SegmentGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTM
|
|
|
66
60
|
asChild?: boolean | undefined;
|
|
67
61
|
}, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
68
62
|
};
|
|
69
|
-
export { Segment, SegmentControl, SegmentGroup,
|
|
70
|
-
export type { SegmentControlProps, SegmentGroupLabelProps, SegmentGroupProps,
|
|
63
|
+
export { Segment, SegmentControl, SegmentGroup, SegmentGroupIndicator, SegmentGroupLabel, SegmentLabel, segmentGroupAnatomy, useSegmentContext, useSegmentGroupContext, };
|
|
64
|
+
export type { SegmentControlProps, SegmentGroupIndicatorProps, SegmentGroupLabelProps, SegmentGroupProps, SegmentLabelProps, SegmentProps, };
|
package/segment-group/index.mjs
CHANGED
|
@@ -3,20 +3,18 @@ export { useSegmentContext } from './segment-context.mjs';
|
|
|
3
3
|
import { SegmentControl } from './segment-control.mjs';
|
|
4
4
|
import { SegmentGroup as SegmentGroup$1 } from './segment-group.mjs';
|
|
5
5
|
export { useSegmentGroupContext } from './segment-group-context.mjs';
|
|
6
|
+
import { SegmentGroupIndicator } from './segment-group-indicator.mjs';
|
|
6
7
|
import { SegmentGroupLabel } from './segment-group-label.mjs';
|
|
7
8
|
export { segmentGroupAnatomy } from './segment-group.anatomy.mjs';
|
|
8
|
-
import { SegmentIndicator } from './segment-indicator.mjs';
|
|
9
|
-
import { SegmentInput } from './segment-input.mjs';
|
|
10
9
|
import { SegmentLabel } from './segment-label.mjs';
|
|
11
10
|
|
|
12
11
|
const SegmentGroup = Object.assign(SegmentGroup$1, {
|
|
13
12
|
Root: SegmentGroup$1,
|
|
14
13
|
Label: SegmentGroupLabel,
|
|
14
|
+
Indicator: SegmentGroupIndicator,
|
|
15
15
|
Segment,
|
|
16
|
-
SegmentIndicator,
|
|
17
|
-
SegmentInput,
|
|
18
16
|
SegmentLabel,
|
|
19
17
|
SegmentControl
|
|
20
18
|
});
|
|
21
19
|
|
|
22
|
-
export { Segment, SegmentControl, SegmentGroup,
|
|
20
|
+
export { Segment, SegmentControl, SegmentGroup, SegmentGroupIndicator, SegmentGroupLabel, SegmentLabel };
|
|
@@ -12,10 +12,13 @@ const segmentGroupContext = require('./segment-group-context.cjs');
|
|
|
12
12
|
const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
|
|
13
13
|
|
|
14
14
|
const SegmentControl = react.forwardRef((props, ref) => {
|
|
15
|
-
const { getRadioControlProps } = segmentGroupContext.useSegmentGroupContext();
|
|
15
|
+
const { getRadioControlProps, getRadioHiddenInputProps } = segmentGroupContext.useSegmentGroupContext();
|
|
16
16
|
const context = segmentContext.useSegmentContext();
|
|
17
17
|
const mergedProps = react$1.mergeProps(getRadioControlProps(context), props);
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ...segmentGroup_anatomy.parts.radioControl.attrs, ref }),
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { ...getRadioHiddenInputProps(context) })
|
|
21
|
+
] });
|
|
19
22
|
});
|
|
20
23
|
SegmentControl.displayName = "SegmentControl";
|
|
21
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { mergeProps } from '@zag-js/react';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { ark } from '../factory.mjs';
|
|
@@ -8,10 +8,13 @@ import { useSegmentGroupContext } from './segment-group-context.mjs';
|
|
|
8
8
|
import { parts } from './segment-group.anatomy.mjs';
|
|
9
9
|
|
|
10
10
|
const SegmentControl = forwardRef((props, ref) => {
|
|
11
|
-
const { getRadioControlProps } = useSegmentGroupContext();
|
|
11
|
+
const { getRadioControlProps, getRadioHiddenInputProps } = useSegmentGroupContext();
|
|
12
12
|
const context = useSegmentContext();
|
|
13
13
|
const mergedProps = mergeProps(getRadioControlProps(context), props);
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx(ark.div, { ...mergedProps, ...parts.radioControl.attrs, ref }),
|
|
16
|
+
/* @__PURE__ */ jsx("input", { ...getRadioHiddenInputProps(context) })
|
|
17
|
+
] });
|
|
15
18
|
});
|
|
16
19
|
SegmentControl.displayName = "SegmentControl";
|
|
17
20
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const segmentGroupContext = require('./segment-group-context.cjs');
|
|
11
|
+
const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
|
|
12
|
+
|
|
13
|
+
const SegmentGroupIndicator = react.forwardRef(
|
|
14
|
+
(props, ref) => {
|
|
15
|
+
const { indicatorProps } = segmentGroupContext.useSegmentGroupContext();
|
|
16
|
+
const mergedProps = react$1.mergeProps(indicatorProps, props);
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ...segmentGroup_anatomy.parts.indicator.attrs, ref });
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
SegmentGroupIndicator.displayName = "SegmentGroupIndicator";
|
|
21
|
+
|
|
22
|
+
exports.SegmentGroupIndicator = SegmentGroupIndicator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefObject, RefAttributes, type ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { ark } from '../factory';
|
|
3
|
-
export type
|
|
4
|
-
export declare const
|
|
3
|
+
export type SegmentGroupIndicatorProps = ComponentPropsWithoutRef<typeof ark.div>;
|
|
4
|
+
export declare const SegmentGroupIndicator: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
5
5
|
ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
|
|
6
6
|
} & {
|
|
7
7
|
asChild?: boolean | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useSegmentGroupContext } from './segment-group-context.mjs';
|
|
7
|
+
import { parts } from './segment-group.anatomy.mjs';
|
|
8
|
+
|
|
9
|
+
const SegmentGroupIndicator = forwardRef(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const { indicatorProps } = useSegmentGroupContext();
|
|
12
|
+
const mergedProps = mergeProps(indicatorProps, props);
|
|
13
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ...parts.indicator.attrs, ref });
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
SegmentGroupIndicator.displayName = "SegmentGroupIndicator";
|
|
17
|
+
|
|
18
|
+
export { SegmentGroupIndicator };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Anatomy, AnatomyPart } from '@zag-js/anatomy';
|
|
2
|
-
export declare const segmentGroupAnatomy: Anatomy<"label" | "radio" | "root" | "indicator" | "radioLabel" | "radioControl"
|
|
3
|
-
export declare const parts: Record<"label" | "radio" | "root" | "indicator" | "radioLabel" | "radioControl"
|
|
2
|
+
export declare const segmentGroupAnatomy: Anatomy<"label" | "radio" | "root" | "indicator" | "radioLabel" | "radioControl">;
|
|
3
|
+
export declare const parts: Record<"label" | "radio" | "root" | "indicator" | "radioLabel" | "radioControl", AnatomyPart>;
|
package/switch/switch.cjs
CHANGED
|
@@ -15,6 +15,7 @@ const useSwitch = require('./use-switch.cjs');
|
|
|
15
15
|
const Switch = react.forwardRef((props, ref) => {
|
|
16
16
|
const [switchProps, { children, ...labelProps }] = createSplitProps.createSplitProps()(props, [
|
|
17
17
|
"checked",
|
|
18
|
+
"defaultChecked",
|
|
18
19
|
"dir",
|
|
19
20
|
"disabled",
|
|
20
21
|
"focusable",
|
package/switch/switch.mjs
CHANGED
package/switch/use-switch.cjs
CHANGED
|
@@ -30,12 +30,17 @@ const zagSwitch__namespace = /*#__PURE__*/_interopNamespaceDefault(zagSwitch);
|
|
|
30
30
|
|
|
31
31
|
const useSwitch = (props) => {
|
|
32
32
|
const getRootNode = environmentContext.useEnvironmentContext();
|
|
33
|
-
const
|
|
33
|
+
const initialContext = {
|
|
34
34
|
id: react.useId(),
|
|
35
35
|
getRootNode,
|
|
36
|
-
...props
|
|
36
|
+
...props,
|
|
37
|
+
checked: props.defaultChecked
|
|
38
|
+
};
|
|
39
|
+
const context = {
|
|
40
|
+
...initialContext,
|
|
41
|
+
checked: props.checked
|
|
37
42
|
};
|
|
38
|
-
const [state, send] = react$1.useMachine(zagSwitch__namespace.machine(
|
|
43
|
+
const [state, send] = react$1.useMachine(zagSwitch__namespace.machine(initialContext), { context });
|
|
39
44
|
return zagSwitch__namespace.connect(state, send, react$1.normalizeProps);
|
|
40
45
|
};
|
|
41
46
|
|
package/switch/use-switch.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { HTMLAttributes, CSSProperties } from 'react';
|
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import * as zagSwitch from '@zag-js/switch';
|
|
4
4
|
import { type Optional } from '../types';
|
|
5
|
-
export type UseSwitchProps = Optional<zagSwitch.Context, 'id'
|
|
5
|
+
export type UseSwitchProps = Optional<zagSwitch.Context, 'id'> & {
|
|
6
|
+
defaultChecked?: boolean;
|
|
7
|
+
};
|
|
6
8
|
export declare const useSwitch: (props: UseSwitchProps) => zagSwitch.PublicApi<JSX.IntrinsicElements & {
|
|
7
9
|
element: HTMLAttributes<HTMLElement>;
|
|
8
10
|
style: CSSProperties;
|
package/switch/use-switch.mjs
CHANGED
|
@@ -7,12 +7,17 @@ import { useEnvironmentContext } from '../environment/environment-context.mjs';
|
|
|
7
7
|
|
|
8
8
|
const useSwitch = (props) => {
|
|
9
9
|
const getRootNode = useEnvironmentContext();
|
|
10
|
-
const
|
|
10
|
+
const initialContext = {
|
|
11
11
|
id: useId(),
|
|
12
12
|
getRootNode,
|
|
13
|
-
...props
|
|
13
|
+
...props,
|
|
14
|
+
checked: props.defaultChecked
|
|
15
|
+
};
|
|
16
|
+
const context = {
|
|
17
|
+
...initialContext,
|
|
18
|
+
checked: props.checked
|
|
14
19
|
};
|
|
15
|
-
const [state, send] = useMachine(zagSwitch.machine(
|
|
20
|
+
const [state, send] = useMachine(zagSwitch.machine(initialContext), { context });
|
|
16
21
|
return zagSwitch.connect(state, send, normalizeProps);
|
|
17
22
|
};
|
|
18
23
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
-
|
|
6
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
const react$1 = require('@zag-js/react');
|
|
8
|
-
const react = require('react');
|
|
9
|
-
const factory = require('../factory.cjs');
|
|
10
|
-
const radioContext = require('./radio-context.cjs');
|
|
11
|
-
const radioGroupContext = require('./radio-group-context.cjs');
|
|
12
|
-
|
|
13
|
-
const RadioInput = react.forwardRef((props, ref) => {
|
|
14
|
-
const { getRadioInputProps } = radioGroupContext.useRadioGroupContext();
|
|
15
|
-
const context = radioContext.useRadioContext();
|
|
16
|
-
const mergedProps = react$1.mergeProps(getRadioInputProps(context), props);
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.input, { ...mergedProps, ref });
|
|
18
|
-
});
|
|
19
|
-
RadioInput.displayName = "RadioInput";
|
|
20
|
-
|
|
21
|
-
exports.RadioInput = RadioInput;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, DetailedHTMLProps, InputHTMLAttributes, RefObject, RefAttributes, type ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { ark } from '../factory';
|
|
3
|
-
export type RadioInputProps = ComponentPropsWithoutRef<typeof ark.input>;
|
|
4
|
-
export declare const RadioInput: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
5
|
-
ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
|
|
6
|
-
} & {
|
|
7
|
-
asChild?: boolean | undefined;
|
|
8
|
-
}, "ref"> & RefAttributes<HTMLInputElement>>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { mergeProps } from '@zag-js/react';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
-
import { ark } from '../factory.mjs';
|
|
6
|
-
import { useRadioContext } from './radio-context.mjs';
|
|
7
|
-
import { useRadioGroupContext } from './radio-group-context.mjs';
|
|
8
|
-
|
|
9
|
-
const RadioInput = forwardRef((props, ref) => {
|
|
10
|
-
const { getRadioInputProps } = useRadioGroupContext();
|
|
11
|
-
const context = useRadioContext();
|
|
12
|
-
const mergedProps = mergeProps(getRadioInputProps(context), props);
|
|
13
|
-
return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });
|
|
14
|
-
});
|
|
15
|
-
RadioInput.displayName = "RadioInput";
|
|
16
|
-
|
|
17
|
-
export { RadioInput };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
-
|
|
6
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
const react$1 = require('@zag-js/react');
|
|
8
|
-
const react = require('react');
|
|
9
|
-
const factory = require('../factory.cjs');
|
|
10
|
-
const segmentGroupContext = require('./segment-group-context.cjs');
|
|
11
|
-
const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
|
|
12
|
-
|
|
13
|
-
const SegmentIndicator = react.forwardRef((props, ref) => {
|
|
14
|
-
const { indicatorProps } = segmentGroupContext.useSegmentGroupContext();
|
|
15
|
-
const mergedProps = react$1.mergeProps(indicatorProps, props);
|
|
16
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ...segmentGroup_anatomy.parts.indicator.attrs, ref });
|
|
17
|
-
});
|
|
18
|
-
SegmentIndicator.displayName = "SegmentIndicator";
|
|
19
|
-
|
|
20
|
-
exports.SegmentIndicator = SegmentIndicator;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { mergeProps } from '@zag-js/react';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
-
import { ark } from '../factory.mjs';
|
|
6
|
-
import { useSegmentGroupContext } from './segment-group-context.mjs';
|
|
7
|
-
import { parts } from './segment-group.anatomy.mjs';
|
|
8
|
-
|
|
9
|
-
const SegmentIndicator = forwardRef((props, ref) => {
|
|
10
|
-
const { indicatorProps } = useSegmentGroupContext();
|
|
11
|
-
const mergedProps = mergeProps(indicatorProps, props);
|
|
12
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ...parts.indicator.attrs, ref });
|
|
13
|
-
});
|
|
14
|
-
SegmentIndicator.displayName = "SegmentIndicator";
|
|
15
|
-
|
|
16
|
-
export { SegmentIndicator };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
-
|
|
6
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
const react$1 = require('@zag-js/react');
|
|
8
|
-
const react = require('react');
|
|
9
|
-
const factory = require('../factory.cjs');
|
|
10
|
-
const segmentContext = require('./segment-context.cjs');
|
|
11
|
-
const segmentGroupContext = require('./segment-group-context.cjs');
|
|
12
|
-
const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
|
|
13
|
-
|
|
14
|
-
const SegmentInput = react.forwardRef((props, ref) => {
|
|
15
|
-
const { getRadioInputProps } = segmentGroupContext.useSegmentGroupContext();
|
|
16
|
-
const context = segmentContext.useSegmentContext();
|
|
17
|
-
const mergedProps = react$1.mergeProps(getRadioInputProps(context), props);
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.input, { ...mergedProps, ...segmentGroup_anatomy.parts.radioInput.attrs, ref });
|
|
19
|
-
});
|
|
20
|
-
SegmentInput.displayName = "SegmentInput";
|
|
21
|
-
|
|
22
|
-
exports.SegmentInput = SegmentInput;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, DetailedHTMLProps, InputHTMLAttributes, RefObject, RefAttributes, type ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { ark } from '../factory';
|
|
3
|
-
export type SegmentInputProps = ComponentPropsWithoutRef<typeof ark.input>;
|
|
4
|
-
export declare const SegmentInput: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
5
|
-
ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
|
|
6
|
-
} & {
|
|
7
|
-
asChild?: boolean | undefined;
|
|
8
|
-
}, "ref"> & RefAttributes<HTMLInputElement>>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { mergeProps } from '@zag-js/react';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
-
import { ark } from '../factory.mjs';
|
|
6
|
-
import { useSegmentContext } from './segment-context.mjs';
|
|
7
|
-
import { useSegmentGroupContext } from './segment-group-context.mjs';
|
|
8
|
-
import { parts } from './segment-group.anatomy.mjs';
|
|
9
|
-
|
|
10
|
-
const SegmentInput = forwardRef((props, ref) => {
|
|
11
|
-
const { getRadioInputProps } = useSegmentGroupContext();
|
|
12
|
-
const context = useSegmentContext();
|
|
13
|
-
const mergedProps = mergeProps(getRadioInputProps(context), props);
|
|
14
|
-
return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ...parts.radioInput.attrs, ref });
|
|
15
|
-
});
|
|
16
|
-
SegmentInput.displayName = "SegmentInput";
|
|
17
|
-
|
|
18
|
-
export { SegmentInput };
|