@ark-ui/solid 0.3.0 → 0.4.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.
Files changed (101) hide show
  1. package/README.md +1 -0
  2. package/dist/accordion/accordion-context.d.ts +3 -11
  3. package/dist/accordion/use-accordion.cjs +1 -1
  4. package/dist/accordion/use-accordion.d.ts +4 -9
  5. package/dist/accordion/use-accordion.mjs +2 -2
  6. package/dist/carousel/use-carousel.cjs +1 -1
  7. package/dist/carousel/use-carousel.mjs +2 -2
  8. package/dist/checkbox/checkbox-context.d.ts +11 -12
  9. package/dist/checkbox/checkbox.cjs +1 -1
  10. package/dist/checkbox/checkbox.mjs +1 -1
  11. package/dist/checkbox/index.d.ts +1 -0
  12. package/dist/checkbox/use-checkbox.cjs +1 -1
  13. package/dist/checkbox/use-checkbox.d.ts +6 -6
  14. package/dist/checkbox/use-checkbox.mjs +2 -2
  15. package/dist/combobox/use-combobox.cjs +1 -1
  16. package/dist/combobox/use-combobox.d.ts +4 -4
  17. package/dist/combobox/use-combobox.mjs +2 -2
  18. package/dist/dialog/use-dialog.cjs +1 -1
  19. package/dist/dialog/use-dialog.mjs +2 -2
  20. package/dist/editable/editable-edit-trigger.cjs +2 -2
  21. package/dist/editable/editable-edit-trigger.mjs +1 -1
  22. package/dist/editable/editable-preview.cjs +2 -2
  23. package/dist/editable/editable-preview.mjs +1 -1
  24. package/dist/editable/editable-submit-trigger.cjs +2 -2
  25. package/dist/editable/editable-submit-trigger.mjs +1 -1
  26. package/dist/editable/use-editable.cjs +1 -1
  27. package/dist/editable/use-editable.mjs +2 -2
  28. package/dist/hover-card/hover-card.cjs +6 -4
  29. package/dist/hover-card/hover-card.d.ts +2 -2
  30. package/dist/hover-card/hover-card.mjs +6 -4
  31. package/dist/hover-card/use-hover-card.cjs +1 -1
  32. package/dist/hover-card/use-hover-card.mjs +2 -2
  33. package/dist/index.cjs +15 -0
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.mjs +6 -0
  36. package/dist/menu/use-menu.cjs +1 -1
  37. package/dist/menu/use-menu.mjs +2 -2
  38. package/dist/number-input/use-number-input.cjs +1 -1
  39. package/dist/number-input/use-number-input.mjs +2 -2
  40. package/dist/pagination/use-pagination.cjs +1 -1
  41. package/dist/pagination/use-pagination.mjs +2 -2
  42. package/dist/pin-input/use-pin-input.cjs +1 -1
  43. package/dist/pin-input/use-pin-input.mjs +2 -2
  44. package/dist/popover/use-popover.cjs +1 -1
  45. package/dist/popover/use-popover.mjs +2 -2
  46. package/dist/pressable/use-pressable.cjs +1 -1
  47. package/dist/pressable/use-pressable.d.ts +1 -1
  48. package/dist/pressable/use-pressable.mjs +2 -2
  49. package/dist/radio-group/radio-group-context.d.ts +2 -0
  50. package/dist/radio-group/use-radio-group.cjs +1 -1
  51. package/dist/radio-group/use-radio-group.d.ts +1 -0
  52. package/dist/radio-group/use-radio-group.mjs +2 -2
  53. package/dist/range-slider/use-range-slider.cjs +1 -1
  54. package/dist/range-slider/use-range-slider.mjs +2 -2
  55. package/dist/rating-group/rating-context.d.ts +2 -13
  56. package/dist/rating-group/rating-group-context.d.ts +5 -20
  57. package/dist/rating-group/rating.cjs +1 -1
  58. package/dist/rating-group/rating.d.ts +2 -2
  59. package/dist/rating-group/rating.mjs +1 -1
  60. package/dist/rating-group/use-rating-group.cjs +1 -1
  61. package/dist/rating-group/use-rating-group.d.ts +2 -10
  62. package/dist/rating-group/use-rating-group.mjs +2 -2
  63. package/dist/select/use-select.cjs +1 -1
  64. package/dist/select/use-select.mjs +2 -2
  65. package/dist/slider/use-slider.cjs +1 -1
  66. package/dist/slider/use-slider.mjs +2 -2
  67. package/dist/splitter/use-splitter.cjs +1 -1
  68. package/dist/splitter/use-splitter.mjs +2 -2
  69. package/dist/switch/index.d.ts +6 -0
  70. package/dist/switch/switch-context.cjs +13 -0
  71. package/dist/switch/switch-context.d.ts +27 -0
  72. package/dist/switch/switch-context.mjs +8 -0
  73. package/dist/switch/switch-control.cjs +16 -0
  74. package/dist/switch/switch-control.d.ts +4 -0
  75. package/dist/switch/switch-control.mjs +12 -0
  76. package/dist/switch/switch-input.cjs +16 -0
  77. package/dist/switch/switch-input.d.ts +4 -0
  78. package/dist/switch/switch-input.mjs +12 -0
  79. package/dist/switch/switch-label.cjs +16 -0
  80. package/dist/switch/switch-label.d.ts +4 -0
  81. package/dist/switch/switch-label.mjs +12 -0
  82. package/dist/switch/switch-thumb.cjs +16 -0
  83. package/dist/switch/switch-thumb.d.ts +4 -0
  84. package/dist/switch/switch-thumb.mjs +12 -0
  85. package/dist/switch/switch.anatomy.d.ts +1 -0
  86. package/dist/switch/switch.cjs +30 -0
  87. package/dist/switch/switch.d.ts +9 -0
  88. package/dist/switch/switch.mjs +26 -0
  89. package/dist/switch/use-switch.cjs +36 -0
  90. package/dist/switch/use-switch.d.ts +17 -0
  91. package/dist/switch/use-switch.mjs +13 -0
  92. package/dist/tabs/tab-trigger.d.ts +2 -4
  93. package/dist/tabs/tabs-context.d.ts +7 -9
  94. package/dist/tabs/use-tabs.cjs +1 -1
  95. package/dist/tabs/use-tabs.d.ts +3 -5
  96. package/dist/tabs/use-tabs.mjs +2 -2
  97. package/dist/tags-input/use-tags-input.cjs +1 -1
  98. package/dist/tags-input/use-tags-input.mjs +2 -2
  99. package/dist/tooltip/use-tooltip.cjs +1 -1
  100. package/dist/tooltip/use-tooltip.mjs +2 -2
  101. package/package.json +45 -43
@@ -28,7 +28,7 @@ const pressable__namespace = /*#__PURE__*/_interopNamespaceDefault(pressable);
28
28
 
29
29
  const usePressable = props => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = solidJs.mergeProps({
31
+ const context = solid.mergeProps({
32
32
  id: solidJs.createUniqueId(),
33
33
  getRootNode
34
34
  }, props);
@@ -3,7 +3,7 @@ import * as pressable from '@zag-js/pressable';
3
3
  import { type Optional } from '../types';
4
4
  export type UsePressableProps = Optional<pressable.Context, 'id'>;
5
5
  export type UsePressableReturn = ReturnType<typeof usePressable>;
6
- export declare const usePressable: (props?: UsePressableProps) => Accessor<{
6
+ export declare const usePressable: (props: UsePressableProps) => Accessor<{
7
7
  isPressed: boolean;
8
8
  pressableProps: JSX.HTMLAttributes<any>;
9
9
  }>;
@@ -1,6 +1,6 @@
1
1
  import * as pressable from '@zag-js/pressable';
2
- import { useMachine, normalizeProps } from '@zag-js/solid';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
2
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const usePressable = props => {
@@ -25,6 +25,7 @@ export declare const RadioGroupProvider: ContextProviderComponent<Accessor<{
25
25
  getRadioLabelProps(props: RadioProps): JSX.HTMLAttributes<any>;
26
26
  getRadioControlProps(props: RadioProps): JSX.HTMLAttributes<any>;
27
27
  getRadioInputProps(props: InputProps): JSX.InputHTMLAttributes<HTMLInputElement>;
28
+ indicatorProps: JSX.HTMLAttributes<any>;
28
29
  }>>, useRadioGroupContext: () => Accessor<{
29
30
  value: string | null;
30
31
  setValue(value: string): void;
@@ -47,4 +48,5 @@ export declare const RadioGroupProvider: ContextProviderComponent<Accessor<{
47
48
  getRadioLabelProps(props: RadioProps): JSX.HTMLAttributes<any>;
48
49
  getRadioControlProps(props: RadioProps): JSX.HTMLAttributes<any>;
49
50
  getRadioInputProps(props: InputProps): JSX.InputHTMLAttributes<HTMLInputElement>;
51
+ indicatorProps: JSX.HTMLAttributes<any>;
50
52
  }>;
@@ -28,7 +28,7 @@ const radio__namespace = /*#__PURE__*/_interopNamespaceDefault(radio);
28
28
 
29
29
  const useRadioGroup = props => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = solidJs.mergeProps({
31
+ const context = solid.mergeProps({
32
32
  id: solidJs.createUniqueId(),
33
33
  getRootNode
34
34
  }, props);
@@ -26,4 +26,5 @@ export declare const useRadioGroup: (props: UseRadioGroupProps) => Accessor<{
26
26
  getRadioLabelProps(props: RadioProps): JSX.HTMLAttributes<any>;
27
27
  getRadioControlProps(props: RadioProps): JSX.HTMLAttributes<any>;
28
28
  getRadioInputProps(props: InputProps): JSX.InputHTMLAttributes<HTMLInputElement>;
29
+ indicatorProps: JSX.HTMLAttributes<any>;
29
30
  }>;
@@ -1,6 +1,6 @@
1
1
  import * as radio from '@zag-js/radio-group';
2
- import { useMachine, normalizeProps } from '@zag-js/solid';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
2
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useRadioGroup = props => {
@@ -28,7 +28,7 @@ const rangeSlider__namespace = /*#__PURE__*/_interopNamespaceDefault(rangeSlider
28
28
 
29
29
  const useRangeSlider = (props) => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = solidJs.mergeProps({ id: solidJs.createUniqueId(), values: props.value, getRootNode }, props);
31
+ const context = solid.mergeProps({ id: solidJs.createUniqueId(), values: props.value, getRootNode }, props);
32
32
  const [state, send] = solid.useMachine(rangeSlider__namespace.machine(context), {
33
33
  context
34
34
  });
@@ -1,6 +1,6 @@
1
1
  import * as rangeSlider from '@zag-js/range-slider';
2
- import { useMachine, normalizeProps } from '@zag-js/solid';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
2
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useRangeSlider = (props) => {
@@ -1,17 +1,6 @@
1
+ import type { ItemState } from '@zag-js/rating-group/dist/rating-group.types';
1
2
  import type { ContextProviderComponent } from 'solid-js/types/reactive/signal';
2
3
  import { type connect } from '@zag-js/rating-group';
3
4
  import type { Accessor } from 'solid-js';
4
5
  export type RatingContext = ReturnType<ReturnType<typeof connect>['getRatingState']>;
5
- export declare const RatingProvider: ContextProviderComponent<Accessor<{
6
- isEqual: boolean;
7
- isValueEmpty: boolean;
8
- isHighlighted: boolean;
9
- isHalf: boolean;
10
- isChecked: boolean;
11
- }>>, useRatingContext: () => Accessor<{
12
- isEqual: boolean;
13
- isValueEmpty: boolean;
14
- isHighlighted: boolean;
15
- isHalf: boolean;
16
- isChecked: boolean;
17
- }>;
6
+ export declare const RatingProvider: ContextProviderComponent<Accessor<ItemState>>, useRatingContext: () => Accessor<ItemState>;
@@ -1,3 +1,4 @@
1
+ import type { ItemProps, ItemState } from '@zag-js/rating-group/dist/rating-group.types';
1
2
  import type { Accessor, JSX } from 'solid-js';
2
3
  import type { ContextProviderComponent } from 'solid-js/types/reactive/signal';
3
4
  import { type UseRatingGroupReturn } from './use-rating-group';
@@ -10,20 +11,12 @@ export declare const RatingGroupProvider: ContextProviderComponent<Accessor<{
10
11
  hoveredValue: number;
11
12
  size: number;
12
13
  sizeArray: number[];
13
- getRatingState(index: number): {
14
- isEqual: boolean;
15
- isValueEmpty: boolean;
16
- isHighlighted: boolean;
17
- isHalf: boolean;
18
- isChecked: boolean;
19
- };
14
+ getRatingState(props: ItemProps): ItemState;
20
15
  rootProps: JSX.HTMLAttributes<any>;
21
16
  hiddenInputProps: JSX.InputHTMLAttributes<HTMLInputElement>;
22
17
  labelProps: JSX.HTMLAttributes<any>;
23
18
  controlProps: JSX.HTMLAttributes<any>;
24
- getRatingProps({ index }: {
25
- index: number;
26
- }): JSX.HTMLAttributes<any>;
19
+ getRatingProps(props: ItemProps): JSX.HTMLAttributes<any>;
27
20
  }>>, useRatingGroupContext: () => Accessor<{
28
21
  setValue(value: number): void;
29
22
  clearValue(): void;
@@ -32,18 +25,10 @@ export declare const RatingGroupProvider: ContextProviderComponent<Accessor<{
32
25
  hoveredValue: number;
33
26
  size: number;
34
27
  sizeArray: number[];
35
- getRatingState(index: number): {
36
- isEqual: boolean;
37
- isValueEmpty: boolean;
38
- isHighlighted: boolean;
39
- isHalf: boolean;
40
- isChecked: boolean;
41
- };
28
+ getRatingState(props: ItemProps): ItemState;
42
29
  rootProps: JSX.HTMLAttributes<any>;
43
30
  hiddenInputProps: JSX.InputHTMLAttributes<HTMLInputElement>;
44
31
  labelProps: JSX.HTMLAttributes<any>;
45
32
  controlProps: JSX.HTMLAttributes<any>;
46
- getRatingProps({ index }: {
47
- index: number;
48
- }): JSX.HTMLAttributes<any>;
33
+ getRatingProps(props: ItemProps): JSX.HTMLAttributes<any>;
49
34
  }>;
@@ -13,7 +13,7 @@ const ratingGroupContext = require('./rating-group-context.cjs');
13
13
  const Rating = props => {
14
14
  const [ratingParams, restProps] = createSplitProps.createSplitProps()(props, ['index']);
15
15
  const api = ratingGroupContext.useRatingGroupContext();
16
- const ratingState = () => api().getRatingState(ratingParams.index);
16
+ const ratingState = () => api().getRatingState(ratingParams);
17
17
  const getChildren = () => runIfFn.runIfFn(restProps.children, ratingState);
18
18
  const ratingProps = solid.mergeProps(() => api().getRatingProps(ratingParams), restProps);
19
19
  return web.createComponent(factory.ark.span, web.mergeProps(ratingProps, {
@@ -1,10 +1,10 @@
1
+ import type { ItemProps } from '@zag-js/rating-group';
1
2
  import type { Accessor } from 'solid-js';
2
3
  import { type JSX } from 'solid-js/jsx-runtime';
3
4
  import { type HTMLArkProps } from '../factory';
4
5
  import type { Assign } from '../types';
5
6
  import { type RatingContext } from './rating-context';
6
- export type RatingProps = Assign<HTMLArkProps<'span'>, {
7
- index: number;
7
+ export type RatingProps = Assign<HTMLArkProps<'span'>, ItemProps & {
8
8
  children: (state: Accessor<RatingContext>) => JSX.Element | JSX.Element;
9
9
  }>;
10
10
  export declare const Rating: (props: RatingProps) => JSX.Element;
@@ -9,7 +9,7 @@ import { useRatingGroupContext } from './rating-group-context.mjs';
9
9
  const Rating = props => {
10
10
  const [ratingParams, restProps] = createSplitProps()(props, ['index']);
11
11
  const api = useRatingGroupContext();
12
- const ratingState = () => api().getRatingState(ratingParams.index);
12
+ const ratingState = () => api().getRatingState(ratingParams);
13
13
  const getChildren = () => runIfFn(restProps.children, ratingState);
14
14
  const ratingProps = mergeProps(() => api().getRatingProps(ratingParams), restProps);
15
15
  return createComponent(ark.span, mergeProps$1(ratingProps, {
@@ -28,7 +28,7 @@ const rating__namespace = /*#__PURE__*/_interopNamespaceDefault(rating);
28
28
 
29
29
  const useRatingGroup = props => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = solidJs.mergeProps({
31
+ const context = solid.mergeProps({
32
32
  id: solidJs.createUniqueId(),
33
33
  getRootNode
34
34
  }, props);
@@ -11,18 +11,10 @@ export declare const useRatingGroup: (props: UseRatingGroupProps) => Accessor<{
11
11
  hoveredValue: number;
12
12
  size: number;
13
13
  sizeArray: number[];
14
- getRatingState(index: number): {
15
- isEqual: boolean;
16
- isValueEmpty: boolean;
17
- isHighlighted: boolean;
18
- isHalf: boolean;
19
- isChecked: boolean;
20
- };
14
+ getRatingState(props: rating.ItemProps): rating.ItemState;
21
15
  rootProps: JSX.HTMLAttributes<any>;
22
16
  hiddenInputProps: JSX.InputHTMLAttributes<HTMLInputElement>;
23
17
  labelProps: JSX.HTMLAttributes<any>;
24
18
  controlProps: JSX.HTMLAttributes<any>;
25
- getRatingProps({ index }: {
26
- index: number;
27
- }): JSX.HTMLAttributes<any>;
19
+ getRatingProps(props: rating.ItemProps): JSX.HTMLAttributes<any>;
28
20
  }>;
@@ -1,6 +1,6 @@
1
1
  import * as rating from '@zag-js/rating-group';
2
- import { useMachine, normalizeProps } from '@zag-js/solid';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
2
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useRatingGroup = props => {
@@ -28,7 +28,7 @@ const select__namespace = /*#__PURE__*/_interopNamespaceDefault(select);
28
28
 
29
29
  const useSelect = (props) => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = solidJs.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
31
+ const context = solid.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
32
32
  const [state, send] = solid.useMachine(select__namespace.machine(context), {
33
33
  context
34
34
  });
@@ -1,6 +1,6 @@
1
1
  import * as select from '@zag-js/select';
2
- import { useMachine, normalizeProps } from '@zag-js/solid';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
2
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useSelect = (props) => {
@@ -28,7 +28,7 @@ const slider__namespace = /*#__PURE__*/_interopNamespaceDefault(slider);
28
28
 
29
29
  const useSlider = (props) => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = solidJs.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
31
+ const context = solid.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
32
32
  const [state, send] = solid.useMachine(slider__namespace.machine(context), { context });
33
33
  return solidJs.createMemo(() => slider__namespace.connect(state, send, solid.normalizeProps));
34
34
  };
@@ -1,6 +1,6 @@
1
1
  import * as slider from '@zag-js/slider';
2
- import { useMachine, normalizeProps } from '@zag-js/solid';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
2
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useSlider = (props) => {
@@ -9,7 +9,7 @@ const environmentContext = require('../environment/environment-context.cjs');
9
9
 
10
10
  const useSplitter = (props) => {
11
11
  const getRootNode = environmentContext.useEnvironmentContext();
12
- const context = solidJs.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
12
+ const context = solid.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
13
13
  const [state, send] = solid.useMachine(splitter.machine(context), { context });
14
14
  return solidJs.createMemo(() => splitter.connect(state, send, solid.normalizeProps));
15
15
  };
@@ -1,6 +1,6 @@
1
- import { useMachine, normalizeProps } from '@zag-js/solid';
1
+ import { mergeProps, useMachine, normalizeProps } from '@zag-js/solid';
2
2
  import { machine, connect } from '@zag-js/splitter';
3
- import { mergeProps, createUniqueId, createMemo } from 'solid-js';
3
+ import { createUniqueId, createMemo } from 'solid-js';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useSplitter = (props) => {
@@ -0,0 +1,6 @@
1
+ export { Switch, type SwitchProps } from './switch';
2
+ export { SwitchControl, type SwitchControlProps } from './switch-control';
3
+ export { SwitchInput, type SwitchInputProps } from './switch-input';
4
+ export { SwitchLabel, type SwitchLabelProps } from './switch-label';
5
+ export { SwitchThumb, type SwitchThumbProps } from './switch-thumb';
6
+ export { switchAnatomy } from './switch.anatomy';
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const createContext = require('../create-context.cjs');
6
+
7
+ const [SwitchProvider, useSwitchContext] = createContext.createContext({
8
+ hookName: "useSwitchContext",
9
+ providerName: "<SwitchProvider />"
10
+ });
11
+
12
+ exports.SwitchProvider = SwitchProvider;
13
+ exports.useSwitchContext = useSwitchContext;
@@ -0,0 +1,27 @@
1
+ import type { Accessor, JSX } from 'solid-js';
2
+ import type { ContextProviderComponent } from 'solid-js/types/reactive/signal';
3
+ import { type UseSwitchReturn } from './use-switch';
4
+ export type SwitchContext = UseSwitchReturn;
5
+ export declare const SwitchProvider: ContextProviderComponent<Accessor<{
6
+ isChecked: boolean;
7
+ isDisabled: boolean | undefined;
8
+ isFocused: boolean | undefined;
9
+ setChecked(checked: boolean): void;
10
+ toggleChecked(): void;
11
+ rootProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;
12
+ labelProps: JSX.HTMLAttributes<any>;
13
+ thumbProps: JSX.HTMLAttributes<any>;
14
+ controlProps: JSX.HTMLAttributes<any>;
15
+ inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;
16
+ }>>, useSwitchContext: () => Accessor<{
17
+ isChecked: boolean;
18
+ isDisabled: boolean | undefined;
19
+ isFocused: boolean | undefined;
20
+ setChecked(checked: boolean): void;
21
+ toggleChecked(): void;
22
+ rootProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;
23
+ labelProps: JSX.HTMLAttributes<any>;
24
+ thumbProps: JSX.HTMLAttributes<any>;
25
+ controlProps: JSX.HTMLAttributes<any>;
26
+ inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;
27
+ }>;
@@ -0,0 +1,8 @@
1
+ import { createContext } from '../create-context.mjs';
2
+
3
+ const [SwitchProvider, useSwitchContext] = createContext({
4
+ hookName: "useSwitchContext",
5
+ providerName: "<SwitchProvider />"
6
+ });
7
+
8
+ export { SwitchProvider, useSwitchContext };
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const web = require('solid-js/web');
6
+ const solid = require('@zag-js/solid');
7
+ const factory = require('../factory.cjs');
8
+ const switchContext = require('./switch-context.cjs');
9
+
10
+ const SwitchControl = props => {
11
+ const checkbox = switchContext.useSwitchContext();
12
+ const controlProps = solid.mergeProps(() => checkbox().controlProps, props);
13
+ return web.createComponent(factory.ark.span, controlProps);
14
+ };
15
+
16
+ exports.SwitchControl = SwitchControl;
@@ -0,0 +1,4 @@
1
+ import type { JSX } from 'solid-js';
2
+ import { type HTMLArkProps } from '../factory';
3
+ export type SwitchControlProps = HTMLArkProps<'span'>;
4
+ export declare const SwitchControl: (props: SwitchControlProps) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { createComponent } from 'solid-js/web';
2
+ import { mergeProps } from '@zag-js/solid';
3
+ import { ark } from '../factory.mjs';
4
+ import { useSwitchContext } from './switch-context.mjs';
5
+
6
+ const SwitchControl = props => {
7
+ const checkbox = useSwitchContext();
8
+ const controlProps = mergeProps(() => checkbox().controlProps, props);
9
+ return createComponent(ark.span, controlProps);
10
+ };
11
+
12
+ export { SwitchControl };
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const web = require('solid-js/web');
6
+ const solid = require('@zag-js/solid');
7
+ const factory = require('../factory.cjs');
8
+ const switchContext = require('./switch-context.cjs');
9
+
10
+ const SwitchInput = props => {
11
+ const checkbox = switchContext.useSwitchContext();
12
+ const inputProps = solid.mergeProps(() => checkbox().inputProps, props);
13
+ return web.createComponent(factory.ark.input, inputProps);
14
+ };
15
+
16
+ exports.SwitchInput = SwitchInput;
@@ -0,0 +1,4 @@
1
+ import type { JSX } from 'solid-js';
2
+ import { type HTMLArkProps } from '../factory';
3
+ export type SwitchInputProps = HTMLArkProps<'input'>;
4
+ export declare const SwitchInput: (props: SwitchInputProps) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { createComponent } from 'solid-js/web';
2
+ import { mergeProps } from '@zag-js/solid';
3
+ import { ark } from '../factory.mjs';
4
+ import { useSwitchContext } from './switch-context.mjs';
5
+
6
+ const SwitchInput = props => {
7
+ const checkbox = useSwitchContext();
8
+ const inputProps = mergeProps(() => checkbox().inputProps, props);
9
+ return createComponent(ark.input, inputProps);
10
+ };
11
+
12
+ export { SwitchInput };
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const web = require('solid-js/web');
6
+ const solid = require('@zag-js/solid');
7
+ const factory = require('../factory.cjs');
8
+ const switchContext = require('./switch-context.cjs');
9
+
10
+ const SwitchLabel = props => {
11
+ const checkbox = switchContext.useSwitchContext();
12
+ const labelProps = solid.mergeProps(() => checkbox().labelProps, props);
13
+ return web.createComponent(factory.ark.span, labelProps);
14
+ };
15
+
16
+ exports.SwitchLabel = SwitchLabel;
@@ -0,0 +1,4 @@
1
+ import type { JSX } from 'solid-js';
2
+ import { type HTMLArkProps } from '../factory';
3
+ export type SwitchLabelProps = HTMLArkProps<'span'>;
4
+ export declare const SwitchLabel: (props: SwitchLabelProps) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { createComponent } from 'solid-js/web';
2
+ import { mergeProps } from '@zag-js/solid';
3
+ import { ark } from '../factory.mjs';
4
+ import { useSwitchContext } from './switch-context.mjs';
5
+
6
+ const SwitchLabel = props => {
7
+ const checkbox = useSwitchContext();
8
+ const labelProps = mergeProps(() => checkbox().labelProps, props);
9
+ return createComponent(ark.span, labelProps);
10
+ };
11
+
12
+ export { SwitchLabel };
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const web = require('solid-js/web');
6
+ const solid = require('@zag-js/solid');
7
+ const factory = require('../factory.cjs');
8
+ const switchContext = require('./switch-context.cjs');
9
+
10
+ const SwitchThumb = props => {
11
+ const checkbox = switchContext.useSwitchContext();
12
+ const thumbProps = solid.mergeProps(() => checkbox().thumbProps, props);
13
+ return web.createComponent(factory.ark.span, thumbProps);
14
+ };
15
+
16
+ exports.SwitchThumb = SwitchThumb;
@@ -0,0 +1,4 @@
1
+ import type { JSX } from 'solid-js';
2
+ import { type HTMLArkProps } from '../factory';
3
+ export type SwitchThumbProps = HTMLArkProps<'span'>;
4
+ export declare const SwitchThumb: (props: SwitchThumbProps) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { createComponent } from 'solid-js/web';
2
+ import { mergeProps } from '@zag-js/solid';
3
+ import { ark } from '../factory.mjs';
4
+ import { useSwitchContext } from './switch-context.mjs';
5
+
6
+ const SwitchThumb = props => {
7
+ const checkbox = useSwitchContext();
8
+ const thumbProps = mergeProps(() => checkbox().thumbProps, props);
9
+ return createComponent(ark.span, thumbProps);
10
+ };
11
+
12
+ export { SwitchThumb };
@@ -0,0 +1 @@
1
+ export { anatomy as switchAnatomy } from '@zag-js/switch';
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const web = require('solid-js/web');
6
+ const solid = require('@zag-js/solid');
7
+ const createSplitProps = require('../create-split-props.cjs');
8
+ const factory = require('../factory.cjs');
9
+ const runIfFn = require('../run-if-fn.cjs');
10
+ const switchContext = require('./switch-context.cjs');
11
+ const useSwitch = require('./use-switch.cjs');
12
+
13
+ const Switch = props => {
14
+ const [switchProps, labelProps] = createSplitProps.createSplitProps()(props, ['checked', 'dir', 'disabled', 'focusable', 'form', 'getRootNode', 'id', 'ids', 'invalid', 'label', 'name', 'onChange', 'readOnly', 'required', 'value']);
15
+ const api = useSwitch.useSwitch(switchProps);
16
+ const rootProps = solid.mergeProps(() => api().rootProps, labelProps);
17
+ const getChildren = () => runIfFn.runIfFn(props.children, api);
18
+ return web.createComponent(switchContext.SwitchProvider, {
19
+ value: api,
20
+ get children() {
21
+ return web.createComponent(factory.ark.label, web.mergeProps(rootProps, {
22
+ get children() {
23
+ return getChildren();
24
+ }
25
+ }));
26
+ }
27
+ });
28
+ };
29
+
30
+ exports.Switch = Switch;
@@ -0,0 +1,9 @@
1
+ import type { JSX } from 'solid-js';
2
+ import { type HTMLArkProps } from '../factory';
3
+ import type { Assign } from '../types';
4
+ import { type SwitchContext } from './switch-context';
5
+ import { type UseSwitchProps } from './use-switch';
6
+ export type SwitchProps = Assign<HTMLArkProps<'label'>, UseSwitchProps & {
7
+ children?: JSX.Element | ((context: SwitchContext) => JSX.Element);
8
+ }>;
9
+ export declare const Switch: (props: SwitchProps) => JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { createComponent, mergeProps as mergeProps$1 } from 'solid-js/web';
2
+ import { mergeProps } from '@zag-js/solid';
3
+ import { createSplitProps } from '../create-split-props.mjs';
4
+ import { ark } from '../factory.mjs';
5
+ import { runIfFn } from '../run-if-fn.mjs';
6
+ import { SwitchProvider } from './switch-context.mjs';
7
+ import { useSwitch } from './use-switch.mjs';
8
+
9
+ const Switch = props => {
10
+ const [switchProps, labelProps] = createSplitProps()(props, ['checked', 'dir', 'disabled', 'focusable', 'form', 'getRootNode', 'id', 'ids', 'invalid', 'label', 'name', 'onChange', 'readOnly', 'required', 'value']);
11
+ const api = useSwitch(switchProps);
12
+ const rootProps = mergeProps(() => api().rootProps, labelProps);
13
+ const getChildren = () => runIfFn(props.children, api);
14
+ return createComponent(SwitchProvider, {
15
+ value: api,
16
+ get children() {
17
+ return createComponent(ark.label, mergeProps$1(rootProps, {
18
+ get children() {
19
+ return getChildren();
20
+ }
21
+ }));
22
+ }
23
+ });
24
+ };
25
+
26
+ export { Switch };
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const solid = require('@zag-js/solid');
6
+ const zagSwitch = require('@zag-js/switch');
7
+ const solidJs = require('solid-js');
8
+ const environmentContext = require('../environment/environment-context.cjs');
9
+
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== 'default') {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ const zagSwitch__namespace = /*#__PURE__*/_interopNamespaceDefault(zagSwitch);
28
+
29
+ const useSwitch = (props) => {
30
+ const getRootNode = environmentContext.useEnvironmentContext();
31
+ const context = solid.mergeProps({ id: solidJs.createUniqueId(), getRootNode }, props);
32
+ const [state, send] = solid.useMachine(zagSwitch__namespace.machine(context), { context });
33
+ return solidJs.createMemo(() => zagSwitch__namespace.connect(state, send, solid.normalizeProps));
34
+ };
35
+
36
+ exports.useSwitch = useSwitch;