@audira/carbon-react-native 1.0.0-beta.13 → 1.0.0-beta.15

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 (73) hide show
  1. package/lib/commonjs/components/checkbox/Checkbox.js +4 -4
  2. package/lib/commonjs/components/checkbox/Checkbox.js.map +1 -1
  3. package/lib/commonjs/components/checkbox/index.js.map +1 -1
  4. package/lib/commonjs/components/checkbox-group/index.js.map +1 -1
  5. package/lib/commonjs/components/checkbox-input/CheckboxInput.js +20 -20
  6. package/lib/commonjs/components/checkbox-input/CheckboxInput.js.map +1 -1
  7. package/lib/commonjs/components/checkbox-input/CheckboxInputState.js +2 -0
  8. package/lib/commonjs/components/checkbox-input/{CheckboxInputValue.js.map → CheckboxInputState.js.map} +1 -1
  9. package/lib/commonjs/components/checkbox-input/index.js +4 -4
  10. package/lib/commonjs/components/checkbox-input/index.js.map +1 -1
  11. package/lib/commonjs/components/notification/_variants/actionable/ActionableVariant.js +0 -1
  12. package/lib/commonjs/components/notification/_variants/actionable/ActionableVariant.js.map +1 -1
  13. package/lib/commonjs/components/notification/_variants/callout/CalloutVariant.js +0 -1
  14. package/lib/commonjs/components/notification/_variants/callout/CalloutVariant.js.map +1 -1
  15. package/lib/module/components/checkbox/Checkbox.js +4 -4
  16. package/lib/module/components/checkbox/Checkbox.js.map +1 -1
  17. package/lib/module/components/checkbox/index.js.map +1 -1
  18. package/lib/module/components/checkbox-group/index.js.map +1 -1
  19. package/lib/module/components/checkbox-input/CheckboxInput.js +20 -20
  20. package/lib/module/components/checkbox-input/CheckboxInput.js.map +1 -1
  21. package/lib/module/components/checkbox-input/CheckboxInputState.js +2 -0
  22. package/lib/module/components/checkbox-input/{CheckboxInputValue.js.map → CheckboxInputState.js.map} +1 -1
  23. package/lib/module/components/checkbox-input/index.js +1 -1
  24. package/lib/module/components/checkbox-input/index.js.map +1 -1
  25. package/lib/module/components/notification/_variants/actionable/ActionableVariant.js +0 -1
  26. package/lib/module/components/notification/_variants/actionable/ActionableVariant.js.map +1 -1
  27. package/lib/module/components/notification/_variants/callout/CalloutVariant.js +0 -1
  28. package/lib/module/components/notification/_variants/callout/CalloutVariant.js.map +1 -1
  29. package/lib/typescript/commonjs/components/checkbox/CheckboxProps.d.ts +3 -3
  30. package/lib/typescript/commonjs/components/checkbox/CheckboxProps.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/components/checkbox/index.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/components/checkbox-group/index.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/components/checkbox-input/CheckboxInputProps.d.ts +5 -5
  34. package/lib/typescript/commonjs/components/checkbox-input/CheckboxInputProps.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/components/checkbox-input/CheckboxInputState.d.ts +5 -0
  36. package/lib/typescript/commonjs/components/checkbox-input/CheckboxInputState.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/components/checkbox-input/_RefBase.d.ts +3 -3
  38. package/lib/typescript/commonjs/components/checkbox-input/index.d.ts +1 -1
  39. package/lib/typescript/commonjs/components/checkbox-input/index.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/components/notification/_variants/actionable/ActionableVariant.d.ts.map +1 -1
  41. package/lib/typescript/commonjs/components/notification/_variants/callout/CalloutVariant.d.ts.map +1 -1
  42. package/lib/typescript/module/components/checkbox/CheckboxProps.d.ts +3 -3
  43. package/lib/typescript/module/components/checkbox/CheckboxProps.d.ts.map +1 -1
  44. package/lib/typescript/module/components/checkbox/index.d.ts.map +1 -1
  45. package/lib/typescript/module/components/checkbox-group/index.d.ts.map +1 -1
  46. package/lib/typescript/module/components/checkbox-input/CheckboxInputProps.d.ts +5 -5
  47. package/lib/typescript/module/components/checkbox-input/CheckboxInputProps.d.ts.map +1 -1
  48. package/lib/typescript/module/components/checkbox-input/CheckboxInputState.d.ts +5 -0
  49. package/lib/typescript/module/components/checkbox-input/CheckboxInputState.d.ts.map +1 -0
  50. package/lib/typescript/module/components/checkbox-input/_RefBase.d.ts +3 -3
  51. package/lib/typescript/module/components/checkbox-input/index.d.ts +1 -1
  52. package/lib/typescript/module/components/checkbox-input/index.d.ts.map +1 -1
  53. package/lib/typescript/module/components/notification/_variants/actionable/ActionableVariant.d.ts.map +1 -1
  54. package/lib/typescript/module/components/notification/_variants/callout/CalloutVariant.d.ts.map +1 -1
  55. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +1 -1
  57. package/src/components/checkbox/Checkbox.tsx +4 -4
  58. package/src/components/checkbox/CheckboxProps.ts +4 -5
  59. package/src/components/checkbox-input/CheckboxInput.tsx +27 -27
  60. package/src/components/checkbox-input/CheckboxInputProps.ts +7 -5
  61. package/src/components/checkbox-input/{CheckboxInputValue.ts → CheckboxInputState.ts} +1 -1
  62. package/src/components/checkbox-input/_RefBase.ts +4 -4
  63. package/src/components/checkbox-input/{index.tsx → index.ts} +1 -1
  64. package/src/components/notification/_variants/actionable/ActionableVariant.tsx +0 -1
  65. package/src/components/notification/_variants/callout/CalloutVariant.tsx +0 -1
  66. package/lib/commonjs/components/checkbox-input/CheckboxInputValue.js +0 -2
  67. package/lib/module/components/checkbox-input/CheckboxInputValue.js +0 -2
  68. package/lib/typescript/commonjs/components/checkbox-input/CheckboxInputValue.d.ts +0 -5
  69. package/lib/typescript/commonjs/components/checkbox-input/CheckboxInputValue.d.ts.map +0 -1
  70. package/lib/typescript/module/components/checkbox-input/CheckboxInputValue.d.ts +0 -5
  71. package/lib/typescript/module/components/checkbox-input/CheckboxInputValue.d.ts.map +0 -1
  72. /package/src/components/checkbox/{index.tsx → index.ts} +0 -0
  73. /package/src/components/checkbox-group/{index.tsx → index.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audira/carbon-react-native",
3
- "version": "1.0.0-beta.13",
3
+ "version": "1.0.0-beta.15",
4
4
  "license": "MIT",
5
5
  "homepage": "https://rakadoank.github.io/carbon-react-native",
6
6
  "repository": "https://github.com/RakaDoank/carbon-react-native",
@@ -61,8 +61,8 @@ import type {
61
61
  export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>(
62
62
  function Checkbox(
63
63
  {
64
- defaultValue,
65
- value,
64
+ defaultChecked,
65
+ checked,
66
66
  interactiveState = "normal",
67
67
  label,
68
68
  role = "checkbox",
@@ -150,8 +150,8 @@ export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>(
150
150
  <CheckboxInput
151
151
  { ...checkboxInputProps }
152
152
  role="none"
153
- defaultValue={ defaultValue }
154
- value={ value }
153
+ defaultChecked={ defaultChecked }
154
+ checked={ checked }
155
155
  interactiveState={ interactiveState }
156
156
  onChange={ onChange }
157
157
  onPress={ onPress }
@@ -12,17 +12,16 @@ import type {
12
12
  } from "../form-label"
13
13
 
14
14
  export interface CheckboxProps extends Omit<ViewProps, "children"> {
15
- defaultValue?: CheckboxInputProps["defaultValue"],
16
- value?: CheckboxInputProps["value"],
15
+ defaultChecked?: CheckboxInputProps["defaultChecked"],
16
+ checked?: CheckboxInputProps["checked"],
17
17
  interactiveState?: CheckboxInputProps["interactiveState"],
18
18
  label: string,
19
19
  onChange?: CheckboxInputProps["onChange"],
20
20
  onPress?: CheckboxInputProps["onPress"],
21
21
  checkboxInputProps?: Omit<
22
22
  CheckboxInputProps,
23
- | "defaultValue"
24
- | "value"
25
- | "indeterminate"
23
+ | "defaultChecked"
24
+ | "checked"
26
25
  | "interactiveState"
27
26
  | "role"
28
27
  | "onChange"
@@ -49,8 +49,8 @@ import type {
49
49
  } from "./CheckboxInputRef"
50
50
 
51
51
  import type {
52
- CheckboxInputValue,
53
- } from "./CheckboxInputValue"
52
+ CheckboxInputState,
53
+ } from "./CheckboxInputState"
54
54
 
55
55
  import type {
56
56
  RefBase,
@@ -59,8 +59,8 @@ import type {
59
59
  export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
60
60
  function CheckboxInput(
61
61
  {
62
- defaultValue,
63
- value: valueProp,
62
+ defaultChecked,
63
+ checked: checkedProp,
64
64
  interactiveState = "normal",
65
65
  style,
66
66
  role = "checkbox",
@@ -83,32 +83,32 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
83
83
  ref =
84
84
  useRef({
85
85
  onChangeEffect: false,
86
- value: typeof valueProp == "boolean" || typeof valueProp == "object"
87
- ? valueProp
88
- : typeof defaultValue == "boolean" || typeof defaultValue == "object"
89
- ? defaultValue
86
+ value: typeof checkedProp == "boolean" || typeof checkedProp == "object"
87
+ ? checkedProp
88
+ : typeof defaultChecked == "boolean" || typeof defaultChecked == "object"
89
+ ? defaultChecked
90
90
  : false,
91
91
  }),
92
92
 
93
93
  [isFocused, setIsFocused] =
94
94
  useState(false),
95
95
 
96
- [valueSelf, setValueSelf] =
96
+ [checkedSelf, setCheckedSelf] =
97
97
  useState(() => {
98
- if(typeof defaultValue == "boolean" || typeof defaultValue == "object") {
99
- return defaultValue
98
+ if(typeof defaultChecked == "boolean" || typeof defaultChecked == "object") {
99
+ return defaultChecked
100
100
  }
101
101
  return false
102
102
  }),
103
103
 
104
104
  controlled =
105
- typeof valueProp !== "undefined",
105
+ typeof checkedProp !== "undefined",
106
106
 
107
- value =
108
- controlled ? valueProp : valueSelf,
107
+ checked =
108
+ controlled ? checkedProp : checkedSelf,
109
109
 
110
110
  indeterminate =
111
- value === null,
111
+ checked === null,
112
112
 
113
113
  blurHandler: NonNullable<PressableProps["onBlur"]> =
114
114
  useCallback(event => {
@@ -132,7 +132,7 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
132
132
  if(interactiveState !== "read_only") {
133
133
  if(!controlled) {
134
134
  ref.current.onChangeEffect = true
135
- setValueSelf(self => self === null ? true : !self)
135
+ setCheckedSelf(self => self === null ? true : !self)
136
136
  } else {
137
137
  onChange?.(ref.current.value === null ? true : !ref.current.value)
138
138
  }
@@ -148,13 +148,13 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
148
148
  mapIconColor[interactiveState][themeContext.colorScheme]
149
149
 
150
150
  useEffect(() => {
151
- ref.current.value = value
151
+ ref.current.value = checked
152
152
  if(ref.current.onChangeEffect) {
153
153
  ref.current.onChangeEffect = false
154
- onChange?.(value)
154
+ onChange?.(checked)
155
155
  }
156
156
  }, [
157
- value,
157
+ checked,
158
158
  onChange,
159
159
  ])
160
160
 
@@ -163,12 +163,12 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
163
163
  viewRef.current as View,
164
164
  {
165
165
  get value() {
166
- return value
166
+ return checked
167
167
  },
168
168
  setValue(value_) {
169
169
  if(!controlled && interactiveState !== "read_only") {
170
170
  ref.current.onChangeEffect = true
171
- setValueSelf(self => {
171
+ setCheckedSelf(self => {
172
172
  if(typeof value_ === "function") {
173
173
  ref.current.value = value_(self)
174
174
  } else {
@@ -181,7 +181,7 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
181
181
  },
182
182
  )
183
183
  }, [
184
- value,
184
+ checked,
185
185
  controlled,
186
186
  interactiveState,
187
187
  ])
@@ -199,7 +199,7 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
199
199
  FlexStyleSheet.justify_center,
200
200
  CommonStyleSheet.relative,
201
201
  baseStyle.checkbox,
202
- getInteractiveStateStyle(interactiveState, value),
202
+ getInteractiveStateStyle(interactiveState, checked),
203
203
  style,
204
204
  ] }
205
205
  ref={ viewRef }
@@ -215,7 +215,7 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
215
215
  ] }
216
216
  />
217
217
 
218
- { value && indeterminate ? (
218
+ { indeterminate ? (
219
219
  <IconSubtract
220
220
  width={ iconSize }
221
221
  height={ iconSize }
@@ -226,7 +226,7 @@ export const CheckboxInput = forwardRef<CheckboxInputRef, CheckboxInputProps>(
226
226
  width={ iconSize }
227
227
  height={ iconSize }
228
228
  fill={ iconColor }
229
- style={ !value ? baseStyle.checkmarkHidden : null }
229
+ style={ !checked ? baseStyle.checkmarkHidden : null }
230
230
  />
231
231
  ) }
232
232
  </Pressable>
@@ -334,7 +334,7 @@ const
334
334
 
335
335
  function getInteractiveStateStyle(
336
336
  interactiveState: CheckboxInputInteractiveState,
337
- value: CheckboxInputValue,
337
+ value: CheckboxInputState,
338
338
  ) {
339
- return interactiveStyle[`${interactiveState}_${!!value}`]
339
+ return interactiveStyle[`${interactiveState}_${typeof value == "object" ? true : value}`]
340
340
  }
@@ -8,18 +8,20 @@ import type {
8
8
  } from "./CheckboxInputInteractiveState"
9
9
 
10
10
  import type {
11
- CheckboxInputValue,
12
- } from "./CheckboxInputValue"
11
+ CheckboxInputState,
12
+ } from "./CheckboxInputState"
13
13
 
14
14
  export interface CheckboxInputProps extends Omit<
15
15
  PressableProps,
16
+ | "defaultValue"
17
+ | "value"
16
18
  | "children"
17
19
  | "disabled"
18
20
  | "style"
19
21
  > {
20
- defaultValue?: CheckboxInputValue,
21
- value?: CheckboxInputValue,
22
+ defaultChecked?: CheckboxInputState,
23
+ checked?: CheckboxInputState,
22
24
  interactiveState?: CheckboxInputInteractiveState,
23
- onChange?: (value: CheckboxInputValue) => void,
25
+ onChange?: (value: CheckboxInputState) => void,
24
26
  style?: ViewProps["style"],
25
27
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * null = indeterminate
3
3
  */
4
- export type CheckboxInputValue =
4
+ export type CheckboxInputState =
5
5
  | boolean
6
6
  | null
@@ -1,11 +1,11 @@
1
1
  import type {
2
- CheckboxInputValue,
3
- } from "./CheckboxInputValue"
2
+ CheckboxInputState,
3
+ } from "./CheckboxInputState"
4
4
 
5
5
  export interface RefBase {
6
- readonly value: CheckboxInputValue,
6
+ readonly value: CheckboxInputState,
7
7
  /**
8
8
  * This method does nothing when `controlled` prop is true
9
9
  */
10
- setValue: (value: CheckboxInputValue | ((value: CheckboxInputValue) => CheckboxInputValue)) => void,
10
+ setValue: (value: CheckboxInputState | ((value: CheckboxInputState) => CheckboxInputState)) => void,
11
11
  }
@@ -2,4 +2,4 @@ export * from "./CheckboxInput"
2
2
  export * from "./CheckboxInputInteractiveState"
3
3
  export * from "./CheckboxInputProps"
4
4
  export * from "./CheckboxInputRef"
5
- export * from "./CheckboxInputValue"
5
+ export * from "./CheckboxInputState"
@@ -43,7 +43,6 @@ export const ActionableVariant = forwardRef<ActionableVariantRef, ActionableVari
43
43
  <VariantContextProvider color={ color }>
44
44
  <Base
45
45
  { ...props }
46
- inline={ false }
47
46
  Icon={ Icon }
48
47
  iconClose
49
48
  body={
@@ -38,7 +38,6 @@ export const CalloutVariant = forwardRef<CalloutVariantRef, CalloutVariantProps>
38
38
  <VariantContextProvider color={ color }>
39
39
  <Base
40
40
  { ...props }
41
- inline={ false }
42
41
  Icon={ Icon }
43
42
  iconClose={ false }
44
43
  body={
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=CheckboxInputValue.js.map
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=CheckboxInputValue.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * null = indeterminate
3
- */
4
- export type CheckboxInputValue = boolean | null;
5
- //# sourceMappingURL=CheckboxInputValue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckboxInputValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkbox-input/CheckboxInputValue.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC3B,OAAO,GACP,IAAI,CAAA"}
@@ -1,5 +0,0 @@
1
- /**
2
- * null = indeterminate
3
- */
4
- export type CheckboxInputValue = boolean | null;
5
- //# sourceMappingURL=CheckboxInputValue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckboxInputValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/checkbox-input/CheckboxInputValue.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC3B,OAAO,GACP,IAAI,CAAA"}
File without changes