@inglorious/ui 7.2.1 → 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 +74 -23
- package/src/controls/combobox/template.js +242 -154
- 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,11 +54,32 @@
|
|
|
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
|
|
|
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
|
+
|
|
42
83
|
/* The control is focusable so it can be opened from the keyboard. */
|
|
43
84
|
&:focus-visible {
|
|
44
85
|
outline: none;
|
|
@@ -46,7 +87,7 @@
|
|
|
46
87
|
box-shadow: var(--iw-input-shadow-focus);
|
|
47
88
|
}
|
|
48
89
|
|
|
49
|
-
&.iw-combobox-
|
|
90
|
+
&.iw-combobox-frame-open {
|
|
50
91
|
border-color: var(--iw-input-border-focus);
|
|
51
92
|
box-shadow: var(--iw-input-shadow-focus);
|
|
52
93
|
background: var(--iw-input-bg-focus);
|
|
@@ -54,14 +95,23 @@
|
|
|
54
95
|
border-bottom-right-radius: 0;
|
|
55
96
|
}
|
|
56
97
|
|
|
57
|
-
&.iw-combobox-
|
|
98
|
+
&.iw-combobox-frame-disabled {
|
|
58
99
|
opacity: 0.6;
|
|
59
100
|
cursor: not-allowed;
|
|
60
101
|
}
|
|
61
102
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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 {
|
|
65
115
|
flex: 1;
|
|
66
116
|
min-width: 0;
|
|
67
117
|
}
|
|
@@ -114,19 +164,20 @@
|
|
|
114
164
|
display: inline-flex;
|
|
115
165
|
align-items: center;
|
|
116
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;
|
|
117
175
|
pointer-events: none;
|
|
118
|
-
position: absolute;
|
|
119
|
-
right: var(--iw-space-3);
|
|
120
176
|
color: var(--iw-color-text-muted);
|
|
121
177
|
transition: transform var(--iw-transition-fast);
|
|
122
|
-
|
|
123
|
-
span {
|
|
124
|
-
font-size: 0.65rem;
|
|
125
|
-
line-height: 1;
|
|
126
|
-
}
|
|
127
178
|
}
|
|
128
179
|
|
|
129
|
-
&.iw-combobox-
|
|
180
|
+
&.iw-combobox-frame-open .iw-combobox-arrow {
|
|
130
181
|
transform: rotate(180deg);
|
|
131
182
|
}
|
|
132
183
|
}
|
|
@@ -198,13 +249,13 @@
|
|
|
198
249
|
}
|
|
199
250
|
}
|
|
200
251
|
|
|
201
|
-
&.iw-combobox-sm .iw-combobox-
|
|
252
|
+
&.iw-combobox-sm .iw-combobox-frame {
|
|
202
253
|
height: 2rem;
|
|
203
|
-
padding: 0 var(--iw-space-
|
|
254
|
+
padding: 0 var(--iw-space-2);
|
|
204
255
|
}
|
|
205
256
|
|
|
206
|
-
&.iw-combobox-lg .iw-combobox-
|
|
257
|
+
&.iw-combobox-lg .iw-combobox-frame {
|
|
207
258
|
height: 2.75rem;
|
|
208
|
-
padding: 0 var(--iw-space-
|
|
259
|
+
padding: 0 var(--iw-space-4);
|
|
209
260
|
}
|
|
210
261
|
}
|