@devschile/chucao 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/p-12e02f8e.entry.js +2 -0
- package/dist/chucao/p-12e02f8e.entry.js.map +1 -0
- package/dist/chucao/p-21fa1897.entry.js +2 -0
- package/dist/chucao/p-21fa1897.entry.js.map +1 -0
- package/dist/chucao/p-5c5048cf.entry.js +2 -0
- package/dist/chucao/p-5c5048cf.entry.js.map +1 -0
- package/dist/chucao/p-5df14f4b.entry.js +2 -0
- package/dist/chucao/p-5df14f4b.entry.js.map +1 -0
- package/dist/chucao/p-5e0ba154.entry.js +2 -0
- package/dist/chucao/p-5e0ba154.entry.js.map +1 -0
- package/dist/chucao/p-C_GZnvOi.js +3 -0
- package/dist/chucao/p-C_GZnvOi.js.map +1 -0
- package/dist/chucao/p-bd015077.entry.js +2 -0
- package/dist/chucao/p-bd015077.entry.js.map +1 -0
- package/dist/chucao/p-ca96fa8a.entry.js +2 -0
- package/dist/chucao/p-ca96fa8a.entry.js.map +1 -0
- package/dist/chucao/p-ccae6c46.entry.js +2 -0
- package/dist/chucao/p-ccae6c46.entry.js.map +1 -0
- package/dist/chucao/p-ecf098bb.entry.js +2 -0
- package/dist/chucao/p-ecf098bb.entry.js.map +1 -0
- package/dist/cjs/ch-accordion.cjs.entry.js +48 -0
- package/dist/cjs/ch-accordion.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-badge_5.cjs.entry.js +56 -8
- package/dist/cjs/ch-badge_5.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +80 -0
- package/dist/cjs/ch-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-divider.cjs.entry.js +24 -0
- package/dist/cjs/ch-divider.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-link.cjs.entry.js +49 -0
- package/dist/cjs/ch-link.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-radio.cjs.entry.js +83 -0
- package/dist/cjs/ch-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-switch.cjs.entry.js +80 -0
- package/dist/cjs/ch-switch.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tabs.cjs.entry.js +100 -0
- package/dist/cjs/ch-tabs.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-textarea.cjs.entry.js +94 -0
- package/dist/cjs/ch-textarea.cjs.entry.js.map +1 -0
- package/dist/cjs/chucao.cjs.js +2 -2
- package/dist/cjs/{index-yB1Ik3Sa.js → index-Ha3VDOML.js} +35 -3
- package/dist/cjs/index-Ha3VDOML.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +9 -1
- package/dist/collection/components/ch-accordion/ch-accordion.css +72 -0
- package/dist/collection/components/ch-accordion/ch-accordion.js +111 -0
- package/dist/collection/components/ch-accordion/ch-accordion.js.map +1 -0
- package/dist/collection/components/ch-badge/ch-badge.js +1 -1
- package/dist/collection/components/ch-button/ch-button.js +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.css +79 -0
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +276 -0
- package/dist/collection/components/ch-checkbox/ch-checkbox.js.map +1 -0
- package/dist/collection/components/ch-divider/ch-divider.css +25 -0
- package/dist/collection/components/ch-divider/ch-divider.js +53 -0
- package/dist/collection/components/ch-divider/ch-divider.js.map +1 -0
- package/dist/collection/components/ch-input/ch-input.css +20 -0
- package/dist/collection/components/ch-input/ch-input.js +83 -1
- package/dist/collection/components/ch-input/ch-input.js.map +1 -1
- package/dist/collection/components/ch-link/ch-link.css +40 -0
- package/dist/collection/components/ch-link/ch-link.js +158 -0
- package/dist/collection/components/ch-link/ch-link.js.map +1 -0
- package/dist/collection/components/ch-radio/ch-radio.css +89 -0
- package/dist/collection/components/ch-radio/ch-radio.js +282 -0
- package/dist/collection/components/ch-radio/ch-radio.js.map +1 -0
- package/dist/collection/components/ch-select/ch-select.css +20 -0
- package/dist/collection/components/ch-select/ch-select.js +83 -1
- package/dist/collection/components/ch-select/ch-select.js.map +1 -1
- package/dist/collection/components/ch-switch/ch-switch.css +92 -0
- package/dist/collection/components/ch-switch/ch-switch.js +276 -0
- package/dist/collection/components/ch-switch/ch-switch.js.map +1 -0
- package/dist/collection/components/ch-tabs/ch-tabs.css +69 -0
- package/dist/collection/components/ch-tabs/ch-tabs.js +182 -0
- package/dist/collection/components/ch-tabs/ch-tabs.js.map +1 -0
- package/dist/collection/components/ch-textarea/ch-textarea.css +66 -0
- package/dist/collection/components/ch-textarea/ch-textarea.js +323 -0
- package/dist/collection/components/ch-textarea/ch-textarea.js.map +1 -0
- package/dist/components/ch-accordion.d.ts +11 -0
- package/dist/components/ch-accordion.js +2 -0
- package/dist/components/ch-accordion.js.map +1 -0
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-card.js.map +1 -1
- package/dist/components/ch-checkbox.d.ts +11 -0
- package/dist/components/ch-checkbox.js +2 -0
- package/dist/components/ch-checkbox.js.map +1 -0
- package/dist/components/ch-divider.d.ts +11 -0
- package/dist/components/ch-divider.js +2 -0
- package/dist/components/ch-divider.js.map +1 -0
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-input.js.map +1 -1
- package/dist/components/ch-link.d.ts +11 -0
- package/dist/components/ch-link.js +2 -0
- package/dist/components/ch-link.js.map +1 -0
- package/dist/components/ch-radio.d.ts +11 -0
- package/dist/components/ch-radio.js +2 -0
- package/dist/components/ch-radio.js.map +1 -0
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-select.js.map +1 -1
- package/dist/components/ch-switch.d.ts +11 -0
- package/dist/components/ch-switch.js +2 -0
- package/dist/components/ch-switch.js.map +1 -0
- package/dist/components/ch-tabs.d.ts +11 -0
- package/dist/components/ch-tabs.js +2 -0
- package/dist/components/ch-tabs.js.map +1 -0
- package/dist/components/ch-textarea.d.ts +11 -0
- package/dist/components/ch-textarea.js +2 -0
- package/dist/components/ch-textarea.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-C3Jfy_hI.js +2 -0
- package/dist/components/p-C3Jfy_hI.js.map +1 -0
- package/dist/esm/ch-accordion.entry.js +46 -0
- package/dist/esm/ch-accordion.entry.js.map +1 -0
- package/dist/esm/ch-badge_5.entry.js +56 -8
- package/dist/esm/ch-badge_5.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +78 -0
- package/dist/esm/ch-checkbox.entry.js.map +1 -0
- package/dist/esm/ch-divider.entry.js +22 -0
- package/dist/esm/ch-divider.entry.js.map +1 -0
- package/dist/esm/ch-link.entry.js +47 -0
- package/dist/esm/ch-link.entry.js.map +1 -0
- package/dist/esm/ch-radio.entry.js +81 -0
- package/dist/esm/ch-radio.entry.js.map +1 -0
- package/dist/esm/ch-switch.entry.js +78 -0
- package/dist/esm/ch-switch.entry.js.map +1 -0
- package/dist/esm/ch-tabs.entry.js +98 -0
- package/dist/esm/ch-tabs.entry.js.map +1 -0
- package/dist/esm/ch-textarea.entry.js +92 -0
- package/dist/esm/ch-textarea.entry.js.map +1 -0
- package/dist/esm/chucao.js +3 -3
- package/dist/esm/{index-COo5t8-6.js → index-C_GZnvOi.js} +35 -3
- package/dist/esm/index-C_GZnvOi.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-accordion/ch-accordion.d.ts +25 -0
- package/dist/types/components/ch-checkbox/ch-checkbox.d.ts +51 -0
- package/dist/types/components/ch-divider/ch-divider.d.ts +8 -0
- package/dist/types/components/ch-input/ch-input.d.ts +16 -0
- package/dist/types/components/ch-link/ch-link.d.ts +28 -0
- package/dist/types/components/ch-radio/ch-radio.d.ts +58 -0
- package/dist/types/components/ch-select/ch-select.d.ts +16 -0
- package/dist/types/components/ch-switch/ch-switch.d.ts +51 -0
- package/dist/types/components/ch-tabs/ch-tabs.d.ts +34 -0
- package/dist/types/components/ch-textarea/ch-textarea.d.ts +60 -0
- package/dist/types/components.d.ts +794 -0
- package/dist-react/components.d.ts +40 -1
- package/dist-react/components.js +75 -0
- package/dist-react/components.ts +103 -1
- package/dist-vue/index.d.ts +8 -0
- package/dist-vue/index.js +100 -0
- package/dist-vue/index.ts +116 -0
- package/package.json +1 -1
- package/dist/chucao/p-94a2b1be.entry.js +0 -2
- package/dist/chucao/p-94a2b1be.entry.js.map +0 -1
- package/dist/chucao/p-COo5t8-6.js +0 -3
- package/dist/chucao/p-COo5t8-6.js.map +0 -1
- package/dist/cjs/index-yB1Ik3Sa.js.map +0 -1
- package/dist/components/p-DCKzDjxR.js +0 -2
- package/dist/components/p-DCKzDjxR.js.map +0 -1
- package/dist/esm/index-COo5t8-6.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-C_GZnvOi.js';
|
|
2
|
+
|
|
3
|
+
const chAccordionCss = () => `:host{display:block}.item{background:var(--surface);border:var(--border-width) solid var(--border);border-radius:var(--radius);transition:border-color var(--duration-normal) var(--easing-default)}.item+.item{margin-top:var(--spacing-md)}.item--open{border-color:var(--border-hover)}.item-head{margin:0}.item-toggle{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-lg);width:100%;padding:var(--spacing-2xl) var(--spacing-3xl);background:transparent;border:none;color:var(--text);font-family:inherit;font-size:inherit;font-weight:var(--typography-weight-semibold);cursor:pointer}.item-toggle::after{content:'';width:var(--spacing-md);height:var(--spacing-md);flex-shrink:0;border-right:var(--border-width) solid var(--text-muted);border-bottom:var(--border-width) solid var(--text-muted);transform:rotate(45deg);transition:transform var(--duration-normal) var(--easing-default)}.item--open .item-toggle::after{transform:rotate(-135deg)}.item-toggle:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.item-toggle:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.item-panel{padding:0 var(--spacing-3xl) var(--spacing-3xl);color:var(--text-muted)}.item-panel[hidden]{display:none}`;
|
|
4
|
+
|
|
5
|
+
let accordionIds = 0;
|
|
6
|
+
const ChAccordion = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.chChange = createEvent(this, "chChange");
|
|
10
|
+
}
|
|
11
|
+
baseId = `ch-accordion-${++accordionIds}`;
|
|
12
|
+
/**
|
|
13
|
+
* The list of items, each with a `title`, a `value`, and an optional `disabled` flag.
|
|
14
|
+
*/
|
|
15
|
+
items = [];
|
|
16
|
+
/**
|
|
17
|
+
* The value of the currently open item. When unset, no item is open.
|
|
18
|
+
*/
|
|
19
|
+
value;
|
|
20
|
+
/**
|
|
21
|
+
* Emitted when the open item changes, with the new value (`undefined` when all items are closed).
|
|
22
|
+
*/
|
|
23
|
+
chChange;
|
|
24
|
+
headerId(value) {
|
|
25
|
+
return `${this.baseId}-${value}-header`;
|
|
26
|
+
}
|
|
27
|
+
panelId(value) {
|
|
28
|
+
return `${this.baseId}-${value}-panel`;
|
|
29
|
+
}
|
|
30
|
+
toggle = (value) => {
|
|
31
|
+
this.value = this.value === value ? undefined : value;
|
|
32
|
+
this.chChange.emit(this.value);
|
|
33
|
+
};
|
|
34
|
+
render() {
|
|
35
|
+
return (h(Host, { key: 'a0b6859c9efc45b158825f2b44aab73a5eb63f0b' }, this.items.map(item => {
|
|
36
|
+
const open = this.value === item.value;
|
|
37
|
+
return (h("div", { key: item.value, class: { 'item': true, 'item--open': open } }, h("h3", { class: "item-head" }, h("button", { type: "button", class: "item-toggle", id: this.headerId(item.value), "data-value": item.value, "aria-expanded": open ? 'true' : 'false', "aria-controls": this.panelId(item.value), disabled: item.disabled, onClick: () => this.toggle(item.value) }, item.title)), h("div", { class: "item-panel", id: this.panelId(item.value), role: "region", "aria-labelledby": this.headerId(item.value), hidden: !open }, h("slot", { name: `panel-${item.value}` }))));
|
|
38
|
+
})));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
ChAccordion.style = chAccordionCss();
|
|
42
|
+
|
|
43
|
+
export { ChAccordion as ch_accordion };
|
|
44
|
+
//# sourceMappingURL=ch-accordion.entry.js.map
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=ch-accordion.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-accordion.entry.js","sources":["src/components/ch-accordion/ch-accordion.css?tag=ch-accordion&encapsulation=shadow","src/components/ch-accordion/ch-accordion.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.item {\n background: var(--surface);\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius);\n transition: border-color var(--duration-normal) var(--easing-default);\n}\n\n.item + .item {\n margin-top: var(--spacing-md);\n}\n\n.item--open {\n border-color: var(--border-hover);\n}\n\n.item-head {\n margin: 0;\n}\n\n.item-toggle {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-lg);\n width: 100%;\n padding: var(--spacing-2xl) var(--spacing-3xl);\n background: transparent;\n border: none;\n color: var(--text);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--typography-weight-semibold);\n cursor: pointer;\n}\n\n.item-toggle::after {\n content: '';\n width: var(--spacing-md);\n height: var(--spacing-md);\n flex-shrink: 0;\n border-right: var(--border-width) solid var(--text-muted);\n border-bottom: var(--border-width) solid var(--text-muted);\n transform: rotate(45deg);\n transition: transform var(--duration-normal) var(--easing-default);\n}\n\n.item--open .item-toggle::after {\n transform: rotate(-135deg);\n}\n\n.item-toggle:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.item-toggle:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.item-panel {\n padding: 0 var(--spacing-3xl) var(--spacing-3xl);\n color: var(--text-muted);\n}\n\n.item-panel[hidden] {\n display: none;\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport interface ChAccordionItem {\n title: string;\n value: string;\n disabled?: boolean;\n}\n\nlet accordionIds = 0;\n\n@Component({\n tag: 'ch-accordion',\n styleUrl: 'ch-accordion.css',\n shadow: true,\n})\nexport class ChAccordion {\n private readonly baseId = `ch-accordion-${++accordionIds}`;\n\n /**\n * The list of items, each with a `title`, a `value`, and an optional `disabled` flag.\n */\n @Prop() items: ChAccordionItem[] = [];\n\n /**\n * The value of the currently open item. When unset, no item is open.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Emitted when the open item changes, with the new value (`undefined` when all items are closed).\n */\n @Event() chChange: EventEmitter<string | undefined>;\n\n private headerId(value: string) {\n return `${this.baseId}-${value}-header`;\n }\n\n private panelId(value: string) {\n return `${this.baseId}-${value}-panel`;\n }\n\n private toggle = (value: string) => {\n this.value = this.value === value ? undefined : value;\n this.chChange.emit(this.value);\n };\n\n render() {\n return (\n <Host>\n {this.items.map(item => {\n const open = this.value === item.value;\n return (\n <div key={item.value} class={{ 'item': true, 'item--open': open }}>\n <h3 class=\"item-head\">\n <button\n type=\"button\"\n class=\"item-toggle\"\n id={this.headerId(item.value)}\n data-value={item.value}\n aria-expanded={open ? 'true' : 'false'}\n aria-controls={this.panelId(item.value)}\n disabled={item.disabled}\n onClick={() => this.toggle(item.value)}\n >\n {item.title}\n </button>\n </h3>\n <div class=\"item-panel\" id={this.panelId(item.value)} role=\"region\" aria-labelledby={this.headerId(item.value)} hidden={!open}>\n <slot name={`panel-${item.value}`}></slot>\n </div>\n </div>\n );\n })}\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,gwCAAgwC,CAAC;;ACQ/xC,IAAI,YAAY,GAAG,CAAC;MAOP,WAAW,GAAA,MAAA;;;;;AACL,IAAA,MAAM,GAAG,CAAA,aAAA,EAAgB,EAAE,YAAY,EAAE;AAE1D;;AAEG;IACK,KAAK,GAAsB,EAAE;AAErC;;AAEG;AAC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C,QAAQ,EACvB,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA,EAErC,IAAI,CAAC,KAAK,CACJ,CACN,EACL,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,YAAY,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAC,QAAQ,EAAA,iBAAA,EAAkB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAA,EAC3H,CAAA,CAAA,MAAA,EAAA,EAAM,IAAI,EAAE,SAAS,IAAI,CAAC,KAAK,CAAA,CAAE,EAAA,CAAS,CACtC,CACF;SAET,CAAC,CACG;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, c as createEvent } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host, c as createEvent } from './index-C_GZnvOi.js';
|
|
2
2
|
|
|
3
3
|
const chBadgeCss = () => `:host{display:inline-block}.badge{display:inline-block;padding:var(--spacing-2xs) var(--spacing-lg);border-radius:var(--radius-pill);font-size:var(--typography-size-xs);font-weight:var(--typography-weight-semibold);text-transform:uppercase;letter-spacing:var(--typography-tracking-badge)}.badge--default{background:var(--color-surface-hover);color:var(--accent)}.badge--positive{background:var(--color-status-positive-background);color:var(--color-status-positive)}.badge--warning{background:var(--color-status-warning-background);color:var(--color-status-warning)}`;
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ const ChBadge = class {
|
|
|
11
11
|
*/
|
|
12
12
|
variant = 'default';
|
|
13
13
|
render() {
|
|
14
|
-
return (h(Host, { key: '
|
|
14
|
+
return (h(Host, { key: 'c0acd8486b8265884b3c4a2a5a68bf10098a09cd' }, h("span", { key: '2ae6af3f7ac4c6967dc6eefe607b3910ba341741', class: { badge: true, [`badge--${this.variant}`]: true } }, h("slot", { key: '2aab4bb7e25492dc01cb94cf055efde3897f736b' }))));
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
ChBadge.style = chBadgeCss();
|
|
@@ -45,7 +45,7 @@ const ChButton = class {
|
|
|
45
45
|
this.chClick.emit(ev);
|
|
46
46
|
};
|
|
47
47
|
render() {
|
|
48
|
-
return (h(Host, { key: '
|
|
48
|
+
return (h(Host, { key: '1fc74b55b6d69be97fba63f0fb2d72ffd217eafb' }, h("button", { key: 'af6721f9eb066f7e0cb7a23031d43eb46fbbdf9e', class: { btn: true, [`btn--${this.variant}`]: true }, type: "button", disabled: this.disabled, "aria-label": this.label, onClick: this.handleClick }, h("slot", { key: '2c42b74352aa7a79ac6bc231cdd828b7a62f5083' }))));
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
ChButton.style = chButtonCss();
|
|
@@ -57,12 +57,12 @@ const ChCard = class {
|
|
|
57
57
|
registerInstance(this, hostRef);
|
|
58
58
|
}
|
|
59
59
|
render() {
|
|
60
|
-
return (h(Host, { key: '
|
|
60
|
+
return (h(Host, { key: '89781abc150f0078e9d36233f02d2bb29f3d2cc1' }, h("div", { key: '41271ca28fd5c045a4dad746ec7e2c7264a35aac', class: "card" }, h("slot", { key: '1786ea797968b94fc48de08836fc0195b0731469' }))));
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
ChCard.style = chCardCss();
|
|
64
64
|
|
|
65
|
-
const chInputCss = () => `:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}`;
|
|
65
|
+
const chInputCss = () => `:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
|
|
66
66
|
|
|
67
67
|
let inputIds = 0;
|
|
68
68
|
const ChInput = class {
|
|
@@ -72,6 +72,8 @@ const ChInput = class {
|
|
|
72
72
|
this.chChange = createEvent(this, "chChange");
|
|
73
73
|
}
|
|
74
74
|
inputId = `ch-input-${++inputIds}`;
|
|
75
|
+
hintId = `${this.inputId}-hint`;
|
|
76
|
+
errorId = `${this.inputId}-error`;
|
|
75
77
|
/**
|
|
76
78
|
* Visible label rendered above the input and associated with it via
|
|
77
79
|
* `for`/`id`, so assistive technology announces the input's purpose.
|
|
@@ -101,6 +103,19 @@ const ChInput = class {
|
|
|
101
103
|
* Whether the input is required.
|
|
102
104
|
*/
|
|
103
105
|
required = false;
|
|
106
|
+
/**
|
|
107
|
+
* Helper text rendered below the input, associated via `aria-describedby`.
|
|
108
|
+
* Replaced by `errorMessage` when the input is invalid.
|
|
109
|
+
*/
|
|
110
|
+
hint;
|
|
111
|
+
/**
|
|
112
|
+
* Error message rendered below the input when it is invalid.
|
|
113
|
+
*/
|
|
114
|
+
errorMessage;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the input is in an invalid state; toggles `aria-invalid` and error styling.
|
|
117
|
+
*/
|
|
118
|
+
invalid = false;
|
|
104
119
|
/**
|
|
105
120
|
* Emitted on every keystroke, with the current input value.
|
|
106
121
|
*/
|
|
@@ -117,13 +132,22 @@ const ChInput = class {
|
|
|
117
132
|
this.value = ev.target.value;
|
|
118
133
|
this.chChange.emit(this.value);
|
|
119
134
|
};
|
|
135
|
+
get describedBy() {
|
|
136
|
+
if (this.invalid && this.errorMessage) {
|
|
137
|
+
return this.errorId;
|
|
138
|
+
}
|
|
139
|
+
if (this.hint) {
|
|
140
|
+
return this.hintId;
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
120
144
|
render() {
|
|
121
|
-
return (h(Host, { key: '
|
|
145
|
+
return (h(Host, { key: '82557c17d49bf048b7056853a088565a243325be' }, this.label && (h("label", { key: 'cc774b0001daa6c7f4e4bb8d62ea21698bd744e9', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: 'dc30d9f798611a0a4bb577c18a2696d065a281ee', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '21b76002a309dfe167e671fd270699f8699ed6b9', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'be64956da00a76dccdbf0979f3352b263a21fb12', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
122
146
|
}
|
|
123
147
|
};
|
|
124
148
|
ChInput.style = chInputCss();
|
|
125
149
|
|
|
126
|
-
const chSelectCss = () => `:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.select{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.select:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.select:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.select option{background:var(--bg);color:var(--text)}`;
|
|
150
|
+
const chSelectCss = () => `:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.select{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.select:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.select--invalid{border-color:var(--color-status-warning)}.select--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.select:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.select option{background:var(--bg);color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
|
|
127
151
|
|
|
128
152
|
let selectIds = 0;
|
|
129
153
|
const ChSelect = class {
|
|
@@ -132,6 +156,8 @@ const ChSelect = class {
|
|
|
132
156
|
this.chChange = createEvent(this, "chChange");
|
|
133
157
|
}
|
|
134
158
|
selectId = `ch-select-${++selectIds}`;
|
|
159
|
+
hintId = `${this.selectId}-hint`;
|
|
160
|
+
errorId = `${this.selectId}-error`;
|
|
135
161
|
/**
|
|
136
162
|
* Visible label rendered above the select and associated with it via
|
|
137
163
|
* `for`/`id`, so assistive technology announces the select's purpose.
|
|
@@ -161,6 +187,19 @@ const ChSelect = class {
|
|
|
161
187
|
* Whether a value is required.
|
|
162
188
|
*/
|
|
163
189
|
required = false;
|
|
190
|
+
/**
|
|
191
|
+
* Helper text rendered below the select, associated via `aria-describedby`.
|
|
192
|
+
* Replaced by `errorMessage` when the select is invalid.
|
|
193
|
+
*/
|
|
194
|
+
hint;
|
|
195
|
+
/**
|
|
196
|
+
* Error message rendered below the select when it is invalid.
|
|
197
|
+
*/
|
|
198
|
+
errorMessage;
|
|
199
|
+
/**
|
|
200
|
+
* Whether the select is in an invalid state; toggles `aria-invalid` and error styling.
|
|
201
|
+
*/
|
|
202
|
+
invalid = false;
|
|
164
203
|
/**
|
|
165
204
|
* Emitted when the selected option changes, with the new value.
|
|
166
205
|
*/
|
|
@@ -169,8 +208,17 @@ const ChSelect = class {
|
|
|
169
208
|
this.value = ev.target.value;
|
|
170
209
|
this.chChange.emit(this.value);
|
|
171
210
|
};
|
|
211
|
+
get describedBy() {
|
|
212
|
+
if (this.invalid && this.errorMessage) {
|
|
213
|
+
return this.errorId;
|
|
214
|
+
}
|
|
215
|
+
if (this.hint) {
|
|
216
|
+
return this.hintId;
|
|
217
|
+
}
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
172
220
|
render() {
|
|
173
|
-
return (h(Host, { key: '
|
|
221
|
+
return (h(Host, { key: '206697f7162cbac4e5486a937d7e44bb971b6ee4' }, this.label && (h("label", { key: '664e7423e7ac1a5dd6c626f2094c0ffe63d7ea36', class: "label", htmlFor: this.selectId }, this.label)), h("select", { key: 'd010c2ea52bf449d823d115fa835b53dfa28390a', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (h("option", { key: '9a28e73a3ef6742d037eaa825f1a66dfd4447ae6', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (h("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '6d3ff7d72bc488b723a3d9cd0982f5e3d4d46c87', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'bbc4b768cb94c39b57663d27a86b886e2ff9a556', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
174
222
|
}
|
|
175
223
|
};
|
|
176
224
|
ChSelect.style = chSelectCss();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"ch-badge_5.entry.js","mappings":";;AAAA,MAAM,UAAU,GAAG,MAAM,CAAC,qjBAAqjB,CAAC;;MCSnkB,OAAO,GAAA,MAAA;;;;AAClB;;AAEG;IACK,OAAO,GAAmB,SAAS;IAE3C,MAAM,GAAA;QACJ,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA,OAAA,EAAU,IAAI,CAAC,OAAO,CAAA,CAAE,GAAG,IAAI,EAAE,EAAA,EAC5D,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACR,CACF;;;;;ACrBb,MAAM,WAAW,GAAG,MAAM,CAAC,u0CAAu0C,CAAC;;MCSt1C,QAAQ,GAAA,MAAA;;;;;AACnB;;AAEG;IACK,OAAO,GAAoB,SAAS;AAE5C;;AAEG;IACK,QAAQ,GAAG,KAAK;AAExB;;;;AAIG;AACK,IAAA,KAAK;AAEb;;AAEG;AACM,IAAA,OAAO;AAER,IAAA,WAAW,GAAG,CAAC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f,CAAA,CAAA,QAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAQ,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAA,IAAA,EAAC,MAAM,QAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,IACnD,IAAI,CAAC,WAAW,CACV,CACV,EACA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,KACtB,CAAA,CAAA,QAAA,EAAA,EAAQ,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAC1F,MAAM,CAAC,KAAK,CACN,CACV,CAAC,CACK,CACJ;;;;;;;","names":[],"sources":["src/components/ch-badge/ch-badge.css?tag=ch-badge&encapsulation=shadow","src/components/ch-badge/ch-badge.tsx","src/components/ch-button/ch-button.css?tag=ch-button&encapsulation=shadow","src/components/ch-button/ch-button.tsx","src/components/ch-card/ch-card.css?tag=ch-card&encapsulation=shadow","src/components/ch-card/ch-card.tsx","src/components/ch-input/ch-input.css?tag=ch-input&encapsulation=shadow","src/components/ch-input/ch-input.tsx","src/components/ch-select/ch-select.css?tag=ch-select&encapsulation=shadow","src/components/ch-select/ch-select.tsx"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.badge {\n display: inline-block;\n padding: var(--spacing-2xs) var(--spacing-lg);\n border-radius: var(--radius-pill);\n font-size: var(--typography-size-xs);\n font-weight: var(--typography-weight-semibold);\n text-transform: uppercase;\n letter-spacing: var(--typography-tracking-badge);\n}\n\n.badge--default {\n background: var(--color-surface-hover);\n color: var(--accent);\n}\n\n.badge--positive {\n background: var(--color-status-positive-background);\n color: var(--color-status-positive);\n}\n.badge--warning {\n background: var(--color-status-warning-background);\n color: var(--color-status-warning);\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\n\nexport type ChBadgeVariant = 'default' | 'positive' | 'warning';\n\n@Component({\n tag: 'ch-badge',\n styleUrl: 'ch-badge.css',\n shadow: true,\n})\nexport class ChBadge {\n /**\n * The visual style of the badge. Either `default`, `positive`, or `warning`.\n */\n @Prop() variant: ChBadgeVariant = 'default';\n\n render() {\n return (\n <Host>\n <span class={{ badge: true, [`badge--${this.variant}`]: true }}>\n <slot></slot>\n </span>\n </Host>\n );\n }\n}\n",":host {\n display: inline-block;\n}\n\n.btn {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-sm);\n border: none;\n cursor: pointer;\n font-family: inherit;\n font-size: inherit;\n}\n\n.btn:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.btn:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.btn--primary {\n background-color: var(--accent);\n color: var(--color-accent-text);\n font-weight: var(--typography-weight-bold);\n padding: var(--spacing-xs) var(--spacing-xl);\n border-radius: var(--radius-pill);\n transition:\n background-color var(--duration-normal) var(--easing-default),\n transform var(--duration-fast) var(--easing-default);\n}\n\n.btn--primary:hover {\n background-color: var(--accent-hover);\n transform: translateY(calc(-1 * var(--spacing-elevate)));\n}\n\n.btn--secondary {\n background-color: transparent;\n color: var(--text);\n font-weight: var(--typography-weight-bold);\n padding: var(--spacing-xs) var(--spacing-xl);\n border-radius: var(--radius-pill);\n border: var(--border-width) solid var(--border);\n transition:\n border-color var(--duration-normal) var(--easing-default),\n background-color var(--duration-normal) var(--easing-default),\n transform var(--duration-fast) var(--easing-default);\n}\n\n.btn--secondary:hover {\n border-color: var(--border-hover);\n background-color: var(--surface-hover);\n transform: translateY(calc(-1 * var(--spacing-elevate)));\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport type ChButtonVariant = 'primary' | 'secondary';\n\n@Component({\n tag: 'ch-button',\n styleUrl: 'ch-button.css',\n shadow: true,\n})\nexport class ChButton {\n /**\n * The visual style of the button. Either `primary` or `secondary`.\n */\n @Prop() variant: ChButtonVariant = 'primary';\n\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Accessible label set as `aria-label` on the native `<button>`. Use it\n * when the button's content doesn't convey its purpose on its own (e.g.\n * an icon-only button).\n */\n @Prop() label?: string;\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() chClick: EventEmitter<MouseEvent>;\n\n private handleClick = (ev: MouseEvent) => {\n this.chClick.emit(ev);\n };\n\n render() {\n return (\n <Host>\n <button\n class={{ btn: true, [`btn--${this.variant}`]: true }}\n type=\"button\"\n disabled={this.disabled}\n aria-label={this.label}\n onClick={this.handleClick}\n >\n <slot></slot>\n </button>\n </Host>\n );\n }\n}\n",":host {\n display: block;\n}\n\n::slotted(p) {\n color: var(--text-muted);\n}\n\n.card {\n color: var(--text);\n background: var(--surface);\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius);\n padding: var(--spacing-4xl) var(--spacing-5xl);\n backdrop-filter: blur(var(--effect-blur));\n position: relative;\n overflow: hidden;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n transform var(--duration-fast) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.card::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: var(--border-accent-bar);\n background: var(--accent);\n opacity: 0;\n transition: opacity var(--duration-normal) var(--easing-default);\n}\n\n.card:hover {\n border-color: var(--border-hover);\n transform: translateX(var(--spacing-shift));\n box-shadow: var(--shadow-card-hover);\n}\n\n.card:hover::before {\n opacity: 1;\n}\n","import { Component, Host, h } from '@stencil/core';\n\n@Component({\n tag: 'ch-card',\n styleUrl: 'ch-card.css',\n shadow: true,\n})\nexport class ChCard {\n render() {\n return (\n <Host>\n <div class=\"card\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n",":host {\n display: inline-block;\n width: 100%;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.input {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border-radius: var(--radius);\n border: var(--border-width) solid var(--border);\n background: var(--surface);\n color: var(--text);\n backdrop-filter: blur(var(--effect-blur));\n font-family: inherit;\n font-size: inherit;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.input::placeholder {\n color: var(--text-muted);\n}\n\n.input:focus {\n border-color: var(--accent);\n box-shadow: var(--shadow-focus-ring);\n outline: none;\n}\n\n.input:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nlet inputIds = 0;\n\n@Component({\n tag: 'ch-input',\n styleUrl: 'ch-input.css',\n shadow: true,\n})\nexport class ChInput {\n private readonly inputId = `ch-input-${++inputIds}`;\n\n /**\n * Visible label rendered above the input and associated with it via\n * `for`/`id`, so assistive technology announces the input's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The type of the input, mirroring the native `<input type>` attribute.\n */\n @Prop() type = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value = '';\n\n /**\n * Placeholder text shown when the input is empty.\n */\n @Prop() placeholder?: string;\n\n /**\n * The name of the input, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether the input is required.\n */\n @Prop() required = false;\n\n /**\n * Emitted on every keystroke, with the current input value.\n */\n @Event() chInput: EventEmitter<string>;\n\n /**\n * Emitted when the input value is committed (on native `change`).\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleInput = (ev: InputEvent) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chInput.emit(this.value);\n };\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chChange.emit(this.value);\n };\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n <input\n id={this.label ? this.inputId : undefined}\n class=\"input\"\n type={this.type}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n value={this.value}\n onInput={this.handleInput}\n onChange={this.handleChange}\n />\n </Host>\n );\n }\n}\n",":host {\n display: inline-block;\n width: 100%;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.select {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border-radius: var(--radius);\n border: var(--border-width) solid var(--border);\n background: var(--surface);\n color: var(--text);\n backdrop-filter: blur(var(--effect-blur));\n font-family: inherit;\n font-size: inherit;\n cursor: pointer;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.select:focus {\n border-color: var(--accent);\n box-shadow: var(--shadow-focus-ring);\n outline: none;\n}\n\n.select:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.select option {\n background: var(--bg);\n color: var(--text);\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport interface ChSelectOption {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nlet selectIds = 0;\n\n@Component({\n tag: 'ch-select',\n styleUrl: 'ch-select.css',\n shadow: true,\n})\nexport class ChSelect {\n private readonly selectId = `ch-select-${++selectIds}`;\n\n /**\n * Visible label rendered above the select and associated with it via\n * `for`/`id`, so assistive technology announces the select's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The list of options rendered inside the select.\n */\n @Prop() options: ChSelectOption[] = [];\n\n /**\n * The value of the selected option.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Placeholder shown as a disabled, hidden first option when no value is selected.\n */\n @Prop() placeholder?: string;\n\n /**\n * The name of the select, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * Whether the select is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether a value is required.\n */\n @Prop() required = false;\n\n /**\n * Emitted when the selected option changes, with the new value.\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLSelectElement).value;\n this.chChange.emit(this.value);\n };\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.selectId}>\n {this.label}\n </label>\n )}\n <select\n id={this.label ? this.selectId : undefined}\n class=\"select\"\n name={this.name}\n disabled={this.disabled}\n required={this.required}\n onChange={this.handleChange}\n >\n {this.placeholder && (\n <option value=\"\" disabled hidden selected={!this.value}>\n {this.placeholder}\n </option>\n )}\n {this.options.map(option => (\n <option value={option.value} disabled={option.disabled} selected={option.value === this.value}>\n {option.label}\n </option>\n ))}\n </select>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"ch-badge_5.entry.js","mappings":";;AAAA,MAAM,UAAU,GAAG,MAAM,CAAC,qjBAAqjB,CAAC;;MCSnkB,OAAO,GAAA,MAAA;;;;AAClB;;AAEG;IACK,OAAO,GAAmB,SAAS;IAE3C,MAAM,GAAA;QACJ,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA,OAAA,EAAU,IAAI,CAAC,OAAO,CAAA,CAAE,GAAG,IAAI,EAAE,EAAA,EAC5D,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACR,CACF;;;;;ACrBb,MAAM,WAAW,GAAG,MAAM,CAAC,u0CAAu0C,CAAC;;MCSt1C,QAAQ,GAAA,MAAA;;;;;AACnB;;AAEG;IACK,OAAO,GAAoB,SAAS;AAE5C;;AAEG;IACK,QAAQ,GAAG,KAAK;AAExB;;;;AAIG;AACK,IAAA,KAAK;AAEb;;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,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAC,OAAO,EAAA,EAC5C,IAAI,CAAC,YAAY,CAChB,CACL,CACI;;;;;;;","names":[],"sources":["src/components/ch-badge/ch-badge.css?tag=ch-badge&encapsulation=shadow","src/components/ch-badge/ch-badge.tsx","src/components/ch-button/ch-button.css?tag=ch-button&encapsulation=shadow","src/components/ch-button/ch-button.tsx","src/components/ch-card/ch-card.css?tag=ch-card&encapsulation=shadow","src/components/ch-card/ch-card.tsx","src/components/ch-input/ch-input.css?tag=ch-input&encapsulation=shadow","src/components/ch-input/ch-input.tsx","src/components/ch-select/ch-select.css?tag=ch-select&encapsulation=shadow","src/components/ch-select/ch-select.tsx"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.badge {\n display: inline-block;\n padding: var(--spacing-2xs) var(--spacing-lg);\n border-radius: var(--radius-pill);\n font-size: var(--typography-size-xs);\n font-weight: var(--typography-weight-semibold);\n text-transform: uppercase;\n letter-spacing: var(--typography-tracking-badge);\n}\n\n.badge--default {\n background: var(--color-surface-hover);\n color: var(--accent);\n}\n\n.badge--positive {\n background: var(--color-status-positive-background);\n color: var(--color-status-positive);\n}\n.badge--warning {\n background: var(--color-status-warning-background);\n color: var(--color-status-warning);\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\n\nexport type ChBadgeVariant = 'default' | 'positive' | 'warning';\n\n@Component({\n tag: 'ch-badge',\n styleUrl: 'ch-badge.css',\n shadow: true,\n})\nexport class ChBadge {\n /**\n * The visual style of the badge. Either `default`, `positive`, or `warning`.\n */\n @Prop() variant: ChBadgeVariant = 'default';\n\n render() {\n return (\n <Host>\n <span class={{ badge: true, [`badge--${this.variant}`]: true }}>\n <slot></slot>\n </span>\n </Host>\n );\n }\n}\n",":host {\n display: inline-block;\n}\n\n.btn {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-sm);\n border: none;\n cursor: pointer;\n font-family: inherit;\n font-size: inherit;\n}\n\n.btn:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.btn:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.btn--primary {\n background-color: var(--accent);\n color: var(--color-accent-text);\n font-weight: var(--typography-weight-bold);\n padding: var(--spacing-xs) var(--spacing-xl);\n border-radius: var(--radius-pill);\n transition:\n background-color var(--duration-normal) var(--easing-default),\n transform var(--duration-fast) var(--easing-default);\n}\n\n.btn--primary:hover {\n background-color: var(--accent-hover);\n transform: translateY(calc(-1 * var(--spacing-elevate)));\n}\n\n.btn--secondary {\n background-color: transparent;\n color: var(--text);\n font-weight: var(--typography-weight-bold);\n padding: var(--spacing-xs) var(--spacing-xl);\n border-radius: var(--radius-pill);\n border: var(--border-width) solid var(--border);\n transition:\n border-color var(--duration-normal) var(--easing-default),\n background-color var(--duration-normal) var(--easing-default),\n transform var(--duration-fast) var(--easing-default);\n}\n\n.btn--secondary:hover {\n border-color: var(--border-hover);\n background-color: var(--surface-hover);\n transform: translateY(calc(-1 * var(--spacing-elevate)));\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport type ChButtonVariant = 'primary' | 'secondary';\n\n@Component({\n tag: 'ch-button',\n styleUrl: 'ch-button.css',\n shadow: true,\n})\nexport class ChButton {\n /**\n * The visual style of the button. Either `primary` or `secondary`.\n */\n @Prop() variant: ChButtonVariant = 'primary';\n\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Accessible label set as `aria-label` on the native `<button>`. Use it\n * when the button's content doesn't convey its purpose on its own (e.g.\n * an icon-only button).\n */\n @Prop() label?: string;\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() chClick: EventEmitter<MouseEvent>;\n\n private handleClick = (ev: MouseEvent) => {\n this.chClick.emit(ev);\n };\n\n render() {\n return (\n <Host>\n <button\n class={{ btn: true, [`btn--${this.variant}`]: true }}\n type=\"button\"\n disabled={this.disabled}\n aria-label={this.label}\n onClick={this.handleClick}\n >\n <slot></slot>\n </button>\n </Host>\n );\n }\n}\n",":host {\n display: block;\n}\n\n::slotted(p) {\n color: var(--text-muted);\n}\n\n.card {\n color: var(--text);\n background: var(--surface);\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius);\n padding: var(--spacing-4xl) var(--spacing-5xl);\n backdrop-filter: blur(var(--effect-blur));\n position: relative;\n overflow: hidden;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n transform var(--duration-fast) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.card::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: var(--border-accent-bar);\n background: var(--accent);\n opacity: 0;\n transition: opacity var(--duration-normal) var(--easing-default);\n}\n\n.card:hover {\n border-color: var(--border-hover);\n transform: translateX(var(--spacing-shift));\n box-shadow: var(--shadow-card-hover);\n}\n\n.card:hover::before {\n opacity: 1;\n}\n","import { Component, Host, h } from '@stencil/core';\n\n@Component({\n tag: 'ch-card',\n styleUrl: 'ch-card.css',\n shadow: true,\n})\nexport class ChCard {\n render() {\n return (\n <Host>\n <div class=\"card\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n",":host {\n display: inline-block;\n width: 100%;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.input {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border-radius: var(--radius);\n border: var(--border-width) solid var(--border);\n background: var(--surface);\n color: var(--text);\n backdrop-filter: blur(var(--effect-blur));\n font-family: inherit;\n font-size: inherit;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.input::placeholder {\n color: var(--text-muted);\n}\n\n.input:focus {\n border-color: var(--accent);\n box-shadow: var(--shadow-focus-ring);\n outline: none;\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.input--invalid:focus {\n border-color: var(--color-status-warning);\n box-shadow: 0 0 0 3px var(--color-status-warning-background);\n}\n\n.input:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--text-muted);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nlet inputIds = 0;\n\n@Component({\n tag: 'ch-input',\n styleUrl: 'ch-input.css',\n shadow: true,\n})\nexport class ChInput {\n private readonly inputId = `ch-input-${++inputIds}`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n\n /**\n * Visible label rendered above the input and associated with it via\n * `for`/`id`, so assistive technology announces the input's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The type of the input, mirroring the native `<input type>` attribute.\n */\n @Prop() type = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value = '';\n\n /**\n * Placeholder text shown when the input is empty.\n */\n @Prop() placeholder?: string;\n\n /**\n * The name of the input, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether the input is required.\n */\n @Prop() required = false;\n\n /**\n * Helper text rendered below the input, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the input is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the input when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the input is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted on every keystroke, with the current input value.\n */\n @Event() chInput: EventEmitter<string>;\n\n /**\n * Emitted when the input value is committed (on native `change`).\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleInput = (ev: InputEvent) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chInput.emit(this.value);\n };\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chChange.emit(this.value);\n };\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n <input\n id={this.label ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.invalid }}\n type={this.type}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n value={this.value}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onInput={this.handleInput}\n onChange={this.handleChange}\n />\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n",":host {\n display: inline-block;\n width: 100%;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.select {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border-radius: var(--radius);\n border: var(--border-width) solid var(--border);\n background: var(--surface);\n color: var(--text);\n backdrop-filter: blur(var(--effect-blur));\n font-family: inherit;\n font-size: inherit;\n cursor: pointer;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.select:focus {\n border-color: var(--accent);\n box-shadow: var(--shadow-focus-ring);\n outline: none;\n}\n\n.select--invalid {\n border-color: var(--color-status-warning);\n}\n\n.select--invalid:focus {\n border-color: var(--color-status-warning);\n box-shadow: 0 0 0 3px var(--color-status-warning-background);\n}\n\n.select:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.select option {\n background: var(--bg);\n color: var(--text);\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--text-muted);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport interface ChSelectOption {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nlet selectIds = 0;\n\n@Component({\n tag: 'ch-select',\n styleUrl: 'ch-select.css',\n shadow: true,\n})\nexport class ChSelect {\n private readonly selectId = `ch-select-${++selectIds}`;\n private readonly hintId = `${this.selectId}-hint`;\n private readonly errorId = `${this.selectId}-error`;\n\n /**\n * Visible label rendered above the select and associated with it via\n * `for`/`id`, so assistive technology announces the select's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The list of options rendered inside the select.\n */\n @Prop() options: ChSelectOption[] = [];\n\n /**\n * The value of the selected option.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Placeholder shown as a disabled, hidden first option when no value is selected.\n */\n @Prop() placeholder?: string;\n\n /**\n * The name of the select, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * Whether the select is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether a value is required.\n */\n @Prop() required = false;\n\n /**\n * Helper text rendered below the select, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the select is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the select when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the select is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted when the selected option changes, with the new value.\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLSelectElement).value;\n this.chChange.emit(this.value);\n };\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.selectId}>\n {this.label}\n </label>\n )}\n <select\n id={this.label ? this.selectId : undefined}\n class={{ 'select': true, 'select--invalid': this.invalid }}\n name={this.name}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onChange={this.handleChange}\n >\n {this.placeholder && (\n <option value=\"\" disabled hidden selected={!this.value}>\n {this.placeholder}\n </option>\n )}\n {this.options.map(option => (\n <option value={option.value} disabled={option.disabled} selected={option.value === this.value}>\n {option.label}\n </option>\n ))}\n </select>\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-C_GZnvOi.js';
|
|
2
|
+
|
|
3
|
+
const chCheckboxCss = () => `:host{display:inline-block}.control{display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--spacing-4xl);height:var(--spacing-4xl);margin:0;flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:var(--radius-sm);background:var(--surface);cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), background-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.input:checked{border-color:var(--accent);background:var(--accent)}.input:checked::before{content:'';width:var(--spacing-xs);height:var(--spacing-lg);border:solid var(--color-accent-text);border-width:0 var(--spacing-shift) var(--spacing-shift) 0;transform:rotate(45deg);margin-top:calc(-1 * var(--spacing-2xs))}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus-visible{outline-color:var(--color-status-warning)}.label-text{color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
|
|
4
|
+
|
|
5
|
+
let checkboxIds = 0;
|
|
6
|
+
const ChCheckbox = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.chChange = createEvent(this, "chChange");
|
|
10
|
+
}
|
|
11
|
+
checkboxId = `ch-checkbox-${++checkboxIds}`;
|
|
12
|
+
hintId = `${this.checkboxId}-hint`;
|
|
13
|
+
errorId = `${this.checkboxId}-error`;
|
|
14
|
+
/**
|
|
15
|
+
* Visible label rendered next to the checkbox, associated with it via
|
|
16
|
+
* `for`/`id`, so assistive technology announces the checkbox's purpose.
|
|
17
|
+
*/
|
|
18
|
+
label;
|
|
19
|
+
/**
|
|
20
|
+
* The name of the checkbox, submitted with form data.
|
|
21
|
+
*/
|
|
22
|
+
name;
|
|
23
|
+
/**
|
|
24
|
+
* The value of the checkbox, submitted with form data.
|
|
25
|
+
*/
|
|
26
|
+
value = 'on';
|
|
27
|
+
/**
|
|
28
|
+
* Whether the checkbox is checked.
|
|
29
|
+
*/
|
|
30
|
+
checked = false;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the checkbox is disabled.
|
|
33
|
+
*/
|
|
34
|
+
disabled = false;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the checkbox is required.
|
|
37
|
+
*/
|
|
38
|
+
required = false;
|
|
39
|
+
/**
|
|
40
|
+
* Helper text rendered below the checkbox, associated via `aria-describedby`.
|
|
41
|
+
* Replaced by `errorMessage` when the checkbox is invalid.
|
|
42
|
+
*/
|
|
43
|
+
hint;
|
|
44
|
+
/**
|
|
45
|
+
* Error message rendered below the checkbox when it is invalid.
|
|
46
|
+
*/
|
|
47
|
+
errorMessage;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the checkbox is in an invalid state; toggles `aria-invalid` and error styling.
|
|
50
|
+
*/
|
|
51
|
+
invalid = false;
|
|
52
|
+
/**
|
|
53
|
+
* Emitted when the checked state changes, with the new checked value.
|
|
54
|
+
*/
|
|
55
|
+
chChange;
|
|
56
|
+
handleChange = (ev) => {
|
|
57
|
+
this.checked = ev.target.checked;
|
|
58
|
+
this.chChange.emit(this.checked);
|
|
59
|
+
};
|
|
60
|
+
get describedBy() {
|
|
61
|
+
if (this.invalid && this.errorMessage) {
|
|
62
|
+
return this.errorId;
|
|
63
|
+
}
|
|
64
|
+
if (this.hint) {
|
|
65
|
+
return this.hintId;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
|
+
return (h(Host, { key: '746f0c29ea01a3a0c24360d964b3c0d65985f941' }, h("label", { key: '9e423a2055ec4e2d77848b7c4b86cb200315a77d', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.checkboxId }, h("input", { key: 'b355914b0b02c9887f93e2a50fcebaf60b21d5bb', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && h("span", { key: '6f7128ccac345af5c9224c0388f960575aebc150', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '402417ceee995e578248307a24ba6f9b1955bda8', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '281930b92221157759d3652391b0cdc337a1f25d', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
ChCheckbox.style = chCheckboxCss();
|
|
74
|
+
|
|
75
|
+
export { ChCheckbox as ch_checkbox };
|
|
76
|
+
//# sourceMappingURL=ch-checkbox.entry.js.map
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=ch-checkbox.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-checkbox.entry.js","sources":["src/components/ch-checkbox/ch-checkbox.css?tag=ch-checkbox&encapsulation=shadow","src/components/ch-checkbox/ch-checkbox.tsx"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.control {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-lg);\n cursor: pointer;\n}\n\n.control--disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.input {\n appearance: none;\n -webkit-appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--spacing-4xl);\n height: var(--spacing-4xl);\n margin: 0;\n flex-shrink: 0;\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius-sm);\n background: var(--surface);\n cursor: pointer;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n background-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.input:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.input:checked {\n border-color: var(--accent);\n background: var(--accent);\n}\n\n.input:checked::before {\n content: '';\n width: var(--spacing-xs);\n height: var(--spacing-lg);\n border: solid var(--color-accent-text);\n border-width: 0 var(--spacing-shift) var(--spacing-shift) 0;\n transform: rotate(45deg);\n margin-top: calc(-1 * var(--spacing-2xs));\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.input--invalid:focus-visible {\n outline-color: var(--color-status-warning);\n}\n\n.label-text {\n color: var(--text);\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--text-muted);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nlet checkboxIds = 0;\n\n@Component({\n tag: 'ch-checkbox',\n styleUrl: 'ch-checkbox.css',\n shadow: true,\n})\nexport class ChCheckbox {\n private readonly checkboxId = `ch-checkbox-${++checkboxIds}`;\n private readonly hintId = `${this.checkboxId}-hint`;\n private readonly errorId = `${this.checkboxId}-error`;\n\n /**\n * Visible label rendered next to the checkbox, associated with it via\n * `for`/`id`, so assistive technology announces the checkbox's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The name of the checkbox, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * The value of the checkbox, submitted with form data.\n */\n @Prop() value = 'on';\n\n /**\n * Whether the checkbox is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Whether the checkbox is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether the checkbox is required.\n */\n @Prop() required = false;\n\n /**\n * Helper text rendered below the checkbox, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the checkbox is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the checkbox when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the checkbox is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted when the checked state changes, with the new checked value.\n */\n @Event() chChange: EventEmitter<boolean>;\n\n private handleChange = (ev: Event) => {\n this.checked = (ev.target as HTMLInputElement).checked;\n this.chChange.emit(this.checked);\n };\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n return (\n <Host>\n <label class={{ 'control': true, 'control--disabled': this.disabled }} htmlFor={this.checkboxId}>\n <input\n id={this.checkboxId}\n class={{ 'input': true, 'input--invalid': this.invalid }}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onChange={this.handleChange}\n />\n {this.label && <span class=\"label-text\">{this.label}</span>}\n </label>\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,aAAa,GAAG,MAAM,CAAC,45CAA45C,CAAC;;ACE17C,IAAI,WAAW,GAAG,CAAC;MAON,UAAU,GAAA,MAAA;;;;;AACJ,IAAA,UAAU,GAAG,CAAA,YAAA,EAAe,EAAE,WAAW,EAAE;AAC3C,IAAA,MAAM,GAAG,CAAA,EAAG,IAAI,CAAC,UAAU,OAAO;AAClC,IAAA,OAAO,GAAG,CAAA,EAAG,IAAI,CAAC,UAAU,QAAQ;AAErD;;;AAGG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,IAAI;AAEZ;;AAEG;IACK,KAAK,GAAG,IAAI;AAEpB;;AAEG;IACsB,OAAO,GAAG,KAAK;AAExC;;AAEG;IACK,QAAQ,GAAG,KAAK;AAExB;;AAEG;IACK,QAAQ,GAAG,KAAK;AAExB;;;AAGG;AACK,IAAA,IAAI;AAEZ;;AAEG;AACK,IAAA,YAAY;AAEpB;;AAEG;IACK,OAAO,GAAG,KAAK;AAEvB;;AAEG;AACM,IAAA,QAAQ;AAET,IAAA,YAAY,GAAG,CAAC,EAAS,KAAI;QACnC,IAAI,CAAC,OAAO,GAAI,EAAE,CAAC,MAA2B,CAAC,OAAO;QACtD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;AAClC,KAAC;AAED,IAAA,IAAY,WAAW,GAAA;QACrB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,EAAE;YACrC,OAAO,IAAI,CAAC,OAAO;;AAErB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO,IAAI,CA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AC,OAAO,IAAI,IAAI,CAAC,YAAY,KAChC,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAC,OAAO,EAAA,EAC5C,IAAI,CAAC,YAAY,CAChB,CACL,CACI;;;;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-C_GZnvOi.js';
|
|
2
|
+
|
|
3
|
+
const chDividerCss = () => `:host{display:block}:host(.divider--vertical){display:inline-block;height:100%;align-self:stretch}.divider{margin:0;border:none;background:var(--border)}.divider--horizontal{width:100%;height:var(--border-width)}.divider--vertical{width:var(--border-width);height:100%}`;
|
|
4
|
+
|
|
5
|
+
const ChDivider = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The orientation of the divider. Either `horizontal` (default) or `vertical`.
|
|
11
|
+
*/
|
|
12
|
+
orientation = 'horizontal';
|
|
13
|
+
render() {
|
|
14
|
+
return (h(Host, { key: '30ad155d178afd93745eb4072a2d9a8012705191', class: { 'divider--vertical': this.orientation === 'vertical' } }, h("hr", { key: 'ce239ccdebec97a2735e14ad62b81d14888881a5', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
ChDivider.style = chDividerCss();
|
|
18
|
+
|
|
19
|
+
export { ChDivider as ch_divider };
|
|
20
|
+
//# sourceMappingURL=ch-divider.entry.js.map
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=ch-divider.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-divider.entry.js","sources":["src/components/ch-divider/ch-divider.css?tag=ch-divider&encapsulation=shadow","src/components/ch-divider/ch-divider.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n:host(.divider--vertical) {\n display: inline-block;\n height: 100%;\n align-self: stretch;\n}\n\n.divider {\n margin: 0;\n border: none;\n background: var(--border);\n}\n\n.divider--horizontal {\n width: 100%;\n height: var(--border-width);\n}\n\n.divider--vertical {\n width: var(--border-width);\n height: 100%;\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\n\nexport type ChDividerOrientation = 'horizontal' | 'vertical';\n\n@Component({\n tag: 'ch-divider',\n styleUrl: 'ch-divider.css',\n shadow: true,\n})\nexport class ChDivider {\n /**\n * The orientation of the divider. Either `horizontal` (default) or `vertical`.\n */\n @Prop() orientation: ChDividerOrientation = 'horizontal';\n\n render() {\n return (\n <Host class={{ 'divider--vertical': this.orientation === 'vertical' }}>\n <hr class={{ divider: true, [`divider--${this.orientation}`]: true }} aria-orientation={this.orientation} />\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,MAAM,CAAC,6QAA6Q,CAAC;;MCS7R,SAAS,GAAA,MAAA;;;;AACpB;;AAEG;IACK,WAAW,GAAyB,YAAY;IAExD,MAAM,GAAA;QACJ,QACE,CAAA,CAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAC,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE,EAAA,EACnE,CAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAI,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA,SAAA,EAAY,IAAI,CAAC,WAAW,CAAA,CAAE,GAAG,IAAI,EAAE,EAAA,kBAAA,EAAoB,IAAI,CAAC,WAAW,EAAA,CAAI,CACvG;;;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-C_GZnvOi.js';
|
|
2
|
+
|
|
3
|
+
const chLinkCss = () => `:host{display:inline}.link{color:var(--accent);font-weight:var(--typography-weight-semibold);text-decoration:underline;text-decoration-thickness:var(--border-width);text-underline-offset:var(--spacing-shift);border-radius:var(--radius-sm);transition:color var(--duration-normal) var(--easing-default), opacity var(--duration-normal) var(--easing-default)}.link:hover{color:var(--accent-hover)}.link:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.link--muted{color:var(--text-muted);text-decoration:none}.link--muted:hover{color:var(--text)}.link--disabled{color:var(--text-muted);text-decoration:none;opacity:var(--opacity-disabled);cursor:not-allowed}`;
|
|
4
|
+
|
|
5
|
+
const ChLink = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.chClick = createEvent(this, "chClick");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The URL the link points to.
|
|
12
|
+
*/
|
|
13
|
+
href;
|
|
14
|
+
/**
|
|
15
|
+
* The browsing context the link opens in (e.g. `_blank`). For `_blank`, a
|
|
16
|
+
* `noopener noreferrer` `rel` is added automatically.
|
|
17
|
+
*/
|
|
18
|
+
target;
|
|
19
|
+
/**
|
|
20
|
+
* The visual style of the link. Either `default` or `muted`.
|
|
21
|
+
*/
|
|
22
|
+
variant = 'default';
|
|
23
|
+
/**
|
|
24
|
+
* Whether the link is disabled. Renders a non-interactive element with
|
|
25
|
+
* `aria-disabled="true"` instead of an anchor.
|
|
26
|
+
*/
|
|
27
|
+
disabled = false;
|
|
28
|
+
/**
|
|
29
|
+
* Emitted when the link is clicked.
|
|
30
|
+
*/
|
|
31
|
+
chClick;
|
|
32
|
+
handleClick = (ev) => {
|
|
33
|
+
this.chClick.emit(ev);
|
|
34
|
+
};
|
|
35
|
+
render() {
|
|
36
|
+
if (this.disabled) {
|
|
37
|
+
return (h(Host, null, h("span", { class: { 'link': true, [`link--${this.variant}`]: true, 'link--disabled': true }, "aria-disabled": "true" }, h("slot", null))));
|
|
38
|
+
}
|
|
39
|
+
return (h(Host, null, h("a", { class: { link: true, [`link--${this.variant}`]: true }, href: this.href, target: this.target, rel: this.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: this.handleClick }, h("slot", null))));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
ChLink.style = chLinkCss();
|
|
43
|
+
|
|
44
|
+
export { ChLink as ch_link };
|
|
45
|
+
//# sourceMappingURL=ch-link.entry.js.map
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=ch-link.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-link.entry.js","sources":["src/components/ch-link/ch-link.css?tag=ch-link&encapsulation=shadow","src/components/ch-link/ch-link.tsx"],"sourcesContent":[":host {\n display: inline;\n}\n\n.link {\n color: var(--accent);\n font-weight: var(--typography-weight-semibold);\n text-decoration: underline;\n text-decoration-thickness: var(--border-width);\n text-underline-offset: var(--spacing-shift);\n border-radius: var(--radius-sm);\n transition:\n color var(--duration-normal) var(--easing-default),\n opacity var(--duration-normal) var(--easing-default);\n}\n\n.link:hover {\n color: var(--accent-hover);\n}\n\n.link:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.link--muted {\n color: var(--text-muted);\n text-decoration: none;\n}\n\n.link--muted:hover {\n color: var(--text);\n}\n\n.link--disabled {\n color: var(--text-muted);\n text-decoration: none;\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport type ChLinkVariant = 'default' | 'muted';\n\n@Component({\n tag: 'ch-link',\n styleUrl: 'ch-link.css',\n shadow: true,\n})\nexport class ChLink {\n /**\n * The URL the link points to.\n */\n @Prop() href?: string;\n\n /**\n * The browsing context the link opens in (e.g. `_blank`). For `_blank`, a\n * `noopener noreferrer` `rel` is added automatically.\n */\n @Prop() target?: string;\n\n /**\n * The visual style of the link. Either `default` or `muted`.\n */\n @Prop() variant: ChLinkVariant = 'default';\n\n /**\n * Whether the link is disabled. Renders a non-interactive element with\n * `aria-disabled=\"true\"` instead of an anchor.\n */\n @Prop() disabled = false;\n\n /**\n * Emitted when the link is clicked.\n */\n @Event() chClick: EventEmitter<MouseEvent>;\n\n private handleClick = (ev: MouseEvent) => {\n this.chClick.emit(ev);\n };\n\n render() {\n if (this.disabled) {\n return (\n <Host>\n <span class={{ 'link': true, [`link--${this.variant}`]: true, 'link--disabled': true }} aria-disabled=\"true\">\n <slot></slot>\n </span>\n </Host>\n );\n }\n return (\n <Host>\n <a\n class={{ link: true, [`link--${this.variant}`]: true }}\n href={this.href}\n target={this.target}\n rel={this.target === '_blank' ? 'noopener noreferrer' : undefined}\n onClick={this.handleClick}\n >\n <slot></slot>\n </a>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,SAAS,GAAG,MAAM,CAAC,ktBAAktB,CAAC;;MCS/tB,MAAM,GAAA,MAAA;;;;;AACjB;;AAEG;AACK,IAAA,IAAI;AAEZ;;;AAGG;AACK,IAAA,MAAM;AAEd;;AAEG;IACK,OAAO,GAAkB,SAAS;AAE1C;;;AAGG;IACK,QAAQ,GAAG,KAAK;AAExB;;AAEG;AACM,IAAA,OAAO;AAER,IAAA,WAAW,GAAG,CAAC,EAAc,KAAI;AACvC,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;AACvB,KAAC;IAED,MAAM,GAAA;AACJ,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,QACE,EAAC,IAAI,EAAA,IAAA,EACH,CAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA,MAAA,EAAS,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAA,eAAA,EAAgB,MAAM,EAAA,EAC1G,CAAA,CAAA,MAAA,EAAA,IAAA,CAAa,CACR,CACF;;AAGX,QAAA,QACE,EAAC,IAAI,EAAA,IAAA,EACH,CAAA,CAAA,GAAA,EAAA,EACE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA,MAAA,EAAS,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EACtD,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,GAAG,EAAE,IAAI,CAAC,MAAM,KAAK,QAAQ,GAAG,qBAAqB,GAAG,SAAS,EACjE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAA,EAEzB,CAAA,CAAA,MAAA,EAAA,IAAA,CAAa,CACX,CACC;;;;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-C_GZnvOi.js';
|
|
2
|
+
|
|
3
|
+
const chRadioCss = () => `:host{display:inline-block}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.radio-group{display:flex;flex-direction:column;gap:var(--spacing-lg)}.control{display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--spacing-4xl);height:var(--spacing-4xl);margin:0;flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:50%;background:var(--surface);cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.input:checked{border-color:var(--accent)}.input:checked::before{content:'';width:var(--spacing-md);height:var(--spacing-md);border-radius:50%;background:var(--accent)}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus-visible{outline-color:var(--color-status-warning)}.label-text{color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
|
|
4
|
+
|
|
5
|
+
let radioIds = 0;
|
|
6
|
+
const ChRadio = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.chChange = createEvent(this, "chChange");
|
|
10
|
+
}
|
|
11
|
+
groupId = `ch-radio-${++radioIds}`;
|
|
12
|
+
labelId = `${this.groupId}-label`;
|
|
13
|
+
hintId = `${this.groupId}-hint`;
|
|
14
|
+
errorId = `${this.groupId}-error`;
|
|
15
|
+
/**
|
|
16
|
+
* Visible label describing the radio group, associated with it via
|
|
17
|
+
* `aria-labelledby`.
|
|
18
|
+
*/
|
|
19
|
+
label;
|
|
20
|
+
/**
|
|
21
|
+
* The list of options rendered as radio inputs.
|
|
22
|
+
*/
|
|
23
|
+
options = [];
|
|
24
|
+
/**
|
|
25
|
+
* The value of the selected option.
|
|
26
|
+
*/
|
|
27
|
+
value;
|
|
28
|
+
/**
|
|
29
|
+
* The name shared by all radio inputs in the group. Defaults to an
|
|
30
|
+
* auto-generated group name so options are mutually exclusive out of the box.
|
|
31
|
+
*/
|
|
32
|
+
name;
|
|
33
|
+
/**
|
|
34
|
+
* Whether all radios in the group are disabled.
|
|
35
|
+
*/
|
|
36
|
+
disabled = false;
|
|
37
|
+
/**
|
|
38
|
+
* Whether a value is required.
|
|
39
|
+
*/
|
|
40
|
+
required = false;
|
|
41
|
+
/**
|
|
42
|
+
* Helper text rendered below the radio group, associated via `aria-describedby`.
|
|
43
|
+
* Replaced by `errorMessage` when the group is invalid.
|
|
44
|
+
*/
|
|
45
|
+
hint;
|
|
46
|
+
/**
|
|
47
|
+
* Error message rendered below the radio group when it is invalid.
|
|
48
|
+
*/
|
|
49
|
+
errorMessage;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the radio group is in an invalid state; toggles `aria-invalid` and error styling.
|
|
52
|
+
*/
|
|
53
|
+
invalid = false;
|
|
54
|
+
/**
|
|
55
|
+
* Emitted when a new option is selected, with the selected value.
|
|
56
|
+
*/
|
|
57
|
+
chChange;
|
|
58
|
+
handleChange = (ev) => {
|
|
59
|
+
this.value = ev.target.value;
|
|
60
|
+
this.chChange.emit(this.value);
|
|
61
|
+
};
|
|
62
|
+
get describedBy() {
|
|
63
|
+
if (this.invalid && this.errorMessage) {
|
|
64
|
+
return this.errorId;
|
|
65
|
+
}
|
|
66
|
+
if (this.hint) {
|
|
67
|
+
return this.hintId;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
const groupName = this.name || `${this.groupId}-group`;
|
|
73
|
+
return (h(Host, { key: 'd9a24c29e5fe841d5c6fefc68bc22db1d9c4ee02' }, this.label && (h("span", { key: 'c8dc580a29569ca98f7e6dafce797fa6ac5f7442', class: "group-label", id: this.labelId }, this.label)), h("div", { key: '6b10d53fbf83286ad18b29d3238df4927b3341db', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || option.disabled } }, h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { class: "mark" }), h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '654315541c6b5ed2886283fae2fb72c37f91f575', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '1ed129bddbf96f3b6562552edf416293a0ba0071', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
ChRadio.style = chRadioCss();
|
|
77
|
+
|
|
78
|
+
export { ChRadio as ch_radio };
|
|
79
|
+
//# sourceMappingURL=ch-radio.entry.js.map
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=ch-radio.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-radio.entry.js","sources":["src/components/ch-radio/ch-radio.css?tag=ch-radio&encapsulation=shadow","src/components/ch-radio/ch-radio.tsx"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.group-label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.radio-group {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-lg);\n}\n\n.control {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-lg);\n cursor: pointer;\n}\n\n.control--disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.input {\n appearance: none;\n -webkit-appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--spacing-4xl);\n height: var(--spacing-4xl);\n margin: 0;\n flex-shrink: 0;\n border: var(--border-width) solid var(--border);\n border-radius: 50%;\n background: var(--surface);\n cursor: pointer;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.input:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.input:checked {\n border-color: var(--accent);\n}\n\n.input:checked::before {\n content: '';\n width: var(--spacing-md);\n height: var(--spacing-md);\n border-radius: 50%;\n background: var(--accent);\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.input--invalid:focus-visible {\n outline-color: var(--color-status-warning);\n}\n\n.label-text {\n color: var(--text);\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--text-muted);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nexport interface ChRadioOption {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nlet radioIds = 0;\n\n@Component({\n tag: 'ch-radio',\n styleUrl: 'ch-radio.css',\n shadow: true,\n})\nexport class ChRadio {\n private readonly groupId = `ch-radio-${++radioIds}`;\n private readonly labelId = `${this.groupId}-label`;\n private readonly hintId = `${this.groupId}-hint`;\n private readonly errorId = `${this.groupId}-error`;\n\n /**\n * Visible label describing the radio group, associated with it via\n * `aria-labelledby`.\n */\n @Prop() label?: string;\n\n /**\n * The list of options rendered as radio inputs.\n */\n @Prop() options: ChRadioOption[] = [];\n\n /**\n * The value of the selected option.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The name shared by all radio inputs in the group. Defaults to an\n * auto-generated group name so options are mutually exclusive out of the box.\n */\n @Prop() name?: string;\n\n /**\n * Whether all radios in the group are disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether a value is required.\n */\n @Prop() required = false;\n\n /**\n * Helper text rendered below the radio group, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the group is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the radio group when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the radio group is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted when a new option is selected, with the selected value.\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chChange.emit(this.value);\n };\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n const groupName = this.name || `${this.groupId}-group`;\n return (\n <Host>\n {this.label && (\n <span class=\"group-label\" id={this.labelId}>\n {this.label}\n </span>\n )}\n <div class=\"radio-group\" role=\"radiogroup\" aria-labelledby={this.label ? this.labelId : undefined}>\n {this.options.map(option => (\n <label class={{ 'control': true, 'control--disabled': this.disabled || option.disabled }}>\n <input\n class={{ 'input': true, 'input--invalid': this.invalid }}\n type=\"radio\"\n name={groupName}\n value={option.value}\n checked={option.value === this.value}\n disabled={this.disabled || option.disabled}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onChange={this.handleChange}\n />\n <span class=\"mark\"></span>\n <span class=\"label-text\">{option.label}</span>\n </label>\n ))}\n </div>\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,UAAU,GAAG,MAAM,CAAC,i6CAAi6C,CAAC;;ACQ57C,IAAI,QAAQ,GAAG,CAAC;MAOH,OAAO,GAAA,MAAA;;;;;AACD,IAAA,OAAO,GAAG,CAAA,SAAA,EAAY,EAAE,QAAQ,EAAE;AAClC,IAAA,OAAO,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,QAAQ;AACjC,IAAA,MAAM,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,OAAO;AAC/B,IAAA,OAAO,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,QAAQ;AAElD;;;AAGG;AACK,IAAA,KAAK;AAEb;;AAEG;IACK,OAAO,GAAoB,EAAE;AAErC;;AAEG;AACsB,IAAA,KAAK;AAE9B;;;AAGG;AACK,IAAA,IAAI;AAEZ;;AAEG;IACK,QAAQ,GAAG,KAAK;AAExB;;AAEG;IACK,QAAQ,GAAG,KAAK;AAExB;;;AAGG;AACK,IAAA,IAAI;AAEZ;;AAEG;AACK,IAAA,YAAY;AAEpB;;AAEG;IACK,OAAO,GAAG,KAAK;AAEvB;;AAEG;AACM,IAAA,QAAQ;AAET,IAAA,YAAY,GAAG,CAAC,EAAS,KAAI;QACnC,IAAI,CAAC,KAAK,GAAI,EAAE,CAAC,MAA2B,CAAC,KAAK;QAClD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CA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