@supersoniks/concorde 5.0.4 → 5.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/.agents/skills/concorde-component-docs/SKILL.md +194 -0
- package/.agents/skills/concorde-component-docs/template.md +45 -0
- package/.tmp-cem/custom-elements.json +13705 -0
- package/ai/cursor/rules/concorde-theme.mdc +1 -1
- package/ai/cursor/rules/concorde.mdc +1 -1
- package/ai/skills/concorde/SKILL.md +1 -1
- package/ai/skills/concorde-theme/SKILL.md +21 -10
- package/build-infos.json +1 -1
- package/concorde-3d.bundle.js +3960 -0
- package/concorde-3d.es.js +33433 -0
- package/concorde-core.bundle.js +507 -513
- package/concorde-core.es.js +4027 -3702
- package/concorde-hugging-face-infer.bundle.js +32 -0
- package/concorde-hugging-face-infer.es.js +2952 -0
- package/concorde-interactive.bundle.js +1157 -0
- package/concorde-interactive.es.js +10734 -0
- package/concorde-shader.bundle.js +116 -0
- package/concorde-shader.es.js +8353 -0
- package/concorde-webgpu.bundle.js +307 -0
- package/concorde-webgpu.es.js +8627 -0
- package/custom-elements-manifest.config.mjs +14 -0
- package/dist/concorde-core.bundle.js +507 -513
- package/dist/concorde-core.es.js +4027 -3702
- package/dist/docs-mock-api-sw.js +2 -0
- package/dist/docs-mock-api-sw.js.map +2 -2
- package/gitlab/job_tests.sh +0 -0
- package/index.html +4 -2
- package/package.json +42 -2
- package/public/docs-mock-api-sw.js +2 -0
- package/public/docs-mock-api-sw.js.map +2 -2
- package/scripts/generate-sdui-catalog.mjs +250 -0
- package/scripts/generate-sdui-catalog.spec.ts +91 -0
- package/scripts/pre-build.mjs +15 -0
- package/src/core/components/functional/if/if.ts +0 -0
- package/src/core/components/functional/sdui/SDUIDescriptorTransformer.ts +5 -5
- package/src/core/components/functional/sdui/__fixtures__/descriptors.ts +251 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui-action.spec.ts.snap +73 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui-incremental.spec.ts.snap +50 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui-partial.spec.ts.snap +50 -0
- package/src/core/components/functional/sdui/__snapshots__/sdui.regression.spec.ts.snap +461 -0
- package/src/core/components/functional/sdui/component-catalog.gaps.json +511 -0
- package/src/core/components/functional/sdui/component-catalog.json +3103 -0
- package/src/core/components/functional/sdui/component-catalog.spec.ts +23 -0
- package/src/core/components/functional/sdui/sdui-action.spec.ts +99 -0
- package/src/core/components/functional/sdui/sdui-dom-snapshot.ts +61 -0
- package/src/core/components/functional/sdui/sdui-extension-points.md +94 -0
- package/src/core/components/functional/sdui/sdui-incremental.spec.ts +137 -0
- package/src/core/components/functional/sdui/sdui-partial.spec.ts +83 -0
- package/src/core/components/functional/sdui/sdui-partial.ts +19 -0
- package/src/core/components/functional/sdui/sdui-safe.spec.ts +188 -0
- package/src/core/components/functional/sdui/sdui-safe.ts +100 -0
- package/src/core/components/functional/sdui/sdui.md +122 -0
- package/src/core/components/functional/sdui/sdui.regression.spec.ts +64 -0
- package/src/core/components/functional/sdui/sdui.ts +442 -34
- package/src/core/components/functional/sdui/types.ts +49 -0
- package/src/core/components/functional/value/value.ts +0 -0
- package/src/core/components/ui/_css/align.ts +1 -0
- package/src/core/components/ui/_css/type.ts +86 -8
- package/src/core/components/ui/_i18n/ui-aria-labels.ts +8 -0
- package/src/core/components/ui/alert/alert.md +21 -2
- package/src/core/components/ui/alert-messages/alert-messages.md +85 -0
- package/src/core/components/ui/badge/badge.md +19 -6
- package/src/core/components/ui/badge/badge.ts +8 -9
- package/src/core/components/ui/button/button.ts +5 -15
- package/src/core/components/ui/captcha/captcha.md +65 -6
- package/src/core/components/ui/card/card.md +73 -10
- package/src/core/components/ui/card/card.ts +24 -22
- package/src/core/components/ui/divider/divider.md +107 -13
- package/src/core/components/ui/divider/divider.ts +40 -33
- package/src/core/components/ui/form/fieldset/fieldset.md +175 -99
- package/src/core/components/ui/form/fieldset/fieldset.ts +15 -28
- package/src/core/components/ui/form/fieldset/legend.ts +13 -13
- package/src/core/components/ui/form/form-actions/form-actions.md +75 -52
- package/src/core/components/ui/form/form-actions/form-actions.ts +7 -5
- package/src/core/components/ui/form/form-layout/form-layout.md +109 -34
- package/src/core/components/ui/form/form-layout/form-layout.ts +27 -24
- package/src/core/components/ui/form/textarea/textarea.ts +4 -3
- package/src/core/components/ui/group/group.md +36 -36
- package/src/core/components/ui/group/group.ts +5 -10
- package/src/core/components/ui/icon/icon.md +132 -43
- package/src/core/components/ui/image/image.md +35 -3
- package/src/core/components/ui/link/link.md +43 -5
- package/src/core/components/ui/loader/loader.md +79 -22
- package/src/core/components/ui/loader/loader.ts +67 -27
- package/src/core/components/ui/loader/styles/fixed.ts +6 -11
- package/src/core/components/ui/menu/menu.md +133 -92
- package/src/core/components/ui/menu/menu.ts +53 -58
- package/src/core/components/ui/modal/modal.md +163 -47
- package/src/core/components/ui/modal/modal.ts +2 -4
- package/src/core/components/ui/pop/pop.md +217 -123
- package/src/core/components/ui/pop/pop.ts +0 -1
- package/src/core/components/ui/progress/progress.md +76 -30
- package/src/core/components/ui/progress/progress.ts +25 -56
- package/src/core/components/ui/table/table-caption.ts +2 -2
- package/src/core/components/ui/table/table-tbody.ts +3 -3
- package/src/core/components/ui/table/table-td.ts +23 -18
- package/src/core/components/ui/table/table-th.ts +8 -8
- package/src/core/components/ui/table/table-tr.ts +4 -4
- package/src/core/components/ui/table/table.md +147 -171
- package/src/core/components/ui/table/table.ts +20 -19
- package/src/core/components/ui/theme/theme-collection/auto.ts +15 -0
- package/src/core/components/ui/theme/theme-collection/core-variables.ts +8 -31
- package/src/core/components/ui/theme/theme-collection/dark.ts +1 -7
- package/src/core/components/ui/theme/theme-collection/light.ts +30 -26
- package/src/core/components/ui/theme/theme.md +122 -0
- package/src/core/components/ui/theme/theme.ts +30 -7
- package/src/core/components/ui/toast/toast-item.ts +6 -9
- package/src/core/components/ui/toast/toast.md +108 -58
- package/src/core/components/ui/toast/types.ts +1 -1
- package/src/core/components/ui/tooltip/tooltip.md +68 -26
- package/src/docs/_getting-started/start.md +1 -1
- package/src/docs/_getting-started/theming.md +223 -61
- package/src/docs/code.ts +125 -58
- package/src/docs/header/header.ts +62 -54
- package/src/docs/mock-api/router.ts +2 -0
- package/src/docs/navigation/navigation.ts +6 -3
- package/src/docs/search/docs-search.json +2504 -399
- package/src/docs/search/markdown-renderer.ts +6 -6
- package/src/docs/search/search.ts +4 -4
- package/src/docs/tailwind/css/tailwind.css +6 -5
- package/src/tsconfig.json +108 -0
- package/src/tsconfig.tsbuildinfo +1 -1
- package/tailwind.config.js +19 -0
|
@@ -1,44 +1,119 @@
|
|
|
1
|
-
# Form
|
|
1
|
+
# Form layout
|
|
2
|
+
|
|
3
|
+
**`sonic-form-layout`** arranges slotted form controls in a **responsive CSS grid** with consistent vertical spacing. Pair **`sonic-input`** · **`sonic-select`** and **`sonic-input-autocomplete`** fields side by side when the host is wider than **440px**; **textareas**, **toggles**, **dividers**, and **`sonic-form-actions`** span the full width. Wrap a **`form`** or **`sonic-fieldset`** body—no attributes are required.
|
|
4
|
+
|
|
5
|
+
## Basic example
|
|
6
|
+
|
|
7
|
+
Typical registration-style form: short fields flow in two columns on wide layouts; long or grouped blocks stay full width.
|
|
8
|
+
|
|
9
|
+
<sonic-code>
|
|
10
|
+
<template>
|
|
11
|
+
<form>
|
|
12
|
+
<sonic-form-layout>
|
|
13
|
+
<sonic-input autocomplete="family-name" label="Last name" name="last_name"></sonic-input>
|
|
14
|
+
<sonic-input autocomplete="given-name" label="First name" name="first_name"></sonic-input>
|
|
15
|
+
<sonic-select autocomplete="sex" label="Gender" name="gender">
|
|
16
|
+
<option value="" selected="selected">— Select —</option>
|
|
17
|
+
<option value="prefer-not">Prefer not to say</option>
|
|
18
|
+
<option value="male">Male</option>
|
|
19
|
+
<option value="female">Female</option>
|
|
20
|
+
</sonic-select>
|
|
21
|
+
<sonic-input autocomplete="bday" label="Date of birth" name="birth_date" type="date"></sonic-input>
|
|
22
|
+
<sonic-divider></sonic-divider>
|
|
23
|
+
<sonic-input autocomplete="email" label="Email" name="email" type="email"></sonic-input>
|
|
24
|
+
<sonic-input
|
|
25
|
+
autocomplete="email"
|
|
26
|
+
label="Confirm email"
|
|
27
|
+
name="email_confirmation"
|
|
28
|
+
type="email"
|
|
29
|
+
></sonic-input>
|
|
30
|
+
<sonic-input autocomplete="new-password" label="Password" name="password" type="password"></sonic-input>
|
|
31
|
+
<sonic-input
|
|
32
|
+
autocomplete="new-password"
|
|
33
|
+
label="Confirm password"
|
|
34
|
+
name="password_confirmation"
|
|
35
|
+
type="password"
|
|
36
|
+
></sonic-input>
|
|
37
|
+
<sonic-divider></sonic-divider>
|
|
38
|
+
<sonic-textarea label="Message" rows="5"></sonic-textarea>
|
|
39
|
+
<sonic-switch>Enable optional feature</sonic-switch>
|
|
40
|
+
<sonic-checkbox>Subscribe to newsletter</sonic-checkbox>
|
|
41
|
+
<sonic-checkbox>
|
|
42
|
+
I accept the
|
|
43
|
+
<sonic-link href="#" class="underline">terms and conditions</sonic-link>
|
|
44
|
+
</sonic-checkbox>
|
|
45
|
+
<sonic-form-actions>
|
|
46
|
+
<sonic-button type="success">Submit</sonic-button>
|
|
47
|
+
</sonic-form-actions>
|
|
48
|
+
</sonic-form-layout>
|
|
49
|
+
</form>
|
|
50
|
+
</template>
|
|
51
|
+
</sonic-code>
|
|
52
|
+
|
|
53
|
+
## Responsive columns
|
|
54
|
+
|
|
55
|
+
When the host **`offsetWidth`** is **greater than 440px**, the grid uses **two equal columns** with slightly larger gap (**1.75rem**). Below that breakpoint, fields stack in a **single column** (**1.5rem** gap).
|
|
56
|
+
|
|
57
|
+
If the slot contains **exactly one** direct **`sonic-input`**, **`sonic-select`**, or **`sonic-input-autocomplete`**, the layout stays **one column** even above the breakpoint so a lone field does not sit in half an empty row.
|
|
58
|
+
|
|
59
|
+
<sonic-code>
|
|
60
|
+
<template>
|
|
61
|
+
<div class="grid gap-8 md:grid-cols-2 mb-6">
|
|
62
|
+
<div>
|
|
63
|
+
<sonic-form-layout style="max-width: 20rem">
|
|
64
|
+
<sonic-divider align="left">Narrow host (single column)</sonic-divider>
|
|
65
|
+
<sonic-input label="Email" name="email_narrow" type="email"></sonic-input>
|
|
66
|
+
<sonic-input label="Confirm email" name="email_confirm_narrow" type="email"></sonic-input>
|
|
67
|
+
</sonic-form-layout>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div>
|
|
71
|
+
<sonic-form-layout>
|
|
72
|
+
<sonic-divider align="left">Wide host (two columns for inputs)</sonic-divider>
|
|
73
|
+
<sonic-input label="Email" name="email_wide" type="email"></sonic-input>
|
|
74
|
+
<sonic-input label="Confirm email" name="email_confirm_wide" type="email"></sonic-input>
|
|
75
|
+
</sonic-form-layout>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
78
|
+
</sonic-code>
|
|
79
|
+
|
|
80
|
+
## Full-width slotted blocks
|
|
81
|
+
|
|
82
|
+
Everything except **`sonic-input`**, **`sonic-select`**, **`sonic-input-autocomplete`**, and slotted elements with class **`form-item-container`** is assigned **`grid-column: 1 / -1`**. Use this for **`sonic-textarea`**, **`sonic-checkbox`**, **`sonic-switch`**, **`sonic-form-actions`**, **`sonic-divider`**, and similar blocks.
|
|
83
|
+
|
|
84
|
+
Slotted **`sonic-divider`** sets **`--sc-divider-my: 0`** so divider spacing matches the grid rhythm. Slotted **`sonic-submit`** uses **`display: contents`** so submit controls participate in the grid without an extra wrapper box.
|
|
2
85
|
|
|
3
86
|
<sonic-code>
|
|
4
87
|
<template>
|
|
5
|
-
<form>
|
|
6
88
|
<sonic-form-layout>
|
|
7
|
-
<sonic-input
|
|
8
|
-
<sonic-
|
|
9
|
-
<sonic-select autocomplete="sex" label="Sexe" name="sexe">
|
|
10
|
-
<option value="" selected="selected">- Sélectionner -</option>
|
|
11
|
-
<option value="-">Je préfère ne pas le dire</option>
|
|
12
|
-
<option value="Homme">Homme</option>
|
|
13
|
-
<option value="Femme">Femme</option>
|
|
14
|
-
</sonic-select>
|
|
15
|
-
<sonic-input autocomplete="bday" label="Date de naissance" name="date_naissance" type="date"></sonic-input>
|
|
16
|
-
<sonic-divider></sonic-divider>
|
|
17
|
-
<sonic-input autocomplete="email" label="e-mail" name="email" type="email"></sonic-input>
|
|
18
|
-
<sonic-input
|
|
19
|
-
autocomplete="email"
|
|
20
|
-
label="Confirmer votre e-mail"
|
|
21
|
-
name="email_confirmation"
|
|
22
|
-
type="email"
|
|
23
|
-
></sonic-input>
|
|
24
|
-
<sonic-input autocomplete="new-password" label="Mot de passe" name="password" type="password"></sonic-input>
|
|
25
|
-
<sonic-input
|
|
26
|
-
autocomplete="new-password"
|
|
27
|
-
label="Confirmer votre mot de passe"
|
|
28
|
-
name="password_confirmation"
|
|
29
|
-
type="password"
|
|
30
|
-
></sonic-input>
|
|
31
|
-
<sonic-divider></sonic-divider>
|
|
32
|
-
<sonic-textarea label="Message" rows="5">
|
|
33
|
-
</sonic-textarea>
|
|
34
|
-
<sonic-switch>Activer une superbe option</sonic-switch>
|
|
35
|
-
<sonic-checkbox>Inscription à la newsletter</sonic-checkbox>
|
|
36
|
-
<sonic-checkbox>J'ai lu et accepte les <sonic-link href="#" class="underline">Conditions générales de ventes</sonic-link></sonic-checkbox>
|
|
89
|
+
<sonic-input label="Subject" name="subject"></sonic-input>
|
|
90
|
+
<sonic-textarea label="Details" rows="4"></sonic-textarea>
|
|
37
91
|
<sonic-form-actions>
|
|
38
|
-
<sonic-button type="
|
|
92
|
+
<sonic-button type="primary">Send</sonic-button>
|
|
39
93
|
</sonic-form-actions>
|
|
40
94
|
</sonic-form-layout>
|
|
41
|
-
</form >
|
|
42
95
|
</template>
|
|
43
96
|
</sonic-code>
|
|
44
97
|
|
|
98
|
+
## Custom column wrapper
|
|
99
|
+
|
|
100
|
+
Add class **`form-item-container`** on a slotted wrapper (for example a **`div`**) when a field is not a direct **`sonic-input`** / **`sonic-select`** / **`sonic-input-autocomplete`** but should still share the two-column flow with short inputs.
|
|
101
|
+
|
|
102
|
+
<sonic-code>
|
|
103
|
+
<template>
|
|
104
|
+
<sonic-form-layout>
|
|
105
|
+
<sonic-input label="City" name="city"></sonic-input>
|
|
106
|
+
<div class="form-item-container">
|
|
107
|
+
<sonic-input label="Postal code" name="postal_code"></sonic-input>
|
|
108
|
+
</div>
|
|
109
|
+
</sonic-form-layout>
|
|
110
|
+
</template>
|
|
111
|
+
</sonic-code>
|
|
112
|
+
|
|
113
|
+
## API reference
|
|
114
|
+
|
|
115
|
+
No public attributes — layout follows slotted children and host width.
|
|
116
|
+
|
|
117
|
+
| Slot | Description |
|
|
118
|
+
|------|-------------|
|
|
119
|
+
| *(default)* | Form fields and blocks in visual order; column vs full-width rules apply per slotted tag or **`form-item-container`** class |
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {html, LitElement, css} from "lit";
|
|
2
|
-
import {customElement,
|
|
3
|
-
import {ResizeController} from "@lit-labs/observers/resize-controller.js";
|
|
4
|
-
import {classMap} from "lit/directives/class-map.js";
|
|
5
|
-
|
|
6
|
-
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
1
|
+
import { html, LitElement, css } from "lit";
|
|
2
|
+
import { customElement, state, queryAssignedElements } from "lit/decorators.js";
|
|
3
|
+
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
4
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
7
5
|
|
|
8
6
|
const tagName = "sonic-form-layout";
|
|
9
7
|
|
|
10
8
|
@customElement(tagName)
|
|
11
|
-
export class FormLayout extends
|
|
9
|
+
export class FormLayout extends LitElement {
|
|
12
10
|
static styles = [
|
|
13
11
|
css`
|
|
14
12
|
:host {
|
|
@@ -17,52 +15,57 @@ export class FormLayout extends Subscriber(LitElement) {
|
|
|
17
15
|
|
|
18
16
|
div {
|
|
19
17
|
display: grid;
|
|
20
|
-
grid-gap: 1.
|
|
18
|
+
grid-gap: 1.25rem;
|
|
21
19
|
align-items: flex-start;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
.cq--md {
|
|
25
|
-
grid-gap: 1.
|
|
23
|
+
grid-gap: 1.35rem;
|
|
26
24
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
27
25
|
}
|
|
28
26
|
.one-form-element {
|
|
29
27
|
grid-template-columns: 1fr;
|
|
30
28
|
}
|
|
31
|
-
/*::slotted(sonic-radio),
|
|
32
|
-
::slotted(sonic-checkbox),
|
|
33
|
-
::slotted(sonic-form-actions),
|
|
34
|
-
::slotted(sonic-divider),
|
|
35
|
-
::slotted(sonic-textarea) {
|
|
36
|
-
grid-column: 1 / -1;
|
|
37
|
-
}*/
|
|
38
29
|
::slotted(sonic-submit) {
|
|
39
30
|
display: contents;
|
|
40
31
|
}
|
|
41
|
-
::slotted(
|
|
32
|
+
::slotted(
|
|
33
|
+
:not(sonic-input):not(sonic-select):not(sonic-input-autocomplete):not(
|
|
34
|
+
.form-item-container
|
|
35
|
+
)
|
|
36
|
+
) {
|
|
42
37
|
grid-column: 1 / -1;
|
|
43
38
|
}
|
|
44
39
|
|
|
45
40
|
::slotted(sonic-divider) {
|
|
46
|
-
|
|
41
|
+
margin-top: 0;
|
|
42
|
+
margin-bottom: 0;
|
|
47
43
|
}
|
|
48
44
|
`,
|
|
49
45
|
];
|
|
50
46
|
_resizeController = new ResizeController(this, {});
|
|
51
47
|
|
|
52
|
-
@queryAssignedElements({flatten: true}) slottedElements!: HTMLElement[];
|
|
53
|
-
@
|
|
48
|
+
@queryAssignedElements({ flatten: true }) slottedElements!: HTMLElement[];
|
|
49
|
+
@state() _oneFormElement = false;
|
|
54
50
|
|
|
55
51
|
onSlotChange() {
|
|
56
52
|
let elements = this.slottedElements;
|
|
57
|
-
const formElementColumns = [
|
|
53
|
+
const formElementColumns = [
|
|
54
|
+
"sonic-input",
|
|
55
|
+
"sonic-select",
|
|
56
|
+
"sonic-input-autocomplete",
|
|
57
|
+
".form-item-container",
|
|
58
|
+
];
|
|
58
59
|
// keep only form elements
|
|
59
|
-
elements = elements.filter((elt) =>
|
|
60
|
-
|
|
60
|
+
elements = elements.filter((elt) =>
|
|
61
|
+
formElementColumns.includes(elt.nodeName.toLowerCase()),
|
|
62
|
+
);
|
|
63
|
+
this._oneFormElement = elements.length == 1;
|
|
61
64
|
}
|
|
62
65
|
render() {
|
|
63
66
|
const classes = {
|
|
64
67
|
"cq--md": this.offsetWidth > 440,
|
|
65
|
-
"one-form-element": this.
|
|
68
|
+
"one-form-element": this._oneFormElement,
|
|
66
69
|
};
|
|
67
70
|
return html`<div class=${classMap(classes)}>
|
|
68
71
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
@@ -84,7 +84,7 @@ export class Textarea extends FormInput(FormElement(LitElement)) {
|
|
|
84
84
|
|
|
85
85
|
validateFormElement() {
|
|
86
86
|
const textarea: HTMLTextAreaElement = this.shadowRoot?.querySelector(
|
|
87
|
-
"textarea"
|
|
87
|
+
"textarea",
|
|
88
88
|
) as HTMLTextAreaElement;
|
|
89
89
|
if (!textarea || textarea.checkValidity()) return;
|
|
90
90
|
const formPublisher = this.getFormPublisher();
|
|
@@ -103,7 +103,7 @@ export class Textarea extends FormInput(FormElement(LitElement)) {
|
|
|
103
103
|
<label
|
|
104
104
|
for="${this.id || "form-element"}"
|
|
105
105
|
class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
106
|
-
>${this.label ? unsafeHTML(this.label
|
|
106
|
+
>${this.label ? unsafeHTML(this.label) : ""}<slot
|
|
107
107
|
name="label"
|
|
108
108
|
@slotchange=${this.hasSlotOrProps}
|
|
109
109
|
></slot
|
|
@@ -115,6 +115,8 @@ export class Textarea extends FormInput(FormElement(LitElement)) {
|
|
|
115
115
|
id="${this.id || "form-element"}"
|
|
116
116
|
@input=${this.handleChange}
|
|
117
117
|
@blur=${this.handleBlur}
|
|
118
|
+
.name=${this.name}
|
|
119
|
+
.value=${this.value}
|
|
118
120
|
?disabled=${this.disabled}
|
|
119
121
|
?required=${this.required}
|
|
120
122
|
?autofocus=${this.autofocus}
|
|
@@ -123,7 +125,6 @@ export class Textarea extends FormInput(FormElement(LitElement)) {
|
|
|
123
125
|
maxlength=${ifDefined(this.maxlength)}
|
|
124
126
|
minlength=${ifDefined(this.minlength)}
|
|
125
127
|
?readonly=${this.readonly}
|
|
126
|
-
spellcheck=${ifDefined(this.spellcheck)}
|
|
127
128
|
autocomplete=${ifDefined(this.autocomplete)}
|
|
128
129
|
tabindex=${ifDefined(this.tabindex)}
|
|
129
130
|
wrap=${ifDefined(this.wrap)}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Group
|
|
2
2
|
|
|
3
|
+
**`sonic-group`** lays out slotted **`sonic-button`** · **`sonic-input`** and **`sonic-select`** controls in a single horizontal row with **shared corner radius** (first / middle / last items). Optional **`label`** and **`description`** follow form field styling. Use it for **button groups**, **radio rows**, or **input + action** toolbars.
|
|
4
|
+
|
|
3
5
|
## Radio group
|
|
6
|
+
|
|
7
|
+
Pair with **`sonic-button`** **`radio`** and a shared **`name`**; ancestor **`formDataProvider`** stores the selected **`value`**.
|
|
8
|
+
|
|
4
9
|
<sonic-code>
|
|
5
10
|
<template>
|
|
6
11
|
<sonic-group formDataProvider="subscriptionData">
|
|
@@ -12,10 +17,13 @@
|
|
|
12
17
|
</sonic-code>
|
|
13
18
|
|
|
14
19
|
## Button group
|
|
20
|
+
|
|
21
|
+
Adjacent link or action buttons without merging into one control.
|
|
22
|
+
|
|
15
23
|
<sonic-code>
|
|
16
24
|
<template>
|
|
17
25
|
<sonic-group>
|
|
18
|
-
<sonic-button type="info" target="_blank" href="https://wwws.airfrance.fr/">🗼Air France</sonic-button>
|
|
26
|
+
<sonic-button type="info" target="_blank" href="https://wwws.airfrance.fr/">🗼 Air France</sonic-button>
|
|
19
27
|
<sonic-button type="success" target="_blank" href="https://www.airtahitinui.com/">🌴 Air Tahiti</sonic-button>
|
|
20
28
|
<sonic-button type="danger" target="_blank" href="https://www.aircorsica.com/">💣 Air Corsica</sonic-button>
|
|
21
29
|
</sonic-group>
|
|
@@ -23,53 +31,45 @@
|
|
|
23
31
|
</sonic-code>
|
|
24
32
|
|
|
25
33
|
## Input actions prefix
|
|
34
|
+
|
|
35
|
+
Action control before the field. **`label`** or **`description`** on **`sonic-group`** annotate the row.
|
|
36
|
+
|
|
26
37
|
<sonic-code>
|
|
27
38
|
<template>
|
|
28
|
-
|
|
29
|
-
<sonic-group>
|
|
30
|
-
<sonic-button type="info" shape="square">
|
|
31
|
-
<sonic-icon library="iconoir" library="iconoir" name="info-empty"></sonic-icon>
|
|
32
|
-
</sonic-button>
|
|
33
|
-
<sonic-input placeholder="placeholder" ></sonic-input>
|
|
34
|
-
</sonic-group>
|
|
35
|
-
<sonic-group label="Label">
|
|
36
|
-
<sonic-button type="info" shape="square">
|
|
37
|
-
<sonic-icon library="iconoir" library="iconoir" name="info-empty"></sonic-icon>
|
|
38
|
-
</sonic-button>
|
|
39
|
-
<sonic-input ></sonic-input>
|
|
40
|
-
</sonic-group>
|
|
41
|
-
<sonic-group description="Description">
|
|
39
|
+
<sonic-group label="Label" description="Description">
|
|
42
40
|
<sonic-button type="info" shape="square">
|
|
43
|
-
<sonic-icon library="iconoir"
|
|
41
|
+
<sonic-icon library="iconoir" name="info-empty"></sonic-icon>
|
|
44
42
|
</sonic-button>
|
|
45
|
-
<sonic-input
|
|
43
|
+
<sonic-input></sonic-input>
|
|
46
44
|
</sonic-group>
|
|
47
|
-
</div>
|
|
48
45
|
</template>
|
|
49
46
|
</sonic-code>
|
|
50
47
|
|
|
51
48
|
## Input actions suffix
|
|
49
|
+
|
|
50
|
+
Field first, action after (submit, validate, etc.).
|
|
51
|
+
|
|
52
52
|
<sonic-code>
|
|
53
53
|
<template>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<sonic-input placeholder="placeholder" ></sonic-input>
|
|
57
|
-
<sonic-button type="primary" shape="square">
|
|
58
|
-
<sonic-icon library="iconoir" library="iconoir" name="check"></sonic-icon>
|
|
59
|
-
</sonic-button>
|
|
60
|
-
</sonic-group>
|
|
61
|
-
<sonic-group label="Label">
|
|
62
|
-
<sonic-input ></sonic-input>
|
|
63
|
-
<sonic-button type="primary" shape="square">
|
|
64
|
-
<sonic-icon library="iconoir" library="iconoir" name="check"></sonic-icon>
|
|
65
|
-
</sonic-button>
|
|
66
|
-
</sonic-group>
|
|
67
|
-
<sonic-group description="Description">
|
|
68
|
-
<sonic-input ></sonic-input>
|
|
54
|
+
<sonic-group label="Label" description="Description">
|
|
55
|
+
<sonic-input></sonic-input>
|
|
69
56
|
<sonic-button type="primary" shape="square">
|
|
70
|
-
<sonic-icon library="iconoir"
|
|
57
|
+
<sonic-icon library="iconoir" name="check"></sonic-icon>
|
|
71
58
|
</sonic-button>
|
|
72
59
|
</sonic-group>
|
|
73
|
-
</div>
|
|
74
60
|
</template>
|
|
75
|
-
</sonic-code>
|
|
61
|
+
</sonic-code>
|
|
62
|
+
|
|
63
|
+
## API reference
|
|
64
|
+
|
|
65
|
+
| Attribute | Values | Description |
|
|
66
|
+
|----------|---------|-------------|
|
|
67
|
+
| `label` | string (HTML) | Label above the row; **`slot="label"`** overrides / extends |
|
|
68
|
+
| `description` | string (HTML) | Help text below the row; **`slot="description"`** overrides / extends |
|
|
69
|
+
| `alignItems` | CSS align-items (default `center`) | Cross-axis alignment of the main flex row |
|
|
70
|
+
|
|
71
|
+
| Slot | Description |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| *(default)* | **`sonic-button`** · **`sonic-input`** · **`sonic-select`** in visual order |
|
|
74
|
+
| `label` | Custom label markup |
|
|
75
|
+
| `description` | Custom description markup |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html, LitElement, css, PropertyValues } from "lit";
|
|
1
|
+
import { html, LitElement, css, PropertyValues, nothing } from "lit";
|
|
2
2
|
import { styleMap } from "lit/directives/style-map.js";
|
|
3
3
|
import {
|
|
4
4
|
customElement,
|
|
@@ -58,7 +58,7 @@ export class Group extends LitElement {
|
|
|
58
58
|
|
|
59
59
|
updated(): void {
|
|
60
60
|
const children = this.querySelectorAll(
|
|
61
|
-
"sonic-input, sonic-button, sonic-select"
|
|
61
|
+
"sonic-input, sonic-button, sonic-select",
|
|
62
62
|
);
|
|
63
63
|
const nbChildren = children.length;
|
|
64
64
|
|
|
@@ -81,14 +81,9 @@ export class Group extends LitElement {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
connectedCallback() {
|
|
85
|
-
super.connectedCallback();
|
|
86
|
-
this.hasSlotOrProps();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
84
|
willUpdate(changedProperties: PropertyValues) {
|
|
90
|
-
this.hasSlotOrProps();
|
|
91
85
|
super.willUpdate(changedProperties);
|
|
86
|
+
this.hasSlotOrProps();
|
|
92
87
|
}
|
|
93
88
|
|
|
94
89
|
hasSlotOrProps() {
|
|
@@ -103,7 +98,7 @@ export class Group extends LitElement {
|
|
|
103
98
|
};
|
|
104
99
|
|
|
105
100
|
return html`<span class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
106
|
-
>${this.label ? unsafeHTML(this.label
|
|
101
|
+
>${this.label ? unsafeHTML(this.label) : nothing}<slot
|
|
107
102
|
name="label"
|
|
108
103
|
@slotchange=${this.hasSlotOrProps}
|
|
109
104
|
></slot
|
|
@@ -114,7 +109,7 @@ export class Group extends LitElement {
|
|
|
114
109
|
@slotchange=${this.hasSlotOrProps}
|
|
115
110
|
class="${this.hasDescription ? "form-description" : "hidden"}"
|
|
116
111
|
>
|
|
117
|
-
${this.description ? html`${unsafeHTML(this.description)}` :
|
|
112
|
+
${this.description ? html`${unsafeHTML(this.description)}` : nothing}
|
|
118
113
|
</slot>`;
|
|
119
114
|
}
|
|
120
115
|
}
|