@supersoniks/concorde 3.1.0 → 3.1.1
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/build-infos.json +1 -1
- package/package.json +1 -1
- package/public/img/paul_metrand.jpg +0 -0
- package/public/img/paul_metrand_xs.jpg +0 -0
- package/src/core/components/functional/list/list.md +8 -3
- package/src/core/components/ui/_css/scroll.ts +3 -2
- package/src/core/components/ui/_css/size.ts +5 -1
- package/src/core/components/ui/form/checkbox/checkbox.ts +31 -21
- package/src/core/components/ui/form/input/input.ts +70 -36
- package/src/core/components/ui/form/select/select.ts +1 -0
- package/src/core/components/ui/form/textarea/textarea.md +2 -3
- package/src/core/components/ui/form/textarea/textarea.ts +51 -24
- package/src/core/components/ui/progress/progress.md +4 -6
- package/src/core/components/ui/progress/progress.ts +28 -13
- package/src/core/components/ui/table/table.md +15 -27
- package/src/core/components/ui/table/table.ts +26 -15
- package/src/core/components/ui/theme/theme-collection/core-variables.ts +20 -12
- package/src/core/components/ui/tooltip/tooltip.md +45 -0
- package/src/core/components/ui/tooltip/tooltip.ts +63 -18
- package/src/core/mixins/FormElement.ts +50 -24
- package/src/docs/_getting-started/my-first-subscriber.md +174 -0
- package/src/docs/_getting-started/start.md +2 -2
- package/src/docs/example/users.ts +43 -48
- package/src/docs/navigation/navigation.ts +2 -2
- package/src/docs/search/docs-search.json +139 -4
- package/src/docs/search/search.ts +6 -4
package/build-infos.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"date":
|
|
1
|
+
{"date":1715539406}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -121,9 +121,14 @@ Enables the list to get data from an external API in order to fill its **props**
|
|
|
121
121
|
See the [Fetch] web component(#core/components/functional/fetch/fetch.md/fetch)
|
|
122
122
|
<sonic-code>
|
|
123
123
|
<template>
|
|
124
|
-
<sonic-list
|
|
124
|
+
<sonic-list
|
|
125
|
+
props='["a", "b", "c"]' fetch
|
|
126
|
+
serviceURL="https://reqres.in"
|
|
127
|
+
dataProvider="api/users"
|
|
128
|
+
key="data"
|
|
129
|
+
class="grid grid-cols-1" debug>
|
|
125
130
|
<template>
|
|
126
|
-
<docs-
|
|
131
|
+
<docs-user></docs-user>
|
|
127
132
|
</template>
|
|
128
133
|
</sonic-list>
|
|
129
134
|
</template>
|
|
@@ -188,7 +193,7 @@ Note that we use:
|
|
|
188
193
|
</form>
|
|
189
194
|
</div>
|
|
190
195
|
<sonic-card dataProvider="profileInfos">
|
|
191
|
-
<docs-
|
|
196
|
+
<docs-user ></docs-user>
|
|
192
197
|
</sonic-card>
|
|
193
198
|
</template>
|
|
194
199
|
</sonic-code> -->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {css} from "lit";
|
|
1
|
+
import { css } from "lit";
|
|
2
2
|
|
|
3
3
|
export const customScroll = css`
|
|
4
4
|
.custom-scroll {
|
|
@@ -16,7 +16,8 @@ export const customScroll = css`
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.custom-scroll::-webkit-scrollbar-thumb {
|
|
19
|
-
box-shadow: inset 0 0 2rem 2rem
|
|
19
|
+
box-shadow: inset 0 0 2rem 2rem
|
|
20
|
+
var(--sc-scrollbar-bg, var(--sc-base-400, #222));
|
|
20
21
|
border-radius: var(--sc-rounded);
|
|
21
22
|
border: solid 0.15rem transparent;
|
|
22
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {css} from "lit";
|
|
1
|
+
import { css } from "lit";
|
|
2
2
|
|
|
3
3
|
export type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
4
4
|
|
|
@@ -10,6 +10,7 @@ export const fontSize = css`
|
|
|
10
10
|
font-size: var(--sc-fs);
|
|
11
11
|
line-height: var(--sc-lh);
|
|
12
12
|
}
|
|
13
|
+
|
|
13
14
|
:host([size="2xs"]) {
|
|
14
15
|
--sc-fs: 0.625rem;
|
|
15
16
|
}
|
|
@@ -19,6 +20,9 @@ export const fontSize = css`
|
|
|
19
20
|
:host([size="sm"]) {
|
|
20
21
|
--sc-fs: 0.875rem;
|
|
21
22
|
}
|
|
23
|
+
:host([size="md"]) {
|
|
24
|
+
--sc-fs: 1rem;
|
|
25
|
+
}
|
|
22
26
|
:host([size="lg"]) {
|
|
23
27
|
--sc-fs: 1.125rem;
|
|
24
28
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {html, LitElement, css, CSSResultGroup, PropertyValues} from "lit";
|
|
2
|
-
import {customElement, property, queryAssignedNodes} from "lit/decorators.js";
|
|
3
|
-
import {ifDefined} from "lit/directives/if-defined.js";
|
|
1
|
+
import { html, LitElement, css, CSSResultGroup, PropertyValues } from "lit";
|
|
2
|
+
import { customElement, property, queryAssignedNodes } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4
4
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
5
5
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
6
6
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
7
7
|
import FormCheckable from "@supersoniks/concorde/core/mixins/FormCheckable";
|
|
8
8
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
9
|
-
import {unsafeHTML} from "lit/directives/unsafe-html.js";
|
|
10
|
-
import {fontSize} from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
9
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
10
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
11
11
|
|
|
12
12
|
const tagName = "sonic-checkbox";
|
|
13
13
|
/**
|
|
@@ -32,7 +32,9 @@ const tagName = "sonic-checkbox";
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
@customElement(tagName)
|
|
35
|
-
export class Checkbox extends FormCheckable(
|
|
35
|
+
export class Checkbox extends FormCheckable(
|
|
36
|
+
FormInput(FormElement(Subscriber(LitElement)))
|
|
37
|
+
) {
|
|
36
38
|
static styles = [
|
|
37
39
|
fontSize,
|
|
38
40
|
css`
|
|
@@ -75,7 +77,8 @@ export class Checkbox extends FormCheckable(FormInput(FormElement(Subscriber(Lit
|
|
|
75
77
|
outline: none;
|
|
76
78
|
margin: 0;
|
|
77
79
|
background-color: var(--sc-checkbox-bg);
|
|
78
|
-
border: var(--sc-checkbox-border-width) solid
|
|
80
|
+
border: var(--sc-checkbox-border-width) solid
|
|
81
|
+
var(--sc-checkbox-border-color);
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
input:focus,
|
|
@@ -163,17 +166,17 @@ export class Checkbox extends FormCheckable(FormInput(FormElement(Subscriber(Lit
|
|
|
163
166
|
` as CSSResultGroup,
|
|
164
167
|
];
|
|
165
168
|
|
|
166
|
-
@property({type: Boolean, reflect: true}) touched = false;
|
|
167
|
-
@property({type: String}) iconName = "check";
|
|
168
|
-
@property({type: String}) indeterminateIconName = "minus-small";
|
|
169
|
-
@property({type: Boolean}) showAsIndeterminate = false;
|
|
169
|
+
@property({ type: Boolean, reflect: true }) touched = false;
|
|
170
|
+
@property({ type: String }) iconName = "check";
|
|
171
|
+
@property({ type: String }) indeterminateIconName = "minus-small";
|
|
172
|
+
@property({ type: Boolean }) showAsIndeterminate = false;
|
|
170
173
|
|
|
171
|
-
@property({type: Boolean}) hasDescription = false;
|
|
172
|
-
@property({type: Boolean}) hasLabel = false;
|
|
173
|
-
@queryAssignedNodes({flatten: true})
|
|
174
|
+
@property({ type: Boolean }) hasDescription = false;
|
|
175
|
+
@property({ type: Boolean }) hasLabel = false;
|
|
176
|
+
@queryAssignedNodes({ flatten: true })
|
|
174
177
|
slotLabelNodes!: Array<Node>;
|
|
175
178
|
|
|
176
|
-
@queryAssignedNodes({slot: "description", flatten: true})
|
|
179
|
+
@queryAssignedNodes({ slot: "description", flatten: true })
|
|
177
180
|
slotDescriptionNodes!: Array<Node>;
|
|
178
181
|
|
|
179
182
|
connectedCallback() {
|
|
@@ -189,7 +192,8 @@ export class Checkbox extends FormCheckable(FormInput(FormElement(Subscriber(Lit
|
|
|
189
192
|
|
|
190
193
|
hasSlotOrProps() {
|
|
191
194
|
this.hasLabel = this.label || this.slotLabelNodes?.length ? true : false;
|
|
192
|
-
this.hasDescription =
|
|
195
|
+
this.hasDescription =
|
|
196
|
+
this.description || this.slotDescriptionNodes?.length ? true : false;
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
render() {
|
|
@@ -213,16 +217,22 @@ export class Checkbox extends FormCheckable(FormInput(FormElement(Subscriber(Lit
|
|
|
213
217
|
aria-labelledby=${ifDefined(this.ariaLabelledby)}
|
|
214
218
|
/>
|
|
215
219
|
<sonic-icon name="${
|
|
216
|
-
this.checked == "indeterminate" || this.showAsIndeterminate
|
|
220
|
+
this.checked == "indeterminate" || this.showAsIndeterminate
|
|
221
|
+
? this.indeterminateIconName
|
|
222
|
+
: this.iconName
|
|
217
223
|
}" class="sc-input-icon"></sonic-icon>
|
|
218
224
|
</span>
|
|
219
225
|
|
|
220
|
-
<div class="checkbox-text ${
|
|
226
|
+
<div class="checkbox-text ${
|
|
227
|
+
!this.hasDescription && !this.hasLabel ? "hidden" : "checkbox-text"
|
|
228
|
+
}">
|
|
221
229
|
${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}
|
|
222
230
|
<slot @slotchange=${this.hasSlotOrProps}></slot>
|
|
223
|
-
<slot @slotchange=${
|
|
224
|
-
this.
|
|
225
|
-
}
|
|
231
|
+
<slot @slotchange=${
|
|
232
|
+
this.hasSlotOrProps
|
|
233
|
+
} name="description" class="${
|
|
234
|
+
this.hasDescription ? "description" : "hidden"
|
|
235
|
+
} ">${this.description ? html`${unsafeHTML(this.description)}` : ""}</slot>
|
|
226
236
|
</div>
|
|
227
237
|
</label>
|
|
228
238
|
</label>
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import {html, LitElement, PropertyValues, css, nothing} from "lit";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { html, LitElement, PropertyValues, css, nothing } from "lit";
|
|
2
|
+
import {
|
|
3
|
+
customElement,
|
|
4
|
+
property,
|
|
5
|
+
queryAssignedNodes,
|
|
6
|
+
state,
|
|
7
|
+
} from "lit/decorators.js";
|
|
8
|
+
import { query } from "lit/decorators/query.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
import {
|
|
11
|
+
formControl,
|
|
12
|
+
label,
|
|
13
|
+
description,
|
|
14
|
+
passwordToggle,
|
|
15
|
+
} from "@supersoniks/concorde/core/components/ui/form/css/form-control";
|
|
6
16
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
7
17
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
8
18
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
9
|
-
import {classMap} from "lit/directives/class-map.js";
|
|
10
|
-
import {fontSize} from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
11
|
-
import {unsafeHTML} from "lit/directives/unsafe-html.js";
|
|
19
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
20
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
21
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
12
22
|
|
|
13
23
|
/**
|
|
14
24
|
* ### Le composent sonic-input étend les mixins FormInput, FormElement et Subscriber
|
|
@@ -44,32 +54,39 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
44
54
|
/**
|
|
45
55
|
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
46
56
|
*/
|
|
47
|
-
@property({type: String, reflect: true}) size?:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@property({type:
|
|
56
|
-
@property({type:
|
|
57
|
-
@property({type: String})
|
|
58
|
-
|
|
59
|
-
@property({type:
|
|
60
|
-
@property({type: Boolean})
|
|
61
|
-
@property({type:
|
|
62
|
-
|
|
63
|
-
@
|
|
57
|
+
@property({ type: String, reflect: true }) size?:
|
|
58
|
+
| "2xs"
|
|
59
|
+
| "xs"
|
|
60
|
+
| "sm"
|
|
61
|
+
| "md"
|
|
62
|
+
| "lg"
|
|
63
|
+
| "xl"
|
|
64
|
+
| "2xl";
|
|
65
|
+
@property({ type: String }) list?: string;
|
|
66
|
+
@property({ type: String }) placeholder?: string;
|
|
67
|
+
@property({ type: String }) pattern?: string;
|
|
68
|
+
@property({ type: String }) min?: string;
|
|
69
|
+
@property({ type: String }) max?: string;
|
|
70
|
+
@property({ type: Boolean }) readonly = false;
|
|
71
|
+
@property({ type: Number }) step?: number;
|
|
72
|
+
@property({ type: Number }) minlength?: number;
|
|
73
|
+
@property({ type: Number }) maxlength?: number;
|
|
74
|
+
@property({ type: String }) src?: string;
|
|
75
|
+
|
|
76
|
+
@property({ type: Boolean, reflect: true }) inlineContent = false;
|
|
77
|
+
@property({ type: Boolean }) disableInlineContentFocus = false;
|
|
78
|
+
@property({ type: Boolean }) showPasswordToggle = false;
|
|
79
|
+
|
|
80
|
+
@queryAssignedNodes({ slot: "label", flatten: true })
|
|
64
81
|
slotLabelNodes!: Array<Node>;
|
|
65
82
|
|
|
66
|
-
@queryAssignedNodes({slot: "description", flatten: true})
|
|
83
|
+
@queryAssignedNodes({ slot: "description", flatten: true })
|
|
67
84
|
slotDescriptionNodes!: Array<Node>;
|
|
68
85
|
|
|
69
|
-
@queryAssignedNodes({slot: "suffix", flatten: true})
|
|
86
|
+
@queryAssignedNodes({ slot: "suffix", flatten: true })
|
|
70
87
|
slotSuffixNodes!: Array<Node>;
|
|
71
88
|
|
|
72
|
-
@queryAssignedNodes({slot: "prefix", flatten: true})
|
|
89
|
+
@queryAssignedNodes({ slot: "prefix", flatten: true })
|
|
73
90
|
slotPrefixNodes!: Array<Node>;
|
|
74
91
|
|
|
75
92
|
@query("input") input!: HTMLInputElement;
|
|
@@ -88,7 +105,8 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
88
105
|
this.hasSlotOrProps();
|
|
89
106
|
if (this.hasAttribute("sameValueAs")) {
|
|
90
107
|
this.sameValueAsName = this.getAttribute("sameValueAs");
|
|
91
|
-
this.sameValueAsHandle = (v: string) =>
|
|
108
|
+
this.sameValueAsHandle = (v: string) =>
|
|
109
|
+
(this.pattern = this.escapeRegExp(v));
|
|
92
110
|
const formPublisher = this.getFormPublisher();
|
|
93
111
|
if (!formPublisher) return;
|
|
94
112
|
formPublisher[this.sameValueAsName].onAssign(this.sameValueAsHandle);
|
|
@@ -123,7 +141,8 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
123
141
|
|
|
124
142
|
hasSlotOrProps() {
|
|
125
143
|
this.hasLabel = this.label || this.slotLabelNodes?.length ? true : false;
|
|
126
|
-
this.hasDescription =
|
|
144
|
+
this.hasDescription =
|
|
145
|
+
this.description || this.slotDescriptionNodes?.length ? true : false;
|
|
127
146
|
this.hasSuffix = this.slotSuffixNodes?.length ? true : false;
|
|
128
147
|
this.hasPrefix = this.slotPrefixNodes?.length ? true : false;
|
|
129
148
|
}
|
|
@@ -140,7 +159,10 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
140
159
|
return;
|
|
141
160
|
}
|
|
142
161
|
if (this.changeTimeoutId) clearTimeout(this.changeTimeoutId);
|
|
143
|
-
this.changeTimeoutId = setTimeout(
|
|
162
|
+
this.changeTimeoutId = setTimeout(
|
|
163
|
+
() => super.handleChange(e),
|
|
164
|
+
parseInt(this.getAttribute("inputDelayMs"))
|
|
165
|
+
);
|
|
144
166
|
}
|
|
145
167
|
|
|
146
168
|
// toggle password visibility
|
|
@@ -159,17 +181,24 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
159
181
|
};
|
|
160
182
|
//let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
161
183
|
return html`
|
|
162
|
-
<label for="${this.id || "form-element"}" class="${
|
|
184
|
+
<label for="${this.id || "form-element"}" class="${
|
|
185
|
+
this.hasLabel ? "form-label" : "hidden"
|
|
186
|
+
}"
|
|
163
187
|
>${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}<slot
|
|
164
188
|
name="label"
|
|
165
189
|
@slotchange=${this.hasSlotOrProps}
|
|
166
190
|
></slot
|
|
167
191
|
></label>
|
|
168
192
|
|
|
169
|
-
<div @click=${this.inlineContentFocus} class="form-control ${classMap(
|
|
170
|
-
|
|
193
|
+
<div @click=${this.inlineContentFocus} class="form-control ${classMap(
|
|
194
|
+
slotClasses
|
|
195
|
+
)}">
|
|
196
|
+
<div part="content" class="${
|
|
197
|
+
this.inlineContent ? "form-element form-element-wrapper" : "contents"
|
|
198
|
+
}">
|
|
171
199
|
<slot name="prefix" @slotchange=${this.hasSlotOrProps}></slot>
|
|
172
200
|
<input
|
|
201
|
+
data-form-element
|
|
173
202
|
part="input"
|
|
174
203
|
id=${ifDefined(this.id || "form-element")}
|
|
175
204
|
part="input"
|
|
@@ -206,7 +235,10 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
206
235
|
aria-label="Toggle password visibility"
|
|
207
236
|
variant="unstyled"
|
|
208
237
|
>
|
|
209
|
-
<sonic-icon
|
|
238
|
+
<sonic-icon
|
|
239
|
+
library="heroicons"
|
|
240
|
+
name=${this.isPassword ? "eye" : "eye-slash"}
|
|
241
|
+
></sonic-icon>
|
|
210
242
|
</sonic-button>`
|
|
211
243
|
: ""
|
|
212
244
|
}
|
|
@@ -219,7 +251,9 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
219
251
|
name="description"
|
|
220
252
|
@slotchange=${this.hasSlotOrProps}
|
|
221
253
|
class="${this.hasDescription ? "form-description" : "hidden"}"
|
|
222
|
-
>${
|
|
254
|
+
>${
|
|
255
|
+
this.description ? html`${unsafeHTML(this.description)}` : nothing
|
|
256
|
+
}</slot>
|
|
223
257
|
<slot name="list"></slot>
|
|
224
258
|
</div>
|
|
225
259
|
`;
|
|
@@ -261,6 +261,7 @@ export class Select extends FormElement(Subscriber(LitElement)) {
|
|
|
261
261
|
<slot name="prefix" @slotchange=${this.hasSlotOrProps}></slot>
|
|
262
262
|
<div class="form-select-wrapper">
|
|
263
263
|
<select
|
|
264
|
+
data-form-element
|
|
264
265
|
id="form-element"
|
|
265
266
|
@change=${this.handleChange}
|
|
266
267
|
@blur=${this.handleBlur}
|
|
@@ -52,12 +52,11 @@
|
|
|
52
52
|
## Size
|
|
53
53
|
<sonic-code>
|
|
54
54
|
<template>
|
|
55
|
-
<div class="grid gap-
|
|
55
|
+
<div class="grid gap-4">
|
|
56
56
|
<sonic-textarea size="2xs" value="2xs"></sonic-textarea>
|
|
57
57
|
<sonic-textarea size="xs" value="xs"></sonic-textarea>
|
|
58
58
|
<sonic-textarea size="sm" value="sm"></sonic-textarea>
|
|
59
|
-
<sonic-textarea
|
|
60
|
-
<sonic-textarea value="default"></sonic-textarea>
|
|
59
|
+
<sonic-textarea value="md / default"></sonic-textarea>
|
|
61
60
|
<sonic-textarea size="lg" value="lg"></sonic-textarea>
|
|
62
61
|
<sonic-textarea size="xl" value="xl"></sonic-textarea>
|
|
63
62
|
<sonic-textarea size="2xl" value="2xl"></sonic-textarea>
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import {css, html, LitElement, PropertyValues} from "lit";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { css, html, LitElement, PropertyValues } from "lit";
|
|
2
|
+
import {
|
|
3
|
+
customElement,
|
|
4
|
+
property,
|
|
5
|
+
queryAssignedNodes,
|
|
6
|
+
state,
|
|
7
|
+
} from "lit/decorators.js";
|
|
8
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
+
import {
|
|
10
|
+
description,
|
|
11
|
+
formControl,
|
|
12
|
+
label,
|
|
13
|
+
} from "@supersoniks/concorde/core/components/ui/form/css/form-control";
|
|
5
14
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
6
15
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
7
16
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
8
|
-
import {customScroll} from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
9
|
-
import {unsafeHTML} from "lit/directives/unsafe-html.js";
|
|
10
|
-
import {fontSize} from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
11
|
-
import {styleMap} from "lit/directives/style-map.js";
|
|
17
|
+
import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
18
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
19
|
+
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
20
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
12
21
|
|
|
13
22
|
const tagName = "sonic-textarea";
|
|
14
23
|
|
|
@@ -31,20 +40,26 @@ export class Textarea extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
31
40
|
// @property({ type: String })
|
|
32
41
|
// type: "" | "primary" | "warning" | "danger" | "success" | "info" = "";
|
|
33
42
|
// @property({ type: String }) variant: "" | "ghost" | "outline" = "";
|
|
34
|
-
@property({type: String}) size: "" | "xs" | "sm" | "lg" = "";
|
|
35
|
-
@property({type: Number}) rows?: number;
|
|
36
|
-
@property({type: Number}) cols?: number;
|
|
37
|
-
@property({type: Number}) maxlength?: number;
|
|
38
|
-
@property({type: Number}) minlength?: number;
|
|
39
|
-
@property({type: String}) wrap?: "hard" | "soft";
|
|
40
|
-
@property({type: Boolean}) readonly = false;
|
|
41
|
-
@property({type: String}) placeholder?: string;
|
|
42
|
-
@property({type: String}) resize?:
|
|
43
|
+
@property({ type: String }) size: "" | "xs" | "sm" | "lg" = "";
|
|
44
|
+
@property({ type: Number }) rows?: number;
|
|
45
|
+
@property({ type: Number }) cols?: number;
|
|
46
|
+
@property({ type: Number }) maxlength?: number;
|
|
47
|
+
@property({ type: Number }) minlength?: number;
|
|
48
|
+
@property({ type: String }) wrap?: "hard" | "soft";
|
|
49
|
+
@property({ type: Boolean }) readonly = false;
|
|
50
|
+
@property({ type: String }) placeholder?: string;
|
|
51
|
+
@property({ type: String }) resize?:
|
|
52
|
+
| "none"
|
|
53
|
+
| "both"
|
|
54
|
+
| "horizontal"
|
|
55
|
+
| "vertical"
|
|
56
|
+
| "block"
|
|
57
|
+
| "inline";
|
|
43
58
|
|
|
44
|
-
@queryAssignedNodes({slot: "label", flatten: true})
|
|
59
|
+
@queryAssignedNodes({ slot: "label", flatten: true })
|
|
45
60
|
slotLabelNodes!: Array<Node>;
|
|
46
61
|
|
|
47
|
-
@queryAssignedNodes({slot: "description", flatten: true})
|
|
62
|
+
@queryAssignedNodes({ slot: "description", flatten: true })
|
|
48
63
|
slotDescriptionNodes!: Array<Node>;
|
|
49
64
|
|
|
50
65
|
@state() hasDescription = false;
|
|
@@ -61,11 +76,14 @@ export class Textarea extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
61
76
|
|
|
62
77
|
hasSlotOrProps() {
|
|
63
78
|
this.hasLabel = this.label || this.slotLabelNodes?.length ? true : false;
|
|
64
|
-
this.hasDescription =
|
|
79
|
+
this.hasDescription =
|
|
80
|
+
this.description || this.slotDescriptionNodes?.length ? true : false;
|
|
65
81
|
}
|
|
66
82
|
|
|
67
83
|
validateFormElement() {
|
|
68
|
-
const textarea: HTMLTextAreaElement = this.shadowRoot?.querySelector(
|
|
84
|
+
const textarea: HTMLTextAreaElement = this.shadowRoot?.querySelector(
|
|
85
|
+
"textarea"
|
|
86
|
+
) as HTMLTextAreaElement;
|
|
69
87
|
if (!textarea || textarea.checkValidity()) return;
|
|
70
88
|
const formPublisher = this.getFormPublisher();
|
|
71
89
|
if (formPublisher) {
|
|
@@ -80,12 +98,18 @@ export class Textarea extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
80
98
|
};
|
|
81
99
|
// let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
82
100
|
return html`
|
|
83
|
-
<label
|
|
84
|
-
|
|
101
|
+
<label
|
|
102
|
+
for="${this.id || "form-element"}"
|
|
103
|
+
class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
104
|
+
>${this.label ? unsafeHTML(this.label /*+ labelStarSuffix*/) : ""}<slot
|
|
105
|
+
name="label"
|
|
106
|
+
@slotchange=${this.hasSlotOrProps}
|
|
107
|
+
></slot
|
|
85
108
|
></label>
|
|
86
109
|
|
|
87
110
|
<div class="form-control">
|
|
88
111
|
<textarea
|
|
112
|
+
data-form-element
|
|
89
113
|
id="${this.id || "form-element"}"
|
|
90
114
|
@input=${this.handleChange}
|
|
91
115
|
@blur=${this.handleBlur}
|
|
@@ -111,7 +135,10 @@ ${this.value}</textarea
|
|
|
111
135
|
>
|
|
112
136
|
</div>
|
|
113
137
|
|
|
114
|
-
<slot
|
|
138
|
+
<slot
|
|
139
|
+
name="description"
|
|
140
|
+
@slotchange=${this.hasSlotOrProps}
|
|
141
|
+
class="${this.hasDescription ? "form-description" : "hidden"}"
|
|
115
142
|
>${this.description ? html`${unsafeHTML(this.description)}` : ""}</slot
|
|
116
143
|
>
|
|
117
144
|
`;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Progress bar
|
|
2
2
|
|
|
3
|
+
Displays an indicator showing the completion progress of a task.
|
|
4
|
+
|
|
3
5
|
## Indeterminate
|
|
4
6
|
|
|
5
7
|
<sonic-code>
|
|
@@ -54,12 +56,8 @@
|
|
|
54
56
|
|
|
55
57
|
<sonic-code>
|
|
56
58
|
<template>
|
|
57
|
-
<div class="bg-neutral-
|
|
58
|
-
<sonic-progress
|
|
59
|
-
<sonic-progress invert type="info" value="50">50%</sonic-progress>
|
|
60
|
-
<sonic-progress invert type="warning" value="50">50%</sonic-progress>
|
|
61
|
-
<sonic-progress invert type="success" value="50">50%</sonic-progress>
|
|
62
|
-
<sonic-progress invert type="danger" value="50">50%</sonic-progress>
|
|
59
|
+
<div class="bg-neutral-900 p-4 rounded-md">
|
|
60
|
+
<sonic-progress type="invert" value="50">50%</sonic-progress>
|
|
63
61
|
</div>
|
|
64
62
|
</template>
|
|
65
63
|
</sonic-code>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {html, LitElement, css} from "lit";
|
|
2
|
-
import {customElement, property} from "lit/decorators.js";
|
|
3
|
-
import {ifDefined} from "lit/directives/if-defined.js";
|
|
4
|
-
import {
|
|
1
|
+
import { html, LitElement, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4
|
+
import {
|
|
5
|
+
fontSize,
|
|
6
|
+
Size,
|
|
7
|
+
} from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
5
8
|
|
|
6
9
|
const tagName = "sonic-progress";
|
|
7
10
|
|
|
@@ -85,8 +88,13 @@ export class Progress extends LitElement {
|
|
|
85
88
|
--sc-progress-color: var(--sc-success);
|
|
86
89
|
}
|
|
87
90
|
|
|
91
|
+
:host([type="invert"]) {
|
|
92
|
+
--sc-progress-bg: rgba(190, 190, 190, 0.125);
|
|
93
|
+
--sc-progress-color: var(--sc-base);
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
:host([invert]) {
|
|
89
|
-
--sc-progress-bg: rgba(
|
|
97
|
+
--sc-progress-bg: rgba(190, 190, 190, 0.125);
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
:host([type="default"][invert]) {
|
|
@@ -115,14 +123,21 @@ export class Progress extends LitElement {
|
|
|
115
123
|
`,
|
|
116
124
|
];
|
|
117
125
|
|
|
118
|
-
@property({type: Number}) value?: number;
|
|
119
|
-
@property({type: Number}) max = 100;
|
|
120
|
-
@property({type: Boolean}) invert = false;
|
|
121
|
-
|
|
122
|
-
@property({type: String, reflect: true})
|
|
123
|
-
type:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
@property({ type: Number }) value?: number;
|
|
127
|
+
@property({ type: Number }) max = 100;
|
|
128
|
+
@property({ type: Boolean }) invert = false;
|
|
129
|
+
|
|
130
|
+
@property({ type: String, reflect: true })
|
|
131
|
+
type:
|
|
132
|
+
| "default"
|
|
133
|
+
| "primary"
|
|
134
|
+
| "warning"
|
|
135
|
+
| "danger"
|
|
136
|
+
| "success"
|
|
137
|
+
| "info"
|
|
138
|
+
| "invert" = "default";
|
|
139
|
+
|
|
140
|
+
@property({ type: String, reflect: true }) size?: Size;
|
|
126
141
|
|
|
127
142
|
render() {
|
|
128
143
|
return html`
|