@conveyorhq/arrow-ds 1.189.0 → 1.190.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.
@@ -111,10 +111,10 @@ an indeterminate state.
111
111
  </Story>
112
112
  </Canvas>
113
113
 
114
- ### Disabled
114
+ ### States
115
115
 
116
116
  <Canvas withSource={SourceState.OPEN}>
117
- <Story name="Disabled">
117
+ <Story name="States">
118
118
  <Checkbox.Group>
119
119
  <Checkbox label="Unchecked" />
120
120
  <Checkbox label="Checked" checked />
@@ -124,6 +124,19 @@ an indeterminate state.
124
124
  </Story>
125
125
  </Canvas>
126
126
 
127
+ ### Blue
128
+
129
+ <Canvas withSource={SourceState.OPEN}>
130
+ <Story name="Blue">
131
+ <Checkbox.Group>
132
+ <Checkbox color="blue" label="Unchecked" />
133
+ <Checkbox color="blue" label="Checked" checked />
134
+ <Checkbox color="blue" label="Disabled" disabled />
135
+ <Checkbox color="blue" label="Checked + Disabled" checked disabled />
136
+ </Checkbox.Group>
137
+ </Story>
138
+ </Canvas>
139
+
127
140
  ### Group Vertical
128
141
 
129
142
  <Canvas withSource={SourceState.OPEN}>
@@ -36,6 +36,10 @@ export type CheckboxProps = Omit<InputProps, "checked"> & {
36
36
  * displayed by passing the string "indeterminate" instead of true/false.
37
37
  */
38
38
  checked?: boolean | "indeterminate";
39
+ /**
40
+ * Determines the background color of the checkbox when checked.
41
+ */
42
+ color?: "brandGreen" | "blue";
39
43
  };
40
44
 
41
45
  const CheckboxGroup = (props: StackProps) => {
@@ -65,6 +69,7 @@ export const Checkbox = ({
65
69
  isRequired = undefined,
66
70
  tabIndex,
67
71
  theme: themeProp,
72
+ color = "brandGreen",
68
73
  ...rest
69
74
  }: CheckboxProps) => {
70
75
  const { isRequired: isRequiredContext, theme: themeContext } = useContext(
@@ -110,6 +115,10 @@ export const Checkbox = ({
110
115
  updatedChecked = CheckboxState.UNCHECKED;
111
116
  } else if (checkedState === CheckboxState.UNCHECKED) {
112
117
  updatedChecked = CheckboxState.CHECKED;
118
+ } else if (checkedState === CheckboxState.INDETERMINATE) {
119
+ updatedChecked = CheckboxState.INDETERMINATE;
120
+ } else {
121
+ updatedChecked = CheckboxState.UNCHECKED;
113
122
  }
114
123
 
115
124
  setCheckedState(updatedChecked as CheckboxState);
@@ -151,22 +160,22 @@ export const Checkbox = ({
151
160
  className={classnames(
152
161
  bem(cn, { e: "Box" }),
153
162
  bem(cn, { e: "Box", m: theme }),
163
+ bem(cn, { e: "Box", m: color }),
154
164
  checked && bem(cn, { e: "Box", m: "checked" }),
155
165
  )}
156
166
  />
157
- {checked && (
158
- <Icon
159
- className={classnames(
160
- bem(cn, { e: "Check" }),
161
- bem(cn, { e: "Check", m: theme }),
162
- )}
163
- icon={
164
- checkedState === CheckboxState.INDETERMINATE
165
- ? ICON_TYPE.MINUS
166
- : ICON_TYPE.CHECK
167
- }
168
- />
169
- )}
167
+ <Icon
168
+ className={classnames(
169
+ bem(cn, { e: "Check" }),
170
+ bem(cn, { e: "Check", m: theme }),
171
+ checked && bem(cn, { e: "Check", m: "checked" }),
172
+ )}
173
+ icon={
174
+ checkedState === CheckboxState.INDETERMINATE
175
+ ? ICON_TYPE.MINUS
176
+ : ICON_TYPE.CHECK
177
+ }
178
+ />
170
179
  </Box>
171
180
  );
172
181
 
@@ -37,10 +37,25 @@
37
37
  /* Checked */
38
38
  .ads-Checkbox-Check {
39
39
  @apply absolute
40
- text-h5;
41
- top: 50%;
42
- left: 50%;
43
- transform: translate(-50%, -50%);
40
+ inset-0
41
+ flex
42
+ items-center
43
+ justify-center
44
+ text-h5
45
+ opacity-0
46
+ duration-150
47
+ pointer-events-none;
48
+
49
+ transition-property: opacity, transform;
50
+ transform: scale(0.5);
51
+ }
52
+
53
+ .ads-Checkbox-Check--checked {
54
+ @apply opacity-100
55
+ duration-150;
56
+
57
+ transition-property: opacity, transform;
58
+ transform: scale(1);
44
59
  }
45
60
 
46
61
  /* Focused */
@@ -4,14 +4,23 @@
4
4
 
5
5
  .ads-Checkbox-Box--product {
6
6
  @apply bg-gray-100
7
- border-gray-600;
7
+ border-gray-600
8
+ duration-150;
9
+
10
+ transition-property: background-color, border-color, opacity;
8
11
  }
9
12
 
10
- .ads-Checkbox-Box--product.ads-Checkbox-Box--checked {
13
+ .ads-Checkbox-Box--product.ads-Checkbox-Box--checked,
14
+ .ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--brandGreen {
11
15
  @apply bg-brandGreen-400
12
16
  border-brandGreen-400;
13
17
  }
14
18
 
19
+ .ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--blue {
20
+ @apply bg-blue-400
21
+ border-blue-400;
22
+ }
23
+
15
24
  .ads-Checkbox-Check--product {
16
25
  @apply text-white;
17
26
  }
@@ -22,11 +31,17 @@
22
31
  }
23
32
 
24
33
  .ads-Checkbox.is-disabled .ads-Checkbox-Box--product {
25
- @apply border-gray-400;
34
+ @apply border-gray-400
35
+ duration-150;
36
+ }
37
+
38
+ .ads-Checkbox.is-disabled .ads-Checkbox-Box--product.ads-Checkbox-Box--checked,
39
+ .ads-Checkbox.is-disabled
40
+ .ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--brandGreen {
41
+ @apply border-brandGreen-400 opacity-50;
26
42
  }
27
43
 
28
- .ads-Checkbox.is-disabled .ads-Checkbox-Box--product.ads-Checkbox-Box--checked {
29
- @apply bg-brandGreen-200
30
- border-brandGreen-200
31
- opacity-50;
44
+ .ads-Checkbox.is-disabled
45
+ .ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--blue {
46
+ @apply border-blue-400 opacity-50;
32
47
  }