@chiralkit/design-system 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/chiralkit-ds/chiralkit-ds.css +1 -0
- package/dist/chiralkit-ds/chiralkit-ds.esm.js +1 -0
- package/dist/chiralkit-ds/index.esm.js +1 -0
- package/dist/chiralkit-ds/p-038fa008.entry.js +1 -0
- package/dist/chiralkit-ds/p-2fdc1012.entry.js +1 -0
- package/dist/chiralkit-ds/p-306ec33b.entry.js +1 -0
- package/dist/chiralkit-ds/p-3f704698.entry.js +1 -0
- package/dist/chiralkit-ds/p-41081d22.entry.js +1 -0
- package/dist/chiralkit-ds/p-7d7e5aac.entry.js +1 -0
- package/dist/chiralkit-ds/p-84b801f8.entry.js +1 -0
- package/dist/chiralkit-ds/p-a28c71b4.entry.js +1 -0
- package/dist/chiralkit-ds/p-be84312f.entry.js +1 -0
- package/dist/chiralkit-ds/p-c8015fe6.entry.js +1 -0
- package/dist/chiralkit-ds/p-d36a6bea.entry.js +1 -0
- package/dist/chiralkit-ds/p-e-glNjK6.js +2 -0
- package/dist/chiralkit-ds/p-f0f9ff61.entry.js +1 -0
- package/dist/cjs/chiralkit-ds.cjs.js +24 -0
- package/dist/cjs/ds-badge.cjs.entry.js +18 -0
- package/dist/cjs/ds-button.cjs.entry.js +26 -0
- package/dist/cjs/ds-card.cjs.entry.js +17 -0
- package/dist/cjs/ds-checkbox.cjs.entry.js +67 -0
- package/dist/cjs/ds-code-block.cjs.entry.js +39 -0
- package/dist/cjs/ds-dialog.cjs.entry.js +67 -0
- package/dist/cjs/ds-input.cjs.entry.js +50 -0
- package/dist/cjs/ds-loader.cjs.entry.js +26 -0
- package/dist/cjs/ds-select.cjs.entry.js +85 -0
- package/dist/cjs/ds-tabs.cjs.entry.js +138 -0
- package/dist/cjs/ds-textarea.cjs.entry.js +50 -0
- package/dist/cjs/ds-tooltip.cjs.entry.js +233 -0
- package/dist/cjs/index-mMvyq7U_.js +2018 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/collection/collection-manifest.json +24 -0
- package/dist/collection/components/ds-badge/ds-badge.css +36 -0
- package/dist/collection/components/ds-badge/ds-badge.js +93 -0
- package/dist/collection/components/ds-button/ds-button.css +66 -0
- package/dist/collection/components/ds-button/ds-button.js +197 -0
- package/dist/collection/components/ds-card/ds-card.css +12 -0
- package/dist/collection/components/ds-card/ds-card.js +68 -0
- package/dist/collection/components/ds-checkbox/ds-checkbox.css +22 -0
- package/dist/collection/components/ds-checkbox/ds-checkbox.js +339 -0
- package/dist/collection/components/ds-code-block/ds-code-block.css +65 -0
- package/dist/collection/components/ds-code-block/ds-code-block.js +162 -0
- package/dist/collection/components/ds-dialog/ds-dialog.css +30 -0
- package/dist/collection/components/ds-dialog/ds-dialog.js +313 -0
- package/dist/collection/components/ds-input/ds-input.css +38 -0
- package/dist/collection/components/ds-input/ds-input.js +353 -0
- package/dist/collection/components/ds-loader/ds-loader.css +94 -0
- package/dist/collection/components/ds-loader/ds-loader.js +149 -0
- package/dist/collection/components/ds-select/ds-select.css +69 -0
- package/dist/collection/components/ds-select/ds-select.js +235 -0
- package/dist/collection/components/ds-tabs/ds-tabs.css +59 -0
- package/dist/collection/components/ds-tabs/ds-tabs.js +248 -0
- package/dist/collection/components/ds-textarea/ds-textarea.css +41 -0
- package/dist/collection/components/ds-textarea/ds-textarea.js +342 -0
- package/dist/collection/components/ds-tooltip/ds-tooltip.css +31 -0
- package/dist/collection/components/ds-tooltip/ds-tooltip.js +318 -0
- package/dist/collection/components.js +2 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/ds-badge.d.ts +11 -0
- package/dist/components/ds-badge.js +1 -0
- package/dist/components/ds-button.d.ts +11 -0
- package/dist/components/ds-button.js +1 -0
- package/dist/components/ds-card.d.ts +11 -0
- package/dist/components/ds-card.js +1 -0
- package/dist/components/ds-checkbox.d.ts +11 -0
- package/dist/components/ds-checkbox.js +1 -0
- package/dist/components/ds-code-block.d.ts +11 -0
- package/dist/components/ds-code-block.js +1 -0
- package/dist/components/ds-dialog.d.ts +11 -0
- package/dist/components/ds-dialog.js +1 -0
- package/dist/components/ds-input.d.ts +11 -0
- package/dist/components/ds-input.js +1 -0
- package/dist/components/ds-loader.d.ts +11 -0
- package/dist/components/ds-loader.js +1 -0
- package/dist/components/ds-select.d.ts +11 -0
- package/dist/components/ds-select.js +1 -0
- package/dist/components/ds-tabs.d.ts +11 -0
- package/dist/components/ds-tabs.js +1 -0
- package/dist/components/ds-textarea.d.ts +11 -0
- package/dist/components/ds-textarea.js +1 -0
- package/dist/components/ds-tooltip.d.ts +11 -0
- package/dist/components/ds-tooltip.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-DDUZow8F.js +1 -0
- package/dist/components/p-ZsYP0VBq.js +1 -0
- package/dist/components/p-k0ywxWpC.js +1 -0
- package/dist/esm/chiralkit-ds.js +20 -0
- package/dist/esm/ds-badge.entry.js +16 -0
- package/dist/esm/ds-button.entry.js +24 -0
- package/dist/esm/ds-card.entry.js +15 -0
- package/dist/esm/ds-checkbox.entry.js +65 -0
- package/dist/esm/ds-code-block.entry.js +37 -0
- package/dist/esm/ds-dialog.entry.js +65 -0
- package/dist/esm/ds-input.entry.js +48 -0
- package/dist/esm/ds-loader.entry.js +24 -0
- package/dist/esm/ds-select.entry.js +83 -0
- package/dist/esm/ds-tabs.entry.js +136 -0
- package/dist/esm/ds-textarea.entry.js +48 -0
- package/dist/esm/ds-tooltip.entry.js +231 -0
- package/dist/esm/index-e-glNjK6.js +2008 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +10 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/layouts/app-shell.css +84 -0
- package/dist/tests/a11y.js +55 -0
- package/dist/types/Users/alex/projects/MyGitHub/chiralkit/packages/design-system/.stencil/tests/a11y.d.ts +17 -0
- package/dist/types/components/ds-badge/ds-badge.d.ts +54 -0
- package/dist/types/components/ds-button/ds-button.d.ts +75 -0
- package/dist/types/components/ds-card/ds-card.d.ts +53 -0
- package/dist/types/components/ds-checkbox/ds-checkbox.d.ts +94 -0
- package/dist/types/components/ds-code-block/ds-code-block.d.ts +83 -0
- package/dist/types/components/ds-dialog/ds-dialog.d.ts +148 -0
- package/dist/types/components/ds-input/ds-input.d.ts +104 -0
- package/dist/types/components/ds-loader/ds-loader.d.ts +64 -0
- package/dist/types/components/ds-select/ds-select.d.ts +123 -0
- package/dist/types/components/ds-tabs/ds-tabs.d.ts +155 -0
- package/dist/types/components/ds-textarea/ds-textarea.d.ts +93 -0
- package/dist/types/components/ds-tooltip/ds-tooltip.d.ts +26 -0
- package/dist/types/components.d.ts +3068 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1861 -0
- package/docs.json +2112 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +78 -0
- package/react/components/ds-badge.tsx +25 -0
- package/react/components/ds-button.tsx +25 -0
- package/react/components/ds-card.tsx +25 -0
- package/react/components/ds-checkbox.tsx +25 -0
- package/react/components/ds-code-block.tsx +25 -0
- package/react/components/ds-dialog.tsx +31 -0
- package/react/components/ds-input.tsx +25 -0
- package/react/components/ds-loader.tsx +25 -0
- package/react/components/ds-select.tsx +25 -0
- package/react/components/ds-tabs.tsx +25 -0
- package/react/components/ds-textarea.tsx +25 -0
- package/react/components/ds-tooltip.tsx +25 -0
- package/react/components.ts +162 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dsButton_entry = require('./ds-button.entry.cjs.js');
|
|
4
|
+
var dsSelect_entry = require('./ds-select.entry.cjs.js');
|
|
5
|
+
require('./index-mMvyq7U_.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.DsButton = dsButton_entry.ds_button;
|
|
10
|
+
exports.DsSelect = dsSelect_entry.ds_select;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-mMvyq7U_.js');
|
|
4
|
+
|
|
5
|
+
const defineCustomElements = async (win, options) => {
|
|
6
|
+
if (typeof window === 'undefined') return undefined;
|
|
7
|
+
await index.globalScripts();
|
|
8
|
+
return index.bootstrapLazy([["ds-badge.cjs",[[769,"ds-badge",{"variant":[1]}]]],["ds-button.cjs",[[769,"ds-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1],"href":[1]}]]],["ds-card.cjs",[[257,"ds-card"]]],["ds-checkbox.cjs",[[513,"ds-checkbox",{"checked":[4],"indeterminate":[4],"name":[1],"value":[1],"disabled":[4],"required":[4],"invalid":[4],"describedBy":[1,"described-by"],"label":[1]},null,{"checked":[{"watchChecked":0}],"indeterminate":[{"watchIndeterminate":0}]}]]],["ds-code-block.cjs",[[513,"ds-code-block",{"code":[1],"language":[1],"copied":[32]}]]],["ds-dialog.cjs",[[769,"ds-dialog",{"open":[4],"label":[1],"labelledBy":[1,"labelled-by"],"describedBy":[1,"described-by"]},null,{"open":[{"watchOpen":0}]}]]],["ds-input.cjs",[[513,"ds-input",{"value":[1],"name":[1],"type":[1],"placeholder":[1],"disabled":[4],"required":[4],"invalid":[4],"describedBy":[1,"described-by"],"label":[1],"size":[1]},null,{"value":[{"watchValue":0}]}]]],["ds-loader.cjs",[[513,"ds-loader",{"size":[1],"label":[1],"speed":[1]}]]],["ds-select.cjs",[[513,"ds-select",{"value":[1],"name":[1],"disabled":[4],"size":[1],"label":[1],"options":[1]},null,{"value":[{"watchValue":0}],"options":[{"watchOptions":0}]}]]],["ds-tabs.cjs",[[512,"ds-tabs",{"items":[1],"active":[1025],"orientation":[1],"label":[1]},null,{"items":[{"watchItems":0}]}]]],["ds-textarea.cjs",[[513,"ds-textarea",{"value":[1],"name":[1],"placeholder":[1],"disabled":[4],"required":[4],"invalid":[4],"describedBy":[1,"described-by"],"label":[1],"rows":[2],"size":[1]},null,{"value":[{"watchValue":0}]}]]],["ds-tooltip.cjs",[[772,"ds-tooltip",{"label":[1],"openDelay":[2,"open-delay"],"closeDelay":[2,"close-delay"],"placement":[1]},null,{"label":[{"watchLabel":0}]}]]]], options);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.setNonce = index.setNonce;
|
|
12
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/ds-button/ds-button.js",
|
|
4
|
+
"components/ds-select/ds-select.js",
|
|
5
|
+
"components/ds-badge/ds-badge.js",
|
|
6
|
+
"components/ds-card/ds-card.js",
|
|
7
|
+
"components/ds-checkbox/ds-checkbox.js",
|
|
8
|
+
"components/ds-code-block/ds-code-block.js",
|
|
9
|
+
"components/ds-dialog/ds-dialog.js",
|
|
10
|
+
"components/ds-input/ds-input.js",
|
|
11
|
+
"components/ds-loader/ds-loader.js",
|
|
12
|
+
"components/ds-tabs/ds-tabs.js",
|
|
13
|
+
"components/ds-textarea/ds-textarea.js",
|
|
14
|
+
"components/ds-tooltip/ds-tooltip.js"
|
|
15
|
+
],
|
|
16
|
+
"mixins": [],
|
|
17
|
+
"compiler": {
|
|
18
|
+
"name": "@stencil/core",
|
|
19
|
+
"version": "4.43.5",
|
|
20
|
+
"typescriptVersion": "5.8.3"
|
|
21
|
+
},
|
|
22
|
+
"collections": [],
|
|
23
|
+
"bundles": []
|
|
24
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ds-badge {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
padding: 3px 8px;
|
|
8
|
+
border-radius: 999px;
|
|
9
|
+
font-family: var(--ds-font-family);
|
|
10
|
+
font-size: 11px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
letter-spacing: 0.02em;
|
|
13
|
+
line-height: 1.4;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
color: currentColor;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-badge--neutral {
|
|
19
|
+
background-color: oklch(0.65 0.03 260 / 0.15);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-badge--ui-component {
|
|
23
|
+
background-color: oklch(0.733 0.178 307 / 0.15);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-badge--recipe {
|
|
27
|
+
background-color: oklch(0.75 0.13 190 / 0.15);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ds-badge--agent {
|
|
31
|
+
background-color: oklch(0.82 0.15 80 / 0.15);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-badge--config {
|
|
35
|
+
background-color: oklch(0.65 0.03 260 / 0.15);
|
|
36
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* ## Accessibility
|
|
4
|
+
*
|
|
5
|
+
* **Category:** static-display
|
|
6
|
+
* **APG pattern:** N/A — non-interactive text label.
|
|
7
|
+
*
|
|
8
|
+
* **Keyboard interactions:**
|
|
9
|
+
* - Tab: N/A — the badge is not focusable and does not appear in tab order.
|
|
10
|
+
* - Enter: N/A.
|
|
11
|
+
* - Escape: N/A.
|
|
12
|
+
* - Arrow keys: N/A.
|
|
13
|
+
* - Printable characters: N/A.
|
|
14
|
+
*
|
|
15
|
+
* **ARIA:**
|
|
16
|
+
* - Roles used: none — renders a plain `<span>` around a `<slot />`. The
|
|
17
|
+
* `variant` prop is a purely visual axis and MUST NOT be the sole carrier
|
|
18
|
+
* of information (color/style alone fails WCAG 1.4.1 Use of Color); the
|
|
19
|
+
* textual content inside the slot must convey the same meaning.
|
|
20
|
+
* - State attributes: none.
|
|
21
|
+
* - Labeling strategy: visible text via `<slot />`. Consumers place the
|
|
22
|
+
* readable label directly inside the tag.
|
|
23
|
+
*
|
|
24
|
+
* **Focus:**
|
|
25
|
+
* - On mount: nothing auto-focuses.
|
|
26
|
+
* - On activate/open: N/A — non-interactive.
|
|
27
|
+
* - On close/deactivate: N/A.
|
|
28
|
+
* - Focus indicator: N/A — the host is not focusable. If a consumer wraps
|
|
29
|
+
* `ds-badge` in an interactive element (e.g. `<button>`, `<a>`), that
|
|
30
|
+
* wrapper owns the focus indicator via the DS `--ds-color-focus` token
|
|
31
|
+
* and its own `:focus-visible` rule.
|
|
32
|
+
*
|
|
33
|
+
* **Motion:**
|
|
34
|
+
* - Animations: none.
|
|
35
|
+
* - Reduced-motion behavior: N/A.
|
|
36
|
+
*
|
|
37
|
+
* **Contrast:**
|
|
38
|
+
* - Text: inherits `color: inherit` / `currentColor` from the host page and
|
|
39
|
+
* the variant-specific style; not verified in isolation here. Consumers
|
|
40
|
+
* are responsible for confirming ≥ 4.5:1 (WCAG 1.4.3) against the surface
|
|
41
|
+
* the badge is placed on.
|
|
42
|
+
* - Non-text: no state-conveying icons or borders that need the 3:1
|
|
43
|
+
* non-text contrast threshold.
|
|
44
|
+
*
|
|
45
|
+
* **Screen reader announcement:**
|
|
46
|
+
* - Rendered state: announces the slot text as inline content within its
|
|
47
|
+
* surrounding context (no role means AT reads it as plain text). The
|
|
48
|
+
* `variant` value is not announced — that is intentional; the label text
|
|
49
|
+
* is the source of truth for meaning.
|
|
50
|
+
* - State change: N/A — no dynamic state owned by this component.
|
|
51
|
+
*/
|
|
52
|
+
export class DsBadge {
|
|
53
|
+
variant = "neutral";
|
|
54
|
+
render() {
|
|
55
|
+
return (h(Host, { key: '45ef132e5fd2c8a1623768ea58431b0cd4f581b4' }, h("span", { key: 'a406af30e18ffee0751ad5f10499f9ff394ae086', class: `ds-badge ds-badge--${this.variant}` }, h("slot", { key: '59bf92a176deeddf23a2f96f194ae4ed02ea0506' }))));
|
|
56
|
+
}
|
|
57
|
+
static get is() { return "ds-badge"; }
|
|
58
|
+
static get encapsulation() { return "shadow"; }
|
|
59
|
+
static get originalStyleUrls() {
|
|
60
|
+
return {
|
|
61
|
+
"$": ["ds-badge.css"]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static get styleUrls() {
|
|
65
|
+
return {
|
|
66
|
+
"$": ["ds-badge.css"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static get properties() {
|
|
70
|
+
return {
|
|
71
|
+
"variant": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"complexType": {
|
|
75
|
+
"original": "| \"neutral\"\n | \"ui-component\"\n | \"recipe\"\n | \"agent\"\n | \"config\"",
|
|
76
|
+
"resolved": "\"agent\" | \"config\" | \"neutral\" | \"recipe\" | \"ui-component\"",
|
|
77
|
+
"references": {}
|
|
78
|
+
},
|
|
79
|
+
"required": false,
|
|
80
|
+
"optional": false,
|
|
81
|
+
"docs": {
|
|
82
|
+
"tags": [],
|
|
83
|
+
"text": ""
|
|
84
|
+
},
|
|
85
|
+
"getter": false,
|
|
86
|
+
"setter": false,
|
|
87
|
+
"reflect": false,
|
|
88
|
+
"attribute": "variant",
|
|
89
|
+
"defaultValue": "\"neutral\""
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ds-button {
|
|
6
|
+
font-family: var(--ds-font-family);
|
|
7
|
+
font-weight: 500;
|
|
8
|
+
border: none;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
text-decoration: none;
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--ds-spacing-sm);
|
|
14
|
+
transition: background-color 0.15s ease-in-out;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ds-button:disabled {
|
|
18
|
+
opacity: 0.5;
|
|
19
|
+
cursor: not-allowed;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-button:focus-visible {
|
|
23
|
+
outline: 2px solid var(--ds-color-focus);
|
|
24
|
+
outline-offset: 2px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ds-button--md {
|
|
28
|
+
font-size: var(--ds-font-size-md);
|
|
29
|
+
padding: var(--ds-spacing-sm) var(--ds-spacing-lg);
|
|
30
|
+
border-radius: var(--ds-radius-sm);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ds-button--lg {
|
|
34
|
+
font-size: var(--ds-font-size-md);
|
|
35
|
+
padding: var(--ds-spacing-md) var(--ds-spacing-xl);
|
|
36
|
+
border-radius: var(--ds-radius-md);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-button--primary {
|
|
40
|
+
background-color: var(--ds-color-primary);
|
|
41
|
+
color: var(--ds-color-text-on-primary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ds-button--primary:hover:not(:disabled) {
|
|
45
|
+
background-color: var(--ds-color-primary-hover);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-button--secondary {
|
|
49
|
+
background-color: var(--ds-color-secondary);
|
|
50
|
+
color: var(--ds-color-text-on-secondary);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ds-button--secondary:hover:not(:disabled) {
|
|
54
|
+
background-color: var(--ds-color-secondary-hover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ds-button--ghost {
|
|
58
|
+
background-color: transparent;
|
|
59
|
+
color: inherit;
|
|
60
|
+
border: 1px solid currentColor;
|
|
61
|
+
opacity: 0.85;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-button--ghost:hover:not(:disabled) {
|
|
65
|
+
opacity: 1;
|
|
66
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* ## Accessibility
|
|
4
|
+
*
|
|
5
|
+
* **Category:** interactive-display
|
|
6
|
+
* **APG pattern:** Button — https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
7
|
+
* (satisfied natively by the underlying `<button>` element). When `href` is
|
|
8
|
+
* set, the component renders `<a href>` instead — a link, not a button — and
|
|
9
|
+
* that surface follows native `<a>` semantics rather than the Button pattern.
|
|
10
|
+
*
|
|
11
|
+
* **Keyboard interactions:**
|
|
12
|
+
* - Tab: moves focus to the internal `<button>` or `<a>` (shadow DOM does not
|
|
13
|
+
* interrupt tab order).
|
|
14
|
+
* - Enter: activates (fires click on `<button>`, navigates on `<a>`).
|
|
15
|
+
* - Space: activates the `<button>` variant only (native behavior); on the
|
|
16
|
+
* `<a>` variant Space scrolls the page as usual.
|
|
17
|
+
* - Escape: N/A — no dismissible state owned by this component.
|
|
18
|
+
* - Arrow keys: N/A.
|
|
19
|
+
* - Printable characters: N/A.
|
|
20
|
+
*
|
|
21
|
+
* **ARIA:**
|
|
22
|
+
* - Roles used: none explicit — the native `<button>` / `<a href>` supplies
|
|
23
|
+
* the implicit `button` / `link` role.
|
|
24
|
+
* - State attributes: `disabled` (native attribute on `<button>`, not
|
|
25
|
+
* `aria-disabled`). The `<a>` variant does not accept `disabled` — a
|
|
26
|
+
* disabled navigation is a spec smell (see spec §"Button vs Link"); if a
|
|
27
|
+
* link needs a disabled state, model it as a `<button>` action instead.
|
|
28
|
+
* - Labeling strategy: visible text via `<slot />`. Consumers MUST place
|
|
29
|
+
* readable text (or a labeled icon) inside the tag. An empty slot leaves
|
|
30
|
+
* the button/link without an accessible name and fails
|
|
31
|
+
* `button-name` / `link-name` axe rules. Icon-only usage is out of contract
|
|
32
|
+
* for `ds-button`; use a future `ds-icon-button` with a required
|
|
33
|
+
* `aria-label` prop when that lands.
|
|
34
|
+
*
|
|
35
|
+
* **Focus:**
|
|
36
|
+
* - On mount: nothing auto-focuses.
|
|
37
|
+
* - On activate: focus stays on the element (native click behavior; the
|
|
38
|
+
* component does not move focus on its own).
|
|
39
|
+
* - On close/deactivate: N/A.
|
|
40
|
+
* - Focus indicator: 2px `outline` in `var(--ds-color-focus)` with 2px
|
|
41
|
+
* `outline-offset`, applied via `:focus-visible` — replaces the browser
|
|
42
|
+
* default so both `<button>` and `<a>` variants use the same DS ring
|
|
43
|
+
* (spec universal rule 3, WCAG 1.4.11 non-text contrast ≥ 3:1).
|
|
44
|
+
*
|
|
45
|
+
* **Motion:**
|
|
46
|
+
* - Animations: 150ms `background-color` ease-in-out transition on
|
|
47
|
+
* `primary`/`secondary` variants (hover).
|
|
48
|
+
* - Reduced-motion behavior: N/A — 150ms is below the spec's 200ms threshold
|
|
49
|
+
* for `prefers-reduced-motion` handling, and the transition animates color
|
|
50
|
+
* only (no motion of position, scale, or opacity).
|
|
51
|
+
*
|
|
52
|
+
* **Contrast:**
|
|
53
|
+
* - Text: `primary` and `secondary` variants pair `--ds-color-{primary,secondary}`
|
|
54
|
+
* with `--ds-color-text-on-{primary,secondary}` — the token pairs are
|
|
55
|
+
* authored to meet WCAG 2.1 AA (≥ 4.5:1). The `ghost` variant inherits
|
|
56
|
+
* `color: inherit` and pins `opacity: 0.85`, so its effective contrast
|
|
57
|
+
* depends on the consumer's surface — verify per site.
|
|
58
|
+
* - Non-text (border on `ghost`): 1px `currentColor`; contrast tracks the
|
|
59
|
+
* text color 1:1, subject to the same host-page caveat.
|
|
60
|
+
*
|
|
61
|
+
* **Screen reader announcement:**
|
|
62
|
+
* - Rendered state: announces the slot text followed by "button" (or "link"
|
|
63
|
+
* for the `href` variant), plus "dimmed" / "unavailable" when `disabled`
|
|
64
|
+
* is set (browser/AT dependent wording).
|
|
65
|
+
* - State change: N/A — this component does not own toggle state. A pressed
|
|
66
|
+
* toggle needs `aria-pressed`, which is out of scope here; model that as
|
|
67
|
+
* a distinct component or extend the API deliberately per the spec.
|
|
68
|
+
*/
|
|
69
|
+
export class DsButton {
|
|
70
|
+
variant = "primary";
|
|
71
|
+
size = "md";
|
|
72
|
+
disabled = false;
|
|
73
|
+
type = "button";
|
|
74
|
+
href;
|
|
75
|
+
render() {
|
|
76
|
+
const cls = `ds-button ds-button--${this.variant} ds-button--${this.size}`;
|
|
77
|
+
if (this.href !== undefined) {
|
|
78
|
+
return (h(Host, null, h("a", { class: cls, href: this.href }, h("slot", null))));
|
|
79
|
+
}
|
|
80
|
+
return (h(Host, null, h("button", { class: cls, type: this.type, disabled: this.disabled }, h("slot", null))));
|
|
81
|
+
}
|
|
82
|
+
static get is() { return "ds-button"; }
|
|
83
|
+
static get encapsulation() { return "shadow"; }
|
|
84
|
+
static get originalStyleUrls() {
|
|
85
|
+
return {
|
|
86
|
+
"$": ["ds-button.css"]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static get styleUrls() {
|
|
90
|
+
return {
|
|
91
|
+
"$": ["ds-button.css"]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
static get properties() {
|
|
95
|
+
return {
|
|
96
|
+
"variant": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"mutable": false,
|
|
99
|
+
"complexType": {
|
|
100
|
+
"original": "\"primary\" | \"secondary\" | \"ghost\"",
|
|
101
|
+
"resolved": "\"ghost\" | \"primary\" | \"secondary\"",
|
|
102
|
+
"references": {}
|
|
103
|
+
},
|
|
104
|
+
"required": false,
|
|
105
|
+
"optional": false,
|
|
106
|
+
"docs": {
|
|
107
|
+
"tags": [],
|
|
108
|
+
"text": ""
|
|
109
|
+
},
|
|
110
|
+
"getter": false,
|
|
111
|
+
"setter": false,
|
|
112
|
+
"reflect": false,
|
|
113
|
+
"attribute": "variant",
|
|
114
|
+
"defaultValue": "\"primary\""
|
|
115
|
+
},
|
|
116
|
+
"size": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "\"md\" | \"lg\"",
|
|
121
|
+
"resolved": "\"lg\" | \"md\"",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": ""
|
|
129
|
+
},
|
|
130
|
+
"getter": false,
|
|
131
|
+
"setter": false,
|
|
132
|
+
"reflect": false,
|
|
133
|
+
"attribute": "size",
|
|
134
|
+
"defaultValue": "\"md\""
|
|
135
|
+
},
|
|
136
|
+
"disabled": {
|
|
137
|
+
"type": "boolean",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "boolean",
|
|
141
|
+
"resolved": "boolean",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"getter": false,
|
|
151
|
+
"setter": false,
|
|
152
|
+
"reflect": false,
|
|
153
|
+
"attribute": "disabled",
|
|
154
|
+
"defaultValue": "false"
|
|
155
|
+
},
|
|
156
|
+
"type": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"mutable": false,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "\"button\" | \"submit\" | \"reset\"",
|
|
161
|
+
"resolved": "\"button\" | \"reset\" | \"submit\"",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": ""
|
|
169
|
+
},
|
|
170
|
+
"getter": false,
|
|
171
|
+
"setter": false,
|
|
172
|
+
"reflect": false,
|
|
173
|
+
"attribute": "type",
|
|
174
|
+
"defaultValue": "\"button\""
|
|
175
|
+
},
|
|
176
|
+
"href": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"mutable": false,
|
|
179
|
+
"complexType": {
|
|
180
|
+
"original": "string",
|
|
181
|
+
"resolved": "string | undefined",
|
|
182
|
+
"references": {}
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"optional": true,
|
|
186
|
+
"docs": {
|
|
187
|
+
"tags": [],
|
|
188
|
+
"text": ""
|
|
189
|
+
},
|
|
190
|
+
"getter": false,
|
|
191
|
+
"setter": false,
|
|
192
|
+
"reflect": false,
|
|
193
|
+
"attribute": "href"
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ds-card {
|
|
6
|
+
color: inherit;
|
|
7
|
+
background-color: color-mix(in oklch, currentColor 4%, transparent);
|
|
8
|
+
border: 1px solid color-mix(in oklch, currentColor 15%, transparent);
|
|
9
|
+
border-radius: var(--ds-radius-md);
|
|
10
|
+
padding: var(--ds-spacing-lg);
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* ## Accessibility
|
|
4
|
+
*
|
|
5
|
+
* **Category:** static-display
|
|
6
|
+
* **APG pattern:** N/A — a container surface with no interactive
|
|
7
|
+
* behavior of its own. If a consumer nests interactive elements
|
|
8
|
+
* inside (button, link, form field), those elements satisfy their
|
|
9
|
+
* own a11y bucket independently.
|
|
10
|
+
*
|
|
11
|
+
* **Keyboard interactions:**
|
|
12
|
+
* - Tab / Shift+Tab: N/A — the card itself is not focusable. Any
|
|
13
|
+
* interactive descendant carries its own tab semantics.
|
|
14
|
+
* - Enter / Space / Arrow / Escape / Printable: N/A.
|
|
15
|
+
*
|
|
16
|
+
* **ARIA:**
|
|
17
|
+
* - Roles used: none. `<ds-card>` is a purely visual grouping and
|
|
18
|
+
* deliberately does not carry `role="region"` — that would demand
|
|
19
|
+
* a labelledby target, which would only be correct in a subset of
|
|
20
|
+
* uses. Consumers that need a labeled landmark should render a
|
|
21
|
+
* `<section aria-labelledby>` around the card.
|
|
22
|
+
* - State attributes: none.
|
|
23
|
+
* - Labeling strategy: none applied by the component; consumer's
|
|
24
|
+
* heading structure inside the slot supplies the accessible name
|
|
25
|
+
* when needed.
|
|
26
|
+
*
|
|
27
|
+
* **Focus:**
|
|
28
|
+
* - On mount: nothing auto-focuses.
|
|
29
|
+
* - Focus indicator: N/A — the card itself is not focusable.
|
|
30
|
+
*
|
|
31
|
+
* **Motion:**
|
|
32
|
+
* - Animations: none.
|
|
33
|
+
* - Reduced-motion behavior: N/A.
|
|
34
|
+
*
|
|
35
|
+
* **Contrast:**
|
|
36
|
+
* - Text: inherits `color: inherit` / `currentColor`; the card does
|
|
37
|
+
* not impose a text color, so contrast is the consumer theme's
|
|
38
|
+
* responsibility.
|
|
39
|
+
* - Non-text (border, subtle background tint): both derived from
|
|
40
|
+
* `color-mix(in oklch, currentColor N%, transparent)`, matching
|
|
41
|
+
* the pattern used by `ds-input` and `ds-select`. WCAG 1.4.11
|
|
42
|
+
* (3:1 non-text contrast) is met in themes where the surface has
|
|
43
|
+
* enough delta against the page background; the component does
|
|
44
|
+
* not override the consumer's palette to force it.
|
|
45
|
+
*
|
|
46
|
+
* **Screen reader announcement:**
|
|
47
|
+
* - Rendered state: no announcement of the card itself. AT
|
|
48
|
+
* navigates to the slotted content directly, using whatever
|
|
49
|
+
* heading and landmark structure the consumer places inside.
|
|
50
|
+
* - State change: N/A.
|
|
51
|
+
*/
|
|
52
|
+
export class DsCard {
|
|
53
|
+
render() {
|
|
54
|
+
return (h(Host, { key: '288726502b909d34c3498bbac671ae892b0f6e17' }, h("div", { key: '2d9efecfdc78292d47d1c322e7d5f30820467ac4', class: "ds-card" }, h("slot", { key: '76ee24c626aaef9528200fc4665a50c491f9f7a0' }))));
|
|
55
|
+
}
|
|
56
|
+
static get is() { return "ds-card"; }
|
|
57
|
+
static get encapsulation() { return "shadow"; }
|
|
58
|
+
static get originalStyleUrls() {
|
|
59
|
+
return {
|
|
60
|
+
"$": ["ds-card.css"]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
static get styleUrls() {
|
|
64
|
+
return {
|
|
65
|
+
"$": ["ds-card.css"]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
vertical-align: middle;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* No `appearance: none` override on purpose. Keeping the native
|
|
8
|
+
* checkbox rendering preserves the OS/browser accessibility rendering
|
|
9
|
+
* that assistive tech and forced-color modes rely on. A themed
|
|
10
|
+
* checkbox visual (custom glyph, custom fill) is a future decision
|
|
11
|
+
* once the DS commits to a design that still passes 3:1 non-text
|
|
12
|
+
* contrast in every theme and forced-color mode.
|
|
13
|
+
*/
|
|
14
|
+
.ds-checkbox {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-checkbox:disabled {
|
|
20
|
+
cursor: not-allowed;
|
|
21
|
+
opacity: 0.5;
|
|
22
|
+
}
|