@bundle-stats/ui 4.9.3-beta.0 → 4.9.3-beta.2
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/ui/button/button.js +6 -2
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/button/button.module.css +30 -1
- package/lib/ui/control-group/control-group.js +16 -0
- package/lib/ui/control-group/control-group.js.map +1 -0
- package/lib/ui/control-group/control-group.module.css +23 -0
- package/lib/ui/control-group/index.js +18 -0
- package/lib/ui/control-group/index.js.map +1 -0
- package/lib/ui/dropdown/dropdown.js +4 -3
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +26 -2
- package/lib/ui/index.js +3 -1
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/input-search/input-search.js +1 -2
- package/lib/ui/input-search/input-search.js.map +1 -1
- package/lib/ui/input-search/input-search.module.css +1 -7
- package/lib-esm/ui/button/button.js +6 -2
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/button/button.module.css +30 -1
- package/lib-esm/ui/control-group/control-group.js +9 -0
- package/lib-esm/ui/control-group/control-group.js.map +1 -0
- package/lib-esm/ui/control-group/control-group.module.css +23 -0
- package/lib-esm/ui/control-group/index.js +2 -0
- package/lib-esm/ui/control-group/index.js.map +1 -0
- package/lib-esm/ui/dropdown/dropdown.js +4 -3
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +26 -2
- package/lib-esm/ui/index.js +1 -0
- package/lib-esm/ui/index.js.map +1 -1
- package/lib-esm/ui/input-search/input-search.js +1 -2
- package/lib-esm/ui/input-search/input-search.js.map +1 -1
- package/lib-esm/ui/input-search/input-search.module.css +1 -7
- package/package.json +8 -8
- package/src/ui/button/button.module.css +30 -1
- package/src/ui/button/button.stories.tsx +112 -23
- package/src/ui/button/button.tsx +15 -1
- package/src/ui/control-group/control-group.module.css +23 -0
- package/src/ui/control-group/control-group.stories.tsx +24 -0
- package/src/ui/control-group/control-group.tsx +17 -0
- package/src/ui/control-group/index.ts +1 -0
- package/src/ui/dropdown/dropdown.jsx +7 -6
- package/src/ui/dropdown/dropdown.module.css +26 -2
- package/src/ui/index.js +1 -0
- package/src/ui/input-search/input-search.module.css +1 -7
- package/src/ui/input-search/input-search.tsx +2 -4
- package/types/ui/button/button.d.ts +4 -0
- package/types/ui/control-group/control-group.d.ts +3 -0
- package/types/ui/control-group/index.d.ts +1 -0
- package/types/ui/dropdown/dropdown.d.ts +3 -0
- package/types/ui/index.d.ts +1 -0
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
right: var(--space-xxxsmall);
|
|
14
14
|
top: 50%;
|
|
15
15
|
transform: translateY(-50%);
|
|
16
|
+
padding: var(--space-xxxsmall);
|
|
16
17
|
background: radial-gradient(var(--color-background) 50%, transparent);
|
|
17
|
-
color: var(--color-text-ultra-light);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.cancelButton:focus,
|
|
21
|
-
.cancelButton:hover,
|
|
22
|
-
.cancelButton:active {
|
|
23
|
-
color: var(--color-text-light);
|
|
24
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "4.9.3-beta.
|
|
3
|
+
"version": "4.9.3-beta.2",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@babel/preset-env": "7.23.9",
|
|
40
40
|
"@babel/preset-react": "7.23.3",
|
|
41
41
|
"@babel/preset-typescript": "7.23.3",
|
|
42
|
-
"@storybook/addon-essentials": "7.6.
|
|
43
|
-
"@storybook/react": "7.6.
|
|
44
|
-
"@storybook/react-webpack5": "7.6.
|
|
42
|
+
"@storybook/addon-essentials": "7.6.15",
|
|
43
|
+
"@storybook/react": "7.6.15",
|
|
44
|
+
"@storybook/react-webpack5": "7.6.15",
|
|
45
45
|
"@types/react": "18.2.55",
|
|
46
46
|
"@types/react-router-dom": "5.3.3",
|
|
47
47
|
"babel-plugin-require-context-hook": "1.0.0",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"react-dom": "18.2.0",
|
|
60
60
|
"react-router-dom": "5.3.4",
|
|
61
61
|
"rimraf": "5.0.5",
|
|
62
|
-
"storybook": "7.6.
|
|
62
|
+
"storybook": "7.6.15",
|
|
63
63
|
"typescript": "5.1.6",
|
|
64
|
-
"typescript-plugin-css-modules": "5.0
|
|
64
|
+
"typescript-plugin-css-modules": "5.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"classnames": "^2.0.0",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"react-router-dom": "^5.0.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@bundle-stats/utils": "4.9.3-beta.
|
|
75
|
+
"@bundle-stats/utils": "4.9.3-beta.2",
|
|
76
76
|
"ariakit": "2.0.0-next.44",
|
|
77
77
|
"modern-css-reset": "1.4.0",
|
|
78
78
|
"use-query-params": "2.2.1"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "457a1e579bfd143165d6bfb15c392db9be88867c"
|
|
81
81
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
.root {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--space-xxsmall);
|
|
2
5
|
appearance: none;
|
|
3
6
|
padding: 0;
|
|
4
7
|
border: 0;
|
|
5
8
|
background: none;
|
|
6
9
|
transition: var(--transition-out);
|
|
7
10
|
color: var(--color-text-ultra-light);
|
|
8
|
-
|
|
11
|
+
font-family: var(--font-family);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
a.root {
|
|
15
|
+
text-decoration: none;
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
.root:hover,
|
|
@@ -15,6 +22,15 @@
|
|
|
15
22
|
transition: var(--transition-in);
|
|
16
23
|
}
|
|
17
24
|
|
|
25
|
+
.glyph {
|
|
26
|
+
flex: 0 0 auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.text {
|
|
30
|
+
min-width: 0;
|
|
31
|
+
flex: 1 1 auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
/**
|
|
19
35
|
* Kind variation
|
|
20
36
|
*/
|
|
@@ -233,14 +249,27 @@
|
|
|
233
249
|
*/
|
|
234
250
|
.small {
|
|
235
251
|
font-size: var(--size-small);
|
|
252
|
+
gap: var(--space-xxxsmall);
|
|
253
|
+
line-height: var(--space-xsmall);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.small .glyph {
|
|
257
|
+
width: calc(var(--space-xsmall) + 2px);
|
|
258
|
+
height: calc(var(--space-xsmall) + 2px);
|
|
259
|
+
margin-top: -1px;
|
|
260
|
+
margin-bottom: -1px;
|
|
236
261
|
}
|
|
237
262
|
|
|
238
263
|
.medium {
|
|
239
264
|
font-size: var(--size-medium);
|
|
265
|
+
gap: var(--space-xxsmall);
|
|
266
|
+
line-height: var(--space-small);
|
|
240
267
|
}
|
|
241
268
|
|
|
242
269
|
.large {
|
|
243
270
|
font-size: var(--size-large);
|
|
271
|
+
gap: var(--space-xxsmall);
|
|
272
|
+
line-height: var(--space-small);
|
|
244
273
|
}
|
|
245
274
|
|
|
246
275
|
/**
|
|
@@ -3,6 +3,7 @@ import { Meta, Story } from '@storybook/react';
|
|
|
3
3
|
|
|
4
4
|
import { Stack } from '../../layout/stack';
|
|
5
5
|
import { FlexStack } from '../../layout/flex-stack';
|
|
6
|
+
import { Icon } from '../icon';
|
|
6
7
|
import { Button } from '.';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
@@ -14,53 +15,73 @@ const Template: Story = ({ children = 'Action', ...props }) => (
|
|
|
14
15
|
<Button {...props}>{children}</Button>
|
|
15
16
|
);
|
|
16
17
|
|
|
18
|
+
const Items = (props) => (
|
|
19
|
+
<FlexStack alignItems="top" style={{ flexWrap: 'wrap', gap: '12px' }} {...props} />
|
|
20
|
+
);
|
|
21
|
+
|
|
17
22
|
export const Default = Template.bind({});
|
|
18
23
|
|
|
19
24
|
export const All = () => (
|
|
20
25
|
<Stack space="large">
|
|
21
26
|
<Stack space="medium">
|
|
22
27
|
<h2>Size</h2>
|
|
23
|
-
<
|
|
28
|
+
<Items>
|
|
24
29
|
{Object.values(Button.SIZE).map((size) => (
|
|
25
30
|
<Button size={size} key={size}>
|
|
26
31
|
Action {size}
|
|
27
32
|
</Button>
|
|
28
33
|
))}
|
|
29
|
-
</
|
|
34
|
+
</Items>
|
|
30
35
|
</Stack>
|
|
31
36
|
<Stack space="medium">
|
|
32
37
|
<h2>Kind</h2>
|
|
33
|
-
<Stack space="
|
|
34
|
-
<
|
|
38
|
+
<Stack space="medium">
|
|
39
|
+
<Items>
|
|
35
40
|
{Object.values(Button.KIND).map((kind) => (
|
|
36
41
|
<Button kind={kind} key={kind}>
|
|
37
42
|
Action {kind}
|
|
38
43
|
</Button>
|
|
39
44
|
))}
|
|
40
|
-
</
|
|
45
|
+
</Items>
|
|
41
46
|
<h3>Active</h3>
|
|
42
|
-
<
|
|
47
|
+
<Items>
|
|
43
48
|
{Object.values(Button.KIND).map((kind) => (
|
|
44
49
|
<Button kind={kind} key={kind} active>
|
|
45
50
|
Action {kind}
|
|
46
51
|
</Button>
|
|
47
52
|
))}
|
|
48
|
-
</
|
|
53
|
+
</Items>
|
|
54
|
+
<h3>As link</h3>
|
|
55
|
+
<Items>
|
|
56
|
+
{Object.values(Button.KIND).map((kind) => (
|
|
57
|
+
<Button kind={kind} key={kind} as="a" href="#">
|
|
58
|
+
Action {kind}
|
|
59
|
+
</Button>
|
|
60
|
+
))}
|
|
61
|
+
</Items>
|
|
62
|
+
<h3>With icon</h3>
|
|
63
|
+
<Items>
|
|
64
|
+
{Object.values(Button.KIND).map((kind) => (
|
|
65
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE} kind={kind} key={kind}>
|
|
66
|
+
Action {kind}
|
|
67
|
+
</Button>
|
|
68
|
+
))}
|
|
69
|
+
</Items>
|
|
49
70
|
<h3>Disabled</h3>
|
|
50
|
-
<
|
|
71
|
+
<Items>
|
|
51
72
|
{Object.values(Button.KIND).map((kind) => (
|
|
52
73
|
<Button kind={kind} key={kind} disabled>
|
|
53
74
|
Action {kind}
|
|
54
75
|
</Button>
|
|
55
76
|
))}
|
|
56
|
-
</
|
|
77
|
+
</Items>
|
|
57
78
|
</Stack>
|
|
58
79
|
</Stack>
|
|
59
80
|
<Stack space="medium">
|
|
60
81
|
<h2>Outline & Kind</h2>
|
|
61
|
-
<Stack space="
|
|
82
|
+
<Stack space="medium">
|
|
62
83
|
{Object.values(Button.SIZE).map((size) => (
|
|
63
|
-
<
|
|
84
|
+
<Items key={size}>
|
|
64
85
|
<Button outline size={size}>
|
|
65
86
|
Action default
|
|
66
87
|
</Button>
|
|
@@ -69,10 +90,10 @@ export const All = () => (
|
|
|
69
90
|
Action {kind}
|
|
70
91
|
</Button>
|
|
71
92
|
))}
|
|
72
|
-
</
|
|
93
|
+
</Items>
|
|
73
94
|
))}
|
|
74
95
|
<h3>Active</h3>
|
|
75
|
-
<
|
|
96
|
+
<Items>
|
|
76
97
|
<Button outline active>
|
|
77
98
|
Action default
|
|
78
99
|
</Button>
|
|
@@ -81,9 +102,43 @@ export const All = () => (
|
|
|
81
102
|
Action {kind}
|
|
82
103
|
</Button>
|
|
83
104
|
))}
|
|
84
|
-
</
|
|
105
|
+
</Items>
|
|
106
|
+
<h3>With icon</h3>
|
|
107
|
+
{Object.values(Button.SIZE).map((size) => (
|
|
108
|
+
<Items key={size}>
|
|
109
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE} outline size={size}>
|
|
110
|
+
Action default
|
|
111
|
+
</Button>
|
|
112
|
+
{Object.values(Button.KIND).map((kind) => (
|
|
113
|
+
<Button
|
|
114
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE}
|
|
115
|
+
outline
|
|
116
|
+
kind={kind}
|
|
117
|
+
size={size}
|
|
118
|
+
key={kind}
|
|
119
|
+
>
|
|
120
|
+
Action {kind}
|
|
121
|
+
</Button>
|
|
122
|
+
))}
|
|
123
|
+
</Items>
|
|
124
|
+
))}
|
|
125
|
+
<h3>Only icon</h3>
|
|
126
|
+
{Object.values(Button.SIZE).map((size) => (
|
|
127
|
+
<Items key={size}>
|
|
128
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE} outline size={size} />
|
|
129
|
+
{Object.values(Button.KIND).map((kind) => (
|
|
130
|
+
<Button
|
|
131
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE}
|
|
132
|
+
outline
|
|
133
|
+
kind={kind}
|
|
134
|
+
size={size}
|
|
135
|
+
key={kind}
|
|
136
|
+
/>
|
|
137
|
+
))}
|
|
138
|
+
</Items>
|
|
139
|
+
))}
|
|
85
140
|
<h3>Disabled</h3>
|
|
86
|
-
<
|
|
141
|
+
<Items>
|
|
87
142
|
<Button outline disabled>
|
|
88
143
|
Action default
|
|
89
144
|
</Button>
|
|
@@ -92,14 +147,14 @@ export const All = () => (
|
|
|
92
147
|
Action {kind}
|
|
93
148
|
</Button>
|
|
94
149
|
))}
|
|
95
|
-
</
|
|
150
|
+
</Items>
|
|
96
151
|
</Stack>
|
|
97
152
|
</Stack>
|
|
98
153
|
<Stack space="medium">
|
|
99
154
|
<h2>Solid & Kind</h2>
|
|
100
|
-
<Stack space="
|
|
155
|
+
<Stack space="medium">
|
|
101
156
|
{Object.values(Button.SIZE).map((size) => (
|
|
102
|
-
<
|
|
157
|
+
<Items key={size}>
|
|
103
158
|
<Button solid size={size}>
|
|
104
159
|
Action default
|
|
105
160
|
</Button>
|
|
@@ -108,10 +163,10 @@ export const All = () => (
|
|
|
108
163
|
Action {kind}
|
|
109
164
|
</Button>
|
|
110
165
|
))}
|
|
111
|
-
</
|
|
166
|
+
</Items>
|
|
112
167
|
))}
|
|
113
168
|
<h3>Active</h3>
|
|
114
|
-
<
|
|
169
|
+
<Items>
|
|
115
170
|
<Button solid active>
|
|
116
171
|
Action default
|
|
117
172
|
</Button>
|
|
@@ -120,9 +175,43 @@ export const All = () => (
|
|
|
120
175
|
Action {kind}
|
|
121
176
|
</Button>
|
|
122
177
|
))}
|
|
123
|
-
</
|
|
178
|
+
</Items>
|
|
179
|
+
<h3>With icon</h3>
|
|
180
|
+
{Object.values(Button.SIZE).map((size) => (
|
|
181
|
+
<Items key={size}>
|
|
182
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE} solid size={size}>
|
|
183
|
+
Action default
|
|
184
|
+
</Button>
|
|
185
|
+
{Object.values(Button.KIND).map((kind) => (
|
|
186
|
+
<Button
|
|
187
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE}
|
|
188
|
+
solid
|
|
189
|
+
kind={kind}
|
|
190
|
+
size={size}
|
|
191
|
+
key={kind}
|
|
192
|
+
>
|
|
193
|
+
Action {kind}
|
|
194
|
+
</Button>
|
|
195
|
+
))}
|
|
196
|
+
</Items>
|
|
197
|
+
))}
|
|
198
|
+
<h3>Only icon</h3>
|
|
199
|
+
{Object.values(Button.SIZE).map((size) => (
|
|
200
|
+
<Items key={size}>
|
|
201
|
+
<Button glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE} solid size={size} />
|
|
202
|
+
{Object.values(Button.KIND).map((kind) => (
|
|
203
|
+
<Button
|
|
204
|
+
glyph={Icon.ICONS.ARROW_RIGHT_CIRLCE}
|
|
205
|
+
solid
|
|
206
|
+
kind={kind}
|
|
207
|
+
size={size}
|
|
208
|
+
key={kind}
|
|
209
|
+
/>
|
|
210
|
+
))}
|
|
211
|
+
</Items>
|
|
212
|
+
))}
|
|
124
213
|
<h3>Disabled</h3>
|
|
125
|
-
<
|
|
214
|
+
<Items>
|
|
126
215
|
<Button solid disabled>
|
|
127
216
|
Action default
|
|
128
217
|
</Button>
|
|
@@ -131,7 +220,7 @@ export const All = () => (
|
|
|
131
220
|
Action {kind}
|
|
132
221
|
</Button>
|
|
133
222
|
))}
|
|
134
|
-
</
|
|
223
|
+
</Items>
|
|
135
224
|
</Stack>
|
|
136
225
|
</Stack>
|
|
137
226
|
</Stack>
|
package/src/ui/button/button.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import { Button as ButtonBaseComponent } from 'ariakit/button';
|
|
4
4
|
|
|
5
|
+
import { Icon as BaseIcon } from '../icon';
|
|
5
6
|
import css from './button.module.css';
|
|
6
7
|
|
|
7
8
|
const SIZE = {
|
|
@@ -31,6 +32,9 @@ interface ButtonProps<T extends React.ElementType> {
|
|
|
31
32
|
radius?: Size | 'circle' | 'none';
|
|
32
33
|
padding?: Size | 'none';
|
|
33
34
|
as?: T;
|
|
35
|
+
Icon?: React.ElementType;
|
|
36
|
+
glyph?: React.ComponentProps<typeof BaseIcon>['glyph'];
|
|
37
|
+
rightGlyph?: React.ComponentProps<typeof BaseIcon>['glyph'];
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export const Button = <T extends React.ElementType = 'button'>(
|
|
@@ -46,6 +50,10 @@ export const Button = <T extends React.ElementType = 'button'>(
|
|
|
46
50
|
radius = '',
|
|
47
51
|
padding = '',
|
|
48
52
|
as: Component = ButtonBaseComponent,
|
|
53
|
+
children,
|
|
54
|
+
Icon = BaseIcon,
|
|
55
|
+
glyph,
|
|
56
|
+
rightGlyph,
|
|
49
57
|
...restProps
|
|
50
58
|
} = props;
|
|
51
59
|
|
|
@@ -75,7 +83,13 @@ export const Button = <T extends React.ElementType = 'button'>(
|
|
|
75
83
|
className,
|
|
76
84
|
);
|
|
77
85
|
|
|
78
|
-
return
|
|
86
|
+
return (
|
|
87
|
+
<Component {...restProps} className={rootClassName}>
|
|
88
|
+
{glyph && <Icon glyph={glyph} size={size} className={css.glyph} />}
|
|
89
|
+
{children && <span className={css.content}>{children}</span>}
|
|
90
|
+
{rightGlyph && <Icon glyph={glyph} size={size} className={css.glyph} />}
|
|
91
|
+
</Component>
|
|
92
|
+
);
|
|
79
93
|
};
|
|
80
94
|
|
|
81
95
|
Button.SIZE = SIZE;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.root > *:not(:first-child) {
|
|
2
|
+
border-top-left-radius: 0px;
|
|
3
|
+
border-bottom-left-radius: 0px;
|
|
4
|
+
|
|
5
|
+
margin-left: -1px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.root > *:not(:last-child) {
|
|
9
|
+
border-top-right-radius: 0px;
|
|
10
|
+
border-bottom-right-radius: 0px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.root > * {
|
|
14
|
+
position: relative;
|
|
15
|
+
z-index: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.root > *:hover,
|
|
19
|
+
.root > *:active,
|
|
20
|
+
.root > *:focus {
|
|
21
|
+
z-index: 1;
|
|
22
|
+
box-shadow: none;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Button } from '../button';
|
|
5
|
+
import { ControlGroup } from '.';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'UI/ControlGroup',
|
|
9
|
+
component: ControlGroup,
|
|
10
|
+
} as Meta;
|
|
11
|
+
|
|
12
|
+
export const Default = () => (
|
|
13
|
+
<ControlGroup>
|
|
14
|
+
<Button outline type="button">
|
|
15
|
+
Option A
|
|
16
|
+
</Button>
|
|
17
|
+
<Button outline type="button">
|
|
18
|
+
Option B
|
|
19
|
+
</Button>
|
|
20
|
+
<Button outline type="button">
|
|
21
|
+
Option C
|
|
22
|
+
</Button>
|
|
23
|
+
</ControlGroup>
|
|
24
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { FlexStack } from '../../layout/flex-stack';
|
|
5
|
+
import css from './control-group.module.css';
|
|
6
|
+
|
|
7
|
+
export const ControlGroup = (props: React.ComponentProps<typeof FlexStack>) => {
|
|
8
|
+
const { className = '', ...restProps } = props;
|
|
9
|
+
return (
|
|
10
|
+
<FlexStack
|
|
11
|
+
className={cx(css.root, className)}
|
|
12
|
+
space="no-space"
|
|
13
|
+
alignItems="center"
|
|
14
|
+
{...restProps}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './control-group';
|
|
@@ -4,7 +4,6 @@ import cx from 'classnames';
|
|
|
4
4
|
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit/menu';
|
|
5
5
|
|
|
6
6
|
import { FlexStack } from '../../layout/flex-stack';
|
|
7
|
-
import { Button } from '../button';
|
|
8
7
|
import { Icon } from '../icon';
|
|
9
8
|
import css from './dropdown.module.css';
|
|
10
9
|
|
|
@@ -23,19 +22,17 @@ Item.defaultProps = {
|
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export const Dropdown = (props) => {
|
|
26
|
-
const { className, buttonClassName, label, ariaLabel, glyph, children } = props;
|
|
25
|
+
const { className, buttonClassName, label, ariaLabel, glyph, disabled, children } = props;
|
|
27
26
|
const rootClassName = cx(css.root, className);
|
|
28
27
|
const menuState = useMenuState();
|
|
29
28
|
|
|
30
29
|
return (
|
|
31
30
|
<div className={rootClassName}>
|
|
32
31
|
<MenuButton
|
|
33
|
-
as={Button}
|
|
34
|
-
outline
|
|
35
|
-
size={Button.SIZE.SMALL}
|
|
36
32
|
state={menuState}
|
|
37
|
-
tabIndex={null}
|
|
38
33
|
className={cx(css.button, buttonClassName)}
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
tabIndex={null}
|
|
39
36
|
>
|
|
40
37
|
<FlexStack space="xxxsmall" alignItems="center" className={css.label}>
|
|
41
38
|
{glyph && <Icon className={css.labelIcon} glyph={glyph} />}
|
|
@@ -62,6 +59,7 @@ Dropdown.defaultProps = {
|
|
|
62
59
|
label: null,
|
|
63
60
|
ariaLabel: '',
|
|
64
61
|
glyph: null,
|
|
62
|
+
disabled: false,
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
Dropdown.propTypes = {
|
|
@@ -80,6 +78,9 @@ Dropdown.propTypes = {
|
|
|
80
78
|
/** Icon glyph */
|
|
81
79
|
glyph: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
82
80
|
|
|
81
|
+
/** Dropdown button disabled attribute */
|
|
82
|
+
disabled: PropTypes.bool,
|
|
83
|
+
|
|
83
84
|
/** Content */
|
|
84
85
|
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired,
|
|
85
86
|
};
|
|
@@ -3,9 +3,33 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.button {
|
|
6
|
+
background: none;
|
|
7
|
+
border: none;
|
|
8
|
+
padding: 0;
|
|
9
|
+
|
|
10
|
+
border: 1px solid var(--color-outline);
|
|
11
|
+
border-radius: var(--radius-small);
|
|
12
|
+
padding: calc(var(--space-xxsmall) - 1px);
|
|
13
|
+
|
|
14
|
+
appearance: none;
|
|
15
|
+
background: none;
|
|
6
16
|
font-size: var(--size-small);
|
|
7
17
|
line-height: var(--space-small);
|
|
8
18
|
white-space: nowrap;
|
|
19
|
+
color: var(--color-text-light);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.button[aria-expanded=true],
|
|
23
|
+
.button:hover,
|
|
24
|
+
.button:focus,
|
|
25
|
+
.button:active {
|
|
26
|
+
outline: none;
|
|
27
|
+
box-shadow: var(--outline-hover);
|
|
28
|
+
color: var(--color-text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.button[disabled] {
|
|
32
|
+
color: var(--color-text-ultra-light);
|
|
9
33
|
}
|
|
10
34
|
|
|
11
35
|
.dropdown {
|
|
@@ -17,7 +41,7 @@
|
|
|
17
41
|
background: var(--color-background);
|
|
18
42
|
min-width: 12em;
|
|
19
43
|
z-index: var(--layer-high);
|
|
20
|
-
padding: var(--space-xxxsmall);
|
|
44
|
+
padding: calc(var(--space-xxxsmall) / 2);
|
|
21
45
|
}
|
|
22
46
|
|
|
23
47
|
.dropdown:focus {
|
|
@@ -31,7 +55,7 @@
|
|
|
31
55
|
outline: none;
|
|
32
56
|
border: 0;
|
|
33
57
|
border-radius: var(--radius-small);
|
|
34
|
-
padding: var(--space-xxxsmall) var(--space-xxxsmall);
|
|
58
|
+
padding: var(--space-xxxsmall) calc(var(--space-xxxsmall) + var(--space-xxxsmall) / 2);
|
|
35
59
|
background: none;
|
|
36
60
|
text-align: left;
|
|
37
61
|
color: var(--color-text-light);
|
package/src/ui/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Alert } from './alert';
|
|
2
2
|
export { Button } from './button';
|
|
3
3
|
export { Container } from './container';
|
|
4
|
+
export { ControlGroup } from './control-group';
|
|
4
5
|
export { Dropdown } from './dropdown';
|
|
5
6
|
export { EmptySet } from './empty-set';
|
|
6
7
|
export { FileName } from './file-name';
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
right: var(--space-xxxsmall);
|
|
14
14
|
top: 50%;
|
|
15
15
|
transform: translateY(-50%);
|
|
16
|
+
padding: var(--space-xxxsmall);
|
|
16
17
|
background: radial-gradient(var(--color-background) 50%, transparent);
|
|
17
|
-
color: var(--color-text-ultra-light);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.cancelButton:focus,
|
|
21
|
-
.cancelButton:hover,
|
|
22
|
-
.cancelButton:active {
|
|
23
|
-
color: var(--color-text-light);
|
|
24
18
|
}
|
|
@@ -71,14 +71,12 @@ export const InputSearch = (
|
|
|
71
71
|
{value && (
|
|
72
72
|
<Button
|
|
73
73
|
radius="circle"
|
|
74
|
-
|
|
74
|
+
glyph={Icon.ICONS.CANCEL}
|
|
75
75
|
type="button"
|
|
76
76
|
onClick={clearButtonOnClick}
|
|
77
77
|
aria-label="Clear search"
|
|
78
78
|
className={css.cancelButton}
|
|
79
|
-
|
|
80
|
-
<Icon className={css.cancelButtonIcon} glyph={Icon.ICONS.CANCEL} />
|
|
81
|
-
</Button>
|
|
79
|
+
/>
|
|
82
80
|
)}
|
|
83
81
|
</div>
|
|
84
82
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Icon as BaseIcon } from '../icon';
|
|
2
3
|
declare const SIZE: {
|
|
3
4
|
readonly SMALL: "small";
|
|
4
5
|
readonly MEDIUM: "medium";
|
|
@@ -23,6 +24,9 @@ interface ButtonProps<T extends React.ElementType> {
|
|
|
23
24
|
radius?: Size | 'circle' | 'none';
|
|
24
25
|
padding?: Size | 'none';
|
|
25
26
|
as?: T;
|
|
27
|
+
Icon?: React.ElementType;
|
|
28
|
+
glyph?: React.ComponentProps<typeof BaseIcon>['glyph'];
|
|
29
|
+
rightGlyph?: React.ComponentProps<typeof BaseIcon>['glyph'];
|
|
26
30
|
}
|
|
27
31
|
export declare const Button: {
|
|
28
32
|
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "button">(props: ButtonProps<T> & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, keyof ButtonProps<T>>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './control-group';
|
|
@@ -6,6 +6,7 @@ export namespace Dropdown {
|
|
|
6
6
|
let label: null;
|
|
7
7
|
let ariaLabel: string;
|
|
8
8
|
let glyph: null;
|
|
9
|
+
let disabled: boolean;
|
|
9
10
|
}
|
|
10
11
|
export namespace propTypes {
|
|
11
12
|
let className_1: PropTypes.Requireable<string>;
|
|
@@ -18,6 +19,8 @@ export namespace Dropdown {
|
|
|
18
19
|
export { ariaLabel_1 as ariaLabel };
|
|
19
20
|
let glyph_1: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
20
21
|
export { glyph_1 as glyph };
|
|
22
|
+
let disabled_1: PropTypes.Requireable<boolean>;
|
|
23
|
+
export { disabled_1 as disabled };
|
|
21
24
|
export let children: PropTypes.Validator<NonNullable<NonNullable<string | PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>>;
|
|
22
25
|
}
|
|
23
26
|
export { Item };
|
package/types/ui/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Alert } from "./alert";
|
|
2
2
|
export { Button } from "./button";
|
|
3
3
|
export { Container } from "./container";
|
|
4
|
+
export { ControlGroup } from "./control-group";
|
|
4
5
|
export { Dropdown } from "./dropdown";
|
|
5
6
|
export { EmptySet } from "./empty-set";
|
|
6
7
|
export { FileName } from "./file-name";
|