@bitrise/bitkit 10.13.0-alpha-table-new.2 → 10.13.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 +1 -1
- package/src/Components/Dropdown/Dropdown.stories.tsx +19 -0
- package/src/Components/Dropdown/Dropdown.test.tsx +25 -0
- package/src/Components/Dropdown/Dropdown.tsx +14 -2
- package/src/index.ts +0 -24
- package/src/old.ts +14 -14
- package/src/theme.ts +1 -3
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/Components/Table/SortIcon.tsx +0 -10
- package/src/Components/Table/Table.stories.tsx +0 -154
- package/src/Components/Table/Table.theme.ts +0 -99
- package/src/Components/Table/Table.tsx +0 -22
- package/src/Components/Table/TableCaption.tsx +0 -27
- package/src/Components/Table/TableContainer.tsx +0 -9
- package/src/Components/Table/Tbody.tsx +0 -9
- package/src/Components/Table/Td.tsx +0 -22
- package/src/Components/Table/Th.tsx +0 -45
- package/src/Components/Table/Thead.tsx +0 -9
- package/src/Components/Table/Tr.tsx +0 -60
package/package.json
CHANGED
|
@@ -133,3 +133,22 @@ export const WithIcon = () => {
|
|
|
133
133
|
</Dropdown>
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
|
+
export const WithCustomLabel = () => {
|
|
137
|
+
const [value, setValue] = useState('custom');
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Dropdown
|
|
141
|
+
iconName="Calendar"
|
|
142
|
+
value={value}
|
|
143
|
+
onChange={(event) => setValue(event.target.value as string)}
|
|
144
|
+
formLabel={value === 'custom' ? '18 Aug - 19 Aug' : value}
|
|
145
|
+
search={false}
|
|
146
|
+
>
|
|
147
|
+
<DropdownOption value="Last 30 days">Last 30 days</DropdownOption>
|
|
148
|
+
<DropdownOption value="Last 40 days">Last 45 days</DropdownOption>
|
|
149
|
+
<DropdownOption value="Last 50 days">Last 60 days</DropdownOption>
|
|
150
|
+
<DropdownOption value="Last 90 days">Last 90 days</DropdownOption>
|
|
151
|
+
<DropdownOption value="custom">Custom</DropdownOption>
|
|
152
|
+
</Dropdown>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
@@ -549,4 +549,29 @@ describe('Dropdown', () => {
|
|
|
549
549
|
});
|
|
550
550
|
});
|
|
551
551
|
});
|
|
552
|
+
|
|
553
|
+
describe('label', () => {
|
|
554
|
+
it('renders label associated with the selected option', async () => {
|
|
555
|
+
render(
|
|
556
|
+
<Dropdown defaultValue="Test option 2">
|
|
557
|
+
<DropdownOption value="Test option 1">Test option 1</DropdownOption>
|
|
558
|
+
<DropdownOption value="Test option 2">Test option 2</DropdownOption>
|
|
559
|
+
</Dropdown>,
|
|
560
|
+
);
|
|
561
|
+
|
|
562
|
+
const button = await screen.findByRole('combobox');
|
|
563
|
+
expect(button).toHaveTextContent('Test option 2');
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
it('renders custom label if provided', async () => {
|
|
567
|
+
render(
|
|
568
|
+
<Dropdown formLabel="Custom label">
|
|
569
|
+
<DropdownOption>Test option</DropdownOption>
|
|
570
|
+
</Dropdown>,
|
|
571
|
+
);
|
|
572
|
+
|
|
573
|
+
const button = await screen.findByRole('combobox');
|
|
574
|
+
expect(button).toHaveTextContent('Custom label');
|
|
575
|
+
});
|
|
576
|
+
});
|
|
552
577
|
});
|
|
@@ -102,6 +102,7 @@ export interface DropdownProps<T> extends ChakraProps {
|
|
|
102
102
|
search?: ReactNode;
|
|
103
103
|
children?: ReactNode;
|
|
104
104
|
iconName?: TypeIconName;
|
|
105
|
+
formLabel?: string;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
function useOptionListWithIndexes({ children }: { children: ReactNode }) {
|
|
@@ -266,7 +267,18 @@ function useDropdown<T>({
|
|
|
266
267
|
|
|
267
268
|
const Dropdown = forwardRef<DropdownInstance<string | null>, DropdownProps<string | null>>(
|
|
268
269
|
(
|
|
269
|
-
{
|
|
270
|
+
{
|
|
271
|
+
dropdownMaxHeight,
|
|
272
|
+
dropdownMinHeight,
|
|
273
|
+
readOnly,
|
|
274
|
+
onBlur,
|
|
275
|
+
placeholder,
|
|
276
|
+
name,
|
|
277
|
+
search,
|
|
278
|
+
size = 'medium',
|
|
279
|
+
formLabel: customFormLabel,
|
|
280
|
+
...props
|
|
281
|
+
},
|
|
270
282
|
ref,
|
|
271
283
|
) => {
|
|
272
284
|
const optionsRef = useRef(null);
|
|
@@ -316,7 +328,7 @@ const Dropdown = forwardRef<DropdownInstance<string | null>, DropdownProps<strin
|
|
|
316
328
|
{...props}
|
|
317
329
|
placeholder={placeholder}
|
|
318
330
|
size={size}
|
|
319
|
-
formLabel={formLabel}
|
|
331
|
+
formLabel={customFormLabel ?? formLabel}
|
|
320
332
|
blurHandler={blurHandler}
|
|
321
333
|
readOnly={readOnly}
|
|
322
334
|
/>
|
package/src/index.ts
CHANGED
|
@@ -159,27 +159,3 @@ export { default as Accordion } from './Components/Accordion/Accordion';
|
|
|
159
159
|
|
|
160
160
|
export type { AccordionItemProps } from './Components/Accordion/AccordionItem';
|
|
161
161
|
export { default as AccordionItem } from './Components/Accordion/AccordionItem';
|
|
162
|
-
|
|
163
|
-
export type { TableProps } from './Components/Table/Table';
|
|
164
|
-
export { default as Table } from './Components/Table/Table';
|
|
165
|
-
|
|
166
|
-
export type { TableCaptionProps } from './Components/Table/TableCaption';
|
|
167
|
-
export { default as TableCaption } from './Components/Table/TableCaption';
|
|
168
|
-
|
|
169
|
-
export type { TableContainerProps } from './Components/Table/TableContainer';
|
|
170
|
-
export { default as TableContainer } from './Components/Table/TableContainer';
|
|
171
|
-
|
|
172
|
-
export type { TableBodyProps } from './Components/Table/Tbody';
|
|
173
|
-
export { default as Tbody } from './Components/Table/Tbody';
|
|
174
|
-
|
|
175
|
-
export type { TableCellProps } from './Components/Table/Td';
|
|
176
|
-
export { default as Td } from './Components/Table/Td';
|
|
177
|
-
|
|
178
|
-
export type { TableColumnHeaderProps } from './Components/Table/Th';
|
|
179
|
-
export { default as Th } from './Components/Table/Th';
|
|
180
|
-
|
|
181
|
-
export type { TableHeadProps } from './Components/Table/Thead';
|
|
182
|
-
export { default as Thead } from './Components/Table/Thead';
|
|
183
|
-
|
|
184
|
-
export type { TableRowProps } from './Components/Table/Tr';
|
|
185
|
-
export { default as Tr } from './Components/Table/Tr';
|
package/src/old.ts
CHANGED
|
@@ -72,27 +72,27 @@ export { default as SkeletonBox } from './Old/Skeleton/SkeletonBox';
|
|
|
72
72
|
export type { Props as Status500Props } from './Old/Status/Status500';
|
|
73
73
|
export { default as Status500 } from './Old/Status/Status500';
|
|
74
74
|
|
|
75
|
-
export type { Props as
|
|
76
|
-
export { default as
|
|
75
|
+
export type { Props as TableProps } from './Old/Table/Table';
|
|
76
|
+
export { default as Table } from './Old/Table/Table';
|
|
77
77
|
|
|
78
|
-
export type { Props as
|
|
79
|
-
export { default as
|
|
78
|
+
export type { Props as TableBodyProps } from './Old/Table/TableBody';
|
|
79
|
+
export { default as TableBody } from './Old/Table/TableBody';
|
|
80
80
|
|
|
81
|
-
export type { Props as
|
|
82
|
-
export { default as
|
|
81
|
+
export type { Props as TableCellProps } from './Old/Table/TableCell';
|
|
82
|
+
export { default as TableCell } from './Old/Table/TableCell';
|
|
83
83
|
|
|
84
|
-
export type { Props as
|
|
85
|
-
export { default as
|
|
84
|
+
export type { Props as TableHeaderProps } from './Old/Table/TableHeader';
|
|
85
|
+
export { default as TableHeader } from './Old/Table/TableHeader';
|
|
86
86
|
|
|
87
|
-
export type { Props as
|
|
87
|
+
export type { Props as TableHeaderCellProps } from './Old/Table/TableHeaderCell';
|
|
88
88
|
export type { TypeTableSort } from './Old/Table/TableHeaderCell';
|
|
89
|
-
export { default as
|
|
89
|
+
export { default as TableHeaderCell } from './Old/Table/TableHeaderCell';
|
|
90
90
|
|
|
91
|
-
export type { Props as
|
|
92
|
-
export { default as
|
|
91
|
+
export type { Props as TableHeaderRowProps } from './Old/Table/TableHeaderRow';
|
|
92
|
+
export { default as TableHeaderRow } from './Old/Table/TableHeaderRow';
|
|
93
93
|
|
|
94
|
-
export type { Props as
|
|
95
|
-
export { default as
|
|
94
|
+
export type { Props as TableRowProps } from './Old/Table/TableRow';
|
|
95
|
+
export { default as TableRow } from './Old/Table/TableRow';
|
|
96
96
|
|
|
97
97
|
export type { Props as TextareaProps } from './Old/Textarea/Textarea';
|
|
98
98
|
export { default as Textarea } from './Old/Textarea/Textarea';
|
package/src/theme.ts
CHANGED
|
@@ -18,7 +18,6 @@ import Input from './Components/Input/Input.theme';
|
|
|
18
18
|
import Dropdown from './Components/Dropdown/Dropdown.theme';
|
|
19
19
|
import Tabs from './Components/Tabs/Tabs.theme';
|
|
20
20
|
import Text from './Components/Text/Text.theme';
|
|
21
|
-
import Table from './Components/Table/Table.theme';
|
|
22
21
|
import Alert from './Foundations/Themes/Alert.theme';
|
|
23
22
|
import Tooltip from './Components/Tooltip/Tooltip.theme';
|
|
24
23
|
import CloseButton from './Components/CloseButton/CloseButton.theme';
|
|
@@ -77,7 +76,6 @@ const theme = {
|
|
|
77
76
|
Checkbox,
|
|
78
77
|
ColorButton,
|
|
79
78
|
Divider,
|
|
80
|
-
Dropdown,
|
|
81
79
|
EmptyState,
|
|
82
80
|
Link,
|
|
83
81
|
List,
|
|
@@ -85,7 +83,7 @@ const theme = {
|
|
|
85
83
|
Modal: Dialog,
|
|
86
84
|
Radio,
|
|
87
85
|
Select,
|
|
88
|
-
|
|
86
|
+
Dropdown,
|
|
89
87
|
Tabs,
|
|
90
88
|
Text,
|
|
91
89
|
Tooltip,
|