ds-one 0.2.5-alpha.9 → 0.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DS1/0-face/device.ts +313 -29
- package/DS1/1-root/fonts/Iosevka-Regular.woff2 +0 -0
- package/DS1/1-root/one.css +124 -77
- package/DS1/2-core/ds-banner.ts +120 -1
- package/DS1/2-core/ds-button.ts +16 -93
- package/DS1/2-core/ds-card.ts +137 -0
- package/DS1/2-core/ds-cycle.ts +77 -179
- package/DS1/2-core/ds-date.ts +3 -10
- package/DS1/2-core/ds-gap.ts +38 -0
- package/DS1/2-core/ds-icon.ts +6 -35
- package/DS1/2-core/ds-input.ts +306 -1
- package/DS1/2-core/ds-pagedots.ts +52 -0
- package/DS1/2-core/ds-text.ts +55 -28
- package/DS1/2-core/ds-tooltip.ts +12 -58
- package/DS1/2-core/styles/ds-banner.css +77 -0
- package/DS1/2-core/styles/ds-button.css +67 -0
- package/DS1/2-core/styles/ds-cycle.css +21 -0
- package/DS1/2-core/styles/ds-date.css +9 -0
- package/DS1/2-core/styles/ds-gap.css +93 -0
- package/DS1/2-core/styles/ds-icon.css +30 -0
- package/DS1/2-core/styles/ds-input.css +46 -0
- package/DS1/2-core/styles/ds-pagedots.css +31 -0
- package/DS1/2-core/styles/ds-text.css +29 -0
- package/DS1/2-core/styles/ds-tooltip.css +49 -0
- package/DS1/3-unit/ds-accordion.ts +95 -0
- package/DS1/3-unit/ds-form.ts +304 -0
- package/DS1/3-unit/ds-list.ts +5 -14
- package/DS1/3-unit/ds-row.ts +3 -19
- package/DS1/3-unit/ds-table.ts +3 -86
- package/DS1/3-unit/styles/ds-accordion.css +46 -0
- package/DS1/3-unit/styles/ds-list.css +9 -0
- package/DS1/3-unit/styles/ds-row.css +19 -0
- package/DS1/3-unit/styles/ds-table.css +80 -0
- package/DS1/4-page/ds-container.ts +28 -0
- package/DS1/4-page/ds-grid.ts +37 -50
- package/DS1/4-page/ds-layout.ts +652 -163
- package/DS1/4-page/styles/ds-container.css +35 -0
- package/DS1/4-page/styles/ds-grid.css +56 -0
- package/DS1/4-page/styles/ds-layout.css +246 -0
- package/DS1/index.ts +8 -1
- package/DS1/vite-env.d.ts +13 -0
- package/DS1/x-icon/2x.svg +4 -0
- package/DS1/x-icon/2xdots.svg +18 -0
- package/DS1/x-icon/2xgrid.svg +6 -0
- package/DS1/x-icon/2xlines.svg +6 -0
- package/DS1/x-icon/4x4.svg +18 -0
- package/DS1/x-icon/apple.svg +4 -0
- package/DS1/x-icon/avatar.svg +4 -0
- package/DS1/x-icon/big.svg +4 -0
- package/DS1/x-icon/blank.svg +3 -0
- package/DS1/x-icon/check.svg +3 -0
- package/DS1/x-icon/close.svg +3 -0
- package/DS1/x-icon/collapse.svg +3 -0
- package/DS1/x-icon/color.svg +4 -0
- package/DS1/x-icon/column.svg +5 -0
- package/DS1/x-icon/default.svg +3 -0
- package/DS1/x-icon/delete.svg +5 -0
- package/DS1/x-icon/dictate.svg +6 -0
- package/DS1/x-icon/do.svg +3 -0
- package/DS1/x-icon/down.svg +3 -0
- package/DS1/x-icon/duplicate.svg +4 -0
- package/DS1/x-icon/gallery.svg +5 -0
- package/DS1/x-icon/google.svg +6 -0
- package/DS1/x-icon/head.svg +5 -0
- package/DS1/x-icon/home.svg +3 -0
- package/DS1/x-icon/icon.svg +4 -0
- package/DS1/x-icon/in.svg +4 -0
- package/DS1/x-icon/lock.svg +5 -0
- package/DS1/x-icon/loop.svg +5 -0
- package/DS1/x-icon/mic.svg +5 -0
- package/DS1/x-icon/minimize.svg +3 -0
- package/DS1/x-icon/more.svg +5 -0
- package/DS1/x-icon/neutral.svg +6 -0
- package/DS1/x-icon/note.svg +6 -0
- package/DS1/x-icon/page.svg +4 -0
- package/DS1/x-icon/plus.svg +3 -0
- package/DS1/x-icon/rewind.svg +4 -0
- package/DS1/x-icon/row.svg +5 -0
- package/DS1/x-icon/sdown.svg +3 -0
- package/DS1/x-icon/search.svg +4 -0
- package/DS1/x-icon/see.svg +4 -0
- package/DS1/x-icon/ship.svg +5 -0
- package/DS1/x-icon/star.svg +3 -0
- package/DS1/x-icon/status.svg +4 -0
- package/DS1/x-icon/sup.svg +3 -0
- package/DS1/x-icon/title.svg +3 -0
- package/DS1/x-icon/undo.svg +3 -0
- package/DS1/x-icon/ungroup.svg +4 -0
- package/DS1/x-icon/unhead.svg +3 -0
- package/DS1/x-icon/unicon.svg +3 -0
- package/DS1/x-icon/unlock.svg +5 -0
- package/DS1/x-icon/unmic.svg +6 -0
- package/DS1/x-icon/unsee.svg +5 -0
- package/DS1/x-icon/unstar.svg +3 -0
- package/DS1/x-icon/untitle.svg +3 -0
- package/DS1/x-icon/up.svg +3 -0
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/dist/0-face/device.d.ts +52 -1
- package/dist/0-face/device.d.ts.map +1 -1
- package/dist/0-face/device.js +239 -21
- package/dist/2-core/ds-banner.d.ts +67 -0
- package/dist/2-core/ds-banner.d.ts.map +1 -1
- package/dist/2-core/ds-banner.js +97 -1
- package/dist/2-core/ds-button.d.ts +4 -15
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +14 -86
- package/dist/2-core/ds-card.d.ts +39 -0
- package/dist/2-core/ds-card.d.ts.map +1 -0
- package/dist/2-core/ds-card.js +119 -0
- package/dist/2-core/ds-cycle.d.ts +1 -5
- package/dist/2-core/ds-cycle.d.ts.map +1 -1
- package/dist/2-core/ds-cycle.js +74 -163
- package/dist/2-core/ds-date.d.ts.map +1 -1
- package/dist/2-core/ds-date.js +3 -9
- package/dist/2-core/ds-gap.d.ts +28 -0
- package/dist/2-core/ds-gap.d.ts.map +1 -0
- package/dist/2-core/ds-gap.js +25 -0
- package/dist/2-core/ds-icon.d.ts.map +1 -1
- package/dist/2-core/ds-icon.js +6 -35
- package/dist/2-core/ds-input.d.ts +127 -0
- package/dist/2-core/ds-input.d.ts.map +1 -1
- package/dist/2-core/ds-input.js +252 -1
- package/dist/2-core/ds-pagedots.d.ts +32 -0
- package/dist/2-core/ds-pagedots.d.ts.map +1 -0
- package/dist/2-core/ds-pagedots.js +36 -0
- package/dist/2-core/ds-text.d.ts +5 -3
- package/dist/2-core/ds-text.d.ts.map +1 -1
- package/dist/2-core/ds-text.js +49 -27
- package/dist/2-core/ds-tooltip.d.ts +2 -2
- package/dist/2-core/ds-tooltip.d.ts.map +1 -1
- package/dist/2-core/ds-tooltip.js +11 -57
- package/dist/3-unit/ds-accordion.d.ts +47 -0
- package/dist/3-unit/ds-accordion.d.ts.map +1 -0
- package/dist/3-unit/ds-accordion.js +75 -0
- package/dist/3-unit/ds-form.d.ts +70 -0
- package/dist/3-unit/ds-form.d.ts.map +1 -0
- package/dist/3-unit/ds-form.js +232 -0
- package/dist/3-unit/ds-list.d.ts.map +1 -1
- package/dist/3-unit/ds-list.js +5 -11
- package/dist/3-unit/ds-row.d.ts.map +1 -1
- package/dist/3-unit/ds-row.js +3 -19
- package/dist/3-unit/ds-table.d.ts.map +1 -1
- package/dist/3-unit/ds-table.js +3 -86
- package/dist/{3-unit/row-v1.d.ts → 4-page/ds-container.d.ts} +3 -11
- package/dist/4-page/ds-container.d.ts.map +1 -0
- package/dist/4-page/ds-container.js +11 -0
- package/dist/4-page/ds-grid.d.ts +5 -0
- package/dist/4-page/ds-grid.d.ts.map +1 -1
- package/dist/4-page/ds-grid.js +38 -56
- package/dist/4-page/ds-layout.d.ts +3 -3
- package/dist/4-page/ds-layout.d.ts.map +1 -1
- package/dist/4-page/ds-layout.js +651 -162
- package/dist/ds-one.bundle.js +3247 -2089
- package/dist/ds-one.bundle.js.map +1 -7
- package/dist/ds-one.bundle.min.js +3839 -550
- package/dist/ds-one.bundle.min.js.map +1 -7
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/package.json +4 -2
- package/dist/3-unit/doublenav-v1.d.ts +0 -51
- package/dist/3-unit/doublenav-v1.d.ts.map +0 -1
- package/dist/3-unit/doublenav-v1.js +0 -88
- package/dist/3-unit/ds-portfolio-doublenav.d.ts +0 -51
- package/dist/3-unit/ds-portfolio-doublenav.d.ts.map +0 -1
- package/dist/3-unit/ds-portfolio-doublenav.js +0 -88
- package/dist/3-unit/ds-portfolio-panel.d.ts +0 -11
- package/dist/3-unit/ds-portfolio-panel.d.ts.map +0 -1
- package/dist/3-unit/ds-portfolio-panel.js +0 -16
- package/dist/3-unit/ds-portfolio-singlenav.d.ts +0 -32
- package/dist/3-unit/ds-portfolio-singlenav.d.ts.map +0 -1
- package/dist/3-unit/ds-portfolio-singlenav.js +0 -62
- package/dist/3-unit/list-v1.d.ts +0 -11
- package/dist/3-unit/list-v1.d.ts.map +0 -1
- package/dist/3-unit/list-v1.js +0 -15
- package/dist/3-unit/panel-v1.d.ts +0 -11
- package/dist/3-unit/panel-v1.d.ts.map +0 -1
- package/dist/3-unit/panel-v1.js +0 -16
- package/dist/3-unit/row-v1.d.ts.map +0 -1
- package/dist/3-unit/row-v1.js +0 -32
- package/dist/3-unit/singlenav-v1.d.ts +0 -32
- package/dist/3-unit/singlenav-v1.d.ts.map +0 -1
- package/dist/3-unit/singlenav-v1.js +0 -62
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import "../2-core/ds-text";
|
|
3
|
+
import "../2-core/ds-icon";
|
|
4
|
+
import "./ds-row";
|
|
5
|
+
import styles from "./styles/ds-accordion.css?inline";
|
|
6
|
+
/**
|
|
7
|
+
* Native accordion using <details>/<summary> (no JS toggle logic).
|
|
8
|
+
*
|
|
9
|
+
* Usage (with translation text):
|
|
10
|
+
* <ds-accordion summary="How it began" details="Designed in Hokkaido"></ds-accordion>
|
|
11
|
+
*
|
|
12
|
+
* Usage (with slotted details content):
|
|
13
|
+
* <ds-accordion summary="How it began">
|
|
14
|
+
* <div slot="details">Rich HTML content here</div>
|
|
15
|
+
* </ds-accordion>
|
|
16
|
+
*/
|
|
17
|
+
export class Accordion extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.summary = "";
|
|
21
|
+
this.details = "";
|
|
22
|
+
this.open = false;
|
|
23
|
+
this._hasSlottedContent = false;
|
|
24
|
+
}
|
|
25
|
+
_handleSlotChange(e) {
|
|
26
|
+
const slot = e.target;
|
|
27
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
28
|
+
// Filter out empty text nodes (whitespace only)
|
|
29
|
+
const hasContent = assignedNodes.some((node) => node.nodeType === Node.ELEMENT_NODE ||
|
|
30
|
+
(node.nodeType === Node.TEXT_NODE && node.textContent?.trim()));
|
|
31
|
+
this._hasSlottedContent = hasContent;
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return html `
|
|
35
|
+
<details ?open=${this.open}>
|
|
36
|
+
<summary>
|
|
37
|
+
<ds-row class="summaryRow" type="centered">
|
|
38
|
+
<ds-text .text=${this.summary}></ds-text>
|
|
39
|
+
<ds-icon class="chevron" aria-hidden="true">
|
|
40
|
+
<svg
|
|
41
|
+
viewBox="0 0 10.157 8.219"
|
|
42
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
focusable="false"
|
|
45
|
+
>
|
|
46
|
+
<path
|
|
47
|
+
d="M5.078 8.219L0 3.141L1.414 1.727L5.078 5.391L8.743 1.727L10.157 3.141L5.078 8.219Z"
|
|
48
|
+
fill="currentColor"
|
|
49
|
+
/>
|
|
50
|
+
</svg>
|
|
51
|
+
</ds-icon>
|
|
52
|
+
</ds-row>
|
|
53
|
+
</summary>
|
|
54
|
+
|
|
55
|
+
<div class="detailsBody">
|
|
56
|
+
<slot name="details" @slotchange=${this._handleSlotChange}></slot>
|
|
57
|
+
${!this._hasSlottedContent
|
|
58
|
+
? html `<ds-text
|
|
59
|
+
class="detailsText"
|
|
60
|
+
.text=${this.details}
|
|
61
|
+
></ds-text>`
|
|
62
|
+
: ""}
|
|
63
|
+
</div>
|
|
64
|
+
</details>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
Accordion.properties = {
|
|
69
|
+
summary: { type: String },
|
|
70
|
+
details: { type: String },
|
|
71
|
+
open: { type: Boolean, reflect: true },
|
|
72
|
+
_hasSlottedContent: { type: Boolean, state: true },
|
|
73
|
+
};
|
|
74
|
+
Accordion.styles = unsafeCSS(styles);
|
|
75
|
+
customElements.define("ds-accordion", Accordion);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export interface FormData {
|
|
3
|
+
[key: string]: string | number | boolean | null;
|
|
4
|
+
}
|
|
5
|
+
export interface FormValidationResult {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
errors: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare class Form extends LitElement {
|
|
12
|
+
static properties: {
|
|
13
|
+
action: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
method: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
};
|
|
19
|
+
name: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
};
|
|
22
|
+
novalidate: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
reflect: boolean;
|
|
25
|
+
};
|
|
26
|
+
autocomplete: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
};
|
|
29
|
+
_isSubmitting: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
state: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
action: string;
|
|
35
|
+
method: "get" | "post";
|
|
36
|
+
name: string;
|
|
37
|
+
novalidate: boolean;
|
|
38
|
+
autocomplete: "on" | "off";
|
|
39
|
+
_isSubmitting: boolean;
|
|
40
|
+
constructor();
|
|
41
|
+
static styles: import("lit").CSSResult;
|
|
42
|
+
/**
|
|
43
|
+
* Get all form data as an object
|
|
44
|
+
*/
|
|
45
|
+
getFormData(): FormData;
|
|
46
|
+
private _collectFormData;
|
|
47
|
+
/**
|
|
48
|
+
* Validate the form
|
|
49
|
+
*/
|
|
50
|
+
validate(): FormValidationResult;
|
|
51
|
+
private _validateElement;
|
|
52
|
+
/**
|
|
53
|
+
* Reset the form
|
|
54
|
+
*/
|
|
55
|
+
reset(): void;
|
|
56
|
+
private _resetElement;
|
|
57
|
+
/**
|
|
58
|
+
* Submit the form
|
|
59
|
+
*/
|
|
60
|
+
submit(): Promise<void>;
|
|
61
|
+
private _handleSubmit;
|
|
62
|
+
private _handleKeydown;
|
|
63
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
"ds-form": Form;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=ds-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-form.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-form.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;MAOf;IAEM,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,IAAI,GAAG,KAAK,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;;IAY/B,MAAM,CAAC,MAAM,0BAqBX;IAEF;;OAEG;IACH,WAAW,IAAI,QAAQ;IAYvB,OAAO,CAAC,gBAAgB;IA8BxB;;OAEG;IACH,QAAQ,IAAI,oBAAoB;IAoBhC,OAAO,CAAC,gBAAgB;IAmCxB;;OAEG;IACH,KAAK,IAAI,IAAI;IAWb,OAAO,CAAC,aAAa;IA0BrB;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAsD7B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;IAWtB,MAAM;CAeP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// ds-form.ts
|
|
2
|
+
// Form component for handling form submissions and validation
|
|
3
|
+
import { LitElement, html, css } from "lit";
|
|
4
|
+
export class Form extends LitElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.action = "";
|
|
8
|
+
this.method = "post";
|
|
9
|
+
this.name = "";
|
|
10
|
+
this.novalidate = false;
|
|
11
|
+
this.autocomplete = "on";
|
|
12
|
+
this._isSubmitting = false;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all form data as an object
|
|
16
|
+
*/
|
|
17
|
+
getFormData() {
|
|
18
|
+
const data = {};
|
|
19
|
+
const slot = this.shadowRoot?.querySelector("slot");
|
|
20
|
+
const elements = slot?.assignedElements({ flatten: true }) || [];
|
|
21
|
+
for (const element of elements) {
|
|
22
|
+
this._collectFormData(element, data);
|
|
23
|
+
}
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
_collectFormData(element, data) {
|
|
27
|
+
// Check if element has name and value properties
|
|
28
|
+
const name = element.getAttribute("name") || element.name;
|
|
29
|
+
if (name) {
|
|
30
|
+
const value = element.value;
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
// Handle checkboxes and radio buttons
|
|
33
|
+
if (element instanceof HTMLInputElement &&
|
|
34
|
+
(element.type === "checkbox" || element.type === "radio")) {
|
|
35
|
+
if (element.type === "checkbox") {
|
|
36
|
+
data[name] = element.checked;
|
|
37
|
+
}
|
|
38
|
+
else if (element.type === "radio" && element.checked) {
|
|
39
|
+
data[name] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
data[name] = value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Recursively check children
|
|
48
|
+
const children = element.shadowRoot?.querySelectorAll("*") || element.querySelectorAll("*");
|
|
49
|
+
children.forEach((child) => {
|
|
50
|
+
this._collectFormData(child, data);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validate the form
|
|
55
|
+
*/
|
|
56
|
+
validate() {
|
|
57
|
+
const result = {
|
|
58
|
+
valid: true,
|
|
59
|
+
errors: {},
|
|
60
|
+
};
|
|
61
|
+
if (this.novalidate) {
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
const slot = this.shadowRoot?.querySelector("slot");
|
|
65
|
+
const elements = slot?.assignedElements({ flatten: true }) || [];
|
|
66
|
+
for (const element of elements) {
|
|
67
|
+
this._validateElement(element, result);
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
_validateElement(element, result) {
|
|
72
|
+
const name = element.getAttribute("name") || element.name;
|
|
73
|
+
// Check for custom validation on ds-input elements
|
|
74
|
+
if (element.tagName.toLowerCase() === "ds-input") {
|
|
75
|
+
const input = element;
|
|
76
|
+
if (input.required && !input.value) {
|
|
77
|
+
result.valid = false;
|
|
78
|
+
result.errors[name || "unknown"] = "This field is required";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Check native form elements
|
|
82
|
+
if (element instanceof HTMLInputElement ||
|
|
83
|
+
element instanceof HTMLTextAreaElement ||
|
|
84
|
+
element instanceof HTMLSelectElement) {
|
|
85
|
+
if (!element.checkValidity()) {
|
|
86
|
+
result.valid = false;
|
|
87
|
+
result.errors[name || "unknown"] = element.validationMessage;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Recursively check children
|
|
91
|
+
const children = element.shadowRoot?.querySelectorAll("*") || element.querySelectorAll("*");
|
|
92
|
+
children.forEach((child) => {
|
|
93
|
+
this._validateElement(child, result);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Reset the form
|
|
98
|
+
*/
|
|
99
|
+
reset() {
|
|
100
|
+
const slot = this.shadowRoot?.querySelector("slot");
|
|
101
|
+
const elements = slot?.assignedElements({ flatten: true }) || [];
|
|
102
|
+
for (const element of elements) {
|
|
103
|
+
this._resetElement(element);
|
|
104
|
+
}
|
|
105
|
+
this.dispatchEvent(new CustomEvent("form-reset", { bubbles: true }));
|
|
106
|
+
}
|
|
107
|
+
_resetElement(element) {
|
|
108
|
+
if (element instanceof HTMLInputElement ||
|
|
109
|
+
element instanceof HTMLTextAreaElement ||
|
|
110
|
+
element instanceof HTMLSelectElement) {
|
|
111
|
+
if (element instanceof HTMLInputElement && element.type === "checkbox") {
|
|
112
|
+
element.checked = false;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
element.value = "";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Handle ds-input elements
|
|
119
|
+
if (element.tagName.toLowerCase() === "ds-input") {
|
|
120
|
+
element.value = "";
|
|
121
|
+
}
|
|
122
|
+
// Recursively reset children
|
|
123
|
+
const children = element.shadowRoot?.querySelectorAll("*") || element.querySelectorAll("*");
|
|
124
|
+
children.forEach((child) => {
|
|
125
|
+
this._resetElement(child);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Submit the form
|
|
130
|
+
*/
|
|
131
|
+
async submit() {
|
|
132
|
+
if (this._isSubmitting)
|
|
133
|
+
return;
|
|
134
|
+
const validationResult = this.validate();
|
|
135
|
+
if (!validationResult.valid) {
|
|
136
|
+
this.dispatchEvent(new CustomEvent("form-invalid", {
|
|
137
|
+
detail: validationResult.errors,
|
|
138
|
+
bubbles: true,
|
|
139
|
+
}));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this._isSubmitting = true;
|
|
143
|
+
const formData = this.getFormData();
|
|
144
|
+
this.dispatchEvent(new CustomEvent("form-submit", {
|
|
145
|
+
detail: { data: formData },
|
|
146
|
+
bubbles: true,
|
|
147
|
+
}));
|
|
148
|
+
// If action is provided, submit to the server
|
|
149
|
+
if (this.action) {
|
|
150
|
+
try {
|
|
151
|
+
const response = await fetch(this.action, {
|
|
152
|
+
method: this.method.toUpperCase(),
|
|
153
|
+
headers: {
|
|
154
|
+
"Content-Type": "application/json",
|
|
155
|
+
},
|
|
156
|
+
body: JSON.stringify(formData),
|
|
157
|
+
});
|
|
158
|
+
this.dispatchEvent(new CustomEvent("form-response", {
|
|
159
|
+
detail: { response, data: formData },
|
|
160
|
+
bubbles: true,
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
this.dispatchEvent(new CustomEvent("form-error", {
|
|
165
|
+
detail: { error, data: formData },
|
|
166
|
+
bubbles: true,
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
this._isSubmitting = false;
|
|
171
|
+
}
|
|
172
|
+
_handleSubmit(e) {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
this.submit();
|
|
175
|
+
}
|
|
176
|
+
_handleKeydown(e) {
|
|
177
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
178
|
+
const target = e.target;
|
|
179
|
+
// Don't submit if in a textarea
|
|
180
|
+
if (target.tagName.toLowerCase() !== "textarea") {
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
this.submit();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
render() {
|
|
187
|
+
return html `
|
|
188
|
+
<form
|
|
189
|
+
.action=${this.action}
|
|
190
|
+
.method=${this.method}
|
|
191
|
+
.name=${this.name}
|
|
192
|
+
?novalidate=${this.novalidate}
|
|
193
|
+
autocomplete=${this.autocomplete}
|
|
194
|
+
@submit=${this._handleSubmit}
|
|
195
|
+
@keydown=${this._handleKeydown}
|
|
196
|
+
>
|
|
197
|
+
<slot></slot>
|
|
198
|
+
</form>
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
Form.properties = {
|
|
203
|
+
action: { type: String },
|
|
204
|
+
method: { type: String },
|
|
205
|
+
name: { type: String },
|
|
206
|
+
novalidate: { type: Boolean, reflect: true },
|
|
207
|
+
autocomplete: { type: String },
|
|
208
|
+
_isSubmitting: { type: Boolean, state: true },
|
|
209
|
+
};
|
|
210
|
+
Form.styles = css `
|
|
211
|
+
:host {
|
|
212
|
+
display: block;
|
|
213
|
+
width: 100%;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
form {
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
gap: calc(var(--05) * var(--sf, 1));
|
|
220
|
+
width: 100%;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
::slotted(*) {
|
|
224
|
+
width: 100%;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
:host([disabled]) {
|
|
228
|
+
opacity: 0.6;
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
}
|
|
231
|
+
`;
|
|
232
|
+
customElements.define("ds-form", Form);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-list.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ds-list.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAGlD,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,CAAC,MAAM,0BAAqB;IAElC,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
|
package/dist/3-unit/ds-list.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
// ds-
|
|
1
|
+
// ds-list.ts
|
|
2
2
|
// Unit component that
|
|
3
|
-
// can be used to show a list of items
|
|
4
|
-
import { LitElement, html,
|
|
3
|
+
// can be used to show a list of items consisting of components from core
|
|
4
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
5
|
+
import styles from "./styles/ds-list.css?inline";
|
|
5
6
|
export class List extends LitElement {
|
|
6
7
|
render() {
|
|
7
8
|
return html `<slot></slot>`;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
List.styles =
|
|
11
|
-
:host {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
gap: 0;
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
11
|
+
List.styles = unsafeCSS(styles);
|
|
18
12
|
customElements.define("ds-list", List);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-row.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ds-row.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAGlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,UAAU,GAAG,IAAI,CAAC;KAC5D;IACD,IAAI,cAAc,EAAE,qBAAqB,CAAC;CAC3C;AAED,qBAAa,GAAI,SAAQ,UAAU;IACjC,MAAM,CAAC,UAAU;;;;;MAEf;IAEM,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;;IAOlC,MAAM,CAAC,MAAM,0BAAqB;IAElC,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,QAAQ,EAAE,GAAG,CAAC;KACf;CACF"}
|
package/dist/3-unit/ds-row.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { LitElement, html,
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import styles from "./styles/ds-row.css?inline";
|
|
2
3
|
export class Row extends LitElement {
|
|
3
4
|
constructor() {
|
|
4
5
|
super();
|
|
@@ -11,22 +12,5 @@ export class Row extends LitElement {
|
|
|
11
12
|
Row.properties = {
|
|
12
13
|
type: { type: String, reflect: true },
|
|
13
14
|
};
|
|
14
|
-
Row.styles =
|
|
15
|
-
:host {
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: end;
|
|
18
|
-
width: calc(240px * var(--sf));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
:host([type="fill"]) {
|
|
22
|
-
justify-content: space-between;
|
|
23
|
-
height: calc(var(--1) * var(--sf));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
:host([type="centered"]) {
|
|
27
|
-
justify-content: center;
|
|
28
|
-
height: calc(var(--1) * var(--sf));
|
|
29
|
-
gap: calc(var(--025) * var(--sf));
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
15
|
+
Row.styles = unsafeCSS(styles);
|
|
32
16
|
customElements.define("ds-row", Row);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-table.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-table.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ds-table.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-table.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAGlD,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,UAAU;;;;;;;;;;;MAIf;IAEM,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;;IAS5B,MAAM,CAAC,MAAM,0BAAqB;IAElC,MAAM;CA0BP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
package/dist/3-unit/ds-table.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// ds-table.ts
|
|
2
2
|
// Data table component
|
|
3
|
-
import { LitElement, html,
|
|
3
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
4
|
+
import styles from "./styles/ds-table.css?inline";
|
|
4
5
|
export class DsTable extends LitElement {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
@@ -12,7 +13,6 @@ export class DsTable extends LitElement {
|
|
|
12
13
|
return html `
|
|
13
14
|
<div class="table-container">
|
|
14
15
|
<div class="table-header">
|
|
15
|
-
|
|
16
16
|
<div class="header-cell product-cell">Product</div>
|
|
17
17
|
<div class="header-cell users-cell">Users</div>
|
|
18
18
|
<div class="header-cell retention-cell">Retention</div>
|
|
@@ -39,88 +39,5 @@ DsTable.properties = {
|
|
|
39
39
|
columns: { type: Array },
|
|
40
40
|
showStatus: { type: Boolean, attribute: "show-status" },
|
|
41
41
|
};
|
|
42
|
-
DsTable.styles =
|
|
43
|
-
:host {
|
|
44
|
-
display: block;
|
|
45
|
-
width: 100%;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.table-container {
|
|
49
|
-
display: flex;
|
|
50
|
-
flex-direction: column;
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.table-header {
|
|
55
|
-
display: grid;
|
|
56
|
-
grid-template-columns: 160px 80px 80px 80px;
|
|
57
|
-
height: 20px;
|
|
58
|
-
width: 400px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.table-body {
|
|
62
|
-
display: grid;
|
|
63
|
-
grid-template-columns: 160px 80px 80px 80px;
|
|
64
|
-
border: 1px solid var(--black);
|
|
65
|
-
width: 400px;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.header-cell {
|
|
69
|
-
height: 20px;
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
justify-content: left;
|
|
73
|
-
padding: 0 2px;
|
|
74
|
-
font-family: var(--typeface);
|
|
75
|
-
font-size: var(--type-size-default);
|
|
76
|
-
font-weight: var(--type-weight-default);
|
|
77
|
-
line-height: var(--type-lineheight-default);
|
|
78
|
-
color: var(--black);
|
|
79
|
-
letter-spacing: -0.26px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.data-cell {
|
|
83
|
-
height: 20px;
|
|
84
|
-
margin-top: -1px;
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: center;
|
|
87
|
-
justify-content: left;
|
|
88
|
-
|
|
89
|
-
outline: 1px solid var(--black);
|
|
90
|
-
|
|
91
|
-
font-family: var(--typeface);
|
|
92
|
-
font-size: var(--type-size-default);
|
|
93
|
-
font-weight: var(--type-weight-default);
|
|
94
|
-
line-height: var(--type-lineheight-default);
|
|
95
|
-
color: var(--black);
|
|
96
|
-
letter-spacing: -0.26px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.status-cell {
|
|
100
|
-
background-color: var(--light-green);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.product-cell {
|
|
104
|
-
text-align: left;
|
|
105
|
-
justify-content: flex-start;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.users-cell,
|
|
109
|
-
.retention-cell {
|
|
110
|
-
text-align: center;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.status-cell {
|
|
114
|
-
text-align: center;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/* Responsive adjustments */
|
|
118
|
-
@media (max-width: 480px) {
|
|
119
|
-
.table-header,
|
|
120
|
-
.table-body {
|
|
121
|
-
width: 100%;
|
|
122
|
-
grid-template-columns: 1fr 60px 60px 60px;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
`;
|
|
42
|
+
DsTable.styles = unsafeCSS(styles);
|
|
126
43
|
customElements.define("ds-table", DsTable);
|
|
@@ -5,21 +5,13 @@ declare global {
|
|
|
5
5
|
}
|
|
6
6
|
var customElements: CustomElementRegistry;
|
|
7
7
|
}
|
|
8
|
-
export declare class
|
|
9
|
-
static properties: {
|
|
10
|
-
type: {
|
|
11
|
-
type: StringConstructor;
|
|
12
|
-
reflect: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
type: "fill" | "centered";
|
|
16
|
-
constructor();
|
|
8
|
+
export declare class Container extends LitElement {
|
|
17
9
|
static styles: import("lit").CSSResult;
|
|
18
10
|
render(): import("lit-html").TemplateResult<1>;
|
|
19
11
|
}
|
|
20
12
|
declare global {
|
|
21
13
|
interface HTMLElementTagNameMap {
|
|
22
|
-
"
|
|
14
|
+
"ds-container": Container;
|
|
23
15
|
}
|
|
24
16
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=ds-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-container.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAGlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,UAAU,GAAG,IAAI,CAAC;KAC5D;IACD,IAAI,cAAc,EAAE,qBAAqB,CAAC;CAC3C;AAED,qBAAa,SAAU,SAAQ,UAAU;IACvC,MAAM,CAAC,MAAM,0BAAqB;IAElC,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,SAAS,CAAC;KAC3B;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ds-container.ts
|
|
2
|
+
// Container component with responsive width constraints
|
|
3
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
4
|
+
import styles from "./styles/ds-container.css?inline";
|
|
5
|
+
export class Container extends LitElement {
|
|
6
|
+
render() {
|
|
7
|
+
return html `<slot></slot>`;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
Container.styles = unsafeCSS(styles);
|
|
11
|
+
customElements.define("ds-container", Container);
|
package/dist/4-page/ds-grid.d.ts
CHANGED
|
@@ -12,7 +12,12 @@ export declare class Grid extends LitElement {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
align?: string;
|
|
15
|
+
private resizeObserver?;
|
|
16
|
+
private resizeTimeout?;
|
|
15
17
|
static styles: import("lit").CSSResult;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
private updateMobileClass;
|
|
16
21
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
22
|
}
|
|
18
23
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-grid.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-grid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ds-grid.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-grid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAIlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,UAAU,GAAG,IAAI,CAAC;KAC5D;IACD,IAAI,cAAc,EAAE,qBAAqB,CAAC;CAC3C;AAED,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,CAAC,UAAU;;;;MAEf;IAEF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,cAAc,CAAC,CAAa;IACpC,OAAO,CAAC,aAAa,CAAC,CAAM;IAE5B,MAAM,CAAC,MAAM,0BAAqB;IAElC,iBAAiB;IAgBjB,oBAAoB;IAUpB,OAAO,CAAC,iBAAiB;IAWzB,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
|