@bundle-stats/ui 4.23.0-beta.4 → 4.23.0-beta.5
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/lib/components/asset-name/asset-name.js +8 -7
- package/lib/components/asset-name/asset-name.js.map +1 -1
- package/lib/components/asset-name/asset-name.module.css +20 -10
- package/lib/components/bundle-assets/bundle-assets.js +4 -2
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -12
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +4 -2
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.module.css +8 -16
- package/lib/components/bundle-packages/bundle-packages.js +4 -2
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.module.css +21 -22
- package/lib/components/metrics-table/metrics-table.js +31 -20
- package/lib/components/metrics-table/metrics-table.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.module.css +4 -12
- package/lib/components/metrics-table-options/metrics-table-options.js +4 -4
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-row-count/index.js +18 -0
- package/lib/components/metrics-table-row-count/index.js.map +1 -0
- package/lib/components/metrics-table-row-count/metrics-table-row-count.js +17 -0
- package/lib/components/metrics-table-row-count/metrics-table-row-count.js.map +1 -0
- package/lib/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
- package/lib/layout/flex-stack/flex-stack.js +2 -2
- package/lib/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib/layout/flex-stack/flex-stack.module.css +65 -10
- package/lib/ui/button/button.js +1 -0
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/button/button.module.css +15 -4
- package/lib/ui/filters/filters.js +6 -5
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +1 -3
- package/lib/ui/table/table.module.css +11 -4
- package/lib/ui/tabs/tabs.module.css +1 -1
- package/lib-esm/components/asset-name/asset-name.js +8 -7
- package/lib-esm/components/asset-name/asset-name.js.map +1 -1
- package/lib-esm/components/asset-name/asset-name.module.css +20 -10
- package/lib-esm/components/bundle-assets/bundle-assets.js +4 -2
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -12
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +4 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +8 -16
- package/lib-esm/components/bundle-packages/bundle-packages.js +4 -2
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +21 -22
- package/lib-esm/components/metrics-table/metrics-table.js +32 -20
- package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.module.css +4 -12
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +4 -4
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-row-count/index.js +2 -0
- package/lib-esm/components/metrics-table-row-count/index.js.map +1 -0
- package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.js +10 -0
- package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.js.map +1 -0
- package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
- package/lib-esm/layout/flex-stack/flex-stack.js +3 -2
- package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib-esm/layout/flex-stack/flex-stack.module.css +65 -10
- package/lib-esm/ui/button/button.js +1 -0
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/button/button.module.css +15 -4
- package/lib-esm/ui/filters/filters.js +6 -5
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +1 -3
- package/lib-esm/ui/table/table.module.css +11 -4
- package/lib-esm/ui/tabs/tabs.module.css +1 -1
- package/package.json +3 -3
- package/src/components/asset-name/asset-name.module.css +20 -10
- package/src/components/asset-name/asset-name.tsx +8 -12
- package/src/components/bundle-assets/bundle-assets.module.css +0 -12
- package/src/components/bundle-assets/bundle-assets.tsx +8 -1
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +6 -4
- package/src/components/bundle-modules/bundle-modules.module.css +8 -16
- package/src/components/bundle-modules/bundle-modules.tsx +8 -1
- package/src/components/bundle-packages/bundle-packages.jsx +5 -1
- package/src/components/bundle-packages/bundle-packages.module.css +21 -22
- package/src/components/metrics-table/metrics-table.module.css +4 -12
- package/src/components/metrics-table/metrics-table.tsx +70 -39
- package/src/components/metrics-table-options/metrics-table-options.tsx +12 -12
- package/src/components/metrics-table-row-count/index.ts +1 -0
- package/src/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
- package/src/components/metrics-table-row-count/metrics-table-row-count.tsx +21 -0
- package/src/layout/flex-stack/flex-stack.module.css +65 -10
- package/src/layout/flex-stack/flex-stack.stories.tsx +68 -9
- package/src/layout/flex-stack/flex-stack.tsx +24 -4
- package/src/ui/button/button.module.css +15 -4
- package/src/ui/button/button.tsx +1 -0
- package/src/ui/filters/filters.module.css +1 -3
- package/src/ui/filters/filters.tsx +21 -16
- package/src/ui/table/table.module.css +11 -4
- package/src/ui/tabs/tabs.module.css +1 -1
- package/types/components/metrics-table/metrics-table.d.ts +2 -1
- package/types/components/metrics-table-row-count/index.d.ts +1 -0
- package/types/components/metrics-table-row-count/metrics-table-row-count.d.ts +7 -0
- package/types/layout/flex-stack/flex-stack.d.ts +6 -2
- package/types/ui/button/button.d.ts +1 -0
|
@@ -12,8 +12,23 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.packageName {
|
|
15
|
-
display: inline-
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: var(--space-xxxsmall);
|
|
16
18
|
color: var(--color-text-light);
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.packageNameTagDuplicate {
|
|
23
|
+
flex: 0 0 auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.packageNameTagDuplicate::before {
|
|
27
|
+
content: 'd';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.packageNameLabel {
|
|
31
|
+
flex: 1 1 auto;
|
|
17
32
|
}
|
|
18
33
|
|
|
19
34
|
.packageName:last-child {
|
|
@@ -25,29 +40,13 @@
|
|
|
25
40
|
margin: 0 var(--space-xxxsmall);
|
|
26
41
|
content: '/';
|
|
27
42
|
color: var(--color-text-ultra-light);
|
|
43
|
+
text-decoration: none;
|
|
28
44
|
}
|
|
29
45
|
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
vertical-align: middle;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.packageNameLabel {
|
|
36
|
-
vertical-align: middle;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.packageNameTagDuplicate::before {
|
|
40
|
-
content: 'd';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.root .packageName:hover,
|
|
44
|
-
.root .packageName:active,
|
|
45
|
-
.root .packageName:focus {
|
|
46
|
-
text-decoration: none;
|
|
46
|
+
.packageName:hover {
|
|
47
|
+
text-decoration: none !important;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
.root .packageName:focus .packageNameLabel {
|
|
52
|
-
text-decoration: underline;
|
|
50
|
+
.packageName:hover .packageNameLabel {
|
|
51
|
+
text-decoration: underline !important;
|
|
53
52
|
}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
.root a {
|
|
2
|
-
color: inherit;
|
|
3
|
-
text-decoration: none;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.root a:hover,
|
|
7
|
-
.root a:active,
|
|
8
|
-
.root a:focus {
|
|
9
|
-
color: var(--color-primary);
|
|
10
|
-
text-decoration: underline;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
1
|
.root .value,
|
|
14
2
|
.root .delta {
|
|
15
3
|
text-align: right;
|
|
16
4
|
}
|
|
17
5
|
|
|
18
6
|
/** rows */
|
|
7
|
+
.clickable {
|
|
8
|
+
cursor: default;
|
|
9
|
+
}
|
|
10
|
+
|
|
19
11
|
.multipleRuns .unchanged th,
|
|
20
12
|
.multipleRuns .unchanged td {
|
|
21
13
|
color: var(--color-text-light);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
4
|
import type { ReportMetricRow } from '@bundle-stats/utils';
|
|
@@ -20,51 +20,75 @@ const CURRENT_COLUMN_SPAN = 3;
|
|
|
20
20
|
interface RowProps extends React.ComponentProps<typeof Table.Tr> {
|
|
21
21
|
item: ReportMetricRow;
|
|
22
22
|
renderHeader: (item: ReportMetricRow) => React.ReactNode;
|
|
23
|
+
onRowClick?: (item: ReportMetricRow) => void;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const Row = ({ className = '', item, renderHeader, ...restProps }: RowProps) =>
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const Row = ({ className = '', item, renderHeader, onRowClick, ...restProps }: RowProps) => {
|
|
27
|
+
const handleClick = useCallback(
|
|
28
|
+
(event: React.MouseEvent<HTMLTableRowElement>) => {
|
|
29
|
+
// Skip clicks on interactive elements (eg: links, buttons)
|
|
30
|
+
if ((event.target as HTMLElement).closest('a, button')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Skip when the user is selecting text
|
|
35
|
+
if (window.getSelection()?.toString()) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
onRowClick?.(item);
|
|
40
|
+
},
|
|
41
|
+
[onRowClick, item],
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Table.Tr
|
|
46
|
+
className={cx(!item.changed && css.unchanged, onRowClick && css.clickable, className)}
|
|
47
|
+
onClick={onRowClick ? handleClick : undefined}
|
|
48
|
+
{...restProps}
|
|
49
|
+
>
|
|
50
|
+
<Table.Th className={css.metricName}>{renderHeader(item)}</Table.Th>
|
|
51
|
+
|
|
52
|
+
{item.runs.map((run, index) => {
|
|
53
|
+
const isBaseline = index === item.runs.length - 1;
|
|
54
|
+
const valueClassName = cx(css.value, !isBaseline && css.current);
|
|
55
|
+
|
|
56
|
+
// Empty cells if no value
|
|
57
|
+
if (!run || typeof run.value === 'undefined') {
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<Table.Td className={valueClassName}>-</Table.Td>
|
|
61
|
+
{!isBaseline && <Table.Td className={css.delta} />}
|
|
62
|
+
{!isBaseline && <Table.Td className={cx(css.delta, css.deltaPercentage)} />}
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
32
66
|
|
|
33
|
-
// Empty cells if no value
|
|
34
|
-
if (!run || typeof run.value === 'undefined') {
|
|
35
67
|
return (
|
|
36
68
|
<>
|
|
37
|
-
<Table.Td className={valueClassName}
|
|
38
|
-
|
|
39
|
-
|
|
69
|
+
<Table.Td className={valueClassName}>
|
|
70
|
+
<Metric value={run.displayValue} />
|
|
71
|
+
</Table.Td>
|
|
72
|
+
{!isBaseline && (
|
|
73
|
+
<>
|
|
74
|
+
<Table.Td className={css.delta}>
|
|
75
|
+
{'delta' in run && (
|
|
76
|
+
<Delta displayValue={run.displayDelta} deltaType={run.deltaType} />
|
|
77
|
+
)}
|
|
78
|
+
</Table.Td>
|
|
79
|
+
<Table.Td className={cx(css.delta, css.deltaPercentage)}>
|
|
80
|
+
{'delta' in run && (
|
|
81
|
+
<Delta displayValue={run.displayDeltaPercentage} deltaType={run.deltaType} />
|
|
82
|
+
)}
|
|
83
|
+
</Table.Td>
|
|
84
|
+
</>
|
|
85
|
+
)}
|
|
40
86
|
</>
|
|
41
87
|
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<Table.Td className={valueClassName}>
|
|
47
|
-
<Metric value={run.displayValue} />
|
|
48
|
-
</Table.Td>
|
|
49
|
-
{!isBaseline && (
|
|
50
|
-
<>
|
|
51
|
-
<Table.Td className={css.delta}>
|
|
52
|
-
{'delta' in run && (
|
|
53
|
-
<Delta displayValue={run.displayDelta} deltaType={run.deltaType} />
|
|
54
|
-
)}
|
|
55
|
-
</Table.Td>
|
|
56
|
-
<Table.Td className={cx(css.delta, css.deltaPercentage)}>
|
|
57
|
-
{'delta' in run && (
|
|
58
|
-
<Delta displayValue={run.displayDeltaPercentage} deltaType={run.deltaType} />
|
|
59
|
-
)}
|
|
60
|
-
</Table.Td>
|
|
61
|
-
</>
|
|
62
|
-
)}
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
})}
|
|
66
|
-
</Table.Tr>
|
|
67
|
-
);
|
|
88
|
+
})}
|
|
89
|
+
</Table.Tr>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
68
92
|
|
|
69
93
|
interface MetricsTableProps extends Omit<React.ComponentProps<typeof Table>, 'title'> {
|
|
70
94
|
runs: Array<{
|
|
@@ -77,6 +101,7 @@ interface MetricsTableProps extends Omit<React.ComponentProps<typeof Table>, 'ti
|
|
|
77
101
|
sort?: MetricsTableHeaderProps['sort'];
|
|
78
102
|
updateSort?: MetricsTableHeaderProps['updateSort'];
|
|
79
103
|
renderRowHeader?: (item: ReportMetricRow) => React.ReactNode;
|
|
104
|
+
onRowClick?: (item: ReportMetricRow) => void;
|
|
80
105
|
emptyMessage?: React.ReactNode;
|
|
81
106
|
showAllItems: boolean;
|
|
82
107
|
setShowAllItems: (value: boolean) => void;
|
|
@@ -91,6 +116,7 @@ export const MetricsTable = ({
|
|
|
91
116
|
sort,
|
|
92
117
|
updateSort,
|
|
93
118
|
renderRowHeader = (item: any) => item.label,
|
|
119
|
+
onRowClick,
|
|
94
120
|
emptyMessage = I18N.EMPTY_MESSAGE,
|
|
95
121
|
showAllItems,
|
|
96
122
|
setShowAllItems,
|
|
@@ -132,7 +158,12 @@ export const MetricsTable = ({
|
|
|
132
158
|
{showItems && (
|
|
133
159
|
<>
|
|
134
160
|
{visibleItems.map((item) => (
|
|
135
|
-
<Row
|
|
161
|
+
<Row
|
|
162
|
+
key={item.key}
|
|
163
|
+
item={item}
|
|
164
|
+
renderHeader={renderRowHeader}
|
|
165
|
+
onRowClick={onRowClick}
|
|
166
|
+
/>
|
|
136
167
|
))}
|
|
137
168
|
|
|
138
169
|
{hasHiddenItems && (
|
|
@@ -15,18 +15,18 @@ export const MetricsTableOptions = (props: MetricsTableOptionsProps) => {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Dropdown glyph="more-vertical" placement="bottom-end" {...restProps}>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
{(onResetClick || onViewAllClick) && (
|
|
19
|
+
<DropdownGroup>
|
|
20
|
+
{onResetClick && <DropdownItem onClick={onResetClick}>{I18N.RESET_FILTERS}</DropdownItem>}
|
|
21
|
+
{onViewAllClick && <DropdownItem onClick={onViewAllClick}>{I18N.VIEW_ALL}</DropdownItem>}
|
|
22
|
+
</DropdownGroup>
|
|
23
|
+
)}
|
|
24
|
+
{onExportClick && (
|
|
25
|
+
<DropdownGroup>
|
|
26
|
+
<DropdownItem onClick={() => onExportClick('csv')}>{I18N.EXPORT_CSV}</DropdownItem>
|
|
27
|
+
<DropdownItem onClick={() => onExportClick('json')}>{I18N.EXPORT_JSON}</DropdownItem>
|
|
28
|
+
</DropdownGroup>
|
|
29
|
+
)}
|
|
30
30
|
</Dropdown>
|
|
31
31
|
);
|
|
32
32
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './metrics-table-row-count';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { FlexStack } from '../../layout';
|
|
4
|
+
import { FlexStackProps } from '../../layout/flex-stack';
|
|
5
|
+
|
|
6
|
+
export type MetricsTableRowCountProps = {
|
|
7
|
+
count: number;
|
|
8
|
+
total: number;
|
|
9
|
+
} & FlexStackProps<'span'>;
|
|
10
|
+
|
|
11
|
+
export const MetricsTableRowCount = (props: MetricsTableRowCountProps) => {
|
|
12
|
+
const { count, total, ...restProps } = props;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<FlexStack inline gap="xxxsmall" alignItems="bottom" {...restProps}>
|
|
16
|
+
<span>{count}</span>
|
|
17
|
+
<span>/</span>
|
|
18
|
+
<span>{total}</span>
|
|
19
|
+
</FlexStack>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -4,43 +4,73 @@
|
|
|
4
4
|
gap: 0;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
.
|
|
7
|
+
/** Gap variation */
|
|
8
|
+
.gap--xxxsmall {
|
|
9
9
|
gap: var(--space-xxxsmall);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.
|
|
12
|
+
.gap--xxsmall {
|
|
13
13
|
gap: var(--space-xxsmall);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.gap--xsmall {
|
|
17
17
|
gap: var(--space-xsmall);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.
|
|
20
|
+
.gap--small {
|
|
21
21
|
gap: var(--space-small);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.
|
|
24
|
+
.gap--medium {
|
|
25
25
|
gap: var(--space-medium);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.gap--large {
|
|
29
29
|
gap: var(--space-large);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.
|
|
32
|
+
.gap--xlarge {
|
|
33
33
|
gap: var(--space-xlarge);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.
|
|
36
|
+
.gap--xxlarge {
|
|
37
37
|
gap: var(--space-xxlarge);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.
|
|
40
|
+
.gap--xxxlarge {
|
|
41
41
|
gap: var(--space-xxxlarge);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/** Direction variation */
|
|
45
|
+
.direction--row {
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.direction--row-reverse {
|
|
50
|
+
flex-direction: row-reverse;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.direction--column {
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.direction--column-reverse {
|
|
58
|
+
flex-direction: column-reverse;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Wrap variation */
|
|
62
|
+
.wrap--nowrap {
|
|
63
|
+
flex-wrap: nowrap;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.wrap--wrap {
|
|
67
|
+
flex-wrap: wrap;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.wrap--wrap-reverse {
|
|
71
|
+
flex-wrap: wrap-reverse;
|
|
72
|
+
}
|
|
73
|
+
|
|
44
74
|
/** Align items variation */
|
|
45
75
|
.root {
|
|
46
76
|
align-items: stretch;
|
|
@@ -62,6 +92,31 @@
|
|
|
62
92
|
align-items: baseline;
|
|
63
93
|
}
|
|
64
94
|
|
|
95
|
+
/** Justify content variation */
|
|
96
|
+
.justify-content--flex-start {
|
|
97
|
+
justify-content: flex-start;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.justify-content--flex-end {
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.justify-content--center {
|
|
105
|
+
justify-content: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.justify-content--space-between {
|
|
109
|
+
justify-content: space-between;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.justify-content--space-around {
|
|
113
|
+
justify-content: space-around;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.justify-content--space-evenly {
|
|
117
|
+
justify-content: space-evenly;
|
|
118
|
+
}
|
|
119
|
+
|
|
65
120
|
/** Inline variation */
|
|
66
121
|
.inline {
|
|
67
122
|
display: inline-flex;
|
|
@@ -28,7 +28,7 @@ export const Default: Story = {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export const
|
|
31
|
+
export const WithCustomWrapper: Story = {
|
|
32
32
|
args: {
|
|
33
33
|
as: 'main',
|
|
34
34
|
className: 'wrapper',
|
|
@@ -41,9 +41,9 @@ export const withCustomWrapper: Story = {
|
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export const
|
|
44
|
+
export const WithLargeGap: Story = {
|
|
45
45
|
args: {
|
|
46
|
-
|
|
46
|
+
gap: 'large',
|
|
47
47
|
children: (
|
|
48
48
|
<>
|
|
49
49
|
<Box outline>Lorem ipsum 1</Box>
|
|
@@ -54,14 +54,14 @@ export const withLargeSpace: Story = {
|
|
|
54
54
|
},
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export const
|
|
57
|
+
export const WithNestedStack: Story = {
|
|
58
58
|
args: {
|
|
59
|
-
|
|
59
|
+
gap: 'large',
|
|
60
60
|
children: (
|
|
61
61
|
<>
|
|
62
62
|
<Box outline>Lorem ipsum 1</Box>
|
|
63
63
|
<Box outline>Lorem ipsum 2</Box>
|
|
64
|
-
<FlexStack
|
|
64
|
+
<FlexStack gap="small">
|
|
65
65
|
<Box outline>Lorem ipsum 3.1</Box>
|
|
66
66
|
<Box outline>Lorem ipsum 3.2</Box>
|
|
67
67
|
</FlexStack>
|
|
@@ -70,16 +70,61 @@ export const withNestedStack: Story = {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
export const
|
|
73
|
+
export const SingleItem: Story = {
|
|
74
74
|
args: {
|
|
75
75
|
children: <Box outline>Lorem ipsum</Box>,
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
export const
|
|
79
|
+
export const WithDirectionColumn: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
direction: 'column',
|
|
82
|
+
gap: 'medium',
|
|
83
|
+
children: (
|
|
84
|
+
<>
|
|
85
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
86
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
87
|
+
<Box outline>Lorem ipsum 3</Box>
|
|
88
|
+
</>
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const WithDirectionRowReverse: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
direction: 'row-reverse',
|
|
96
|
+
gap: 'medium',
|
|
97
|
+
children: (
|
|
98
|
+
<>
|
|
99
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
100
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
101
|
+
<Box outline>Lorem ipsum 3</Box>
|
|
102
|
+
</>
|
|
103
|
+
),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const WithWrap: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
wrap: 'wrap',
|
|
110
|
+
gap: 'medium',
|
|
111
|
+
style: { maxWidth: '320px' },
|
|
112
|
+
children: (
|
|
113
|
+
<>
|
|
114
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
115
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
116
|
+
<Box outline>Lorem ipsum 3</Box>
|
|
117
|
+
<Box outline>Lorem ipsum 4</Box>
|
|
118
|
+
<Box outline>Lorem ipsum 5</Box>
|
|
119
|
+
</>
|
|
120
|
+
),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const WithAlignItems: Story = {
|
|
80
125
|
args: {
|
|
81
126
|
alignItems: 'center',
|
|
82
|
-
|
|
127
|
+
gap: 'medium',
|
|
83
128
|
children: (
|
|
84
129
|
<>
|
|
85
130
|
<h1>Title</h1>
|
|
@@ -88,3 +133,17 @@ export const withAlignItems: Story = {
|
|
|
88
133
|
),
|
|
89
134
|
},
|
|
90
135
|
};
|
|
136
|
+
|
|
137
|
+
export const WithJustifyContent: Story = {
|
|
138
|
+
args: {
|
|
139
|
+
justifyContent: 'space-between',
|
|
140
|
+
gap: 'medium',
|
|
141
|
+
children: (
|
|
142
|
+
<>
|
|
143
|
+
<Box outline>Lorem ipsum 1</Box>
|
|
144
|
+
<Box outline>Lorem ipsum 2</Box>
|
|
145
|
+
<Box outline>Lorem ipsum 3</Box>
|
|
146
|
+
</>
|
|
147
|
+
),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
@@ -6,12 +6,25 @@ import css from './flex-stack.module.css';
|
|
|
6
6
|
|
|
7
7
|
type SpaceValue = (typeof SPACES)[number];
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export type FlexStackProps<T extends React.ElementType> = {
|
|
10
10
|
as?: T;
|
|
11
|
+
gap?: SpaceValue;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `gap` instead.
|
|
14
|
+
*/
|
|
11
15
|
space?: SpaceValue;
|
|
12
16
|
inline?: boolean;
|
|
17
|
+
direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
18
|
+
wrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
13
19
|
alignItems?: 'top' | 'center' | 'bottom';
|
|
14
|
-
|
|
20
|
+
justifyContent?:
|
|
21
|
+
| 'flex-start'
|
|
22
|
+
| 'flex-end'
|
|
23
|
+
| 'center'
|
|
24
|
+
| 'space-between'
|
|
25
|
+
| 'space-around'
|
|
26
|
+
| 'space-evenly';
|
|
27
|
+
};
|
|
15
28
|
|
|
16
29
|
export const FlexStack = <T extends React.ElementType = 'div'>(
|
|
17
30
|
props: FlexStackProps<T> & Omit<React.ComponentProps<T>, keyof FlexStackProps<T>>,
|
|
@@ -19,16 +32,23 @@ export const FlexStack = <T extends React.ElementType = 'div'>(
|
|
|
19
32
|
const {
|
|
20
33
|
as: Component = 'div',
|
|
21
34
|
className = '',
|
|
22
|
-
|
|
35
|
+
gap,
|
|
36
|
+
space,
|
|
23
37
|
inline = false,
|
|
38
|
+
direction = '',
|
|
39
|
+
wrap = '',
|
|
24
40
|
alignItems = '',
|
|
41
|
+
justifyContent = '',
|
|
25
42
|
...restProps
|
|
26
43
|
} = props;
|
|
27
44
|
|
|
28
45
|
const rootClassName = cx(
|
|
29
46
|
css.root,
|
|
30
|
-
css[`
|
|
47
|
+
css[`gap--${gap ?? space ?? NO_SPACE}`],
|
|
48
|
+
css[`direction--${direction}`],
|
|
49
|
+
css[`wrap--${wrap}`],
|
|
31
50
|
css[`align-items--${alignItems}`],
|
|
51
|
+
css[`justify-content--${justifyContent}`],
|
|
32
52
|
inline && css.inline,
|
|
33
53
|
className,
|
|
34
54
|
);
|
|
@@ -49,13 +49,13 @@ a.root {
|
|
|
49
49
|
* Kind variation
|
|
50
50
|
*/
|
|
51
51
|
.primary {
|
|
52
|
-
color: var(--color-
|
|
52
|
+
color: var(--color-accent);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.primary:hover,
|
|
56
56
|
.primary:active,
|
|
57
57
|
.primary:focus {
|
|
58
|
-
color: var(--color-
|
|
58
|
+
color: var(--color-accent-dark);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.secondary {
|
|
@@ -112,14 +112,14 @@ a.root {
|
|
|
112
112
|
* Solid Kind variation
|
|
113
113
|
*/
|
|
114
114
|
.solid {
|
|
115
|
-
background: var(--color-
|
|
115
|
+
background: var(--color-accent);
|
|
116
116
|
color: var(--color-background);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
.solid:hover,
|
|
120
120
|
.solid:active,
|
|
121
121
|
.solid:focus {
|
|
122
|
-
background: var(--color-
|
|
122
|
+
background: var(--color-accent-dark);
|
|
123
123
|
color: var(--color-background);
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -186,6 +186,13 @@ a.root {
|
|
|
186
186
|
/**
|
|
187
187
|
* Size variation
|
|
188
188
|
*/
|
|
189
|
+
.xsmall {
|
|
190
|
+
--button-space: var(--space-xxxsmall);
|
|
191
|
+
--line-height: var(--space-xsmall);
|
|
192
|
+
|
|
193
|
+
font-size: var(--size-xsmall);
|
|
194
|
+
}
|
|
195
|
+
|
|
189
196
|
.small {
|
|
190
197
|
--button-space: var(--space-xxsmall);
|
|
191
198
|
--line-height: var(--space-small);
|
|
@@ -289,6 +296,10 @@ a.root {
|
|
|
289
296
|
/**
|
|
290
297
|
* Radius variation
|
|
291
298
|
*/
|
|
299
|
+
.radius--xsmall {
|
|
300
|
+
border-radius: var(--radius-xsmall);
|
|
301
|
+
}
|
|
302
|
+
|
|
292
303
|
.radius--small {
|
|
293
304
|
border-radius: var(--radius-small);
|
|
294
305
|
}
|
package/src/ui/button/button.tsx
CHANGED
|
@@ -72,8 +72,6 @@
|
|
|
72
72
|
right: 2px;
|
|
73
73
|
top: 50%;
|
|
74
74
|
transform: translateY(-50%);
|
|
75
|
-
padding: var(--space-xxxsmall);
|
|
76
|
-
font-size: var(--size-xsmall);
|
|
77
75
|
line-height: 1.1;
|
|
78
76
|
}
|
|
79
77
|
|
|
@@ -102,8 +100,8 @@
|
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
.filterGroupSearchNotFound {
|
|
105
|
-
padding: var(--space-xxsmall) 0;
|
|
106
103
|
text-align: center;
|
|
104
|
+
min-height: calc(10 * (var(--space-small) + 2 * var(--space-xxxsmall)));
|
|
107
105
|
font-size: var(--size-small);
|
|
108
106
|
color: var(--color-text-light);
|
|
109
107
|
}
|