@bitrise/bitkit 13.140.0 → 13.142.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/package.json +2 -2
- package/src/Components/ControlButton/ControlButton.tsx +5 -0
- package/src/Components/Filter/FilterForm/FilterForm.tsx +74 -73
- package/src/Components/Form/Checkbox/Checkbox.theme.ts +3 -0
- package/src/Components/Form/Input/Input.theme.ts +3 -0
- package/src/Components/Form/Radio/Radio.theme.ts +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.142.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"luxon": "^3.5.0",
|
|
43
43
|
"react": "^18.3.1",
|
|
44
44
|
"react-dom": "^18.3.1",
|
|
45
|
-
"react-focus-lock": "2.
|
|
45
|
+
"react-focus-lock": "2.13.1",
|
|
46
46
|
"react-imask": "^7.6.1",
|
|
47
47
|
"react-markdown": "^9.0.1"
|
|
48
48
|
},
|
|
@@ -15,6 +15,11 @@ const colors: ControlButtonProps['sx'] = {
|
|
|
15
15
|
backgroundColor: 'button/tertiary/bg-active',
|
|
16
16
|
color: 'button/secondary/fg-active',
|
|
17
17
|
},
|
|
18
|
+
_disabled: {
|
|
19
|
+
backgroundColor: 'button/tertiary/bg-disabled',
|
|
20
|
+
color: 'button/tertiary/fg-disabled',
|
|
21
|
+
cursor: 'not-allowed',
|
|
22
|
+
},
|
|
18
23
|
};
|
|
19
24
|
|
|
20
25
|
const ControlButton = forwardRef<ControlButtonProps, 'button'>((props, ref) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormEvent, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { useMultiStyleConfig } from '@chakra-ui/react';
|
|
2
|
+
import { FocusLock, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
3
|
import Badge from '../../Badge/Badge';
|
|
4
4
|
import Box from '../../Box/Box';
|
|
5
5
|
import Button from '../../Button/Button';
|
|
@@ -114,80 +114,81 @@ const FilterForm = (props: FilterFormProps) => {
|
|
|
114
114
|
: Array.from(new Set([...value, ...filteredOptions]));
|
|
115
115
|
|
|
116
116
|
return (
|
|
117
|
-
<
|
|
118
|
-
<Box sx={filterStyle.
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
<FocusLock>
|
|
118
|
+
<Box as="form" data-testid={`${category}-form`} onSubmit={onSubmit} sx={filterStyle.form}>
|
|
119
|
+
<Box sx={filterStyle.formHeader}>
|
|
120
|
+
<Text as="h5" sx={filterStyle.formTitle}>
|
|
121
|
+
{categoryName || category}
|
|
122
|
+
</Text>
|
|
123
|
+
{isMultiple && (
|
|
124
|
+
<Badge variant="subtle" colorScheme="neutral" sx={filterStyle.formBadge}>
|
|
125
|
+
{selected[0] === '' ? '0' : String(selected.length)}
|
|
126
|
+
</Badge>
|
|
127
|
+
)}
|
|
128
|
+
</Box>
|
|
129
|
+
{(withSearch || isAsync) && (
|
|
130
|
+
<SearchInput
|
|
131
|
+
onChange={onSearchChange}
|
|
132
|
+
placeholder={isAsync ? 'Start typing to search options' : 'Start typing to find options'}
|
|
133
|
+
sx={filterStyle.formSearch}
|
|
134
|
+
value={searchValue}
|
|
135
|
+
/>
|
|
126
136
|
)}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{label}
|
|
167
|
-
</Box>
|
|
168
|
-
) : (
|
|
169
|
-
label
|
|
170
|
-
)}
|
|
171
|
-
</Radio>
|
|
172
|
-
);
|
|
173
|
-
})
|
|
174
|
-
: getEmptyText()}
|
|
175
|
-
</RadioGroup>
|
|
176
|
-
)}
|
|
177
|
-
<ButtonGroup spacing="12" sx={filterStyle.formButtonGroup}>
|
|
178
|
-
{isEditMode && (
|
|
179
|
-
<Button marginInlineEnd="auto" onClick={onClearClick} size="sm" variant="tertiary">
|
|
180
|
-
Clear
|
|
181
|
-
</Button>
|
|
137
|
+
{isLoading && 'Loading...'}
|
|
138
|
+
{!isLoading && isMultiple && (
|
|
139
|
+
<CheckboxGroup onChange={setSelected} sx={filterStyle.formInputGroup} value={selected}>
|
|
140
|
+
{items.length
|
|
141
|
+
? items.map((opt) => (
|
|
142
|
+
<Checkbox key={opt} value={opt}>
|
|
143
|
+
{iconsMap && iconsMap[opt] && <Icon name={iconsMap[opt]} />}
|
|
144
|
+
{getOptionLabel(opt, optionsMap)}
|
|
145
|
+
</Checkbox>
|
|
146
|
+
))
|
|
147
|
+
: getEmptyText()}
|
|
148
|
+
</CheckboxGroup>
|
|
149
|
+
)}
|
|
150
|
+
{!isLoading && !isMultiple && (
|
|
151
|
+
<RadioGroup onChange={(v) => setSelected([v])} sx={filterStyle.formInputGroup} value={selected[0] || ''}>
|
|
152
|
+
<Radio value="">
|
|
153
|
+
<Text as="span" color="neutral.40" fontStyle="italic">
|
|
154
|
+
Not filtered
|
|
155
|
+
</Text>
|
|
156
|
+
</Radio>
|
|
157
|
+
{items.length
|
|
158
|
+
? items.map((opt) => {
|
|
159
|
+
const hasIcon = iconsMap && iconsMap[opt];
|
|
160
|
+
const label = getOptionLabel(opt, optionsMap);
|
|
161
|
+
return (
|
|
162
|
+
<Radio key={opt} value={opt}>
|
|
163
|
+
{hasIcon ? (
|
|
164
|
+
<Box as="span" display="flex" gap="4">
|
|
165
|
+
<Icon name={iconsMap[opt]} />
|
|
166
|
+
{label}
|
|
167
|
+
</Box>
|
|
168
|
+
) : (
|
|
169
|
+
label
|
|
170
|
+
)}
|
|
171
|
+
</Radio>
|
|
172
|
+
);
|
|
173
|
+
})
|
|
174
|
+
: getEmptyText()}
|
|
175
|
+
</RadioGroup>
|
|
182
176
|
)}
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
177
|
+
<ButtonGroup spacing="12" sx={filterStyle.formButtonGroup}>
|
|
178
|
+
{isEditMode && (
|
|
179
|
+
<Button marginInlineEnd="auto" onClick={onClearClick} size="sm" variant="tertiary">
|
|
180
|
+
Clear
|
|
181
|
+
</Button>
|
|
182
|
+
)}
|
|
183
|
+
<Button onClick={onCancelClick} size="sm" type="reset" variant="secondary">
|
|
184
|
+
Cancel
|
|
185
|
+
</Button>
|
|
186
|
+
<Button isDisabled={isDisabled} size="sm" type="submit">
|
|
187
|
+
{(selected.length === 0 || selected[0] === '') && isEditMode ? 'Remove' : 'Apply'}
|
|
188
|
+
</Button>
|
|
189
|
+
</ButtonGroup>
|
|
190
|
+
</Box>
|
|
191
|
+
</FocusLock>
|
|
191
192
|
);
|
|
192
193
|
};
|
|
193
194
|
|