@sankhyatronics/sankhya-cms 0.0.0-stage → 0.1.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/README.md +34 -3
- package/custom-elements.json +4008 -0
- package/dist/bento-grid/index.d.ts +27 -0
- package/dist/bento-grid/index.js +10 -0
- package/dist/bento-grid/index.js.map +1 -0
- package/dist/card/index.d.ts +20 -0
- package/dist/card/index.js +9 -0
- package/dist/card/index.js.map +1 -0
- package/dist/carousel/index.d.ts +44 -0
- package/dist/carousel/index.js +10 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/chunk-23IHTBAB.js +557 -0
- package/dist/chunk-23IHTBAB.js.map +1 -0
- package/dist/chunk-2VZFHTBC.js +203 -0
- package/dist/chunk-2VZFHTBC.js.map +1 -0
- package/dist/chunk-3ERKQNZT.js +155 -0
- package/dist/chunk-3ERKQNZT.js.map +1 -0
- package/dist/chunk-3JU3R22O.js +193 -0
- package/dist/chunk-3JU3R22O.js.map +1 -0
- package/dist/chunk-3TCP25JG.js +347 -0
- package/dist/chunk-3TCP25JG.js.map +1 -0
- package/dist/chunk-3VE6VFJ4.js +87 -0
- package/dist/chunk-3VE6VFJ4.js.map +1 -0
- package/dist/chunk-4HKSA5UT.js +312 -0
- package/dist/chunk-4HKSA5UT.js.map +1 -0
- package/dist/chunk-5REZSZCK.js +266 -0
- package/dist/chunk-5REZSZCK.js.map +1 -0
- package/dist/chunk-5UFRGZWG.js +268 -0
- package/dist/chunk-5UFRGZWG.js.map +1 -0
- package/dist/chunk-74MILER4.js +215 -0
- package/dist/chunk-74MILER4.js.map +1 -0
- package/dist/chunk-7PSYCTEN.js +118 -0
- package/dist/chunk-7PSYCTEN.js.map +1 -0
- package/dist/chunk-CDC4P77V.js +299 -0
- package/dist/chunk-CDC4P77V.js.map +1 -0
- package/dist/chunk-E52WO7R7.js +279 -0
- package/dist/chunk-E52WO7R7.js.map +1 -0
- package/dist/chunk-EUXUH3YW.js +15 -0
- package/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/chunk-IMACP7HN.js +156 -0
- package/dist/chunk-IMACP7HN.js.map +1 -0
- package/dist/chunk-LHU23TF6.js +273 -0
- package/dist/chunk-LHU23TF6.js.map +1 -0
- package/dist/chunk-OEX5FDMR.js +250 -0
- package/dist/chunk-OEX5FDMR.js.map +1 -0
- package/dist/chunk-RHAOQ6K4.js +138 -0
- package/dist/chunk-RHAOQ6K4.js.map +1 -0
- package/dist/chunk-RMIJVTFS.js +397 -0
- package/dist/chunk-RMIJVTFS.js.map +1 -0
- package/dist/chunk-U7YKCCJG.js +228 -0
- package/dist/chunk-U7YKCCJG.js.map +1 -0
- package/dist/chunk-USNFT4DU.js +125 -0
- package/dist/chunk-USNFT4DU.js.map +1 -0
- package/dist/chunk-VYON56QO.js +90 -0
- package/dist/chunk-VYON56QO.js.map +1 -0
- package/dist/chunk-WCO7JAIK.js +195 -0
- package/dist/chunk-WCO7JAIK.js.map +1 -0
- package/dist/chunk-XHBC23TV.js +254 -0
- package/dist/chunk-XHBC23TV.js.map +1 -0
- package/dist/chunk-XXPBFHWR.js +70 -0
- package/dist/chunk-XXPBFHWR.js.map +1 -0
- package/dist/cms-theme.css +15 -0
- package/dist/content-block/index.d.ts +25 -0
- package/dist/content-block/index.js +11 -0
- package/dist/content-block/index.js.map +1 -0
- package/dist/cookie-consent/index.d.ts +33 -0
- package/dist/cookie-consent/index.js +9 -0
- package/dist/cookie-consent/index.js.map +1 -0
- package/dist/dropdown/index.d.ts +89 -0
- package/dist/dropdown/index.js +9 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/feature-split/index.d.ts +38 -0
- package/dist/feature-split/index.js +11 -0
- package/dist/feature-split/index.js.map +1 -0
- package/dist/features-section/index.d.ts +50 -0
- package/dist/features-section/index.js +14 -0
- package/dist/features-section/index.js.map +1 -0
- package/dist/footer/index.d.ts +64 -0
- package/dist/footer/index.js +9 -0
- package/dist/footer/index.js.map +1 -0
- package/dist/header/index.d.ts +112 -0
- package/dist/header/index.js +10 -0
- package/dist/header/index.js.map +1 -0
- package/dist/hero/index.d.ts +32 -0
- package/dist/hero/index.js +10 -0
- package/dist/hero/index.js.map +1 -0
- package/dist/icon-button/index.d.ts +23 -0
- package/dist/icon-button/index.js +9 -0
- package/dist/icon-button/index.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/items-accordion/index.d.ts +31 -0
- package/dist/items-accordion/index.js +10 -0
- package/dist/items-accordion/index.js.map +1 -0
- package/dist/markdown/index.d.ts +33 -0
- package/dist/markdown/index.js +9 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/menu-grid/index.d.ts +21 -0
- package/dist/menu-grid/index.js +9 -0
- package/dist/menu-grid/index.js.map +1 -0
- package/dist/menu-grid-item/index.d.ts +53 -0
- package/dist/menu-grid-item/index.js +9 -0
- package/dist/menu-grid-item/index.js.map +1 -0
- package/dist/menu-item/index.d.ts +50 -0
- package/dist/menu-item/index.js +9 -0
- package/dist/menu-item/index.js.map +1 -0
- package/dist/promo-banner/index.d.ts +22 -0
- package/dist/promo-banner/index.js +10 -0
- package/dist/promo-banner/index.js.map +1 -0
- package/dist/schema/index.d.ts +72 -0
- package/dist/schema/index.js +75 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/select/index.d.ts +77 -0
- package/dist/select/index.js +10 -0
- package/dist/select/index.js.map +1 -0
- package/dist/shared/icons.d.ts +77 -0
- package/dist/shared/icons.js +64 -0
- package/dist/shared/icons.js.map +1 -0
- package/dist/shared/styles.d.ts +90 -0
- package/dist/shared/styles.js +48 -0
- package/dist/shared/styles.js.map +1 -0
- package/dist/stats/index.d.ts +17 -0
- package/dist/stats/index.js +9 -0
- package/dist/stats/index.js.map +1 -0
- package/dist/testimonials/index.d.ts +25 -0
- package/dist/testimonials/index.js +10 -0
- package/dist/testimonials/index.js.map +1 -0
- package/dist/theme.css +292 -0
- package/dist/themes.css +65 -0
- package/dist/theming/index.d.ts +28 -0
- package/dist/theming/index.js +53 -0
- package/dist/theming/index.js.map +1 -0
- package/package.json +161 -4
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chevronIcon,
|
|
3
|
+
externalLinkIcon
|
|
4
|
+
} from "./chunk-3TCP25JG.js";
|
|
5
|
+
import {
|
|
6
|
+
controlBaseStyles,
|
|
7
|
+
eyebrowLabelStyles,
|
|
8
|
+
fontFamilyStyles
|
|
9
|
+
} from "./chunk-RHAOQ6K4.js";
|
|
10
|
+
import {
|
|
11
|
+
__decorateClass
|
|
12
|
+
} from "./chunk-EUXUH3YW.js";
|
|
13
|
+
|
|
14
|
+
// src/select/Select.ts
|
|
15
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
16
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
17
|
+
var instanceCounter = 0;
|
|
18
|
+
var Select = class extends LitElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.options = [];
|
|
22
|
+
this.value = "";
|
|
23
|
+
this.placeholder = "Select\u2026";
|
|
24
|
+
this.fieldLabel = "";
|
|
25
|
+
this.linkHref = "";
|
|
26
|
+
this.linkLabel = "Open";
|
|
27
|
+
this.selectLabel = "";
|
|
28
|
+
this.disabled = false;
|
|
29
|
+
this.ghost = false;
|
|
30
|
+
this.instanceId = ++instanceCounter;
|
|
31
|
+
this.fieldLabelId = `st-select-label-${this.instanceId}`;
|
|
32
|
+
this.onChange = (event) => {
|
|
33
|
+
const newValue = event.target.value;
|
|
34
|
+
if (newValue === this.value) return;
|
|
35
|
+
this.value = newValue;
|
|
36
|
+
this.dispatchEvent(new CustomEvent("select-change", { detail: { value: newValue }, bubbles: true, composed: true }));
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
updated(changed) {
|
|
40
|
+
if (changed.has("value") || changed.has("options")) {
|
|
41
|
+
const hasValue = this.options.some((option) => option.value === this.value);
|
|
42
|
+
const nextValue = hasValue ? this.value : "";
|
|
43
|
+
if (this.selectEl.value !== nextValue) this.selectEl.value = nextValue;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
const hasValue = this.options.some((option) => option.value === this.value);
|
|
48
|
+
return html`
|
|
49
|
+
${this.fieldLabel ? html`
|
|
50
|
+
<span class="field-label-row">
|
|
51
|
+
${this.linkHref ? html`
|
|
52
|
+
<a
|
|
53
|
+
part="field-label-link"
|
|
54
|
+
class="field-label-link"
|
|
55
|
+
href=${this.linkHref}
|
|
56
|
+
target="_blank"
|
|
57
|
+
rel="noopener noreferrer"
|
|
58
|
+
title=${this.linkLabel}
|
|
59
|
+
aria-label=${this.linkLabel}
|
|
60
|
+
>
|
|
61
|
+
${externalLinkIcon(11)}
|
|
62
|
+
</a>
|
|
63
|
+
` : nothing}
|
|
64
|
+
<span part="field-label" id=${this.fieldLabelId} class="field-label">${this.fieldLabel}</span>
|
|
65
|
+
</span>
|
|
66
|
+
` : nothing}
|
|
67
|
+
<select
|
|
68
|
+
part="select"
|
|
69
|
+
aria-label=${!this.fieldLabel && this.selectLabel ? this.selectLabel : nothing}
|
|
70
|
+
aria-labelledby=${this.fieldLabel ? this.fieldLabelId : nothing}
|
|
71
|
+
?disabled=${this.disabled}
|
|
72
|
+
@change=${this.onChange}
|
|
73
|
+
>
|
|
74
|
+
<button part="trigger" class="trigger" type="button">
|
|
75
|
+
<selectedcontent></selectedcontent>
|
|
76
|
+
<span class="caret">${chevronIcon("down", 10)}</span>
|
|
77
|
+
</button>
|
|
78
|
+
<option value="" ?selected=${!hasValue} disabled hidden>${this.placeholder}</option>
|
|
79
|
+
${this.options.map(
|
|
80
|
+
(option) => html`<option part="option" value=${option.value} ?selected=${option.value === this.value}>${option.label}</option>`
|
|
81
|
+
)}
|
|
82
|
+
</select>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
Select.styles = css`
|
|
87
|
+
${controlBaseStyles}
|
|
88
|
+
|
|
89
|
+
:host {
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
gap: var(--st-space-4);
|
|
93
|
+
min-width: 0;
|
|
94
|
+
${fontFamilyStyles}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.field-label-row {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: var(--st-space-6);
|
|
101
|
+
min-width: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.field-label {
|
|
105
|
+
font-size: var(--st-text-xs);
|
|
106
|
+
${eyebrowLabelStyles}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.field-label-link {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
flex: none;
|
|
114
|
+
color: var(--st-color-text-faint);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.field-label-link:hover {
|
|
118
|
+
color: var(--st-color-text-strong);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
select {
|
|
122
|
+
appearance: base-select;
|
|
123
|
+
width: 100%;
|
|
124
|
+
min-width: 0;
|
|
125
|
+
border: 0;
|
|
126
|
+
padding: 0;
|
|
127
|
+
background: transparent;
|
|
128
|
+
font: inherit;
|
|
129
|
+
color: inherit;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
select::picker(select) {
|
|
133
|
+
appearance: base-select;
|
|
134
|
+
margin-top: var(--st-space-4);
|
|
135
|
+
background: var(--st-color-surface);
|
|
136
|
+
border: 1px solid var(--st-color-border);
|
|
137
|
+
border-radius: var(--st-radius-sm);
|
|
138
|
+
box-shadow: 0 4px 16px var(--st-shadow-color-sm);
|
|
139
|
+
padding: var(--st-space-4) 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.trigger {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: space-between;
|
|
146
|
+
gap: var(--st-space-8);
|
|
147
|
+
width: 100%;
|
|
148
|
+
padding: var(--st-space-8) var(--st-space-10);
|
|
149
|
+
border-radius: var(--st-radius-sm);
|
|
150
|
+
border: 1px solid var(--st-color-border);
|
|
151
|
+
background: var(--st-color-surface);
|
|
152
|
+
color: var(--st-color-text-strong);
|
|
153
|
+
font: inherit;
|
|
154
|
+
font-size: var(--st-text-base);
|
|
155
|
+
box-sizing: border-box;
|
|
156
|
+
text-align: left;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.trigger:hover,
|
|
161
|
+
.trigger:focus-visible {
|
|
162
|
+
background: var(--st-color-hover);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Borderless variant for a header/toolbar utility slot, so it reads as the same kind of
|
|
166
|
+
* hover-only control as st-icon-button and st-header's own language trigger (same fixed
|
|
167
|
+
* height, no permanent visible border) instead of a form-field box. */
|
|
168
|
+
:host([ghost]) .trigger {
|
|
169
|
+
height: var(--st-size-32);
|
|
170
|
+
padding: 0 var(--st-space-8);
|
|
171
|
+
border: none;
|
|
172
|
+
background: transparent;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host([ghost]) .trigger:hover,
|
|
176
|
+
:host([ghost]) .trigger:focus-visible {
|
|
177
|
+
background: var(--st-color-hover);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
select:disabled .trigger {
|
|
181
|
+
color: var(--st-color-text-muted);
|
|
182
|
+
cursor: not-allowed;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
selectedcontent {
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
text-overflow: ellipsis;
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
select:has(option[value='']:checked) selectedcontent {
|
|
192
|
+
color: var(--st-color-text-muted);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
select::picker-icon {
|
|
196
|
+
display: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.caret {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex: none;
|
|
202
|
+
color: var(--st-color-text-muted);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
option {
|
|
206
|
+
display: block;
|
|
207
|
+
padding: var(--st-space-8) var(--st-space-10);
|
|
208
|
+
font-size: var(--st-text-base);
|
|
209
|
+
color: var(--st-color-text);
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
option[hidden] {
|
|
214
|
+
display: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
option:hover,
|
|
218
|
+
option:focus {
|
|
219
|
+
background: var(--st-color-hover);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
option:checked {
|
|
223
|
+
color: var(--st-color-text-strong);
|
|
224
|
+
font-weight: var(--st-font-weight-semibold);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
option::checkmark {
|
|
228
|
+
display: none;
|
|
229
|
+
}
|
|
230
|
+
`;
|
|
231
|
+
__decorateClass([
|
|
232
|
+
property({ attribute: false })
|
|
233
|
+
], Select.prototype, "options", 2);
|
|
234
|
+
__decorateClass([
|
|
235
|
+
property({ type: String })
|
|
236
|
+
], Select.prototype, "value", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
property({ type: String })
|
|
239
|
+
], Select.prototype, "placeholder", 2);
|
|
240
|
+
__decorateClass([
|
|
241
|
+
property({ type: String, attribute: "field-label" })
|
|
242
|
+
], Select.prototype, "fieldLabel", 2);
|
|
243
|
+
__decorateClass([
|
|
244
|
+
property({ type: String, attribute: "link-href" })
|
|
245
|
+
], Select.prototype, "linkHref", 2);
|
|
246
|
+
__decorateClass([
|
|
247
|
+
property({ type: String, attribute: "link-label" })
|
|
248
|
+
], Select.prototype, "linkLabel", 2);
|
|
249
|
+
__decorateClass([
|
|
250
|
+
property({ type: String, attribute: "select-label" })
|
|
251
|
+
], Select.prototype, "selectLabel", 2);
|
|
252
|
+
__decorateClass([
|
|
253
|
+
property({ type: Boolean, reflect: true })
|
|
254
|
+
], Select.prototype, "disabled", 2);
|
|
255
|
+
__decorateClass([
|
|
256
|
+
property({ type: Boolean, reflect: true })
|
|
257
|
+
], Select.prototype, "ghost", 2);
|
|
258
|
+
__decorateClass([
|
|
259
|
+
query("select")
|
|
260
|
+
], Select.prototype, "selectEl", 2);
|
|
261
|
+
Select = __decorateClass([
|
|
262
|
+
customElement("st-select")
|
|
263
|
+
], Select);
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
Select
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=chunk-5UFRGZWG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/select/Select.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\r\nimport type { PropertyValues } from 'lit';\r\nimport { customElement, property, query } from 'lit/decorators.js';\r\n\r\nimport { chevronIcon, externalLinkIcon } from '../shared/icons';\r\nimport { controlBaseStyles, eyebrowLabelStyles, fontFamilyStyles } from '../shared/styles';\r\nimport type { SelectOption } from './SelectEvents';\r\nimport type { SelectChangedEventDetail } from './SelectEvents';\r\n\r\nlet instanceCounter = 0;\r\n\r\n/**\r\n * A fully custom-styled replacement for native `<select>`, used everywhere\r\n * the wizard needs a single-choice dropdown (template source, list, document\r\n * library, admin roles, ...).\r\n *\r\n * Built on the CSS Customizable Select API (`appearance: base-select`) —\r\n * still a real `<select>`/`<option>` element tree, so focus, keyboard\r\n * (arrows/Home/End/typeahead), and ARIA all come from the browser for free,\r\n * but the trigger (`<button>`/`<selectedcontent>`) and popup\r\n * (`::picker(select)`) are fully styleable instead of OS-rendered. Chromium\r\n * only for now (Firefox/Safari fall back to an unstyled native `<select>` —\r\n * the extra `<button>`/`<selectedcontent>` markup is simply not rendered by\r\n * browsers that don't support the parsing/CSS additions, so the control\r\n * still works there, just without the custom look).\r\n *\r\n * `options` intentionally has no \"unselected\" placeholder entry — set\r\n * `value=\"\"` (or any value with no matching option) and it falls back to\r\n * showing `placeholder` in the trigger instead, letting callers swap the\r\n * placeholder text dynamically (e.g. \"Select a list\" vs \"Select a list\r\n * first\") without needing a synthetic option in the list. Internally this is\r\n * a real hidden/disabled `<option value=\"\">`, since a native `<select>`\r\n * always has *some* option selected.\r\n *\r\n * Fires `select-change` (detail: `{ value }`) only when the value actually\r\n * changes, matching native `<select>`'s `change` event semantics.\r\n *\r\n * `link-href` optionally renders an external-link button in front of\r\n * `field-label` — the same glyph/placement as the \"open library\" links\r\n * placed next to the Templates/Save-location breadcrumbs — for callers that\r\n * want a one-click way to open whatever the current selection points at\r\n * (e.g. the SharePoint site or library) in a new tab.\r\n */\r\n@customElement('st-select')\r\nexport class Select extends LitElement {\r\n static styles = css`\r\n ${controlBaseStyles}\r\n\r\n :host {\r\n display: inline-flex;\r\n flex-direction: column;\r\n gap: var(--st-space-4);\r\n min-width: 0;\r\n ${fontFamilyStyles}\r\n }\r\n\r\n .field-label-row {\r\n display: flex;\r\n align-items: center;\r\n gap: var(--st-space-6);\r\n min-width: 0;\r\n }\r\n\r\n .field-label {\r\n font-size: var(--st-text-xs);\r\n ${eyebrowLabelStyles}\r\n }\r\n\r\n .field-label-link {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex: none;\r\n color: var(--st-color-text-faint);\r\n }\r\n\r\n .field-label-link:hover {\r\n color: var(--st-color-text-strong);\r\n }\r\n\r\n select {\r\n appearance: base-select;\r\n width: 100%;\r\n min-width: 0;\r\n border: 0;\r\n padding: 0;\r\n background: transparent;\r\n font: inherit;\r\n color: inherit;\r\n }\r\n\r\n select::picker(select) {\r\n appearance: base-select;\r\n margin-top: var(--st-space-4);\r\n background: var(--st-color-surface);\r\n border: 1px solid var(--st-color-border);\r\n border-radius: var(--st-radius-sm);\r\n box-shadow: 0 4px 16px var(--st-shadow-color-sm);\r\n padding: var(--st-space-4) 0;\r\n }\r\n\r\n .trigger {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n gap: var(--st-space-8);\r\n width: 100%;\r\n padding: var(--st-space-8) var(--st-space-10);\r\n border-radius: var(--st-radius-sm);\r\n border: 1px solid var(--st-color-border);\r\n background: var(--st-color-surface);\r\n color: var(--st-color-text-strong);\r\n font: inherit;\r\n font-size: var(--st-text-base);\r\n box-sizing: border-box;\r\n text-align: left;\r\n cursor: pointer;\r\n }\r\n\r\n .trigger:hover,\r\n .trigger:focus-visible {\r\n background: var(--st-color-hover);\r\n }\r\n\r\n /* Borderless variant for a header/toolbar utility slot, so it reads as the same kind of\r\n * hover-only control as st-icon-button and st-header's own language trigger (same fixed\r\n * height, no permanent visible border) instead of a form-field box. */\r\n :host([ghost]) .trigger {\r\n height: var(--st-size-32);\r\n padding: 0 var(--st-space-8);\r\n border: none;\r\n background: transparent;\r\n }\r\n\r\n :host([ghost]) .trigger:hover,\r\n :host([ghost]) .trigger:focus-visible {\r\n background: var(--st-color-hover);\r\n }\r\n\r\n select:disabled .trigger {\r\n color: var(--st-color-text-muted);\r\n cursor: not-allowed;\r\n }\r\n\r\n selectedcontent {\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n }\r\n\r\n select:has(option[value='']:checked) selectedcontent {\r\n color: var(--st-color-text-muted);\r\n }\r\n\r\n select::picker-icon {\r\n display: none;\r\n }\r\n\r\n .caret {\r\n display: flex;\r\n flex: none;\r\n color: var(--st-color-text-muted);\r\n }\r\n\r\n option {\r\n display: block;\r\n padding: var(--st-space-8) var(--st-space-10);\r\n font-size: var(--st-text-base);\r\n color: var(--st-color-text);\r\n cursor: pointer;\r\n }\r\n\r\n option[hidden] {\r\n display: none;\r\n }\r\n\r\n option:hover,\r\n option:focus {\r\n background: var(--st-color-hover);\r\n }\r\n\r\n option:checked {\r\n color: var(--st-color-text-strong);\r\n font-weight: var(--st-font-weight-semibold);\r\n }\r\n\r\n option::checkmark {\r\n display: none;\r\n }\r\n `;\r\n\r\n @property({ attribute: false })\r\n options: SelectOption[] = [];\r\n\r\n @property({ type: String })\r\n value = '';\r\n\r\n @property({ type: String })\r\n placeholder = 'Select…';\r\n\r\n /** Renders an internal `<label>` above the trigger, associated via `aria-labelledby`. Leave empty when the field is labeled some other way (e.g. context alone). */\r\n @property({ type: String, attribute: 'field-label' })\r\n fieldLabel = '';\r\n\r\n /**\r\n * Optional URL for an external-link button rendered in front of\r\n * `field-label` (same glyph/placement as the \"open library\" links next to\r\n * the Templates/Save-location breadcrumbs) — e.g. a link to the\r\n * SharePoint site or library the current selection points at. Ignored\r\n * when `field-label` is empty, since there'd be nothing to place it in\r\n * front of.\r\n */\r\n @property({ type: String, attribute: 'link-href' })\r\n linkHref = '';\r\n\r\n /** Accessible name/title for the `link-href` button. */\r\n @property({ type: String, attribute: 'link-label' })\r\n linkLabel = 'Open';\r\n\r\n /** Accessible name for the trigger when there's no visible `field-label` (e.g. a filter-row select). Ignored when `field-label` is set. */\r\n @property({ type: String, attribute: 'select-label' })\r\n selectLabel = '';\r\n\r\n @property({ type: Boolean, reflect: true })\r\n disabled = false;\r\n\r\n /** Borderless variant for a header/toolbar utility slot — see the `:host([ghost])` styles. */\r\n @property({ type: Boolean, reflect: true })\r\n ghost = false;\r\n\r\n @query('select')\r\n private readonly selectEl!: HTMLSelectElement;\r\n\r\n private readonly instanceId = ++instanceCounter;\r\n private readonly fieldLabelId = `st-select-label-${this.instanceId}`;\r\n\r\n protected updated(changed: PropertyValues): void {\r\n if (changed.has('value') || changed.has('options')) {\r\n const hasValue = this.options.some((option) => option.value === this.value);\r\n const nextValue = hasValue ? this.value : '';\r\n if (this.selectEl.value !== nextValue) this.selectEl.value = nextValue;\r\n }\r\n }\r\n\r\n render() {\r\n const hasValue = this.options.some((option) => option.value === this.value);\r\n\r\n return html`\r\n ${this.fieldLabel\r\n ? html`\r\n <span class=\"field-label-row\">\r\n ${this.linkHref\r\n ? html`\r\n <a\r\n part=\"field-label-link\"\r\n class=\"field-label-link\"\r\n href=${this.linkHref}\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n title=${this.linkLabel}\r\n aria-label=${this.linkLabel}\r\n >\r\n ${externalLinkIcon(11)}\r\n </a>\r\n `\r\n : nothing}\r\n <span part=\"field-label\" id=${this.fieldLabelId} class=\"field-label\">${this.fieldLabel}</span>\r\n </span>\r\n `\r\n : nothing}\r\n <select\r\n part=\"select\"\r\n aria-label=${!this.fieldLabel && this.selectLabel ? this.selectLabel : nothing}\r\n aria-labelledby=${this.fieldLabel ? this.fieldLabelId : nothing}\r\n ?disabled=${this.disabled}\r\n @change=${this.onChange}\r\n >\r\n <button part=\"trigger\" class=\"trigger\" type=\"button\">\r\n <selectedcontent></selectedcontent>\r\n <span class=\"caret\">${chevronIcon('down', 10)}</span>\r\n </button>\r\n <option value=\"\" ?selected=${!hasValue} disabled hidden>${this.placeholder}</option>\r\n ${this.options.map(\r\n (option) => html`<option part=\"option\" value=${option.value} ?selected=${option.value === this.value}>${option.label}</option>`\r\n )}\r\n </select>\r\n `;\r\n }\r\n\r\n private onChange = (event: Event): void => {\r\n const newValue = (event.target as HTMLSelectElement).value;\r\n if (newValue === this.value) return;\r\n\r\n this.value = newValue;\r\n this.dispatchEvent(new CustomEvent<SelectChangedEventDetail>('select-change', { detail: { value: newValue }, bubbles: true, composed: true }));\r\n };\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAE/C,SAAS,eAAe,UAAU,aAAa;AAO/C,IAAI,kBAAkB;AAmCf,IAAM,SAAN,cAAqB,WAAW;AAAA,EAAhC;AAAA;AAoJL,mBAA0B,CAAC;AAG3B,iBAAQ;AAGR,uBAAc;AAId,sBAAa;AAWb,oBAAW;AAIX,qBAAY;AAIZ,uBAAc;AAGd,oBAAW;AAIX,iBAAQ;AAKR,SAAiB,aAAa,EAAE;AAChC,SAAiB,eAAe,mBAAmB,KAAK,UAAU;AAuDlE,SAAQ,WAAW,CAAC,UAAuB;AACzC,YAAM,W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AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GA7JzC,OA8JX;AAWA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,YAAY,CAAC;AAAA,GAxKvC,OAyKX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,aAAa,CAAC;AAAA,GA5KxC,OA6KX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,eAAe,CAAC;AAAA,GAhL1C,OAiLX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAnL/B,OAoLX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAvL/B,OAwLX;AAGiB;AAAA,EADhB,MAAM,QAAQ;AAAA,GA1LJ,OA2LM;AA3LN,SAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":[]}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {
|
|
2
|
+
reducedMotionStyles,
|
|
3
|
+
sectionHeaderStyles,
|
|
4
|
+
sectionSubtitleStyles,
|
|
5
|
+
sectionTitleStyles
|
|
6
|
+
} from "./chunk-3VE6VFJ4.js";
|
|
7
|
+
import {
|
|
8
|
+
buttonResetStyles,
|
|
9
|
+
controlBaseStyles,
|
|
10
|
+
fontFamilyStyles
|
|
11
|
+
} from "./chunk-RHAOQ6K4.js";
|
|
12
|
+
import {
|
|
13
|
+
__decorateClass
|
|
14
|
+
} from "./chunk-EUXUH3YW.js";
|
|
15
|
+
|
|
16
|
+
// src/items-accordion/ItemsAccordion.ts
|
|
17
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
18
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
19
|
+
import "iconify-icon";
|
|
20
|
+
var ItemsAccordion = class extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.title = "";
|
|
24
|
+
this.subtitle = "";
|
|
25
|
+
this.items = [];
|
|
26
|
+
this.allowMultiple = false;
|
|
27
|
+
this.openIds = /* @__PURE__ */ new Set();
|
|
28
|
+
}
|
|
29
|
+
toggle(id) {
|
|
30
|
+
const wasOpen = this.openIds.has(id);
|
|
31
|
+
const next = new Set(this.allowMultiple ? this.openIds : []);
|
|
32
|
+
if (wasOpen) next.delete(id);
|
|
33
|
+
else next.add(id);
|
|
34
|
+
this.openIds = next;
|
|
35
|
+
this.dispatchEvent(
|
|
36
|
+
new CustomEvent("accordion-toggle", {
|
|
37
|
+
detail: { id, open: !wasOpen },
|
|
38
|
+
bubbles: true,
|
|
39
|
+
composed: true
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return html`
|
|
45
|
+
<div class="container" part="container">
|
|
46
|
+
${this.title || this.subtitle ? html`<div class="header" part="header">
|
|
47
|
+
${this.title ? html`<h2 class="title" part="title">${this.title}</h2>` : nothing}
|
|
48
|
+
${this.subtitle ? html`<p class="subtitle" part="subtitle">${this.subtitle}</p>` : nothing}
|
|
49
|
+
</div>` : nothing}
|
|
50
|
+
<div class="list" part="list">
|
|
51
|
+
${this.items.map((item) => {
|
|
52
|
+
const open = this.openIds.has(item.id);
|
|
53
|
+
return html`
|
|
54
|
+
<div class="item ${open ? "open" : ""}" part="item">
|
|
55
|
+
<button
|
|
56
|
+
class="trigger"
|
|
57
|
+
part="trigger"
|
|
58
|
+
type="button"
|
|
59
|
+
aria-expanded=${open ? "true" : "false"}
|
|
60
|
+
aria-controls="content-${item.id}"
|
|
61
|
+
@click=${() => this.toggle(item.id)}
|
|
62
|
+
>
|
|
63
|
+
<span>${item.title}</span>
|
|
64
|
+
<iconify-icon class="chevron" icon="mdi:chevron-down"></iconify-icon>
|
|
65
|
+
</button>
|
|
66
|
+
<div class="content" id="content-${item.id}" part="content" role="region" ?inert=${!open}>
|
|
67
|
+
<div class="content-clip">
|
|
68
|
+
<div class="content-inner">${item.content}</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
`;
|
|
73
|
+
})}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
ItemsAccordion.styles = css`
|
|
80
|
+
${controlBaseStyles}
|
|
81
|
+
|
|
82
|
+
:host {
|
|
83
|
+
display: block;
|
|
84
|
+
padding: var(--st-cms-section-padding) var(--st-space-24);
|
|
85
|
+
background: var(--st-color-page);
|
|
86
|
+
${fontFamilyStyles}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.container {
|
|
90
|
+
max-width: 800px;
|
|
91
|
+
margin: 0 auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.header {
|
|
95
|
+
${sectionHeaderStyles}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.title {
|
|
99
|
+
${sectionTitleStyles}
|
|
100
|
+
font-size: var(--st-text-2xl);
|
|
101
|
+
margin-bottom: var(--st-space-12);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.subtitle {
|
|
105
|
+
${sectionSubtitleStyles}
|
|
106
|
+
font-size: var(--st-text-base);
|
|
107
|
+
margin: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.list {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
gap: var(--st-space-16);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.item {
|
|
117
|
+
border: 1px solid var(--st-color-border);
|
|
118
|
+
border-radius: var(--st-radius-lg);
|
|
119
|
+
background: var(--st-color-surface);
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
transition:
|
|
122
|
+
border-color 0.2s ease,
|
|
123
|
+
box-shadow 0.2s ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.item.open {
|
|
127
|
+
border-color: var(--st-color-border-strong);
|
|
128
|
+
box-shadow: 0 4px 6px -1px var(--st-shadow-color-sm);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.trigger {
|
|
132
|
+
${buttonResetStyles}
|
|
133
|
+
width: 100%;
|
|
134
|
+
display: flex;
|
|
135
|
+
justify-content: space-between;
|
|
136
|
+
align-items: center;
|
|
137
|
+
padding: var(--st-space-24);
|
|
138
|
+
text-align: left;
|
|
139
|
+
font-size: var(--st-text-lg);
|
|
140
|
+
font-weight: var(--st-font-weight-semibold);
|
|
141
|
+
color: var(--st-color-text-strong);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.trigger:hover {
|
|
145
|
+
background: var(--st-color-hover);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.chevron {
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
margin-left: var(--st-space-16);
|
|
151
|
+
font-size: 24px;
|
|
152
|
+
color: var(--st-color-text-faint);
|
|
153
|
+
transition: transform 0.3s ease;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.open .chevron {
|
|
157
|
+
transform: rotate(180deg);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.content {
|
|
161
|
+
display: grid;
|
|
162
|
+
grid-template-rows: 0fr;
|
|
163
|
+
transition: grid-template-rows 0.3s ease;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.open .content {
|
|
167
|
+
grid-template-rows: 1fr;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.content-clip {
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
min-height: 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.content-inner {
|
|
176
|
+
padding: 0 var(--st-space-24) var(--st-space-24);
|
|
177
|
+
color: var(--st-color-text);
|
|
178
|
+
line-height: 1.6;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@media (max-width: 768px) {
|
|
182
|
+
:host {
|
|
183
|
+
padding: var(--st-space-48) var(--st-space-20);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.title {
|
|
187
|
+
font-size: var(--st-text-xl);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
${reducedMotionStyles}
|
|
192
|
+
`;
|
|
193
|
+
__decorateClass([
|
|
194
|
+
property({ type: String })
|
|
195
|
+
], ItemsAccordion.prototype, "title", 2);
|
|
196
|
+
__decorateClass([
|
|
197
|
+
property({ type: String })
|
|
198
|
+
], ItemsAccordion.prototype, "subtitle", 2);
|
|
199
|
+
__decorateClass([
|
|
200
|
+
property({ attribute: false })
|
|
201
|
+
], ItemsAccordion.prototype, "items", 2);
|
|
202
|
+
__decorateClass([
|
|
203
|
+
property({ type: Boolean, attribute: "allow-multiple" })
|
|
204
|
+
], ItemsAccordion.prototype, "allowMultiple", 2);
|
|
205
|
+
__decorateClass([
|
|
206
|
+
state()
|
|
207
|
+
], ItemsAccordion.prototype, "openIds", 2);
|
|
208
|
+
ItemsAccordion = __decorateClass([
|
|
209
|
+
customElement("st-items-accordion")
|
|
210
|
+
], ItemsAccordion);
|
|
211
|
+
|
|
212
|
+
export {
|
|
213
|
+
ItemsAccordion
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=chunk-74MILER4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/items-accordion/ItemsAccordion.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\r\nimport { customElement, property, state } from 'lit/decorators.js';\r\nimport 'iconify-icon';\r\n\r\nimport { buttonResetStyles, controlBaseStyles, fontFamilyStyles } from '../shared/styles';\r\nimport {\r\n reducedMotionStyles,\r\n sectionHeaderStyles,\r\n sectionSubtitleStyles,\r\n sectionTitleStyles,\r\n} from '../shared/section-styles';\r\nimport type { AccordionToggleEventDetail } from './ItemsAccordionEvents';\r\n\r\nexport interface AccordionItem {\r\n id: string;\r\n title: string;\r\n content: string;\r\n}\r\n\r\n/** A vertical list of collapsible title/content rows; one open at a time unless `allow-multiple`. */\r\n@customElement('st-items-accordion')\r\nexport class ItemsAccordion extends LitElement {\r\n static styles = css`\r\n ${controlBaseStyles}\r\n\r\n :host {\r\n display: block;\r\n padding: var(--st-cms-section-padding) var(--st-space-24);\r\n background: var(--st-color-page);\r\n ${fontFamilyStyles}\r\n }\r\n\r\n .container {\r\n max-width: 800px;\r\n margin: 0 auto;\r\n }\r\n\r\n .header {\r\n ${sectionHeaderStyles}\r\n }\r\n\r\n .title {\r\n ${sectionTitleStyles}\r\n font-size: var(--st-text-2xl);\r\n margin-bottom: var(--st-space-12);\r\n }\r\n\r\n .subtitle {\r\n ${sectionSubtitleStyles}\r\n font-size: var(--st-text-base);\r\n margin: 0;\r\n }\r\n\r\n .list {\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--st-space-16);\r\n }\r\n\r\n .item {\r\n border: 1px solid var(--st-color-border);\r\n border-radius: var(--st-radius-lg);\r\n background: var(--st-color-surface);\r\n overflow: hidden;\r\n transition:\r\n border-color 0.2s ease,\r\n box-shadow 0.2s ease;\r\n }\r\n\r\n .item.open {\r\n border-color: var(--st-color-border-strong);\r\n box-shadow: 0 4px 6px -1px var(--st-shadow-color-sm);\r\n }\r\n\r\n .trigger {\r\n ${buttonResetStyles}\r\n width: 100%;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: var(--st-space-24);\r\n text-align: left;\r\n font-size: var(--st-text-lg);\r\n font-weight: var(--st-font-weight-semibold);\r\n color: var(--st-color-text-strong);\r\n }\r\n\r\n .trigger:hover {\r\n background: var(--st-color-hover);\r\n }\r\n\r\n .chevron {\r\n flex-shrink: 0;\r\n margin-left: var(--st-space-16);\r\n font-size: 24px;\r\n color: var(--st-color-text-faint);\r\n transition: transform 0.3s ease;\r\n }\r\n\r\n .open .chevron {\r\n transform: rotate(180deg);\r\n }\r\n\r\n .content {\r\n display: grid;\r\n grid-template-rows: 0fr;\r\n transition: grid-template-rows 0.3s ease;\r\n }\r\n\r\n .open .content {\r\n grid-template-rows: 1fr;\r\n }\r\n\r\n .content-clip {\r\n overflow: hidden;\r\n min-height: 0;\r\n }\r\n\r\n .content-inner {\r\n padding: 0 var(--st-space-24) var(--st-space-24);\r\n color: var(--st-color-text);\r\n line-height: 1.6;\r\n }\r\n\r\n @media (max-width: 768px) {\r\n :host {\r\n padding: var(--st-space-48) var(--st-space-20);\r\n }\r\n\r\n .title {\r\n font-size: var(--st-text-xl);\r\n }\r\n }\r\n\r\n ${reducedMotionStyles}\r\n `;\r\n\r\n @property({ type: String })\r\n title = '';\r\n\r\n @property({ type: String })\r\n subtitle = '';\r\n\r\n @property({ attribute: false })\r\n items: AccordionItem[] = [];\r\n\r\n @property({ type: Boolean, attribute: 'allow-multiple' })\r\n allowMultiple = false;\r\n\r\n @state() private openIds = new Set<string>();\r\n\r\n private toggle(id: string) {\r\n const wasOpen = this.openIds.has(id);\r\n const next = new Set(this.allowMultiple ? this.openIds : []);\r\n if (wasOpen) next.delete(id);\r\n else next.add(id);\r\n this.openIds = next;\r\n this.dispatchEvent(\r\n new CustomEvent<AccordionToggleEventDetail>('accordion-toggle', {\r\n detail: { id, open: !wasOpen },\r\n bubbles: true,\r\n composed: true,\r\n }),\r\n );\r\n }\r\n\r\n render() {\r\n return html`\r\n <div class=\"container\" part=\"container\">\r\n ${this.title || this.subtitle\r\n ? html`<div class=\"header\" part=\"header\">\r\n ${this.title ? html`<h2 class=\"title\" part=\"title\">${this.title}</h2>` : nothing}\r\n ${this.subtitle ? html`<p class=\"subtitle\" part=\"subtitle\">${this.subtitle}</p>` : nothing}\r\n </div>`\r\n : nothing}\r\n <div class=\"list\" part=\"list\">\r\n ${this.items.map((item) => {\r\n const open = this.openIds.has(item.id);\r\n return html`\r\n <div class=\"item ${open ? 'open' : ''}\" part=\"item\">\r\n <button\r\n class=\"trigger\"\r\n part=\"trigger\"\r\n type=\"button\"\r\n aria-expanded=${open ? 'true' : 'false'}\r\n aria-controls=\"content-${item.id}\"\r\n @click=${() => this.toggle(item.id)}\r\n >\r\n <span>${item.title}</span>\r\n <iconify-icon class=\"chevron\" icon=\"mdi:chevron-down\"></iconify-icon>\r\n </button>\r\n <div class=\"content\" id=\"content-${item.id}\" part=\"content\" role=\"region\" ?inert=${!open}>\r\n <div class=\"content-clip\">\r\n <div class=\"content-inner\">${item.content}</div>\r\n </div>\r\n </div>\r\n </div>\r\n `;\r\n })}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAC/C,SAAS,eAAe,UAAU,aAAa;AAC/C,OAAO;AAmBA,IAAM,iBAAN,cAA6B,WAAW;AAAA,EAAxC;AAAA;AAqHL,iBAAQ;AAGR,oBAAW;AAGX,iBAAyB,CAAC;AAG1B,yBAAgB;AAEP,SAAQ,UAAU,oBAAI,IAAY;AAAA;AAAA,EAEnC,OAAO,IAAY;AACzB,UAAM,UAAU,KAAK,QAAQ,IAAI,EAAE;AACnC,UAAM,OAAO,IAAI,IAAI,KAAK,gBAAgB,KAAK,UAAU,CAAC,CAAC;AAC3D,QAAI,QAAS,MAAK,OAAO,EAAE;AAAA,QACtB,MAAK,IAAI,EAAE;AAChB,SAAK,UAAU;AACf,SAAK;AAAA,MACH,IAAI,YAAwC,oBAAoB;AAAA,QAC9D,QAAQ,EAAE,IAAI,MAAM,CAAC,QAAQ;AAAA,QAC7B,SAAS;AAAA,QACT,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA;AAAA,UAED,KAAK,SAAS,KAAK,WACjB;AAAA,gBACI,KAAK,QAAQ,sCAAsC,KAAK,KAAK,UAAU,OAAO;AAAA,gBAC9E,KAAK,WAAW,2CAA2C,KAAK,QAAQ,SAAS,OAAO;AAAA,sBAE5F,OAAO;AAAA;AAAA,YAEP,KAAK,MAAM,IAAI,CAAC,SAAS;AACzB,YAAM,OAAO,KAAK,QAAQ,IAAI,KAAK,EAAE;AAC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AAA,GApHf,eAqHX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAvHf,eAwHX;AAGA;AAAA,EADC,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GA1HnB,eA2HX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,iBAAiB,CAAC;AAAA,GA7H7C,eA8HX;AAEiB;AAAA,EAAhB,MAAM;AAAA,GAhII,eAgIM;AAhIN,iBAAN;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB;","names":[]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cardShellStyles,
|
|
3
|
+
controlBaseStyles,
|
|
4
|
+
fontFamilyStyles
|
|
5
|
+
} from "./chunk-RHAOQ6K4.js";
|
|
6
|
+
import {
|
|
7
|
+
__decorateClass
|
|
8
|
+
} from "./chunk-EUXUH3YW.js";
|
|
9
|
+
|
|
10
|
+
// src/card/Card.ts
|
|
11
|
+
import { LitElement, css, html } from "lit";
|
|
12
|
+
import { customElement, property } from "lit/decorators.js";
|
|
13
|
+
var Card = class extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.variant = "default";
|
|
17
|
+
this.padding = "medium";
|
|
18
|
+
this.elevation = "sm";
|
|
19
|
+
this.hoverable = false;
|
|
20
|
+
this.inverted = false;
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return html`<div class="body" part="body"><slot></slot></div>`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
Card.styles = css`
|
|
27
|
+
${controlBaseStyles}
|
|
28
|
+
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
${fontFamilyStyles}
|
|
32
|
+
${cardShellStyles}
|
|
33
|
+
border-radius: var(--st-radius-lg);
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
position: relative;
|
|
36
|
+
transition:
|
|
37
|
+
transform 0.3s ease,
|
|
38
|
+
box-shadow 0.3s ease,
|
|
39
|
+
border-color 0.3s ease;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([variant='bordered']) {
|
|
43
|
+
border-color: var(--st-color-border-strong);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([elevation='sm']) {
|
|
47
|
+
box-shadow: 0 1px 2px var(--st-shadow-color-sm);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([elevation='md']) {
|
|
51
|
+
box-shadow: 0 4px 6px -1px var(--st-shadow-color-md);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host([elevation='lg']) {
|
|
55
|
+
box-shadow: 0 10px 15px -3px var(--st-shadow-color-lg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([hoverable]:hover) {
|
|
59
|
+
transform: translateY(-4px);
|
|
60
|
+
box-shadow: 0 20px 25px -5px var(--st-shadow-color-xl);
|
|
61
|
+
border-color: var(--st-color-border-strong);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([inverted]) {
|
|
65
|
+
background: var(--st-color-text-strong);
|
|
66
|
+
color: var(--st-color-on-solid);
|
|
67
|
+
border-color: var(--st-color-text-strong);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.body {
|
|
71
|
+
padding: var(--st-space-24);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:host([padding='none']) .body {
|
|
75
|
+
padding: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([padding='small']) .body {
|
|
79
|
+
padding: var(--st-space-16);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([padding='large']) .body {
|
|
83
|
+
padding: var(--st-space-32);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (prefers-reduced-motion: reduce) {
|
|
87
|
+
:host {
|
|
88
|
+
transition: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host([hoverable]:hover) {
|
|
92
|
+
transform: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
__decorateClass([
|
|
97
|
+
property({ type: String, reflect: true })
|
|
98
|
+
], Card.prototype, "variant", 2);
|
|
99
|
+
__decorateClass([
|
|
100
|
+
property({ type: String, reflect: true })
|
|
101
|
+
], Card.prototype, "padding", 2);
|
|
102
|
+
__decorateClass([
|
|
103
|
+
property({ type: String, reflect: true })
|
|
104
|
+
], Card.prototype, "elevation", 2);
|
|
105
|
+
__decorateClass([
|
|
106
|
+
property({ type: Boolean, reflect: true })
|
|
107
|
+
], Card.prototype, "hoverable", 2);
|
|
108
|
+
__decorateClass([
|
|
109
|
+
property({ type: Boolean, reflect: true })
|
|
110
|
+
], Card.prototype, "inverted", 2);
|
|
111
|
+
Card = __decorateClass([
|
|
112
|
+
customElement("st-card")
|
|
113
|
+
], Card);
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
Card
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=chunk-7PSYCTEN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/card/Card.ts"],"sourcesContent":["import { LitElement, css, html } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\n\r\nimport { controlBaseStyles, cardShellStyles, fontFamilyStyles } from '../shared/styles';\r\n\r\n/**\r\n * A surfaced container — content goes in the default slot. Ports `SankhyaUI`'s React `Card`\r\n * (`variant`, `padding`, `elevation`, `hoverable`, `inverted`); `onClick` is just a native `click`\r\n * listener on the element. `padding` takes `none | small | medium | large` (the source's\r\n * `sm|md|lg`, spelled like `paddingScaleStyles`); `elevation` takes `none | sm | md | lg`.\r\n */\r\n@customElement('st-card')\r\nexport class Card extends LitElement {\r\n static styles = css`\r\n ${controlBaseStyles}\r\n\r\n :host {\r\n display: block;\r\n ${fontFamilyStyles}\r\n ${cardShellStyles}\r\n border-radius: var(--st-radius-lg);\r\n overflow: hidden;\r\n position: relative;\r\n transition:\r\n transform 0.3s ease,\r\n box-shadow 0.3s ease,\r\n border-color 0.3s ease;\r\n }\r\n\r\n :host([variant='bordered']) {\r\n border-color: var(--st-color-border-strong);\r\n }\r\n\r\n :host([elevation='sm']) {\r\n box-shadow: 0 1px 2px var(--st-shadow-color-sm);\r\n }\r\n\r\n :host([elevation='md']) {\r\n box-shadow: 0 4px 6px -1px var(--st-shadow-color-md);\r\n }\r\n\r\n :host([elevation='lg']) {\r\n box-shadow: 0 10px 15px -3px var(--st-shadow-color-lg);\r\n }\r\n\r\n :host([hoverable]:hover) {\r\n transform: translateY(-4px);\r\n box-shadow: 0 20px 25px -5px var(--st-shadow-color-xl);\r\n border-color: var(--st-color-border-strong);\r\n }\r\n\r\n :host([inverted]) {\r\n background: var(--st-color-text-strong);\r\n color: var(--st-color-on-solid);\r\n border-color: var(--st-color-text-strong);\r\n }\r\n\r\n .body {\r\n padding: var(--st-space-24);\r\n }\r\n\r\n :host([padding='none']) .body {\r\n padding: 0;\r\n }\r\n\r\n :host([padding='small']) .body {\r\n padding: var(--st-space-16);\r\n }\r\n\r\n :host([padding='large']) .body {\r\n padding: var(--st-space-32);\r\n }\r\n\r\n @media (prefers-reduced-motion: reduce) {\r\n :host {\r\n transition: none;\r\n }\r\n\r\n :host([hoverable]:hover) {\r\n transform: none;\r\n }\r\n }\r\n `;\r\n\r\n @property({ type: String, reflect: true })\r\n variant: 'default' | 'bordered' = 'default';\r\n\r\n @property({ type: String, reflect: true })\r\n padding: 'none' | 'small' | 'medium' | 'large' = 'medium';\r\n\r\n @property({ type: String, reflect: true })\r\n elevation: 'none' | 'sm' | 'md' | 'lg' = 'sm';\r\n\r\n @property({ type: Boolean, reflect: true })\r\n hoverable = false;\r\n\r\n @property({ type: Boolean, reflect: true })\r\n inverted = false;\r\n\r\n render() {\r\n return html`<div class=\"body\" part=\"body\"><slot></slot></div>`;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;AAAA,SAAS,YAAY,KAAK,YAAY;AACtC,SAAS,eAAe,gBA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