@startupjs-ui/checkbox 0.1.23 → 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,12 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [0.1.23](https://github.com/startupjs/startupjs-ui/compare/v0.1.22...v0.1.23) (2026-03-27)
6
+ # [0.2.0-alpha.0](https://github.com/startupjs/startupjs-ui/compare/v0.1.22...v0.2.0-alpha.0) (2026-03-27)
7
7
 
8
8
 
9
- ### Bug Fixes
9
+ ### Features
10
10
 
11
- * **Checkbox:** add prop for background color ([#23](https://github.com/startupjs/startupjs-ui/issues/23)) ([613a522](https://github.com/startupjs/startupjs-ui/commit/613a5226e15d9a682f7652155f084c26c747ea4d))
11
+ * fix and improve accessibility of various components. Add storybook with tests. ([#21](https://github.com/startupjs/startupjs-ui/issues/21)) ([83b6576](https://github.com/startupjs/startupjs-ui/commit/83b65767ed61b24209f71b143ba1c2986170ab58))
12
12
 
13
13
 
14
14
 
package/checkbox.tsx CHANGED
@@ -13,7 +13,6 @@ const AnimatedView = Animated.View
13
13
  interface CheckboxInputProps {
14
14
  value?: boolean
15
15
  icon?: any
16
- checkedBgColor?: string
17
16
  _hasError?: boolean
18
17
  [key: string]: any
19
18
  }
@@ -21,9 +20,7 @@ interface CheckboxInputProps {
21
20
  function CheckboxInput ({
22
21
  value,
23
22
  icon,
24
- checkedBgColor,
25
23
  _hasError,
26
- style,
27
24
  ...props
28
25
  }: CheckboxInputProps): ReactNode {
29
26
  const animation = useRef(new Animated.Value(value ? 1 : 0)).current
@@ -50,19 +47,14 @@ function CheckboxInput ({
50
47
  }, [value])
51
48
 
52
49
  const checkedStyleName = { checked: value }
53
- const checkedBgStyle = value && checkedBgColor
54
- ? { backgroundColor: checkedBgColor }
55
- : undefined
56
50
 
57
51
  return pug`
58
52
  Div.checkbox(
59
53
  styleName=[checkedStyleName, { error: _hasError }]
60
- style=style
61
- accessibilityRole='checkbox'
54
+ role='checkbox'
62
55
  onLayout=(event) => setWidth(event.nativeEvent.layout.width)
63
56
  ...props
64
57
  )
65
- Div.checkbox-bg(style=checkedBgStyle)
66
58
  Icon.checkbox-icon(
67
59
  styleName=[checkedStyleName]
68
60
  icon= icon || faCheck
package/index.cssx.styl CHANGED
@@ -51,14 +51,6 @@ $this = merge({
51
51
  background-color var(--color-bg-primary)
52
52
  border-color var(--color-border-primary)
53
53
 
54
- .checkbox-bg
55
- position absolute
56
- left 0
57
- right 0
58
- top 0
59
- bottom 0
60
- border-radius: $this.checkbox.borderRadius
61
-
62
54
  .checkbox-icon
63
55
  display none
64
56
  color $checkedIconColor
@@ -95,14 +87,6 @@ $this = merge({
95
87
  &.checked
96
88
  background-color var(--color-bg-primary)
97
89
 
98
- .switch-bg
99
- position absolute
100
- left 0
101
- right 0
102
- top 0
103
- bottom 0
104
- radius(circle)
105
-
106
90
  .switch-circle
107
91
  width: $this.switch.circleSize
108
92
  height @width
package/index.d.ts CHANGED
@@ -15,8 +15,6 @@ export interface CheckboxProps {
15
15
  value?: boolean;
16
16
  /** Custom icon for the checkbox variant */
17
17
  icon?: any;
18
- /** Custom background color when checked */
19
- checkedBgColor?: string;
20
18
  /** Disable interactions @default false */
21
19
  disabled?: boolean;
22
20
  /** Render a non-interactive value @default false */
package/index.tsx CHANGED
@@ -31,8 +31,6 @@ export interface CheckboxProps {
31
31
  value?: boolean
32
32
  /** Custom icon for the checkbox variant */
33
33
  icon?: any
34
- /** Custom background color when checked */
35
- checkedBgColor?: string
36
34
  /** Disable interactions @default false */
37
35
  disabled?: boolean
38
36
  /** Render a non-interactive value @default false */
@@ -57,7 +55,6 @@ function Checkbox ({
57
55
  readonly = false,
58
56
  value = false,
59
57
  disabled = false,
60
- checkedBgColor,
61
58
  onChange,
62
59
  onFocus, // skip due to pointless triggering when clicked on the View
63
60
  onBlur, // skip due to pointless triggering when clicked on the View
@@ -79,8 +76,9 @@ function Checkbox ({
79
76
  value=value
80
77
  onPress=onPress
81
78
  disabled=disabled
82
- accessibilityRole='checkbox'
83
- checkedBgColor=checkedBgColor
79
+ role=variant === 'switch' ? 'switch' : 'checkbox'
80
+ aria-checked=value
81
+ aria-disabled=disabled
84
82
  ...props
85
83
  )
86
84
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startupjs-ui/checkbox",
3
- "version": "0.1.23",
3
+ "version": "0.2.0-alpha.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -8,15 +8,15 @@
8
8
  "types": "index.d.ts",
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@startupjs-ui/core": "^0.1.22",
12
- "@startupjs-ui/div": "^0.1.22",
13
- "@startupjs-ui/icon": "^0.1.22",
14
- "@startupjs-ui/span": "^0.1.22"
11
+ "@startupjs-ui/core": "^0.2.0-alpha.0",
12
+ "@startupjs-ui/div": "^0.2.0-alpha.0",
13
+ "@startupjs-ui/icon": "^0.2.0-alpha.0",
14
+ "@startupjs-ui/span": "^0.2.0-alpha.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": "*",
18
18
  "react-native": "*",
19
19
  "startupjs": "*"
20
20
  },
21
- "gitHead": "37e37c298a2467d18d1de1931f9e7942f06e7665"
21
+ "gitHead": "a428246a18d0e7f77809043c8240253240d11d66"
22
22
  }
package/switch.tsx CHANGED
@@ -17,16 +17,13 @@ const AnimatedView = Animated.View
17
17
 
18
18
  interface SwitchInputProps {
19
19
  value?: boolean
20
- checkedBgColor?: string
21
20
  _hasError?: boolean
22
21
  [key: string]: any
23
22
  }
24
23
 
25
24
  function SwitchInput ({
26
25
  value,
27
- checkedBgColor,
28
26
  _hasError,
29
- style,
30
27
  ...props
31
28
  }: SwitchInputProps): ReactNode {
32
29
  const animation = useRef(new Animated.Value(value ? 1 : 0)).current
@@ -55,17 +52,11 @@ function SwitchInput ({
55
52
  }
56
53
  }, [value])
57
54
 
58
- const checkedBgStyle = value && checkedBgColor
59
- ? { backgroundColor: checkedBgColor }
60
- : undefined
61
-
62
55
  return pug`
63
56
  Div.switch(
64
57
  styleName=[{ checked: value, error: _hasError }]
65
- style=style
66
58
  ...props
67
59
  )
68
- Div.switch-bg(style=checkedBgStyle)
69
60
  AnimatedView.switch-circle(
70
61
  part='switchCircle'
71
62
  style={