@crowdstrike/glide-core 0.29.1 → 0.30.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/dist/accordion.js +240 -1
- package/dist/accordion.styles.js +13 -7
- package/dist/button-group.button.js +143 -1
- package/dist/button-group.button.styles.js +43 -15
- package/dist/button-group.js +249 -1
- package/dist/button-group.styles.js +10 -5
- package/dist/button.js +206 -1
- package/dist/button.styles.js +12 -7
- package/dist/checkbox-group.js +479 -14
- package/dist/checkbox-group.styles.js +5 -2
- package/dist/checkbox.js +519 -32
- package/dist/checkbox.styles.js +10 -5
- package/dist/drawer.js +168 -1
- package/dist/drawer.styles.js +5 -2
- package/dist/dropdown.js +2423 -123
- package/dist/dropdown.option.js +536 -1
- package/dist/dropdown.option.styles.js +5 -2
- package/dist/dropdown.styles.js +14 -7
- package/dist/form-controls-layout.js +102 -1
- package/dist/form-controls-layout.styles.js +5 -2
- package/dist/icon-button.js +139 -1
- package/dist/icon-button.styles.js +19 -7
- package/dist/icons/checked.js +28 -1
- package/dist/icons/chevron.js +21 -1
- package/dist/icons/magnifying-glass.js +23 -1
- package/dist/icons/pencil.js +21 -1
- package/dist/icons/severity-critical.js +20 -1
- package/dist/icons/severity-informational.js +20 -1
- package/dist/icons/severity-medium.js +20 -1
- package/dist/icons/x.js +21 -1
- package/dist/inline-alert.js +118 -1
- package/dist/inline-alert.styles.js +5 -2
- package/dist/input.d.ts +8 -2
- package/dist/input.js +505 -41
- package/dist/input.styles.js +25 -4
- package/dist/label.js +303 -1
- package/dist/label.styles.js +11 -5
- package/dist/library/assert-slot.js +136 -1
- package/dist/library/expect-unhandled-rejection.js +14 -1
- package/dist/library/expect-window-error.js +26 -1
- package/dist/library/final.js +18 -1
- package/dist/library/form-control.js +1 -1
- package/dist/library/localize.js +10 -1
- package/dist/library/mouse.js +35 -1
- package/dist/library/on-resize.js +24 -1
- package/dist/library/required.js +35 -1
- package/dist/library/shadow-root-mode.js +4 -1
- package/dist/library/unique-id.js +3 -1
- package/dist/link.js +92 -1
- package/dist/link.styles.js +10 -5
- package/dist/menu.d.ts +3 -2
- package/dist/menu.js +1259 -1
- package/dist/menu.styles.js +34 -17
- package/dist/modal.d.ts +4 -0
- package/dist/modal.icon-button.js +60 -1
- package/dist/modal.icon-button.styles.js +5 -2
- package/dist/modal.js +473 -1
- package/dist/modal.styles.js +71 -22
- package/dist/option.d.ts +74 -0
- package/dist/option.js +498 -0
- package/dist/option.styles.js +140 -0
- package/dist/{menu.options.d.ts → options.d.ts} +5 -6
- package/dist/options.js +130 -0
- package/dist/options.styles.js +21 -0
- package/dist/popover.js +620 -1
- package/dist/popover.styles.js +11 -5
- package/dist/radio-group.js +624 -17
- package/dist/radio-group.radio.js +211 -1
- package/dist/radio-group.radio.styles.js +9 -4
- package/dist/radio-group.styles.js +5 -2
- package/dist/slider.js +1040 -61
- package/dist/slider.styles.js +9 -4
- package/dist/spinner.js +60 -1
- package/dist/spinner.styles.js +5 -2
- package/dist/split-button.js +116 -1
- package/dist/split-button.primary-button.js +100 -1
- package/dist/split-button.primary-button.styles.js +13 -6
- package/dist/split-button.primary-link.js +102 -1
- package/dist/split-button.secondary-button.d.ts +2 -3
- package/dist/split-button.secondary-button.js +121 -1
- package/dist/split-button.secondary-button.styles.js +12 -7
- package/dist/split-button.styles.js +9 -4
- package/dist/styles/focus-outline.js +9 -3
- package/dist/styles/fonts.css +6 -1
- package/dist/styles/opacity-and-scale-animation.js +6 -3
- package/dist/styles/skeleton.js +6 -3
- package/dist/styles/variables.css +410 -1
- package/dist/styles/visually-hidden.js +6 -3
- package/dist/tab.group.js +386 -1
- package/dist/tab.group.styles.js +5 -2
- package/dist/tab.js +133 -1
- package/dist/tab.panel.js +93 -1
- package/dist/tab.panel.styles.js +11 -5
- package/dist/tab.styles.js +9 -4
- package/dist/tag.js +207 -1
- package/dist/tag.styles.js +10 -5
- package/dist/textarea.js +353 -19
- package/dist/textarea.styles.js +23 -4
- package/dist/toast.js +130 -1
- package/dist/toast.toasts.js +248 -25
- package/dist/toast.toasts.styles.js +9 -4
- package/dist/toggle.js +178 -1
- package/dist/toggle.styles.js +25 -5
- package/dist/tooltip.container.d.ts +2 -0
- package/dist/tooltip.container.js +130 -1
- package/dist/tooltip.container.styles.js +18 -4
- package/dist/tooltip.d.ts +6 -0
- package/dist/tooltip.js +484 -1
- package/dist/tooltip.styles.js +21 -5
- package/dist/translations/en.js +36 -1
- package/dist/translations/fr.js +37 -1
- package/dist/translations/ja.js +37 -1
- package/package.json +8 -12
- package/dist/menu.button.d.ts +0 -42
- package/dist/menu.button.js +0 -1
- package/dist/menu.button.styles.js +0 -32
- package/dist/menu.link.d.ts +0 -44
- package/dist/menu.link.js +0 -1
- package/dist/menu.link.styles.js +0 -35
- package/dist/menu.options.js +0 -1
- package/dist/menu.options.styles.d.ts +0 -2
- package/dist/menu.options.styles.js +0 -20
- /package/dist/{menu.button.styles.d.ts → option.styles.d.ts} +0 -0
- /package/dist/{menu.link.styles.d.ts → options.styles.d.ts} +0 -0
package/dist/accordion.js
CHANGED
@@ -1 +1,240 @@
|
|
1
|
-
var __decorate
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { html, LitElement } from 'lit';
|
8
|
+
import { classMap } from 'lit/directives/class-map.js';
|
9
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
10
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
11
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
12
|
+
import packageJson from '../package.json' with { type: 'json' };
|
13
|
+
import chevronIcon from './icons/chevron.js';
|
14
|
+
import styles from './accordion.styles.js';
|
15
|
+
import assertSlot from './library/assert-slot.js';
|
16
|
+
import shadowRootMode from './library/shadow-root-mode.js';
|
17
|
+
import final from './library/final.js';
|
18
|
+
import required from './library/required.js';
|
19
|
+
/**
|
20
|
+
* @attr {string} label
|
21
|
+
* @attr {boolean} [open=false]
|
22
|
+
*
|
23
|
+
* @readonly
|
24
|
+
* @attr {string} [version]
|
25
|
+
*
|
26
|
+
* @slot {Element | string} - The content of the accordion
|
27
|
+
* @slot {Element} [prefix-icon] - An icon before the label
|
28
|
+
* @slot {Element} [suffix-icons] - Icons after the label
|
29
|
+
*
|
30
|
+
* @fires {Event} toggle
|
31
|
+
*/
|
32
|
+
let Accordion = class Accordion extends LitElement {
|
33
|
+
constructor() {
|
34
|
+
super(...arguments);
|
35
|
+
this.version = packageJson.version;
|
36
|
+
this.hasPrefixIcon = false;
|
37
|
+
this.hasSuffixIcons = false;
|
38
|
+
this.isClosing = false;
|
39
|
+
this.#defaultSlotElementRef = createRef();
|
40
|
+
this.#detailsElementRef = createRef();
|
41
|
+
this.#isOpen = false;
|
42
|
+
this.#prefixIconSlotElementRef = createRef();
|
43
|
+
this.#suffixIconsSlotElementRef = createRef();
|
44
|
+
this.#summaryElementRef = createRef();
|
45
|
+
}
|
46
|
+
static { this.shadowRootOptions = {
|
47
|
+
...LitElement.shadowRootOptions,
|
48
|
+
delegatesFocus: true,
|
49
|
+
mode: shadowRootMode,
|
50
|
+
}; }
|
51
|
+
static { this.styles = styles; }
|
52
|
+
/**
|
53
|
+
* @default false
|
54
|
+
*/
|
55
|
+
get open() {
|
56
|
+
return this.#isOpen;
|
57
|
+
}
|
58
|
+
set open(isOpen) {
|
59
|
+
const hasChanged = isOpen !== this.#isOpen;
|
60
|
+
this.#isOpen = isOpen;
|
61
|
+
const isReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
62
|
+
if (isReducedMotion && hasChanged && this.#detailsElementRef.value) {
|
63
|
+
this.#detailsElementRef.value.open = isOpen;
|
64
|
+
this.dispatchEvent(new Event('toggle', { bubbles: true, composed: true }));
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
if (isOpen && hasChanged) {
|
68
|
+
// Wait for `.summary` to re-render after the "active" class addition to
|
69
|
+
// prevent animation jank, especially in Firefox and Safari.
|
70
|
+
this.updateComplete.then(() => {
|
71
|
+
if (this.#detailsElementRef.value &&
|
72
|
+
this.#defaultSlotElementRef.value) {
|
73
|
+
const bottomPadding = Number.parseFloat(getComputedStyle(this.#defaultSlotElementRef.value)?.paddingBottom);
|
74
|
+
this.#detailsElementRef.value.open = true;
|
75
|
+
this.#defaultSlotElementRef.value
|
76
|
+
.animate({
|
77
|
+
height: [
|
78
|
+
'0px',
|
79
|
+
`${this.#defaultSlotElementRef.value.offsetHeight -
|
80
|
+
bottomPadding}px`,
|
81
|
+
],
|
82
|
+
opacity: [0, 1],
|
83
|
+
}, {
|
84
|
+
duration: Number(getComputedStyle(this.#defaultSlotElementRef.value)
|
85
|
+
.getPropertyValue('--private-open-duration')
|
86
|
+
.replace('ms', '')),
|
87
|
+
easing: getComputedStyle(this.#defaultSlotElementRef.value).getPropertyValue('--private-easing'),
|
88
|
+
})
|
89
|
+
.addEventListener('finish', () => {
|
90
|
+
if (this.#detailsElementRef.value) {
|
91
|
+
this.dispatchEvent(new Event('toggle', { bubbles: true, composed: true }));
|
92
|
+
}
|
93
|
+
});
|
94
|
+
}
|
95
|
+
});
|
96
|
+
}
|
97
|
+
else if (hasChanged) {
|
98
|
+
this.isClosing = true;
|
99
|
+
if (this.#defaultSlotElementRef.value) {
|
100
|
+
const bottomPadding = Number.parseFloat(getComputedStyle(this.#defaultSlotElementRef.value)?.paddingBottom);
|
101
|
+
this.#defaultSlotElementRef.value
|
102
|
+
.animate({
|
103
|
+
height: [
|
104
|
+
`${this.#defaultSlotElementRef.value.offsetHeight - bottomPadding}px`,
|
105
|
+
'0px',
|
106
|
+
],
|
107
|
+
opacity: [1, 0],
|
108
|
+
}, {
|
109
|
+
duration: Number(getComputedStyle(this.#defaultSlotElementRef.value)
|
110
|
+
.getPropertyValue('--private-close-duration')
|
111
|
+
.replace('ms', '')),
|
112
|
+
easing: getComputedStyle(this.#defaultSlotElementRef.value).getPropertyValue('--private-easing'),
|
113
|
+
})
|
114
|
+
.addEventListener('finish', () => {
|
115
|
+
if (this.#detailsElementRef.value) {
|
116
|
+
this.#detailsElementRef.value.open = false;
|
117
|
+
this.isClosing = false;
|
118
|
+
this.dispatchEvent(new Event('toggle', { bubbles: true, composed: true }));
|
119
|
+
}
|
120
|
+
});
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
click() {
|
125
|
+
this.#summaryElementRef.value?.click();
|
126
|
+
}
|
127
|
+
render() {
|
128
|
+
return html `<details class="component" ${ref(this.#detailsElementRef)}>
|
129
|
+
<summary
|
130
|
+
class=${classMap({
|
131
|
+
summary: true,
|
132
|
+
active: this.open || this.isClosing,
|
133
|
+
open: this.open,
|
134
|
+
})}
|
135
|
+
data-test="summary"
|
136
|
+
@click=${this.#onSummaryClick}
|
137
|
+
${ref(this.#summaryElementRef)}
|
138
|
+
>
|
139
|
+
${chevronIcon}
|
140
|
+
|
141
|
+
<div class="label-container">
|
142
|
+
<slot
|
143
|
+
class="prefix-icon-slot"
|
144
|
+
name="prefix-icon"
|
145
|
+
@slotchange=${this.#onPrefixIconSlotChange}
|
146
|
+
${ref(this.#prefixIconSlotElementRef)}
|
147
|
+
>
|
148
|
+
<!--
|
149
|
+
An icon before the label
|
150
|
+
@type {Element}
|
151
|
+
-->
|
152
|
+
</slot>
|
153
|
+
|
154
|
+
<span class="label">${this.label}</span>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<slot
|
158
|
+
class=${classMap({
|
159
|
+
'suffix-icons-slot': true,
|
160
|
+
icons: this.hasSuffixIcons,
|
161
|
+
})}
|
162
|
+
name="suffix-icons"
|
163
|
+
@slotchange=${this.#onSuffixIconsSlotChange}
|
164
|
+
${ref(this.#suffixIconsSlotElementRef)}
|
165
|
+
>
|
166
|
+
<!--
|
167
|
+
Icons after the label
|
168
|
+
@type {Element}
|
169
|
+
-->
|
170
|
+
</slot>
|
171
|
+
</summary>
|
172
|
+
|
173
|
+
<slot
|
174
|
+
class=${classMap({
|
175
|
+
'default-slot': true,
|
176
|
+
indented: this.hasPrefixIcon,
|
177
|
+
})}
|
178
|
+
data-test="default-slot"
|
179
|
+
style=${styleMap({
|
180
|
+
'--private-close-duration': 'var(--glide-core-duration-fast-02)',
|
181
|
+
'--private-easing': 'var(--glide-core-animation-swoop)',
|
182
|
+
'--private-open-duration': 'var(--glide-core-duration-slow-01)',
|
183
|
+
})}
|
184
|
+
${assertSlot()}
|
185
|
+
${ref(this.#defaultSlotElementRef)}
|
186
|
+
>
|
187
|
+
<!--
|
188
|
+
The content of the accordion
|
189
|
+
|
190
|
+
@required
|
191
|
+
@type {Element | string}
|
192
|
+
-->
|
193
|
+
</slot>
|
194
|
+
</details>`;
|
195
|
+
}
|
196
|
+
#defaultSlotElementRef;
|
197
|
+
#detailsElementRef;
|
198
|
+
#isOpen;
|
199
|
+
#prefixIconSlotElementRef;
|
200
|
+
#suffixIconsSlotElementRef;
|
201
|
+
#summaryElementRef;
|
202
|
+
#onPrefixIconSlotChange() {
|
203
|
+
const assignedNodes = this.#prefixIconSlotElementRef.value?.assignedNodes();
|
204
|
+
this.hasPrefixIcon = Boolean(assignedNodes && assignedNodes.length > 0);
|
205
|
+
}
|
206
|
+
#onSuffixIconsSlotChange() {
|
207
|
+
const assignedNodes = this.#suffixIconsSlotElementRef.value?.assignedNodes();
|
208
|
+
this.hasSuffixIcons = Boolean(assignedNodes && assignedNodes.length > 0);
|
209
|
+
}
|
210
|
+
#onSummaryClick(event) {
|
211
|
+
// Canceling it prevents `details` from immediately showing and hiding
|
212
|
+
// the default slot on open and close, letting us animate it when we're ready.
|
213
|
+
event.preventDefault();
|
214
|
+
this.open = !this.open;
|
215
|
+
}
|
216
|
+
};
|
217
|
+
__decorate([
|
218
|
+
property({ reflect: true }),
|
219
|
+
required
|
220
|
+
], Accordion.prototype, "label", void 0);
|
221
|
+
__decorate([
|
222
|
+
property({ reflect: true, type: Boolean })
|
223
|
+
], Accordion.prototype, "open", null);
|
224
|
+
__decorate([
|
225
|
+
property({ reflect: true })
|
226
|
+
], Accordion.prototype, "version", void 0);
|
227
|
+
__decorate([
|
228
|
+
state()
|
229
|
+
], Accordion.prototype, "hasPrefixIcon", void 0);
|
230
|
+
__decorate([
|
231
|
+
state()
|
232
|
+
], Accordion.prototype, "hasSuffixIcons", void 0);
|
233
|
+
__decorate([
|
234
|
+
state()
|
235
|
+
], Accordion.prototype, "isClosing", void 0);
|
236
|
+
Accordion = __decorate([
|
237
|
+
customElement('glide-core-accordion'),
|
238
|
+
final
|
239
|
+
], Accordion);
|
240
|
+
export default Accordion;
|
package/dist/accordion.styles.js
CHANGED
@@ -1,17 +1,21 @@
|
|
1
|
-
import{css}from
|
2
|
-
|
3
|
-
|
1
|
+
import { css } from 'lit';
|
2
|
+
import focusOutline from './styles/focus-outline.js';
|
3
|
+
export default [
|
4
|
+
css `
|
5
|
+
${focusOutline('.summary:focus-visible')}
|
6
|
+
`,
|
7
|
+
css `
|
4
8
|
.component {
|
5
9
|
border: 1px solid
|
6
10
|
var(--glide-core-color-static-surface-container-secondary);
|
7
|
-
border-radius: var(--glide-core-rounding-base-radius-
|
11
|
+
border-radius: var(--glide-core-rounding-base-radius-md);
|
8
12
|
box-shadow: var(--glide-core-effect-lifted);
|
9
13
|
font-family: var(--glide-core-typography-family-primary);
|
10
14
|
}
|
11
15
|
|
12
16
|
.summary {
|
13
17
|
align-items: center;
|
14
|
-
border-radius: var(--glide-core-rounding-base-radius-
|
18
|
+
border-radius: var(--glide-core-rounding-base-radius-md);
|
15
19
|
color: var(--glide-core-color-static-text-default);
|
16
20
|
cursor: pointer;
|
17
21
|
display: flex;
|
@@ -50,7 +54,8 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
50
54
|
rotate: -90deg;
|
51
55
|
|
52
56
|
@media (prefers-reduced-motion: no-preference) {
|
53
|
-
transition:
|
57
|
+
transition: var(--glide-core-duration-slow-01) rotate
|
58
|
+
var(--glide-core-animation-swoop);
|
54
59
|
}
|
55
60
|
}
|
56
61
|
}
|
@@ -99,4 +104,5 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
99
104
|
display: flex;
|
100
105
|
}
|
101
106
|
}
|
102
|
-
|
107
|
+
`,
|
108
|
+
];
|
@@ -1 +1,143 @@
|
|
1
|
-
var __decorate
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { html, LitElement } from 'lit';
|
8
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
10
|
+
import { classMap } from 'lit/directives/class-map.js';
|
11
|
+
import packageJson from '../package.json' with { type: 'json' };
|
12
|
+
import styles from './button-group.button.styles.js';
|
13
|
+
import assertSlot from './library/assert-slot.js';
|
14
|
+
import shadowRootMode from './library/shadow-root-mode.js';
|
15
|
+
import final from './library/final.js';
|
16
|
+
import required from './library/required.js';
|
17
|
+
/**
|
18
|
+
* @attr {string} label
|
19
|
+
* @attr {boolean} [disabled=false]
|
20
|
+
* @attr {boolean} [selected=false]
|
21
|
+
* @attr {string} [value='']
|
22
|
+
*
|
23
|
+
* @readonly
|
24
|
+
* @attr {string} [version]
|
25
|
+
*
|
26
|
+
* @slot {Element} [icon]
|
27
|
+
*
|
28
|
+
* @fires {Event} selected
|
29
|
+
*/
|
30
|
+
let ButtonGroupButton = class ButtonGroupButton extends LitElement {
|
31
|
+
constructor() {
|
32
|
+
super(...arguments);
|
33
|
+
this.disabled = false;
|
34
|
+
// `value` is used by consumers to identify selections based on something other
|
35
|
+
// than the label.
|
36
|
+
this.value = '';
|
37
|
+
// Private because it's only meant to be used by Button Group.
|
38
|
+
this.privateOrientation = 'horizontal';
|
39
|
+
this.version = packageJson.version;
|
40
|
+
this.hasIcon = false;
|
41
|
+
this.#componentElementRef = createRef();
|
42
|
+
this.#iconSlotElementRef = createRef();
|
43
|
+
this.#isSelected = false;
|
44
|
+
}
|
45
|
+
static { this.shadowRootOptions = {
|
46
|
+
...LitElement.shadowRootOptions,
|
47
|
+
mode: shadowRootMode,
|
48
|
+
}; }
|
49
|
+
static { this.styles = styles; }
|
50
|
+
/**
|
51
|
+
* @default false
|
52
|
+
*/
|
53
|
+
get selected() {
|
54
|
+
return this.#isSelected;
|
55
|
+
}
|
56
|
+
set selected(isSelected) {
|
57
|
+
this.#isSelected = isSelected;
|
58
|
+
this.dispatchEvent(new Event('private-selected', { bubbles: true }));
|
59
|
+
}
|
60
|
+
click() {
|
61
|
+
this.#componentElementRef.value?.click();
|
62
|
+
}
|
63
|
+
focus(options) {
|
64
|
+
this.#componentElementRef.value?.focus(options);
|
65
|
+
}
|
66
|
+
privateSelect() {
|
67
|
+
this.selected = true;
|
68
|
+
this.dispatchEvent(new Event('selected', { bubbles: true, composed: true }));
|
69
|
+
}
|
70
|
+
render() {
|
71
|
+
return html `<div
|
72
|
+
aria-checked=${this.selected}
|
73
|
+
aria-disabled=${this.disabled}
|
74
|
+
class=${classMap({
|
75
|
+
component: true,
|
76
|
+
selected: this.selected,
|
77
|
+
disabled: this.disabled,
|
78
|
+
[this.privateOrientation]: true,
|
79
|
+
icon: this.hasIcon,
|
80
|
+
'icon-only': this.privateVariant === 'icon-only',
|
81
|
+
})}
|
82
|
+
data-test="radio"
|
83
|
+
role="radio"
|
84
|
+
tabindex=${!this.selected || this.disabled ? -1 : 0}
|
85
|
+
${ref(this.#componentElementRef)}
|
86
|
+
>
|
87
|
+
<slot
|
88
|
+
name="icon"
|
89
|
+
@slotchange=${this.#onIconSlotChange}
|
90
|
+
${assertSlot(null, this.privateVariant !== 'icon-only')}
|
91
|
+
${ref(this.#iconSlotElementRef)}
|
92
|
+
>
|
93
|
+
<!-- @type {Element} -->
|
94
|
+
</slot>
|
95
|
+
|
96
|
+
<div
|
97
|
+
class=${classMap({
|
98
|
+
label: true,
|
99
|
+
'visually-hidden': this.privateVariant === 'icon-only',
|
100
|
+
})}
|
101
|
+
>
|
102
|
+
${this.label}
|
103
|
+
</div>
|
104
|
+
</div>`;
|
105
|
+
}
|
106
|
+
#componentElementRef;
|
107
|
+
#iconSlotElementRef;
|
108
|
+
#isSelected;
|
109
|
+
#onIconSlotChange() {
|
110
|
+
const assignedNodes = this.#iconSlotElementRef.value?.assignedNodes();
|
111
|
+
this.hasIcon = Boolean(assignedNodes && assignedNodes.length > 0);
|
112
|
+
}
|
113
|
+
};
|
114
|
+
__decorate([
|
115
|
+
property({ reflect: true }),
|
116
|
+
required
|
117
|
+
], ButtonGroupButton.prototype, "label", void 0);
|
118
|
+
__decorate([
|
119
|
+
property({ type: Boolean, reflect: true })
|
120
|
+
], ButtonGroupButton.prototype, "selected", null);
|
121
|
+
__decorate([
|
122
|
+
property({ type: Boolean, reflect: true })
|
123
|
+
], ButtonGroupButton.prototype, "disabled", void 0);
|
124
|
+
__decorate([
|
125
|
+
property({ reflect: true, useDefault: true })
|
126
|
+
], ButtonGroupButton.prototype, "value", void 0);
|
127
|
+
__decorate([
|
128
|
+
property()
|
129
|
+
], ButtonGroupButton.prototype, "privateOrientation", void 0);
|
130
|
+
__decorate([
|
131
|
+
property()
|
132
|
+
], ButtonGroupButton.prototype, "privateVariant", void 0);
|
133
|
+
__decorate([
|
134
|
+
property({ reflect: true })
|
135
|
+
], ButtonGroupButton.prototype, "version", void 0);
|
136
|
+
__decorate([
|
137
|
+
state()
|
138
|
+
], ButtonGroupButton.prototype, "hasIcon", void 0);
|
139
|
+
ButtonGroupButton = __decorate([
|
140
|
+
customElement('glide-core-button-group-button'),
|
141
|
+
final
|
142
|
+
], ButtonGroupButton);
|
143
|
+
export default ButtonGroupButton;
|
@@ -1,31 +1,58 @@
|
|
1
|
-
import{css}
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import { css } from 'lit';
|
2
|
+
import focusOutline from './styles/focus-outline.js';
|
3
|
+
import visuallyHidden from './styles/visually-hidden.js';
|
4
|
+
export default [
|
5
|
+
css `
|
6
|
+
${focusOutline('.component:focus-visible')}
|
7
|
+
${visuallyHidden('.label.visually-hidden')}
|
8
|
+
`,
|
9
|
+
css `
|
5
10
|
/*
|
6
11
|
Nesting within :host does not work as expected in Safari
|
7
12
|
https://bugs.webkit.org/show_bug.cgi?id=275341#c1
|
8
13
|
*/
|
9
14
|
:host(:first-of-type) .component.horizontal {
|
10
|
-
|
11
|
-
|
15
|
+
/*
|
16
|
+
Button Group Button's border radius needs to be slightly
|
17
|
+
smaller than the parent's border radius, otherwise the
|
18
|
+
Button won't appear to fill the Group when selected or
|
19
|
+
hovered.
|
20
|
+
*/
|
21
|
+
border-end-start-radius: calc(
|
22
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
23
|
+
);
|
24
|
+
border-start-start-radius: calc(
|
25
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
26
|
+
);
|
12
27
|
}
|
13
28
|
|
14
29
|
:host(:first-of-type) .component.vertical {
|
15
|
-
border-start-end-radius:
|
16
|
-
|
30
|
+
border-start-end-radius: calc(
|
31
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
32
|
+
);
|
33
|
+
border-start-start-radius: calc(
|
34
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
35
|
+
);
|
17
36
|
}
|
18
37
|
|
19
38
|
:host(:last-of-type) .component.horizontal {
|
20
|
-
border-end-end-radius:
|
39
|
+
border-end-end-radius: calc(
|
40
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
41
|
+
);
|
21
42
|
border-inline-end: none;
|
22
|
-
border-start-end-radius:
|
43
|
+
border-start-end-radius: calc(
|
44
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
45
|
+
);
|
23
46
|
}
|
24
47
|
|
25
48
|
:host(:last-of-type) .component.vertical {
|
26
49
|
border-block-end: none;
|
27
|
-
border-end-end-radius:
|
28
|
-
|
50
|
+
border-end-end-radius: calc(
|
51
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
52
|
+
);
|
53
|
+
border-end-start-radius: calc(
|
54
|
+
var(--glide-core-rounding-base-radius-sm) - 1px
|
55
|
+
);
|
29
56
|
}
|
30
57
|
|
31
58
|
.component {
|
@@ -45,9 +72,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
45
72
|
min-inline-size: 2.75rem;
|
46
73
|
padding-block: var(--glide-core-spacing-base-xs);
|
47
74
|
padding-inline: var(--glide-core-spacing-base-md);
|
48
|
-
transition-duration:
|
75
|
+
transition-duration: var(--glide-core-duration-moderate-02);
|
49
76
|
transition-property: color, background-color, fill, stroke;
|
50
|
-
transition-timing-function:
|
77
|
+
transition-timing-function: var(--glide-core-animation-swoop-in);
|
51
78
|
user-select: none;
|
52
79
|
white-space: nowrap;
|
53
80
|
|
@@ -121,4 +148,5 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
121
148
|
color: var(--glide-core-color-interactive-text-link);
|
122
149
|
}
|
123
150
|
}
|
124
|
-
|
151
|
+
`,
|
152
|
+
];
|