@ark-ui/react 3.2.0 → 3.3.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/README.md +21 -17
- package/dist/components/checkbox/checkbox-group.cjs +27 -0
- package/dist/components/checkbox/checkbox-group.d.cts +8 -0
- package/dist/components/checkbox/checkbox-group.d.ts +8 -0
- package/dist/components/checkbox/checkbox-group.js +23 -0
- package/dist/components/checkbox/checkbox.cjs +2 -0
- package/dist/components/checkbox/checkbox.d.cts +1 -0
- package/dist/components/checkbox/checkbox.d.ts +1 -0
- package/dist/components/checkbox/checkbox.js +1 -0
- package/dist/components/checkbox/index.cjs +6 -0
- package/dist/components/checkbox/index.d.cts +3 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/checkbox/index.js +3 -0
- package/dist/components/checkbox/use-checkbox-group-context.cjs +16 -0
- package/dist/components/checkbox/use-checkbox-group-context.d.cts +6 -0
- package/dist/components/checkbox/use-checkbox-group-context.d.ts +6 -0
- package/dist/components/checkbox/use-checkbox-group-context.js +11 -0
- package/dist/components/checkbox/use-checkbox-group.cjs +60 -0
- package/dist/components/checkbox/use-checkbox-group.d.cts +41 -0
- package/dist/components/checkbox/use-checkbox-group.d.ts +41 -0
- package/dist/components/checkbox/use-checkbox-group.js +56 -0
- package/dist/components/checkbox/use-checkbox.cjs +6 -1
- package/dist/components/checkbox/use-checkbox.d.cts +1 -1
- package/dist/components/checkbox/use-checkbox.d.ts +1 -1
- package/dist/components/checkbox/use-checkbox.js +8 -3
- package/dist/components/combobox/combobox-list.cjs +19 -0
- package/dist/components/combobox/combobox-list.d.cts +6 -0
- package/dist/components/combobox/combobox-list.d.ts +6 -0
- package/dist/components/combobox/combobox-list.js +15 -0
- package/dist/components/combobox/combobox.cjs +2 -0
- package/dist/components/combobox/combobox.d.cts +1 -0
- package/dist/components/combobox/combobox.d.ts +1 -0
- package/dist/components/combobox/combobox.js +1 -0
- package/dist/components/combobox/index.cjs +2 -0
- package/dist/components/combobox/index.d.cts +1 -0
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/hover-card/use-hover-card.cjs +1 -1
- package/dist/components/hover-card/use-hover-card.js +1 -1
- package/dist/components/index.cjs +50 -0
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +27 -0
- package/dist/components/menu/use-menu-item-group-context.d.cts +0 -1
- package/dist/components/menu/use-menu-item-group-context.d.ts +0 -1
- package/dist/components/popover/use-popover.cjs +1 -1
- package/dist/components/popover/use-popover.js +1 -1
- package/dist/components/presence/split-presence-props.cjs +1 -0
- package/dist/components/presence/split-presence-props.d.cts +1 -1
- package/dist/components/presence/split-presence-props.d.ts +1 -1
- package/dist/components/presence/split-presence-props.js +1 -0
- package/dist/components/qr-code/index.cjs +25 -0
- package/dist/components/qr-code/index.d.cts +10 -0
- package/dist/components/qr-code/index.d.ts +10 -0
- package/dist/components/qr-code/index.js +10 -0
- package/dist/components/qr-code/qr-code-context.cjs +10 -0
- package/dist/components/qr-code/qr-code-context.d.cts +7 -0
- package/dist/components/qr-code/qr-code-context.d.ts +7 -0
- package/dist/components/qr-code/qr-code-context.js +6 -0
- package/dist/components/qr-code/qr-code-frame.cjs +19 -0
- package/dist/components/qr-code/qr-code-frame.d.cts +6 -0
- package/dist/components/qr-code/qr-code-frame.d.ts +6 -0
- package/dist/components/qr-code/qr-code-frame.js +15 -0
- package/dist/components/qr-code/qr-code-overlay.cjs +19 -0
- package/dist/components/qr-code/qr-code-overlay.d.cts +6 -0
- package/dist/components/qr-code/qr-code-overlay.d.ts +6 -0
- package/dist/components/qr-code/qr-code-overlay.js +15 -0
- package/dist/components/qr-code/qr-code-pattern.cjs +19 -0
- package/dist/components/qr-code/qr-code-pattern.d.cts +6 -0
- package/dist/components/qr-code/qr-code-pattern.d.ts +6 -0
- package/dist/components/qr-code/qr-code-pattern.js +15 -0
- package/dist/components/qr-code/qr-code-root-provider.cjs +22 -0
- package/dist/components/qr-code/qr-code-root-provider.d.cts +11 -0
- package/dist/components/qr-code/qr-code-root-provider.d.ts +11 -0
- package/dist/components/qr-code/qr-code-root-provider.js +18 -0
- package/dist/components/qr-code/qr-code-root.cjs +27 -0
- package/dist/components/qr-code/qr-code-root.d.cts +8 -0
- package/dist/components/qr-code/qr-code-root.d.ts +8 -0
- package/dist/components/qr-code/qr-code-root.js +23 -0
- package/dist/components/qr-code/qr-code.cjs +19 -0
- package/dist/components/qr-code/qr-code.d.cts +7 -0
- package/dist/components/qr-code/qr-code.d.ts +7 -0
- package/dist/components/qr-code/qr-code.js +6 -0
- package/dist/components/qr-code/use-qr-code-context.cjs +15 -0
- package/dist/components/qr-code/use-qr-code-context.d.cts +6 -0
- package/dist/components/qr-code/use-qr-code-context.d.ts +6 -0
- package/dist/components/qr-code/use-qr-code-context.js +10 -0
- package/dist/components/qr-code/use-qr-code.cjs +44 -0
- package/dist/components/qr-code/use-qr-code.d.cts +8 -0
- package/dist/components/qr-code/use-qr-code.d.ts +8 -0
- package/dist/components/qr-code/use-qr-code.js +21 -0
- package/dist/components/select/index.cjs +2 -0
- package/dist/components/select/index.d.cts +1 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/select-list.cjs +19 -0
- package/dist/components/select/select-list.d.cts +6 -0
- package/dist/components/select/select-list.d.ts +6 -0
- package/dist/components/select/select-list.js +15 -0
- package/dist/components/select/select.cjs +2 -0
- package/dist/components/select/select.d.cts +1 -0
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +1 -0
- package/dist/components/signature-pad/index.cjs +29 -0
- package/dist/components/signature-pad/index.d.cts +12 -0
- package/dist/components/signature-pad/index.d.ts +12 -0
- package/dist/components/signature-pad/index.js +12 -0
- package/dist/components/signature-pad/signature-pad-clear-trigger.cjs +19 -0
- package/dist/components/signature-pad/signature-pad-clear-trigger.d.cts +6 -0
- package/dist/components/signature-pad/signature-pad-clear-trigger.d.ts +6 -0
- package/dist/components/signature-pad/signature-pad-clear-trigger.js +15 -0
- package/dist/components/signature-pad/signature-pad-context.cjs +10 -0
- package/dist/components/signature-pad/signature-pad-context.d.cts +7 -0
- package/dist/components/signature-pad/signature-pad-context.d.ts +7 -0
- package/dist/components/signature-pad/signature-pad-context.js +6 -0
- package/dist/components/signature-pad/signature-pad-control.cjs +21 -0
- package/dist/components/signature-pad/signature-pad-control.d.cts +6 -0
- package/dist/components/signature-pad/signature-pad-control.d.ts +6 -0
- package/dist/components/signature-pad/signature-pad-control.js +17 -0
- package/dist/components/signature-pad/signature-pad-guide.cjs +21 -0
- package/dist/components/signature-pad/signature-pad-guide.d.cts +6 -0
- package/dist/components/signature-pad/signature-pad-guide.d.ts +6 -0
- package/dist/components/signature-pad/signature-pad-guide.js +17 -0
- package/dist/components/signature-pad/signature-pad-label.cjs +21 -0
- package/dist/components/signature-pad/signature-pad-label.d.cts +6 -0
- package/dist/components/signature-pad/signature-pad-label.d.ts +6 -0
- package/dist/components/signature-pad/signature-pad-label.js +17 -0
- package/dist/components/signature-pad/signature-pad-root-provider.cjs +24 -0
- package/dist/components/signature-pad/signature-pad-root-provider.d.cts +11 -0
- package/dist/components/signature-pad/signature-pad-root-provider.d.ts +11 -0
- package/dist/components/signature-pad/signature-pad-root-provider.js +20 -0
- package/dist/components/signature-pad/signature-pad-root.cjs +31 -0
- package/dist/components/signature-pad/signature-pad-root.d.cts +8 -0
- package/dist/components/signature-pad/signature-pad-root.d.ts +8 -0
- package/dist/components/signature-pad/signature-pad-root.js +27 -0
- package/dist/components/signature-pad/signature-pad-segment.cjs +25 -0
- package/dist/components/signature-pad/signature-pad-segment.d.cts +6 -0
- package/dist/components/signature-pad/signature-pad-segment.d.ts +6 -0
- package/dist/components/signature-pad/signature-pad-segment.js +21 -0
- package/dist/components/signature-pad/signature-pad.cjs +23 -0
- package/dist/components/signature-pad/signature-pad.d.cts +9 -0
- package/dist/components/signature-pad/signature-pad.d.ts +9 -0
- package/dist/components/signature-pad/signature-pad.js +8 -0
- package/dist/components/signature-pad/use-signature-pad-context.cjs +17 -0
- package/dist/components/signature-pad/use-signature-pad-context.d.cts +6 -0
- package/dist/components/signature-pad/use-signature-pad-context.d.ts +6 -0
- package/dist/components/signature-pad/use-signature-pad-context.js +12 -0
- package/dist/components/signature-pad/use-signature-pad.cjs +51 -0
- package/dist/components/signature-pad/use-signature-pad.d.cts +9 -0
- package/dist/components/signature-pad/use-signature-pad.d.ts +9 -0
- package/dist/components/signature-pad/use-signature-pad.js +28 -0
- package/dist/components/tabs/tab-content.cjs +2 -1
- package/dist/components/tabs/tab-content.js +2 -1
- package/dist/components/tree-view/use-tree-view-depth-context.d.cts +0 -1
- package/dist/components/tree-view/use-tree-view-depth-context.d.ts +0 -1
- package/dist/components/tree-view/use-tree-view.cjs +2 -0
- package/dist/components/tree-view/use-tree-view.js +2 -0
- package/dist/index.cjs +50 -0
- package/dist/index.js +27 -0
- package/dist/providers/environment/use-environment-context.d.cts +0 -1
- package/dist/providers/environment/use-environment-context.d.ts +0 -1
- package/dist/utils/compose-refs.d.cts +0 -1
- package/dist/utils/compose-refs.d.ts +0 -1
- package/dist/utils/create-context.d.cts +0 -1
- package/dist/utils/create-context.d.ts +0 -1
- package/dist/utils/render-strategy.d.cts +0 -1
- package/dist/utils/render-strategy.d.ts +0 -1
- package/dist/utils/use-controllable-state.cjs +26 -0
- package/dist/utils/use-controllable-state.d.cts +1 -1
- package/dist/utils/use-controllable-state.d.ts +1 -1
- package/dist/utils/use-controllable-state.js +22 -0
- package/package.json +74 -49
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="License" src="https://img.shields.io/npm/l/@ark-ui/react?style=for-the-badge" />
|
|
3
|
+
<img alt="GitHub stars" src="https://img.shields.io/github/stars/chakra-ui/ark?logo=github&style=for-the-badge" />
|
|
4
|
+
<img alt="Downloads" src="https://img.shields.io/npm/dt/@ark-ui/react?style=for-the-badge" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
1
7
|
# Welcome to Ark UI
|
|
2
8
|
|
|
3
9
|
Ark UI is a headless, open-source UI library with over 30+ components designed for building
|
|
@@ -18,6 +24,8 @@ Ark UI is available for the following JavaScript frameworks:
|
|
|
18
24
|
- [Avatar](https://ark-ui.com/react/docs/components/avatar)
|
|
19
25
|
- [Carousel](https://ark-ui.com/react/docs/components/carousel)
|
|
20
26
|
- [Checkbox](https://ark-ui.com/react/docs/components/checkbox)
|
|
27
|
+
- [Clipboard](https://ark-ui.com/react/docs/components/clipboard)
|
|
28
|
+
- [Collapsible](https://ark-ui.com/react/docs/components/collapsible)
|
|
21
29
|
- [Color Picker](https://ark-ui.com/react/docs/components/color-picker)
|
|
22
30
|
- [Combobox](https://ark-ui.com/react/docs/components/combobox)
|
|
23
31
|
- [Date Picker](https://ark-ui.com/react/docs/components/date-picker)
|
|
@@ -30,12 +38,14 @@ Ark UI is available for the following JavaScript frameworks:
|
|
|
30
38
|
- [Pagination](https://ark-ui.com/react/docs/components/pagination)
|
|
31
39
|
- [Pin Input](https://ark-ui.com/react/docs/components/pin-input)
|
|
32
40
|
- [Popover](https://ark-ui.com/react/docs/components/popover)
|
|
33
|
-
- [Progress](https://ark-ui.com/react/docs/components/progress)
|
|
41
|
+
- [Progress - Circular](https://ark-ui.com/react/docs/components/progress-circular)
|
|
42
|
+
- [Progress - Linear](https://ark-ui.com/react/docs/components/progress-linear)
|
|
43
|
+
- [QR Code](https://ark-ui.com/react/docs/components/qr-code)
|
|
34
44
|
- [Radio Group](https://ark-ui.com/react/docs/components/radio-group)
|
|
35
|
-
- [Range Slider](https://ark-ui.com/react/docs/components/slider)
|
|
36
45
|
- [Rating Group](https://ark-ui.com/react/docs/components/rating-group)
|
|
37
46
|
- [Segment Group](https://ark-ui.com/react/docs/components/segment-group)
|
|
38
47
|
- [Select](https://ark-ui.com/react/docs/components/select)
|
|
48
|
+
- [Signature Pad](https://ark-ui.com/react/docs/components/signature-pad)
|
|
39
49
|
- [Slider](https://ark-ui.com/react/docs/components/slider)
|
|
40
50
|
- [Splitter](https://ark-ui.com/react/docs/components/splitter)
|
|
41
51
|
- [Switch](https://ark-ui.com/react/docs/components/switch)
|
|
@@ -65,33 +75,27 @@ yarn add @ark-ui/react
|
|
|
65
75
|
To use a component from `@ark-ui/react`, import it and include it in your application:
|
|
66
76
|
|
|
67
77
|
```tsx
|
|
68
|
-
import { Slider
|
|
78
|
+
import { Slider } from '@ark-ui/react'
|
|
69
79
|
import { useState } from 'react'
|
|
70
|
-
|
|
71
|
-
export const MySlider = (
|
|
72
|
-
const [value, setValue] = useState([
|
|
73
|
-
|
|
80
|
+
|
|
81
|
+
export const MySlider = () => {
|
|
82
|
+
const [value, setValue] = useState([30])
|
|
83
|
+
|
|
74
84
|
return (
|
|
75
85
|
<Slider.Root
|
|
76
|
-
min={
|
|
77
|
-
max={
|
|
86
|
+
min={-50}
|
|
87
|
+
max={50}
|
|
78
88
|
value={value}
|
|
79
89
|
onValueChange={(e) => setValue(e.value)}
|
|
80
|
-
{...props}
|
|
81
90
|
>
|
|
82
91
|
<Slider.Label>Label</Slider.Label>
|
|
83
|
-
<Slider.ValueText
|
|
92
|
+
<Slider.ValueText>{value}</Slider.ValueText>
|
|
84
93
|
<Slider.Control>
|
|
85
94
|
<Slider.Track>
|
|
86
95
|
<Slider.Range />
|
|
87
96
|
</Slider.Track>
|
|
88
|
-
<Slider.Thumb
|
|
97
|
+
<Slider.Thumb index={0} />
|
|
89
98
|
</Slider.Control>
|
|
90
|
-
<Slider.MarkerGroup>
|
|
91
|
-
<Slider.Marker value={25}>25</Slider.Marker>
|
|
92
|
-
<Slider.Marker value={50}>50</Slider.Marker>
|
|
93
|
-
<Slider.Marker value={75}>75</Slider.Marker>
|
|
94
|
-
</Slider.MarkerGroup>
|
|
95
99
|
</Slider.Root>
|
|
96
100
|
)
|
|
97
101
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 anatomy = require('@ark-ui/anatomy');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const createSplitProps = require('../../utils/create-split-props.cjs');
|
|
10
|
+
const factory = require('../factory.cjs');
|
|
11
|
+
const useCheckboxGroup = require('./use-checkbox-group.cjs');
|
|
12
|
+
const useCheckboxGroupContext = require('./use-checkbox-group-context.cjs');
|
|
13
|
+
|
|
14
|
+
const CheckboxGroup = react.forwardRef((props, ref) => {
|
|
15
|
+
const [checkboxGroupProps, localProps] = createSplitProps.createSplitProps()(props, [
|
|
16
|
+
"defaultValue",
|
|
17
|
+
"value",
|
|
18
|
+
"onValueChange",
|
|
19
|
+
"disabled",
|
|
20
|
+
"readOnly"
|
|
21
|
+
]);
|
|
22
|
+
const checkboxGroup = useCheckboxGroup.useCheckboxGroup(checkboxGroupProps);
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(useCheckboxGroupContext.CheckboxGroupContextProvider, { value: checkboxGroup, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ref, ...localProps, ...anatomy.checkboxAnatomy.build().group.attrs }) });
|
|
24
|
+
});
|
|
25
|
+
CheckboxGroup.displayName = "CheckboxGroup";
|
|
26
|
+
|
|
27
|
+
exports.CheckboxGroup = CheckboxGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Assign } from '../../types';
|
|
2
|
+
import { HTMLArkProps } from '../factory';
|
|
3
|
+
import { UseCheckboxGroupProps } from './use-checkbox-group';
|
|
4
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface CheckboxGroupProps extends Assign<HTMLArkProps<'div'>, UseCheckboxGroupProps> {
|
|
7
|
+
}
|
|
8
|
+
export declare const CheckboxGroup: ForwardRefExoticComponent<CheckboxGroupProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Assign } from '../../types';
|
|
2
|
+
import { HTMLArkProps } from '../factory';
|
|
3
|
+
import { UseCheckboxGroupProps } from './use-checkbox-group';
|
|
4
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface CheckboxGroupProps extends Assign<HTMLArkProps<'div'>, UseCheckboxGroupProps> {
|
|
7
|
+
}
|
|
8
|
+
export declare const CheckboxGroup: ForwardRefExoticComponent<CheckboxGroupProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { checkboxAnatomy } from '@ark-ui/anatomy';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { createSplitProps } from '../../utils/create-split-props.js';
|
|
6
|
+
import { ark } from '../factory.js';
|
|
7
|
+
import { useCheckboxGroup } from './use-checkbox-group.js';
|
|
8
|
+
import { CheckboxGroupContextProvider } from './use-checkbox-group-context.js';
|
|
9
|
+
|
|
10
|
+
const CheckboxGroup = forwardRef((props, ref) => {
|
|
11
|
+
const [checkboxGroupProps, localProps] = createSplitProps()(props, [
|
|
12
|
+
"defaultValue",
|
|
13
|
+
"value",
|
|
14
|
+
"onValueChange",
|
|
15
|
+
"disabled",
|
|
16
|
+
"readOnly"
|
|
17
|
+
]);
|
|
18
|
+
const checkboxGroup = useCheckboxGroup(checkboxGroupProps);
|
|
19
|
+
return /* @__PURE__ */ jsx(CheckboxGroupContextProvider, { value: checkboxGroup, children: /* @__PURE__ */ jsx(ark.div, { ref, ...localProps, ...checkboxAnatomy.build().group.attrs }) });
|
|
20
|
+
});
|
|
21
|
+
CheckboxGroup.displayName = "CheckboxGroup";
|
|
22
|
+
|
|
23
|
+
export { CheckboxGroup };
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
const checkboxContext = require('./checkbox-context.cjs');
|
|
6
6
|
const checkboxControl = require('./checkbox-control.cjs');
|
|
7
|
+
const checkboxGroup = require('./checkbox-group.cjs');
|
|
7
8
|
const checkboxHiddenInput = require('./checkbox-hidden-input.cjs');
|
|
8
9
|
const checkboxIndicator = require('./checkbox-indicator.cjs');
|
|
9
10
|
const checkboxLabel = require('./checkbox-label.cjs');
|
|
@@ -14,6 +15,7 @@ const checkboxRootProvider = require('./checkbox-root-provider.cjs');
|
|
|
14
15
|
|
|
15
16
|
exports.Context = checkboxContext.CheckboxContext;
|
|
16
17
|
exports.Control = checkboxControl.CheckboxControl;
|
|
18
|
+
exports.Group = checkboxGroup.CheckboxGroup;
|
|
17
19
|
exports.HiddenInput = checkboxHiddenInput.CheckboxHiddenInput;
|
|
18
20
|
exports.Indicator = checkboxIndicator.CheckboxIndicator;
|
|
19
21
|
exports.Label = checkboxLabel.CheckboxLabel;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CheckedChangeDetails, CheckedState } from '@zag-js/checkbox';
|
|
2
2
|
export { CheckboxContext as Context, type CheckboxContextProps as ContextProps, } from './checkbox-context';
|
|
3
3
|
export { CheckboxControl as Control, type CheckboxControlProps as ControlProps, } from './checkbox-control';
|
|
4
|
+
export { CheckboxGroup as Group, type CheckboxGroupProps as GroupProps } from './checkbox-group';
|
|
4
5
|
export { CheckboxHiddenInput as HiddenInput, type CheckboxHiddenInputProps as HiddenInputProps, } from './checkbox-hidden-input';
|
|
5
6
|
export { CheckboxIndicator as Indicator, type CheckboxIndicatorProps as IndicatorProps, } from './checkbox-indicator';
|
|
6
7
|
export { CheckboxLabel as Label, type CheckboxLabelProps as LabelProps } from './checkbox-label';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CheckedChangeDetails, CheckedState } from '@zag-js/checkbox';
|
|
2
2
|
export { CheckboxContext as Context, type CheckboxContextProps as ContextProps, } from './checkbox-context';
|
|
3
3
|
export { CheckboxControl as Control, type CheckboxControlProps as ControlProps, } from './checkbox-control';
|
|
4
|
+
export { CheckboxGroup as Group, type CheckboxGroupProps as GroupProps } from './checkbox-group';
|
|
4
5
|
export { CheckboxHiddenInput as HiddenInput, type CheckboxHiddenInputProps as HiddenInputProps, } from './checkbox-hidden-input';
|
|
5
6
|
export { CheckboxIndicator as Indicator, type CheckboxIndicatorProps as IndicatorProps, } from './checkbox-indicator';
|
|
6
7
|
export { CheckboxLabel as Label, type CheckboxLabelProps as LabelProps } from './checkbox-label';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CheckboxContext as Context } from './checkbox-context.js';
|
|
2
2
|
export { CheckboxControl as Control } from './checkbox-control.js';
|
|
3
|
+
export { CheckboxGroup as Group } from './checkbox-group.js';
|
|
3
4
|
export { CheckboxHiddenInput as HiddenInput } from './checkbox-hidden-input.js';
|
|
4
5
|
export { CheckboxIndicator as Indicator } from './checkbox-indicator.js';
|
|
5
6
|
export { CheckboxLabel as Label } from './checkbox-label.js';
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
const checkboxContext = require('./checkbox-context.cjs');
|
|
6
6
|
const checkboxControl = require('./checkbox-control.cjs');
|
|
7
|
+
const checkboxGroup = require('./checkbox-group.cjs');
|
|
7
8
|
const checkboxHiddenInput = require('./checkbox-hidden-input.cjs');
|
|
8
9
|
const checkboxIndicator = require('./checkbox-indicator.cjs');
|
|
9
10
|
const checkboxLabel = require('./checkbox-label.cjs');
|
|
@@ -11,12 +12,15 @@ const checkboxRoot = require('./checkbox-root.cjs');
|
|
|
11
12
|
const checkboxRootProvider = require('./checkbox-root-provider.cjs');
|
|
12
13
|
const useCheckbox = require('./use-checkbox.cjs');
|
|
13
14
|
const useCheckboxContext = require('./use-checkbox-context.cjs');
|
|
15
|
+
const useCheckboxGroup = require('./use-checkbox-group.cjs');
|
|
16
|
+
const useCheckboxGroupContext = require('./use-checkbox-group-context.cjs');
|
|
14
17
|
const checkbox = require('./checkbox.cjs');
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
exports.CheckboxContext = checkboxContext.CheckboxContext;
|
|
19
22
|
exports.CheckboxControl = checkboxControl.CheckboxControl;
|
|
23
|
+
exports.CheckboxGroup = checkboxGroup.CheckboxGroup;
|
|
20
24
|
exports.CheckboxHiddenInput = checkboxHiddenInput.CheckboxHiddenInput;
|
|
21
25
|
exports.CheckboxIndicator = checkboxIndicator.CheckboxIndicator;
|
|
22
26
|
exports.CheckboxLabel = checkboxLabel.CheckboxLabel;
|
|
@@ -24,4 +28,6 @@ exports.CheckboxRoot = checkboxRoot.CheckboxRoot;
|
|
|
24
28
|
exports.CheckboxRootProvider = checkboxRootProvider.CheckboxRootProvider;
|
|
25
29
|
exports.useCheckbox = useCheckbox.useCheckbox;
|
|
26
30
|
exports.useCheckboxContext = useCheckboxContext.useCheckboxContext;
|
|
31
|
+
exports.useCheckboxGroup = useCheckboxGroup.useCheckboxGroup;
|
|
32
|
+
exports.useCheckboxGroupContext = useCheckboxGroupContext.useCheckboxGroupContext;
|
|
27
33
|
exports.Checkbox = checkbox;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CheckedChangeDetails as CheckboxCheckedChangeDetails, CheckedState as CheckboxCheckedState, } from '@zag-js/checkbox';
|
|
2
2
|
export { CheckboxContext, type CheckboxContextProps } from './checkbox-context';
|
|
3
3
|
export { CheckboxControl, type CheckboxControlProps } from './checkbox-control';
|
|
4
|
+
export { CheckboxGroup, type CheckboxGroupProps } from './checkbox-group';
|
|
4
5
|
export { CheckboxHiddenInput, type CheckboxHiddenInputProps } from './checkbox-hidden-input';
|
|
5
6
|
export { CheckboxIndicator, type CheckboxIndicatorProps } from './checkbox-indicator';
|
|
6
7
|
export { CheckboxLabel, type CheckboxLabelProps } from './checkbox-label';
|
|
@@ -8,4 +9,6 @@ export { CheckboxRoot, type CheckboxRootProps } from './checkbox-root';
|
|
|
8
9
|
export { CheckboxRootProvider, type CheckboxRootProviderProps } from './checkbox-root-provider';
|
|
9
10
|
export { useCheckbox, type UseCheckboxProps, type UseCheckboxReturn } from './use-checkbox';
|
|
10
11
|
export { useCheckboxContext, type UseCheckboxContext } from './use-checkbox-context';
|
|
12
|
+
export { useCheckboxGroup, type UseCheckboxGroupProps, type UseCheckboxGroupReturn, } from './use-checkbox-group';
|
|
13
|
+
export { useCheckboxGroupContext, type UseCheckboxGroupContext } from './use-checkbox-group-context';
|
|
11
14
|
export * as Checkbox from './checkbox';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CheckedChangeDetails as CheckboxCheckedChangeDetails, CheckedState as CheckboxCheckedState, } from '@zag-js/checkbox';
|
|
2
2
|
export { CheckboxContext, type CheckboxContextProps } from './checkbox-context';
|
|
3
3
|
export { CheckboxControl, type CheckboxControlProps } from './checkbox-control';
|
|
4
|
+
export { CheckboxGroup, type CheckboxGroupProps } from './checkbox-group';
|
|
4
5
|
export { CheckboxHiddenInput, type CheckboxHiddenInputProps } from './checkbox-hidden-input';
|
|
5
6
|
export { CheckboxIndicator, type CheckboxIndicatorProps } from './checkbox-indicator';
|
|
6
7
|
export { CheckboxLabel, type CheckboxLabelProps } from './checkbox-label';
|
|
@@ -8,4 +9,6 @@ export { CheckboxRoot, type CheckboxRootProps } from './checkbox-root';
|
|
|
8
9
|
export { CheckboxRootProvider, type CheckboxRootProviderProps } from './checkbox-root-provider';
|
|
9
10
|
export { useCheckbox, type UseCheckboxProps, type UseCheckboxReturn } from './use-checkbox';
|
|
10
11
|
export { useCheckboxContext, type UseCheckboxContext } from './use-checkbox-context';
|
|
12
|
+
export { useCheckboxGroup, type UseCheckboxGroupProps, type UseCheckboxGroupReturn, } from './use-checkbox-group';
|
|
13
|
+
export { useCheckboxGroupContext, type UseCheckboxGroupContext } from './use-checkbox-group-context';
|
|
11
14
|
export * as Checkbox from './checkbox';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CheckboxContext } from './checkbox-context.js';
|
|
2
2
|
export { CheckboxControl } from './checkbox-control.js';
|
|
3
|
+
export { CheckboxGroup } from './checkbox-group.js';
|
|
3
4
|
export { CheckboxHiddenInput } from './checkbox-hidden-input.js';
|
|
4
5
|
export { CheckboxIndicator } from './checkbox-indicator.js';
|
|
5
6
|
export { CheckboxLabel } from './checkbox-label.js';
|
|
@@ -7,5 +8,7 @@ export { CheckboxRoot } from './checkbox-root.js';
|
|
|
7
8
|
export { CheckboxRootProvider } from './checkbox-root-provider.js';
|
|
8
9
|
export { useCheckbox } from './use-checkbox.js';
|
|
9
10
|
export { useCheckboxContext } from './use-checkbox-context.js';
|
|
11
|
+
export { useCheckboxGroup } from './use-checkbox-group.js';
|
|
12
|
+
export { useCheckboxGroupContext } from './use-checkbox-group-context.js';
|
|
10
13
|
import * as checkbox from './checkbox.js';
|
|
11
14
|
export { checkbox as Checkbox };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const createContext = require('../../utils/create-context.cjs');
|
|
7
|
+
|
|
8
|
+
const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createContext.createContext({
|
|
9
|
+
name: "CheckboxGroupContext",
|
|
10
|
+
hookName: "useCheckboxGroupContext",
|
|
11
|
+
providerName: "<CheckboxGroupProvider />",
|
|
12
|
+
strict: false
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
exports.CheckboxGroupContextProvider = CheckboxGroupContextProvider;
|
|
16
|
+
exports.useCheckboxGroupContext = useCheckboxGroupContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseCheckboxGroupReturn } from './use-checkbox-group';
|
|
2
|
+
import { Provider } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface UseCheckboxGroupContext extends UseCheckboxGroupReturn {
|
|
5
|
+
}
|
|
6
|
+
export declare const CheckboxGroupContextProvider: Provider<UseCheckboxGroupContext | undefined>, useCheckboxGroupContext: () => UseCheckboxGroupContext | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseCheckboxGroupReturn } from './use-checkbox-group';
|
|
2
|
+
import { Provider } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface UseCheckboxGroupContext extends UseCheckboxGroupReturn {
|
|
5
|
+
}
|
|
6
|
+
export declare const CheckboxGroupContextProvider: Provider<UseCheckboxGroupContext | undefined>, useCheckboxGroupContext: () => UseCheckboxGroupContext | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createContext } from '../../utils/create-context.js';
|
|
3
|
+
|
|
4
|
+
const [CheckboxGroupContextProvider, useCheckboxGroupContext] = createContext({
|
|
5
|
+
name: "CheckboxGroupContext",
|
|
6
|
+
hookName: "useCheckboxGroupContext",
|
|
7
|
+
providerName: "<CheckboxGroupProvider />",
|
|
8
|
+
strict: false
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { CheckboxGroupContextProvider, useCheckboxGroupContext };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const useControllableState = require('../../utils/use-controllable-state.cjs');
|
|
7
|
+
const useEvent = require('../../utils/use-event.cjs');
|
|
8
|
+
|
|
9
|
+
function useCheckboxGroup(props = {}) {
|
|
10
|
+
const { defaultValue, value: controlledValue, onValueChange, disabled, readOnly } = props;
|
|
11
|
+
const interative = !(disabled || readOnly);
|
|
12
|
+
const onChangeProp = useEvent.useEvent(onValueChange, { sync: true });
|
|
13
|
+
const [value, setValue] = useControllableState.useControllableState({
|
|
14
|
+
value: controlledValue,
|
|
15
|
+
defaultValue: defaultValue || [],
|
|
16
|
+
onChange: onChangeProp
|
|
17
|
+
});
|
|
18
|
+
const isChecked = (val) => {
|
|
19
|
+
return value.some((v) => String(v) === String(val));
|
|
20
|
+
};
|
|
21
|
+
const toggleValue = (val) => {
|
|
22
|
+
isChecked(val) ? removeValue(val) : addValue(val);
|
|
23
|
+
};
|
|
24
|
+
const addValue = (val) => {
|
|
25
|
+
if (!interative)
|
|
26
|
+
return;
|
|
27
|
+
if (isChecked(val))
|
|
28
|
+
return;
|
|
29
|
+
setValue(value.concat(val));
|
|
30
|
+
};
|
|
31
|
+
const removeValue = (val) => {
|
|
32
|
+
if (!interative)
|
|
33
|
+
return;
|
|
34
|
+
setValue(value.filter((v) => String(v) !== String(val)));
|
|
35
|
+
};
|
|
36
|
+
const getItemProps = (props2) => {
|
|
37
|
+
return {
|
|
38
|
+
checked: props2.value != null ? isChecked(props2.value) : void 0,
|
|
39
|
+
onCheckedChange() {
|
|
40
|
+
if (props2.value != null) {
|
|
41
|
+
toggleValue(props2.value);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
disabled,
|
|
45
|
+
readOnly
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
isChecked,
|
|
50
|
+
value,
|
|
51
|
+
disabled,
|
|
52
|
+
readOnly,
|
|
53
|
+
setValue,
|
|
54
|
+
addValue,
|
|
55
|
+
toggleValue,
|
|
56
|
+
getItemProps
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
exports.useCheckboxGroup = useCheckboxGroup;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface UseCheckboxGroupProps {
|
|
2
|
+
/**
|
|
3
|
+
* The initial value of `value` when uncontrolled
|
|
4
|
+
*/
|
|
5
|
+
defaultValue?: string[];
|
|
6
|
+
/**
|
|
7
|
+
* The controlled value of the checkbox group
|
|
8
|
+
*/
|
|
9
|
+
value?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* The callback to call when the value changes
|
|
12
|
+
*/
|
|
13
|
+
onValueChange?: (value: string[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* If `true`, the checkbox group is disabled
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If `true`, the checkbox group is read-only
|
|
20
|
+
*/
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CheckboxGroupItemProps {
|
|
24
|
+
value: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare function useCheckboxGroup(props?: UseCheckboxGroupProps): {
|
|
27
|
+
isChecked: (val: string | undefined) => boolean;
|
|
28
|
+
value: string[];
|
|
29
|
+
disabled: boolean | undefined;
|
|
30
|
+
readOnly: boolean | undefined;
|
|
31
|
+
setValue: (value: string[]) => void | undefined;
|
|
32
|
+
addValue: (val: string) => void;
|
|
33
|
+
toggleValue: (val: string) => void;
|
|
34
|
+
getItemProps: (props: CheckboxGroupItemProps) => {
|
|
35
|
+
checked: boolean | undefined;
|
|
36
|
+
onCheckedChange(): void;
|
|
37
|
+
disabled: boolean | undefined;
|
|
38
|
+
readOnly: boolean | undefined;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface UseCheckboxGroupProps {
|
|
2
|
+
/**
|
|
3
|
+
* The initial value of `value` when uncontrolled
|
|
4
|
+
*/
|
|
5
|
+
defaultValue?: string[];
|
|
6
|
+
/**
|
|
7
|
+
* The controlled value of the checkbox group
|
|
8
|
+
*/
|
|
9
|
+
value?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* The callback to call when the value changes
|
|
12
|
+
*/
|
|
13
|
+
onValueChange?: (value: string[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* If `true`, the checkbox group is disabled
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If `true`, the checkbox group is read-only
|
|
20
|
+
*/
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CheckboxGroupItemProps {
|
|
24
|
+
value: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare function useCheckboxGroup(props?: UseCheckboxGroupProps): {
|
|
27
|
+
isChecked: (val: string | undefined) => boolean;
|
|
28
|
+
value: string[];
|
|
29
|
+
disabled: boolean | undefined;
|
|
30
|
+
readOnly: boolean | undefined;
|
|
31
|
+
setValue: (value: string[]) => void | undefined;
|
|
32
|
+
addValue: (val: string) => void;
|
|
33
|
+
toggleValue: (val: string) => void;
|
|
34
|
+
getItemProps: (props: CheckboxGroupItemProps) => {
|
|
35
|
+
checked: boolean | undefined;
|
|
36
|
+
onCheckedChange(): void;
|
|
37
|
+
disabled: boolean | undefined;
|
|
38
|
+
readOnly: boolean | undefined;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useControllableState } from '../../utils/use-controllable-state.js';
|
|
3
|
+
import { useEvent } from '../../utils/use-event.js';
|
|
4
|
+
|
|
5
|
+
function useCheckboxGroup(props = {}) {
|
|
6
|
+
const { defaultValue, value: controlledValue, onValueChange, disabled, readOnly } = props;
|
|
7
|
+
const interative = !(disabled || readOnly);
|
|
8
|
+
const onChangeProp = useEvent(onValueChange, { sync: true });
|
|
9
|
+
const [value, setValue] = useControllableState({
|
|
10
|
+
value: controlledValue,
|
|
11
|
+
defaultValue: defaultValue || [],
|
|
12
|
+
onChange: onChangeProp
|
|
13
|
+
});
|
|
14
|
+
const isChecked = (val) => {
|
|
15
|
+
return value.some((v) => String(v) === String(val));
|
|
16
|
+
};
|
|
17
|
+
const toggleValue = (val) => {
|
|
18
|
+
isChecked(val) ? removeValue(val) : addValue(val);
|
|
19
|
+
};
|
|
20
|
+
const addValue = (val) => {
|
|
21
|
+
if (!interative)
|
|
22
|
+
return;
|
|
23
|
+
if (isChecked(val))
|
|
24
|
+
return;
|
|
25
|
+
setValue(value.concat(val));
|
|
26
|
+
};
|
|
27
|
+
const removeValue = (val) => {
|
|
28
|
+
if (!interative)
|
|
29
|
+
return;
|
|
30
|
+
setValue(value.filter((v) => String(v) !== String(val)));
|
|
31
|
+
};
|
|
32
|
+
const getItemProps = (props2) => {
|
|
33
|
+
return {
|
|
34
|
+
checked: props2.value != null ? isChecked(props2.value) : void 0,
|
|
35
|
+
onCheckedChange() {
|
|
36
|
+
if (props2.value != null) {
|
|
37
|
+
toggleValue(props2.value);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
disabled,
|
|
41
|
+
readOnly
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
isChecked,
|
|
46
|
+
value,
|
|
47
|
+
disabled,
|
|
48
|
+
readOnly,
|
|
49
|
+
setValue,
|
|
50
|
+
addValue,
|
|
51
|
+
toggleValue,
|
|
52
|
+
getItemProps
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { useCheckboxGroup };
|
|
@@ -9,6 +9,7 @@ const react = require('react');
|
|
|
9
9
|
const useEnvironmentContext = require('../../providers/environment/use-environment-context.cjs');
|
|
10
10
|
const useLocaleContext = require('../../providers/locale/use-locale-context.cjs');
|
|
11
11
|
const useEvent = require('../../utils/use-event.cjs');
|
|
12
|
+
const useCheckboxGroupContext = require('./use-checkbox-group-context.cjs');
|
|
12
13
|
|
|
13
14
|
function _interopNamespaceDefault(e) {
|
|
14
15
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -29,7 +30,11 @@ function _interopNamespaceDefault(e) {
|
|
|
29
30
|
|
|
30
31
|
const checkbox__namespace = /*#__PURE__*/_interopNamespaceDefault(checkbox);
|
|
31
32
|
|
|
32
|
-
const useCheckbox = (
|
|
33
|
+
const useCheckbox = (ownProps = {}) => {
|
|
34
|
+
const checkboxGroup = useCheckboxGroupContext.useCheckboxGroupContext();
|
|
35
|
+
const props = react.useMemo(() => {
|
|
36
|
+
return react$1.mergeProps(ownProps, checkboxGroup?.getItemProps({ value: ownProps.value }) ?? {});
|
|
37
|
+
}, [ownProps, checkboxGroup]);
|
|
33
38
|
const { getRootNode } = useEnvironmentContext.useEnvironmentContext();
|
|
34
39
|
const { dir } = useLocaleContext.useLocaleContext();
|
|
35
40
|
const initialContext = {
|
|
@@ -10,4 +10,4 @@ export interface UseCheckboxProps extends Optional<Omit<checkbox.Context, 'dir'
|
|
|
10
10
|
}
|
|
11
11
|
export interface UseCheckboxReturn extends checkbox.Api<PropTypes> {
|
|
12
12
|
}
|
|
13
|
-
export declare const useCheckbox: (
|
|
13
|
+
export declare const useCheckbox: (ownProps?: UseCheckboxProps) => UseCheckboxReturn;
|
|
@@ -10,4 +10,4 @@ export interface UseCheckboxProps extends Optional<Omit<checkbox.Context, 'dir'
|
|
|
10
10
|
}
|
|
11
11
|
export interface UseCheckboxReturn extends checkbox.Api<PropTypes> {
|
|
12
12
|
}
|
|
13
|
-
export declare const useCheckbox: (
|
|
13
|
+
export declare const useCheckbox: (ownProps?: UseCheckboxProps) => UseCheckboxReturn;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as checkbox from '@zag-js/checkbox';
|
|
3
|
-
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
4
|
-
import { useId } from 'react';
|
|
3
|
+
import { mergeProps, useMachine, normalizeProps } from '@zag-js/react';
|
|
4
|
+
import { useMemo, useId } from 'react';
|
|
5
5
|
import { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';
|
|
6
6
|
import { useLocaleContext } from '../../providers/locale/use-locale-context.js';
|
|
7
7
|
import { useEvent } from '../../utils/use-event.js';
|
|
8
|
+
import { useCheckboxGroupContext } from './use-checkbox-group-context.js';
|
|
8
9
|
|
|
9
|
-
const useCheckbox = (
|
|
10
|
+
const useCheckbox = (ownProps = {}) => {
|
|
11
|
+
const checkboxGroup = useCheckboxGroupContext();
|
|
12
|
+
const props = useMemo(() => {
|
|
13
|
+
return mergeProps(ownProps, checkboxGroup?.getItemProps({ value: ownProps.value }) ?? {});
|
|
14
|
+
}, [ownProps, checkboxGroup]);
|
|
10
15
|
const { getRootNode } = useEnvironmentContext();
|
|
11
16
|
const { dir } = useLocaleContext();
|
|
12
17
|
const initialContext = {
|
|
@@ -0,0 +1,19 @@
|
|
|
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 useComboboxContext = require('./use-combobox-context.cjs');
|
|
11
|
+
|
|
12
|
+
const ComboboxList = react.forwardRef((props, ref) => {
|
|
13
|
+
const combobox = useComboboxContext.useComboboxContext();
|
|
14
|
+
const mergedProps = react$1.mergeProps(combobox.getListProps(), props);
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
16
|
+
});
|
|
17
|
+
ComboboxList.displayName = "ComboboxList";
|
|
18
|
+
|
|
19
|
+
exports.ComboboxList = ComboboxList;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLArkProps } from '../factory';
|
|
2
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface ComboboxListProps extends HTMLArkProps<'div'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const ComboboxList: ForwardRefExoticComponent<ComboboxListProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLArkProps } from '../factory';
|
|
2
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface ComboboxListProps extends HTMLArkProps<'div'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const ComboboxList: ForwardRefExoticComponent<ComboboxListProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
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.js';
|
|
6
|
+
import { useComboboxContext } from './use-combobox-context.js';
|
|
7
|
+
|
|
8
|
+
const ComboboxList = forwardRef((props, ref) => {
|
|
9
|
+
const combobox = useComboboxContext();
|
|
10
|
+
const mergedProps = mergeProps(combobox.getListProps(), props);
|
|
11
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
12
|
+
});
|
|
13
|
+
ComboboxList.displayName = "ComboboxList";
|
|
14
|
+
|
|
15
|
+
export { ComboboxList };
|
|
@@ -14,6 +14,7 @@ const comboboxItemGroupLabel = require('./combobox-item-group-label.cjs');
|
|
|
14
14
|
const comboboxItemIndicator = require('./combobox-item-indicator.cjs');
|
|
15
15
|
const comboboxItemText = require('./combobox-item-text.cjs');
|
|
16
16
|
const comboboxLabel = require('./combobox-label.cjs');
|
|
17
|
+
const comboboxList = require('./combobox-list.cjs');
|
|
17
18
|
const comboboxPositioner = require('./combobox-positioner.cjs');
|
|
18
19
|
const comboboxRoot = require('./combobox-root.cjs');
|
|
19
20
|
const comboboxRootProvider = require('./combobox-root-provider.cjs');
|
|
@@ -33,6 +34,7 @@ exports.ItemGroupLabel = comboboxItemGroupLabel.ComboboxItemGroupLabel;
|
|
|
33
34
|
exports.ItemIndicator = comboboxItemIndicator.ComboboxItemIndicator;
|
|
34
35
|
exports.ItemText = comboboxItemText.ComboboxItemText;
|
|
35
36
|
exports.Label = comboboxLabel.ComboboxLabel;
|
|
37
|
+
exports.List = comboboxList.ComboboxList;
|
|
36
38
|
exports.Positioner = comboboxPositioner.ComboboxPositioner;
|
|
37
39
|
exports.Root = comboboxRoot.ComboboxRoot;
|
|
38
40
|
exports.RootProvider = comboboxRootProvider.ComboboxRootProvider;
|