@inglorious/ui 7.2.0 → 7.2.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/package.json +1 -1
- package/src/controls/combobox/combobox.stories.js +66 -4
- package/src/controls/combobox/style.css +81 -23
- package/src/controls/combobox/template.js +276 -145
- package/src/controls/input/index.js +1 -1
- package/src/controls/input/input.stories.js +35 -0
- package/src/controls/input/style.css +43 -56
- package/src/controls/input/template.js +112 -88
- package/src/controls/select/index.js +1 -1
- package/src/controls/select/select.stories.js +35 -3
- package/src/controls/select/style.css +145 -66
- package/src/controls/select/template.js +178 -74
- package/types/controls/combobox.d.ts +3 -0
- package/types/controls/select.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/ui",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.2",
|
|
4
4
|
"description": "A design system for Inglorious Web with render-function components and customizable themes",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,8 +56,8 @@ export default {
|
|
|
56
56
|
},
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const
|
|
60
|
-
|
|
59
|
+
export const Default = {}
|
|
60
|
+
Default.args = {
|
|
61
61
|
id: "combobox",
|
|
62
62
|
type: "Combobox",
|
|
63
63
|
label: "Country",
|
|
@@ -79,14 +79,76 @@ SingleClosed.args = {
|
|
|
79
79
|
|
|
80
80
|
export const SingleOpen = {}
|
|
81
81
|
SingleOpen.args = {
|
|
82
|
-
...
|
|
82
|
+
...Default.args,
|
|
83
83
|
isOpen: true,
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export const MultiOpen = {}
|
|
87
87
|
MultiOpen.args = {
|
|
88
|
-
...
|
|
88
|
+
...Default.args,
|
|
89
89
|
isMulti: true,
|
|
90
90
|
selectedValue: ["it", "fr"],
|
|
91
91
|
isOpen: true,
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
export const WithHint = {}
|
|
95
|
+
WithHint.args = {
|
|
96
|
+
...Default.args,
|
|
97
|
+
hint: "Please select a country",
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const WithError = {}
|
|
101
|
+
WithError.args = {
|
|
102
|
+
...Default.args,
|
|
103
|
+
error: "You cannot select this one!",
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const WithHintAndError = {}
|
|
107
|
+
WithHintAndError.args = {
|
|
108
|
+
...WithHint.args,
|
|
109
|
+
error: "You cannot select this one!",
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const Required = {}
|
|
113
|
+
Required.args = {
|
|
114
|
+
...Default.args,
|
|
115
|
+
isRequired: true,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const Disabled = {}
|
|
119
|
+
Disabled.args = {
|
|
120
|
+
...Default.args,
|
|
121
|
+
isDisabled: true,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const DisabledOption = {}
|
|
125
|
+
DisabledOption.args = {
|
|
126
|
+
...Default.args,
|
|
127
|
+
options: Default.args.options.map((option, index) =>
|
|
128
|
+
index % 2 ? { ...option, isDisabled: true } : option,
|
|
129
|
+
),
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const Small = {}
|
|
133
|
+
Small.args = {
|
|
134
|
+
...Default.args,
|
|
135
|
+
size: "sm",
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const Medium = {}
|
|
139
|
+
Medium.args = {
|
|
140
|
+
...Default.args,
|
|
141
|
+
size: "md",
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const Large = {}
|
|
145
|
+
Large.args = {
|
|
146
|
+
...Default.args,
|
|
147
|
+
size: "lg",
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const FullWidth = {}
|
|
151
|
+
FullWidth.args = {
|
|
152
|
+
...Default.args,
|
|
153
|
+
isFullWidth: true,
|
|
154
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@import "../../data-display/chip/style.css";
|
|
2
2
|
|
|
3
3
|
.iw-combobox {
|
|
4
|
-
position: relative;
|
|
5
4
|
display: inline-flex;
|
|
6
5
|
flex-direction: column;
|
|
7
6
|
gap: var(--iw-space-1);
|
|
8
7
|
font-family: var(--iw-font-family-sans);
|
|
8
|
+
position: relative; /* required for dropdown positioning */
|
|
9
9
|
|
|
10
10
|
&.iw-combobox-full-width {
|
|
11
11
|
width: 100%;
|
|
@@ -13,20 +13,40 @@
|
|
|
13
13
|
|
|
14
14
|
.iw-combobox-label {
|
|
15
15
|
font-size: var(--iw-font-size-sm);
|
|
16
|
+
font-weight: var(--iw-font-weight-normal);
|
|
16
17
|
color: var(--iw-color-text);
|
|
17
18
|
line-height: var(--iw-line-height-normal);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
.iw-combobox-
|
|
21
|
-
|
|
21
|
+
.iw-combobox-required {
|
|
22
|
+
color: var(--iw-color-error);
|
|
23
|
+
margin-left: var(--iw-space-1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.iw-combobox-hint,
|
|
27
|
+
.iw-combobox-error-message {
|
|
28
|
+
font-size: var(--iw-font-size-sm);
|
|
29
|
+
line-height: var(--iw-line-height-normal);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.iw-combobox-hint {
|
|
33
|
+
color: var(--iw-color-text-muted);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iw-combobox-error-message {
|
|
37
|
+
color: var(--iw-color-error);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.iw-combobox-frame {
|
|
22
41
|
display: flex;
|
|
23
42
|
align-items: center;
|
|
43
|
+
/* The gap spaces the text from the arrow, as it does for Input's icons. */
|
|
24
44
|
gap: var(--iw-space-2);
|
|
25
|
-
padding: 0 var(--iw-space-
|
|
45
|
+
padding: 0 var(--iw-space-3);
|
|
26
46
|
border: 1px solid var(--iw-input-border);
|
|
27
47
|
border-radius: var(--iw-input-radius);
|
|
28
|
-
background: var(--iw-input-bg);
|
|
29
48
|
color: var(--iw-input-text);
|
|
49
|
+
background-color: var(--iw-input-bg);
|
|
30
50
|
cursor: pointer;
|
|
31
51
|
user-select: none;
|
|
32
52
|
transition:
|
|
@@ -34,12 +54,40 @@
|
|
|
34
54
|
box-shadow var(--iw-transition-fast),
|
|
35
55
|
background-color var(--iw-transition-fast);
|
|
36
56
|
|
|
37
|
-
|
|
57
|
+
&.iw-combobox-sm {
|
|
58
|
+
height: 2rem;
|
|
59
|
+
font-size: var(--iw-font-size-sm);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.iw-combobox-md {
|
|
63
|
+
height: 2.25rem;
|
|
64
|
+
font-size: var(--iw-font-size-base);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.iw-combobox-lg {
|
|
68
|
+
height: 2.75rem;
|
|
69
|
+
font-size: var(--iw-font-size-lg);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:hover:not(.iw-combobox-frame-disabled) {
|
|
38
73
|
border-color: var(--iw-input-border-hover);
|
|
39
74
|
background: var(--iw-input-bg-hover);
|
|
40
75
|
}
|
|
41
76
|
|
|
42
|
-
|
|
77
|
+
&:focus-within:not(.iw-combobox-frame-disabled) {
|
|
78
|
+
background-color: var(--iw-input-bg-focus);
|
|
79
|
+
border-color: var(--iw-input-border-focus);
|
|
80
|
+
box-shadow: var(--iw-input-shadow-focus);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* The control is focusable so it can be opened from the keyboard. */
|
|
84
|
+
&:focus-visible {
|
|
85
|
+
outline: none;
|
|
86
|
+
border-color: var(--iw-input-border-focus);
|
|
87
|
+
box-shadow: var(--iw-input-shadow-focus);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&.iw-combobox-frame-open {
|
|
43
91
|
border-color: var(--iw-input-border-focus);
|
|
44
92
|
box-shadow: var(--iw-input-shadow-focus);
|
|
45
93
|
background: var(--iw-input-bg-focus);
|
|
@@ -47,14 +95,23 @@
|
|
|
47
95
|
border-bottom-right-radius: 0;
|
|
48
96
|
}
|
|
49
97
|
|
|
50
|
-
&.iw-combobox-
|
|
98
|
+
&.iw-combobox-frame-disabled {
|
|
51
99
|
opacity: 0.6;
|
|
52
100
|
cursor: not-allowed;
|
|
53
101
|
}
|
|
54
102
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
103
|
+
&.iw-combobox-frame-error {
|
|
104
|
+
border-color: var(--iw-color-error);
|
|
105
|
+
|
|
106
|
+
&:focus-visible {
|
|
107
|
+
border-color: var(--iw-color-error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* The text element, whatever it is showing. Same role as
|
|
112
|
+
.iw-input-control in Input, so the shared rules live here and the
|
|
113
|
+
variant classes only add what is specific to them. */
|
|
114
|
+
.iw-combobox-control {
|
|
58
115
|
flex: 1;
|
|
59
116
|
min-width: 0;
|
|
60
117
|
}
|
|
@@ -107,19 +164,20 @@
|
|
|
107
164
|
display: inline-flex;
|
|
108
165
|
align-items: center;
|
|
109
166
|
justify-content: center;
|
|
167
|
+
font-size: var(--iw-font-size-sm);
|
|
168
|
+
line-height: 1;
|
|
169
|
+
/* A flex child, like Input's icons and the Select arrow. Absolutely
|
|
170
|
+
positioning it anchored to .iw-combobox rather than the frame, so
|
|
171
|
+
the glyph drifted whenever a label sat above the control, and it
|
|
172
|
+
needed a reserved padding strip to stop text running under it. The
|
|
173
|
+
row's gap does both. */
|
|
174
|
+
flex: none;
|
|
110
175
|
pointer-events: none;
|
|
111
|
-
position: absolute;
|
|
112
|
-
right: var(--iw-space-3);
|
|
113
176
|
color: var(--iw-color-text-muted);
|
|
114
177
|
transition: transform var(--iw-transition-fast);
|
|
115
|
-
|
|
116
|
-
span {
|
|
117
|
-
font-size: 0.65rem;
|
|
118
|
-
line-height: 1;
|
|
119
|
-
}
|
|
120
178
|
}
|
|
121
179
|
|
|
122
|
-
&.iw-combobox-
|
|
180
|
+
&.iw-combobox-frame-open .iw-combobox-arrow {
|
|
123
181
|
transform: rotate(180deg);
|
|
124
182
|
}
|
|
125
183
|
}
|
|
@@ -191,13 +249,13 @@
|
|
|
191
249
|
}
|
|
192
250
|
}
|
|
193
251
|
|
|
194
|
-
&.iw-combobox-sm .iw-combobox-
|
|
252
|
+
&.iw-combobox-sm .iw-combobox-frame {
|
|
195
253
|
height: 2rem;
|
|
196
|
-
padding: 0 var(--iw-space-
|
|
254
|
+
padding: 0 var(--iw-space-2);
|
|
197
255
|
}
|
|
198
256
|
|
|
199
|
-
&.iw-combobox-lg .iw-combobox-
|
|
257
|
+
&.iw-combobox-lg .iw-combobox-frame {
|
|
200
258
|
height: 2.75rem;
|
|
201
|
-
padding: 0 var(--iw-space-
|
|
259
|
+
padding: 0 var(--iw-space-4);
|
|
202
260
|
}
|
|
203
261
|
}
|