@cdx-ui/primitives 0.0.1-alpha.1 → 0.0.1-alpha.10

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 (122) hide show
  1. package/lib/commonjs/button/createButtonRoot.js +3 -3
  2. package/lib/commonjs/button/createButtonRoot.js.map +1 -1
  3. package/lib/commonjs/checkbox/context.js +14 -0
  4. package/lib/commonjs/checkbox/context.js.map +1 -0
  5. package/lib/commonjs/checkbox/createCheckboxGroup.js +44 -0
  6. package/lib/commonjs/checkbox/createCheckboxGroup.js.map +1 -0
  7. package/lib/commonjs/checkbox/createCheckboxIcon.js +28 -0
  8. package/lib/commonjs/checkbox/createCheckboxIcon.js.map +1 -0
  9. package/lib/commonjs/checkbox/createCheckboxIndicator.js +47 -0
  10. package/lib/commonjs/checkbox/createCheckboxIndicator.js.map +1 -0
  11. package/lib/commonjs/checkbox/createCheckboxLabel.js +46 -0
  12. package/lib/commonjs/checkbox/createCheckboxLabel.js.map +1 -0
  13. package/lib/commonjs/checkbox/createCheckboxRoot.js +99 -0
  14. package/lib/commonjs/checkbox/createCheckboxRoot.js.map +1 -0
  15. package/lib/commonjs/checkbox/createCheckboxRoot.web.js +88 -0
  16. package/lib/commonjs/checkbox/createCheckboxRoot.web.js.map +1 -0
  17. package/lib/commonjs/checkbox/index.js +32 -0
  18. package/lib/commonjs/checkbox/index.js.map +1 -0
  19. package/lib/commonjs/checkbox/types.js +6 -0
  20. package/lib/commonjs/checkbox/types.js.map +1 -0
  21. package/lib/commonjs/checkbox/useCheckboxRoot.js +82 -0
  22. package/lib/commonjs/checkbox/useCheckboxRoot.js.map +1 -0
  23. package/lib/commonjs/index.js +25 -1
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/switch/createSwitchRoot.js +73 -0
  26. package/lib/commonjs/switch/createSwitchRoot.js.map +1 -0
  27. package/lib/commonjs/switch/index.js +15 -0
  28. package/lib/commonjs/switch/index.js.map +1 -0
  29. package/lib/commonjs/switch/types.js +6 -0
  30. package/lib/commonjs/switch/types.js.map +1 -0
  31. package/lib/commonjs/types.js +2 -0
  32. package/lib/commonjs/types.js.map +1 -0
  33. package/lib/module/button/createButtonRoot.js +3 -3
  34. package/lib/module/button/createButtonRoot.js.map +1 -1
  35. package/lib/module/checkbox/context.js +7 -0
  36. package/lib/module/checkbox/context.js.map +1 -0
  37. package/lib/module/checkbox/createCheckboxGroup.js +39 -0
  38. package/lib/module/checkbox/createCheckboxGroup.js.map +1 -0
  39. package/lib/module/checkbox/createCheckboxIcon.js +23 -0
  40. package/lib/module/checkbox/createCheckboxIcon.js.map +1 -0
  41. package/lib/module/checkbox/createCheckboxIndicator.js +42 -0
  42. package/lib/module/checkbox/createCheckboxIndicator.js.map +1 -0
  43. package/lib/module/checkbox/createCheckboxLabel.js +41 -0
  44. package/lib/module/checkbox/createCheckboxLabel.js.map +1 -0
  45. package/lib/module/checkbox/createCheckboxRoot.js +94 -0
  46. package/lib/module/checkbox/createCheckboxRoot.js.map +1 -0
  47. package/lib/module/checkbox/createCheckboxRoot.web.js +83 -0
  48. package/lib/module/checkbox/createCheckboxRoot.web.js.map +1 -0
  49. package/lib/module/checkbox/index.js +27 -0
  50. package/lib/module/checkbox/index.js.map +1 -0
  51. package/lib/module/checkbox/types.js +4 -0
  52. package/lib/module/checkbox/types.js.map +1 -0
  53. package/lib/module/checkbox/useCheckboxRoot.js +78 -0
  54. package/lib/module/checkbox/useCheckboxRoot.js.map +1 -0
  55. package/lib/module/index.js +3 -1
  56. package/lib/module/index.js.map +1 -1
  57. package/lib/module/switch/createSwitchRoot.js +67 -0
  58. package/lib/module/switch/createSwitchRoot.js.map +1 -0
  59. package/lib/module/switch/index.js +11 -0
  60. package/lib/module/switch/index.js.map +1 -0
  61. package/lib/module/switch/types.js +4 -0
  62. package/lib/module/switch/types.js.map +1 -0
  63. package/lib/module/types.js +2 -0
  64. package/lib/module/types.js.map +1 -0
  65. package/lib/typescript/button/context.d.ts +1 -1
  66. package/lib/typescript/button/context.d.ts.map +1 -1
  67. package/lib/typescript/button/createButtonRoot.d.ts +1 -1
  68. package/lib/typescript/button/createButtonRoot.d.ts.map +1 -1
  69. package/lib/typescript/button/types.d.ts +0 -7
  70. package/lib/typescript/button/types.d.ts.map +1 -1
  71. package/lib/typescript/checkbox/context.d.ts +18 -0
  72. package/lib/typescript/checkbox/context.d.ts.map +1 -0
  73. package/lib/typescript/checkbox/createCheckboxGroup.d.ts +3 -0
  74. package/lib/typescript/checkbox/createCheckboxGroup.d.ts.map +1 -0
  75. package/lib/typescript/checkbox/createCheckboxIcon.d.ts +3 -0
  76. package/lib/typescript/checkbox/createCheckboxIcon.d.ts.map +1 -0
  77. package/lib/typescript/checkbox/createCheckboxIndicator.d.ts +5 -0
  78. package/lib/typescript/checkbox/createCheckboxIndicator.d.ts.map +1 -0
  79. package/lib/typescript/checkbox/createCheckboxLabel.d.ts +5 -0
  80. package/lib/typescript/checkbox/createCheckboxLabel.d.ts.map +1 -0
  81. package/lib/typescript/checkbox/createCheckboxRoot.d.ts +2 -0
  82. package/lib/typescript/checkbox/createCheckboxRoot.d.ts.map +1 -0
  83. package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts +2 -0
  84. package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts.map +1 -0
  85. package/lib/typescript/checkbox/index.d.ts +10 -0
  86. package/lib/typescript/checkbox/index.d.ts.map +1 -0
  87. package/lib/typescript/checkbox/types.d.ts +57 -0
  88. package/lib/typescript/checkbox/types.d.ts.map +1 -0
  89. package/lib/typescript/checkbox/useCheckboxRoot.d.ts +147 -0
  90. package/lib/typescript/checkbox/useCheckboxRoot.d.ts.map +1 -0
  91. package/lib/typescript/index.d.ts +4 -1
  92. package/lib/typescript/index.d.ts.map +1 -1
  93. package/lib/typescript/select/types.d.ts +2 -7
  94. package/lib/typescript/select/types.d.ts.map +1 -1
  95. package/lib/typescript/switch/createSwitchRoot.d.ts +3 -0
  96. package/lib/typescript/switch/createSwitchRoot.d.ts.map +1 -0
  97. package/lib/typescript/switch/index.d.ts +7 -0
  98. package/lib/typescript/switch/index.d.ts.map +1 -0
  99. package/lib/typescript/switch/types.d.ts +38 -0
  100. package/lib/typescript/switch/types.d.ts.map +1 -0
  101. package/lib/typescript/types.d.ts +8 -0
  102. package/lib/typescript/types.d.ts.map +1 -0
  103. package/package.json +12 -9
  104. package/src/button/context.tsx +1 -1
  105. package/src/button/createButtonRoot.tsx +5 -4
  106. package/src/button/types.ts +0 -8
  107. package/src/checkbox/context.tsx +18 -0
  108. package/src/checkbox/createCheckboxGroup.tsx +32 -0
  109. package/src/checkbox/createCheckboxIcon.tsx +18 -0
  110. package/src/checkbox/createCheckboxIndicator.tsx +43 -0
  111. package/src/checkbox/createCheckboxLabel.tsx +42 -0
  112. package/src/checkbox/createCheckboxRoot.tsx +100 -0
  113. package/src/checkbox/createCheckboxRoot.web.tsx +77 -0
  114. package/src/checkbox/index.ts +43 -0
  115. package/src/checkbox/types.ts +74 -0
  116. package/src/checkbox/useCheckboxRoot.ts +85 -0
  117. package/src/index.ts +4 -1
  118. package/src/select/types.ts +2 -10
  119. package/src/switch/createSwitchRoot.tsx +72 -0
  120. package/src/switch/index.ts +16 -0
  121. package/src/switch/types.ts +42 -0
  122. package/src/types.ts +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIrE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ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,CAAC,yBAAyB,CACnC,eAAe,CAAC,SAAS,GAAG,gBAAgB,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CACvE,CAAC;IACF,SAAS,EAAE,KAAK,CAAC,yBAAyB,CACxC,eAAe,CAAC,cAAc,GAAG,qBAAqB,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CACjF,CAAC;CACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const createSwitchRoot: <T, R = unknown>(BaseSwitch: React.ComponentType<T>) => React.ForwardRefExoticComponent<import("./types").IInterfaceSwitchProps & React.RefAttributes<R>>;
3
+ //# sourceMappingURL=createSwitchRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSwitchRoot.d.ts","sourceRoot":"","sources":["../../../src/switch/createSwitchRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAS1C,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,YAAY,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,sGA8DhF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type React from 'react';
2
+ import type { ISwitchComponentType } from './types';
3
+ export type { ISwitchProps, ISwitchComponentType, IInterfaceSwitchProps } from './types';
4
+ export declare function createSwitch<T, R = unknown>({ Root, }: {
5
+ Root: React.ComponentType<T>;
6
+ }): ISwitchComponentType<T, R>;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEzF,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,EAC3C,IAAI,GACL,EAAE;IACD,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAC9B,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAK7B"}
@@ -0,0 +1,38 @@
1
+ import type React from 'react';
2
+ export interface IInterfaceSwitchProps {
3
+ /**
4
+ * Callback invoked when the switch value changes.
5
+ */
6
+ onValueChange?: (value: boolean) => void;
7
+ /**
8
+ * If true, set the Switch to the checked state.
9
+ */
10
+ isChecked?: boolean;
11
+ /**
12
+ * The current value of the switch.
13
+ */
14
+ value?: boolean;
15
+ /**
16
+ * If true, the switch will be disabled.
17
+ */
18
+ isDisabled?: boolean;
19
+ /**
20
+ * If true, the switch will be disabled.
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * If true, the checkbox will be initially checked.
25
+ */
26
+ defaultValue?: boolean;
27
+ /**
28
+ * If true, set the switch to the invalid state.
29
+ */
30
+ isInvalid?: boolean;
31
+ /**
32
+ * If true, the switch will be hovered.
33
+ */
34
+ isHovered?: boolean;
35
+ }
36
+ export type ISwitchComponentType<T, R = unknown> = React.ForwardRefExoticComponent<React.PropsWithoutRef<T & IInterfaceSwitchProps> & React.RefAttributes<R>>;
37
+ export type ISwitchProps = IInterfaceSwitchProps;
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/switch/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,IAAI,KAAK,CAAC,yBAAyB,CAChF,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,qBAAqB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAC1E,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface InteractionState {
2
+ hover: boolean;
3
+ focus: boolean;
4
+ active: boolean;
5
+ disabled: boolean;
6
+ focusVisible: boolean;
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;CACvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdx-ui/primitives",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.10",
4
4
  "main": "lib/commonjs/index.js",
5
5
  "module": "lib/module/index.js",
6
6
  "react-native": "src/index.ts",
@@ -9,7 +9,6 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "react-native": "./src/index.ts",
12
- "source": "./src/index.ts",
13
12
  "types": "./lib/typescript/index.d.ts",
14
13
  "import": "./lib/module/index.js",
15
14
  "require": "./lib/commonjs/index.js",
@@ -30,26 +29,30 @@
30
29
  ]
31
30
  },
32
31
  "peerDependencies": {
33
- "react": ">=18.0.0",
34
- "react-native": ">=0.74.0",
35
- "react-native-web": ">=0.19.0",
36
- "react-dom": ">=18.0.0"
32
+ "react": "^18.2.0 || ^19.0.0",
33
+ "react-native": ">=0.76.0",
34
+ "react-native-reanimated": ">=3.0.0",
35
+ "react-native-web": ">=0.19.0"
37
36
  },
38
37
  "peerDependenciesMeta": {
39
38
  "react-native": {
40
39
  "optional": true
41
40
  },
42
- "react-native-web": {
41
+ "react-native-reanimated": {
43
42
  "optional": true
44
43
  },
45
- "react-dom": {
44
+ "react-native-web": {
46
45
  "optional": true
47
46
  }
48
47
  },
49
48
  "dependencies": {
49
+ "@react-aria/visually-hidden": "3.8.30",
50
+ "@react-native-aria/checkbox": "0.2.10",
50
51
  "@react-native-aria/focus": "^0.2.9",
51
52
  "@react-native-aria/interactions": "^0.2.16",
52
- "@cdx-ui/utils": "0.0.1-alpha.1"
53
+ "@react-stately/checkbox": "3.7.4",
54
+ "@react-stately/toggle": "3.9.4",
55
+ "@cdx-ui/utils": "0.0.1-alpha.10"
53
56
  },
54
57
  "devDependencies": {
55
58
  "@types/react": "*",
@@ -1,4 +1,4 @@
1
1
  import { createContext } from '@cdx-ui/utils';
2
- import type { InteractionState } from './types';
2
+ import type { InteractionState } from '../types';
3
3
 
4
4
  export const [ButtonProvider, useButtonContext] = createContext<InteractionState>('ButtonContext');
@@ -3,9 +3,10 @@ import { forwardRef, useMemo } from 'react';
3
3
  import { composeEventHandlers } from '@cdx-ui/utils';
4
4
  import { useFocus, useFocusRing } from '@react-native-aria/focus';
5
5
  import { useHover, usePress } from '@react-native-aria/interactions';
6
+ import type { InteractionState } from '../types';
6
7
  import { dataAttributes } from '../utils/dataAttributes';
7
8
  import { ButtonProvider } from './context';
8
- import type { IButtonProps, InteractionState } from './types';
9
+ import type { IButtonProps } from './types';
9
10
 
10
11
  export const createButtonRoot = <T,>(BaseButton: React.ComponentType<T>) =>
11
12
  forwardRef(
@@ -37,7 +38,7 @@ export const createButtonRoot = <T,>(BaseButton: React.ComponentType<T>) =>
37
38
  hover: isHoveredProp || isHovered,
38
39
  focus: isFocusedProp || isFocused,
39
40
  active: isActiveProp || isActive,
40
- disabled: isDisabled,
41
+ disabled: !!isDisabled,
41
42
  focusVisible: isFocusVisibleProp || isFocusVisible,
42
43
  };
43
44
  }, [
@@ -61,7 +62,7 @@ export const createButtonRoot = <T,>(BaseButton: React.ComponentType<T>) =>
61
62
  hover: isHoveredProp || isHovered,
62
63
  focus: isFocusedProp || isFocused,
63
64
  active: isActiveProp || isActive,
64
- disabled: isDisabled,
65
+ disabled: !!isDisabled,
65
66
  focusVisible: isFocusVisibleProp || isFocusVisible,
66
67
  })}
67
68
  disabled={isDisabled}
@@ -90,7 +91,7 @@ export const createButtonRoot = <T,>(BaseButton: React.ComponentType<T>) =>
90
91
  hover: isHoveredProp || isHovered,
91
92
  focus: isFocusedProp || isFocused,
92
93
  active: isActiveProp || isActive,
93
- disabled: isDisabled,
94
+ disabled: !!isDisabled,
94
95
  focusVisible: isFocusVisibleProp || isFocusVisible,
95
96
  })
96
97
  : children}
@@ -1,14 +1,6 @@
1
1
  import type { PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from 'react';
2
2
  import type { PressableProps, ViewProps } from 'react-native';
3
3
 
4
- export interface InteractionState {
5
- hover: boolean;
6
- focus: boolean;
7
- active: boolean;
8
- disabled?: boolean;
9
- focusVisible: boolean;
10
- }
11
-
12
4
  export interface InterfaceButtonProps extends PressableProps {
13
5
  /**
14
6
  * If true, the button will be in hovered state.
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { createContext } from '@cdx-ui/utils';
3
+ import type { ICheckboxContextValue } from './types';
4
+
5
+ export const [CheckboxProvider, useCheckboxContext] =
6
+ createContext<ICheckboxContextValue>('CheckboxContext');
7
+
8
+ interface ICheckboxGroupState {
9
+ isReadOnly: boolean;
10
+ isDisabled: boolean;
11
+ isSelected: (value: string) => boolean;
12
+ addValue: (value: string) => void;
13
+ removeValue: (value: string) => void;
14
+ }
15
+
16
+ export const CheckboxGroupContext = React.createContext<{
17
+ state: ICheckboxGroupState;
18
+ } | null>(null);
@@ -0,0 +1,32 @@
1
+ import { forwardRef } from 'react';
2
+ import { useFormControlContext } from '@cdx-ui/utils';
3
+ import { useCheckboxGroup } from '@react-native-aria/checkbox';
4
+ import { useCheckboxGroupState } from '@react-stately/checkbox';
5
+ import { CheckboxGroupContext } from './context';
6
+ import type { ICheckboxGroupProps } from './types';
7
+
8
+ export const createCheckboxGroup = <T,>(BaseCheckboxGroup: React.ComponentType<T>) =>
9
+ forwardRef(({ children, ...props }: ICheckboxGroupProps, ref?: React.Ref<T>) => {
10
+ const state = useCheckboxGroupState({
11
+ ...props,
12
+ validationState: props.isInvalid ? 'invalid' : 'valid',
13
+ });
14
+
15
+ const { groupProps } = useCheckboxGroup(
16
+ {
17
+ ...props,
18
+ 'aria-label': props['aria-label'],
19
+ },
20
+ state,
21
+ );
22
+
23
+ const formControlContext = useFormControlContext();
24
+
25
+ return (
26
+ <CheckboxGroupContext.Provider value={{ state: { ...formControlContext, ...state } }}>
27
+ <BaseCheckboxGroup {...groupProps} {...props} ref={ref}>
28
+ {children}
29
+ </BaseCheckboxGroup>
30
+ </CheckboxGroupContext.Provider>
31
+ );
32
+ });
@@ -0,0 +1,18 @@
1
+ import { forwardRef } from 'react';
2
+ import { useCheckboxContext } from './context';
3
+ import type { ICheckboxIconProps } from './types';
4
+
5
+ export const createCheckboxIcon = <T,>(BaseCheckboxIcon: React.ComponentType<T>) =>
6
+ forwardRef<unknown, ICheckboxIconProps>(({ children, forceMount = false, ...props }, ref) => {
7
+ const { isChecked } = useCheckboxContext();
8
+
9
+ if (forceMount || isChecked) {
10
+ return (
11
+ <BaseCheckboxIcon {...(props as T)} ref={ref}>
12
+ {children}
13
+ </BaseCheckboxIcon>
14
+ );
15
+ }
16
+
17
+ return null;
18
+ });
@@ -0,0 +1,43 @@
1
+ import { forwardRef } from 'react';
2
+ import { dataAttributes } from '../utils/dataAttributes';
3
+ import { useCheckboxContext } from './context';
4
+ import type { ICheckboxIndicatorProps } from './types';
5
+
6
+ export const createCheckboxIndicator = <T,>(BaseCheckboxIndicator: React.ComponentType<T>) =>
7
+ forwardRef<unknown, ICheckboxIndicatorProps & { className?: string }>(
8
+ ({ children, className, ...props }, ref) => {
9
+ const {
10
+ isChecked,
11
+ isDisabled,
12
+ isHovered,
13
+ isInvalid,
14
+ isReadOnly,
15
+ isPressed,
16
+ isFocused,
17
+ isIndeterminate,
18
+ isFocusVisible,
19
+ } = useCheckboxContext();
20
+
21
+ return (
22
+ <BaseCheckboxIndicator
23
+ className={className}
24
+ {...dataAttributes({
25
+ hover: isHovered,
26
+ checked: isChecked,
27
+ disabled: isDisabled,
28
+ focusVisible: isFocusVisible,
29
+ invalid: isInvalid,
30
+ readOnly: isReadOnly,
31
+ active: isPressed,
32
+ focused: isFocused,
33
+ indeterminate: isIndeterminate,
34
+ slot: 'checkbox-indicator',
35
+ })}
36
+ {...(props as T)}
37
+ ref={ref}
38
+ >
39
+ {children}
40
+ </BaseCheckboxIndicator>
41
+ );
42
+ },
43
+ );
@@ -0,0 +1,42 @@
1
+ import { forwardRef } from 'react';
2
+ import { dataAttributes } from '../utils/dataAttributes';
3
+ import { useCheckboxContext } from './context';
4
+ import type { ICheckboxLabelProps } from './types';
5
+
6
+ export const createCheckboxLabel = <T,>(BaseCheckboxLabel: React.ComponentType<T>) =>
7
+ forwardRef<unknown, ICheckboxLabelProps & { className?: string }>(
8
+ ({ children, className, ...props }, ref) => {
9
+ const {
10
+ isChecked,
11
+ isDisabled,
12
+ isHovered,
13
+ isInvalid,
14
+ isReadOnly,
15
+ isPressed,
16
+ isFocused,
17
+ isIndeterminate,
18
+ isFocusVisible,
19
+ } = useCheckboxContext();
20
+
21
+ return (
22
+ <BaseCheckboxLabel
23
+ className={className}
24
+ {...dataAttributes({
25
+ hover: isHovered,
26
+ checked: isChecked,
27
+ disabled: isDisabled,
28
+ focusVisible: isFocusVisible,
29
+ invalid: isInvalid,
30
+ readOnly: isReadOnly,
31
+ pressed: isPressed,
32
+ focused: isFocused,
33
+ indeterminate: isIndeterminate,
34
+ })}
35
+ {...(props as T)}
36
+ ref={ref}
37
+ >
38
+ {children}
39
+ </BaseCheckboxLabel>
40
+ );
41
+ },
42
+ );
@@ -0,0 +1,100 @@
1
+ import { forwardRef } from 'react';
2
+ import { composeEventHandlers } from '@cdx-ui/utils';
3
+ import { useFocus } from '@react-native-aria/focus';
4
+ import { usePress } from '@react-native-aria/interactions';
5
+ import { dataAttributes } from '../utils/dataAttributes';
6
+ import { CheckboxProvider } from './context';
7
+ import type { ICheckboxProps } from './types';
8
+ import { useCheckboxRoot } from './useCheckboxRoot';
9
+
10
+ export const createCheckboxRoot = <T,>(BaseCheckbox: React.ComponentType<T>) =>
11
+ forwardRef(
12
+ (
13
+ {
14
+ onPressIn,
15
+ onPressOut,
16
+ onHoverIn,
17
+ onHoverOut,
18
+ onFocus,
19
+ onBlur,
20
+ children,
21
+ ...props
22
+ }: ICheckboxProps,
23
+ ref?: React.Ref<T>,
24
+ ) => {
25
+ const {
26
+ isHovered: isHoveredProp,
27
+ isChecked: isCheckedProp,
28
+ isDisabled: isDisabledProp,
29
+ isInvalid: isInvalidProp,
30
+ isReadOnly: isReadOnlyProp,
31
+ isPressed: isPressedProp,
32
+ isFocused: isFocusedProp,
33
+ isIndeterminate: isIndeterminateProp,
34
+ isFocusVisible,
35
+ } = props;
36
+
37
+ const {
38
+ combinedProps,
39
+ isInvalid,
40
+ isReadOnly,
41
+ isIndeterminate,
42
+ groupItemInputProps,
43
+ isChecked,
44
+ isDisabled,
45
+ isHovered,
46
+ hoverProps,
47
+ mergedRef,
48
+ } = useCheckboxRoot(props, ref);
49
+
50
+ const { focusProps, isFocused } = useFocus();
51
+
52
+ const { pressProps, isPressed } = usePress({
53
+ isDisabled: isDisabled || isDisabledProp,
54
+ });
55
+
56
+ return (
57
+ <BaseCheckbox
58
+ disabled={isDisabled || isDisabledProp}
59
+ {...pressProps}
60
+ {...(combinedProps as T)}
61
+ {...groupItemInputProps}
62
+ ref={mergedRef}
63
+ role="checkbox"
64
+ onPressIn={composeEventHandlers(onPressIn, pressProps.onPressIn)}
65
+ onPressOut={composeEventHandlers(onPressOut, pressProps.onPressOut)}
66
+ onHoverIn={composeEventHandlers(onHoverIn, hoverProps.onHoverIn)}
67
+ onHoverOut={composeEventHandlers(onHoverOut, hoverProps.onHoverOut)}
68
+ onFocus={composeEventHandlers(composeEventHandlers(onFocus, focusProps.onFocus))}
69
+ onBlur={composeEventHandlers(composeEventHandlers(onBlur, focusProps.onBlur))}
70
+ {...dataAttributes({
71
+ checked: isChecked || isCheckedProp,
72
+ disabled: isDisabled || isDisabledProp,
73
+ hover: isHovered || isHoveredProp,
74
+ invalid: isInvalid || isInvalidProp,
75
+ readonly: isReadOnly || isReadOnlyProp,
76
+ active: isPressed,
77
+ focus: isFocused,
78
+ indeterminate: isIndeterminate || isIndeterminateProp,
79
+ focusVisible: isFocusVisible,
80
+ })}
81
+ >
82
+ <CheckboxProvider
83
+ value={{
84
+ isChecked: isChecked || isCheckedProp,
85
+ isDisabled: isDisabled || isDisabledProp,
86
+ isHovered: isHovered || isHoveredProp,
87
+ isInvalid: isInvalid || isInvalidProp,
88
+ isReadOnly: isReadOnly || isReadOnlyProp,
89
+ isPressed: isPressed || isPressedProp,
90
+ isFocused: isFocused || isFocusedProp,
91
+ isIndeterminate: isIndeterminate || isIndeterminateProp,
92
+ isFocusVisible,
93
+ }}
94
+ >
95
+ {children}
96
+ </CheckboxProvider>
97
+ </BaseCheckbox>
98
+ );
99
+ },
100
+ );
@@ -0,0 +1,77 @@
1
+ import { forwardRef } from 'react';
2
+ import { VisuallyHidden } from '@react-aria/visually-hidden';
3
+ import { useFocusRing } from '@react-native-aria/focus';
4
+ import { dataAttributes } from '../utils/dataAttributes';
5
+ import { CheckboxProvider } from './context';
6
+ import type { ICheckboxProps } from './types';
7
+ import { useCheckboxRoot } from './useCheckboxRoot';
8
+
9
+ export const createCheckboxRoot = <T,>(BaseCheckbox: React.ComponentType<T>) =>
10
+ forwardRef(({ children, ...props }: ICheckboxProps, ref?: React.Ref<T>) => {
11
+ const {
12
+ isHovered: isHoveredProp,
13
+ isFocusVisible: isFocusVisibleProp,
14
+ isChecked: isCheckedProp,
15
+ isDisabled: isDisabledProp,
16
+ isInvalid: isInvalidProp,
17
+ isReadOnly: isReadOnlyProp,
18
+ isIndeterminate: isIndeterminateProp,
19
+ isFocused,
20
+ isPressed,
21
+ } = props;
22
+
23
+ const {
24
+ combinedProps,
25
+ isInvalid,
26
+ isReadOnly,
27
+ isIndeterminate,
28
+ groupItemInputProps,
29
+ isChecked,
30
+ isDisabled,
31
+ isHovered,
32
+ mergedRef,
33
+ inputRef,
34
+ } = useCheckboxRoot(props, ref, { useInputRefForAria: true });
35
+
36
+ const { focusProps, isFocusVisible } = useFocusRing();
37
+
38
+ return (
39
+ <BaseCheckbox
40
+ {...(combinedProps as T)}
41
+ ref={mergedRef}
42
+ role="label"
43
+ // eslint-disable-next-line react-native-a11y/has-valid-accessibility-role
44
+ accessibilityRole="label"
45
+ {...dataAttributes({
46
+ checked: isChecked || isCheckedProp,
47
+ disabled: isDisabled || isDisabledProp,
48
+ hover: isHovered || isHoveredProp,
49
+ invalid: isInvalid || isInvalidProp,
50
+ readonly: isReadOnly || isReadOnlyProp,
51
+ active: isPressed,
52
+ focus: isFocused,
53
+ indeterminate: isIndeterminate || isIndeterminateProp,
54
+ focusVisible: isFocusVisible,
55
+ })}
56
+ >
57
+ <CheckboxProvider
58
+ value={{
59
+ isChecked: isChecked || isCheckedProp,
60
+ isDisabled: isDisabled || isDisabledProp,
61
+ isFocusVisible: isFocusVisible || isFocusVisibleProp,
62
+ isHovered: isHovered || isHoveredProp,
63
+ isInvalid: isInvalid || isInvalidProp,
64
+ isReadOnly: isReadOnly || isReadOnlyProp,
65
+ isIndeterminate: isIndeterminate || isIndeterminateProp,
66
+ isPressed,
67
+ isFocused,
68
+ }}
69
+ >
70
+ <VisuallyHidden>
71
+ <input {...groupItemInputProps} {...focusProps} ref={inputRef} />
72
+ </VisuallyHidden>
73
+ {children}
74
+ </CheckboxProvider>
75
+ </BaseCheckbox>
76
+ );
77
+ });
@@ -0,0 +1,43 @@
1
+ import { createCheckboxGroup } from './createCheckboxGroup';
2
+ import { createCheckboxIcon } from './createCheckboxIcon';
3
+ import { createCheckboxIndicator } from './createCheckboxIndicator';
4
+ import { createCheckboxLabel } from './createCheckboxLabel';
5
+ import { createCheckboxRoot } from './createCheckboxRoot';
6
+ import type { ICheckboxComponentType } from './types';
7
+
8
+ export type {
9
+ ICheckboxComponentType,
10
+ ICheckboxGroupProps,
11
+ ICheckboxIconProps,
12
+ ICheckboxIndicatorProps,
13
+ ICheckboxLabelProps,
14
+ ICheckboxProps,
15
+ } from './types';
16
+
17
+ export const createCheckbox = <Root, Indicator, Icon, Label, Group>({
18
+ Root,
19
+ Indicator,
20
+ Icon,
21
+ Label,
22
+ Group,
23
+ }: {
24
+ Root: React.ComponentType<Root>;
25
+ Indicator: React.ComponentType<Indicator>;
26
+ Icon: React.ComponentType<Icon>;
27
+ Label: React.ComponentType<Label>;
28
+ Group: React.ComponentType<Group>;
29
+ }) => {
30
+ const Checkbox = createCheckboxRoot(Root) as any;
31
+ Checkbox.Indicator = createCheckboxIndicator(Indicator);
32
+ Checkbox.Icon = createCheckboxIcon(Icon);
33
+ Checkbox.Label = createCheckboxLabel(Label);
34
+ Checkbox.Group = createCheckboxGroup(Group);
35
+
36
+ Checkbox.displayName = 'Checkbox';
37
+ Checkbox.Indicator.displayName = 'Checkbox.Indicator';
38
+ Checkbox.Icon.displayName = 'Checkbox.Icon';
39
+ Checkbox.Label.displayName = 'Checkbox.Label';
40
+ Checkbox.Group.displayName = 'Checkbox.Group';
41
+
42
+ return Checkbox as ICheckboxComponentType<Root, Indicator, Icon, Label, Group>;
43
+ };
@@ -0,0 +1,74 @@
1
+ import type { PressableProps } from 'react-native';
2
+ export interface InterfaceCheckbox extends PressableProps {
3
+ value: string;
4
+ onChange?: (isSelected: boolean) => void;
5
+ children?: React.ReactNode;
6
+ defaultIsChecked?: boolean;
7
+ isChecked?: boolean;
8
+ isDisabled?: boolean;
9
+ isInvalid?: boolean;
10
+ isReadOnly?: boolean;
11
+ isHovered?: boolean;
12
+ isFocused?: boolean;
13
+ isPressed?: boolean;
14
+ isRequired?: boolean;
15
+ isIndeterminate?: boolean;
16
+ isFocusVisible?: boolean;
17
+ }
18
+
19
+ export interface ICheckboxGroupProps {
20
+ value: string[];
21
+ onChange?: (values: string[]) => void;
22
+ children?: React.ReactNode;
23
+ isDisabled?: boolean;
24
+ isInvalid?: boolean;
25
+ isReadOnly?: boolean;
26
+ isRequired?: boolean;
27
+ 'aria-label'?: string;
28
+ }
29
+
30
+ export type ICheckboxComponentType<Root, Indicator, Icon, Label, Group> =
31
+ React.ForwardRefExoticComponent<
32
+ React.RefAttributes<Root> & React.PropsWithoutRef<Root> & InterfaceCheckbox
33
+ > & {
34
+ Indicator: React.ForwardRefExoticComponent<
35
+ React.RefAttributes<Indicator> & React.PropsWithoutRef<Indicator> & ICheckboxIndicatorProps
36
+ >;
37
+ Icon: React.ForwardRefExoticComponent<
38
+ React.RefAttributes<Icon> & React.PropsWithoutRef<Icon> & ICheckboxIconProps
39
+ >;
40
+ Label: React.ForwardRefExoticComponent<
41
+ React.RefAttributes<Label> & React.PropsWithoutRef<Label> & ICheckboxLabelProps
42
+ >;
43
+ Group: React.ForwardRefExoticComponent<
44
+ React.RefAttributes<Group> & React.PropsWithoutRef<Group> & ICheckboxGroupProps
45
+ >;
46
+ };
47
+
48
+ export interface ICheckboxIndicatorProps {
49
+ children?: React.ReactNode;
50
+ }
51
+
52
+ export interface ICheckboxIconProps {
53
+ children?: React.ReactNode;
54
+ /** Render the icon even when unchecked */
55
+ forceMount?: boolean;
56
+ }
57
+
58
+ export interface ICheckboxLabelProps {
59
+ children?: React.ReactNode;
60
+ }
61
+
62
+ export type ICheckboxProps = InterfaceCheckbox;
63
+
64
+ export interface ICheckboxContextValue {
65
+ isChecked?: boolean;
66
+ isDisabled?: boolean;
67
+ isHovered?: boolean;
68
+ isInvalid?: boolean;
69
+ isReadOnly?: boolean;
70
+ isPressed?: boolean;
71
+ isFocused?: boolean;
72
+ isIndeterminate?: boolean;
73
+ isFocusVisible?: boolean;
74
+ }