@devschile/chucao 2.1.0 → 2.2.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/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/{p-d5a9e340.entry.js → p-077dc2a6.entry.js} +2 -2
- package/dist/chucao/{p-4bc8e098.entry.js → p-079c2017.entry.js} +2 -2
- package/dist/chucao/p-37e7f9cc.entry.js +2 -0
- package/dist/chucao/p-37e7f9cc.entry.js.map +1 -0
- package/dist/chucao/{p-121fbfc8.entry.js → p-5ae89a19.entry.js} +2 -2
- package/dist/chucao/p-70285203.entry.js +2 -0
- package/dist/chucao/p-70285203.entry.js.map +1 -0
- package/dist/chucao/{p-5fe8bfff.entry.js → p-9c072600.entry.js} +2 -2
- package/dist/chucao/p-b678a7e2.entry.js +2 -0
- package/dist/chucao/p-b678a7e2.entry.js.map +1 -0
- package/dist/chucao/p-b8bd0310.entry.js +2 -0
- package/dist/chucao/p-b8bd0310.entry.js.map +1 -0
- package/dist/chucao/p-bb2445d1.entry.js +2 -0
- package/dist/chucao/{p-9bb81a65.entry.js → p-c986036f.entry.js} +2 -2
- package/dist/chucao/p-d8DfpzMR.js +2 -0
- package/dist/chucao/p-d8DfpzMR.js.map +1 -0
- package/dist/chucao/{p-1b1e56cd.entry.js → p-e3265e38.entry.js} +2 -2
- package/dist/cjs/ch-alert_8.cjs.entry.js +54 -11
- package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- package/dist/cjs/ch-drawer.cjs.entry.js +153 -0
- package/dist/cjs/ch-drawer.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-emoji.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +4 -23
- package/dist/cjs/ch-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-radio.cjs.entry.js +1 -1
- package/dist/cjs/ch-segmented-control.cjs.entry.js +112 -0
- package/dist/cjs/ch-segmented-control.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ch-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/chucao.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/scroll-lock-DIRqLP4K.js +49 -0
- package/dist/cjs/scroll-lock-DIRqLP4K.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ch-button/ch-button.css +56 -18
- package/dist/collection/components/ch-button/ch-button.js +135 -8
- package/dist/collection/components/ch-button/ch-button.js.map +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.css +152 -0
- package/dist/collection/components/ch-drawer/ch-drawer.js +285 -0
- package/dist/collection/components/ch-drawer/ch-drawer.js.map +1 -0
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +4 -23
- package/dist/collection/components/ch-modal/ch-modal.js.map +1 -1
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.css +88 -0
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +295 -0
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js.map +1 -0
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +1 -1
- package/dist/collection/utils/scroll-lock.js +42 -0
- package/dist/collection/utils/scroll-lock.js.map +1 -0
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-button.js.map +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.d.ts +11 -0
- package/dist/components/ch-drawer.js +2 -0
- package/dist/components/ch-drawer.js.map +1 -0
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-modal.js.map +1 -1
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.d.ts +11 -0
- package/dist/components/ch-segmented-control.js +2 -0
- package/dist/components/ch-segmented-control.js.map +1 -0
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-spinner.js.map +1 -1
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-tooltip.js +1 -1
- package/dist/components/p-C4eGmLcE.js +2 -0
- package/dist/components/p-C4eGmLcE.js.map +1 -0
- package/dist/components/p-d8DfpzMR.js +2 -0
- package/dist/components/p-d8DfpzMR.js.map +1 -0
- package/dist/esm/ch-alert_8.entry.js +54 -11
- package/dist/esm/ch-alert_8.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-divider.entry.js +1 -1
- package/dist/esm/ch-drawer.entry.js +151 -0
- package/dist/esm/ch-drawer.entry.js.map +1 -0
- package/dist/esm/ch-emoji.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +4 -23
- package/dist/esm/ch-modal.entry.js.map +1 -1
- package/dist/esm/ch-radio.entry.js +1 -1
- package/dist/esm/ch-segmented-control.entry.js +110 -0
- package/dist/esm/ch-segmented-control.entry.js.map +1 -0
- package/dist/esm/ch-tabs.entry.js +1 -1
- package/dist/esm/ch-textarea.entry.js +1 -1
- package/dist/esm/ch-tooltip.entry.js +1 -1
- package/dist/esm/chucao.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/scroll-lock-d8DfpzMR.js +46 -0
- package/dist/esm/scroll-lock-d8DfpzMR.js.map +1 -0
- package/dist/types/components/ch-button/ch-button.d.ts +29 -5
- package/dist/types/components/ch-drawer/ch-drawer.d.ts +68 -0
- package/dist/types/components/ch-segmented-control/ch-segmented-control.d.ts +72 -0
- package/dist/types/components.d.ts +333 -6
- package/dist/types/utils/scroll-lock.d.ts +17 -0
- package/dist-react/components.d.ts +12 -1
- package/dist-react/components.js +21 -0
- package/dist-react/components.ts +31 -1
- package/dist-vue/index.d.ts +2 -0
- package/dist-vue/index.js +29 -0
- package/dist-vue/index.ts +33 -0
- package/hydrate/index.js +418 -41
- package/hydrate/index.mjs +418 -41
- package/package.json +4 -3
- package/dist/chucao/p-11083711.entry.js +0 -2
- package/dist/chucao/p-11083711.entry.js.map +0 -1
- package/dist/chucao/p-2ab4a6a8.entry.js +0 -2
- package/dist/chucao/p-a955eebf.entry.js +0 -2
- package/dist/chucao/p-a955eebf.entry.js.map +0 -1
- /package/dist/chucao/{p-d5a9e340.entry.js.map → p-077dc2a6.entry.js.map} +0 -0
- /package/dist/chucao/{p-4bc8e098.entry.js.map → p-079c2017.entry.js.map} +0 -0
- /package/dist/chucao/{p-121fbfc8.entry.js.map → p-5ae89a19.entry.js.map} +0 -0
- /package/dist/chucao/{p-5fe8bfff.entry.js.map → p-9c072600.entry.js.map} +0 -0
- /package/dist/chucao/{p-2ab4a6a8.entry.js.map → p-bb2445d1.entry.js.map} +0 -0
- /package/dist/chucao/{p-9bb81a65.entry.js.map → p-c986036f.entry.js.map} +0 -0
- /package/dist/chucao/{p-1b1e56cd.entry.js.map → p-e3265e38.entry.js.map} +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-DWC12BJ-.js';
|
|
2
|
+
|
|
3
|
+
const chSegmentedControlCss = () => `:host{display:inline-block;max-width:100%}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.segmented{display:inline-flex;align-items:stretch;max-width:100%;padding:var(--spacing-2xs);border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:var(--surface)}.control{position:relative;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-pill);cursor:pointer;transition:background-color var(--duration-normal) var(--easing-default)}.control:hover:not(.control--disabled){background:var(--surface-hover)}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{position:absolute;inset:0;margin:0;opacity:0;cursor:inherit}.input:checked~.label-text{background:var(--accent);color:var(--color-accent-text);font-weight:var(--typography-weight-semibold)}.input:focus-visible~.label-text{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.label-text{display:block;padding:var(--spacing-2xs) var(--spacing-3xl);border-radius:inherit;font-size:var(--typography-size-sm);white-space:nowrap;transition:background-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default)}.segmented--sm .label-text{padding:var(--spacing-2xs) var(--spacing-2xl);font-size:var(--typography-size-xs)}:host([data-touched]:invalid) .segmented,:host(:user-invalid) .segmented{border-color:var(--color-status-warning)}@media (prefers-reduced-motion: reduce){.control,.label-text{transition:none}}`;
|
|
4
|
+
|
|
5
|
+
let segmentedIds = 0;
|
|
6
|
+
const ChSegmentedControl = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.chChange = createEvent(this, "chChange");
|
|
10
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
11
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
15
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
groupId = `ch-segmented-${++segmentedIds}`;
|
|
19
|
+
labelId = `${this.groupId}-label`;
|
|
20
|
+
initialValue;
|
|
21
|
+
internals;
|
|
22
|
+
formDisabled = false;
|
|
23
|
+
get host() { return getElement(this); }
|
|
24
|
+
/**
|
|
25
|
+
* Visible label describing the group, associated with it via
|
|
26
|
+
* `aria-labelledby`.
|
|
27
|
+
*/
|
|
28
|
+
label;
|
|
29
|
+
/**
|
|
30
|
+
* The list of options rendered as segments.
|
|
31
|
+
*/
|
|
32
|
+
options = [];
|
|
33
|
+
/**
|
|
34
|
+
* The value of the selected option.
|
|
35
|
+
*/
|
|
36
|
+
value;
|
|
37
|
+
/**
|
|
38
|
+
* The size of the segments. Either `sm` or `md`.
|
|
39
|
+
*/
|
|
40
|
+
size = 'md';
|
|
41
|
+
/**
|
|
42
|
+
* The name shared by all radio inputs in the group, also used to submit the
|
|
43
|
+
* value. Defaults to an auto-generated group name so options are mutually
|
|
44
|
+
* exclusive out of the box.
|
|
45
|
+
*/
|
|
46
|
+
name;
|
|
47
|
+
/**
|
|
48
|
+
* Whether all segments are disabled.
|
|
49
|
+
*/
|
|
50
|
+
disabled = false;
|
|
51
|
+
/**
|
|
52
|
+
* Whether a value is required.
|
|
53
|
+
*/
|
|
54
|
+
required = false;
|
|
55
|
+
/**
|
|
56
|
+
* Emitted when a new option is selected, with the selected value.
|
|
57
|
+
*/
|
|
58
|
+
chChange;
|
|
59
|
+
handleChange = (ev) => {
|
|
60
|
+
this.value = ev.target.value;
|
|
61
|
+
this.chChange.emit(this.value);
|
|
62
|
+
};
|
|
63
|
+
syncForm() {
|
|
64
|
+
const internals = this.internals;
|
|
65
|
+
if (typeof internals?.setFormValue !== 'function') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
internals.setFormValue(this.value ?? null);
|
|
69
|
+
const flags = {};
|
|
70
|
+
if (this.required && !this.value) {
|
|
71
|
+
flags.valueMissing = true;
|
|
72
|
+
}
|
|
73
|
+
internals.setValidity(flags, flags.valueMissing ? 'Please fill out this field.' : undefined);
|
|
74
|
+
}
|
|
75
|
+
componentDidLoad() {
|
|
76
|
+
this.initialValue = this.value;
|
|
77
|
+
this.syncForm();
|
|
78
|
+
this.host.addEventListener('change', this.markTouched);
|
|
79
|
+
this.host.addEventListener('focusout', this.markTouched);
|
|
80
|
+
this.host.addEventListener('invalid', this.markTouched);
|
|
81
|
+
}
|
|
82
|
+
markTouched = () => {
|
|
83
|
+
this.host.setAttribute('data-touched', '');
|
|
84
|
+
};
|
|
85
|
+
formResetCallback() {
|
|
86
|
+
this.value = this.initialValue;
|
|
87
|
+
}
|
|
88
|
+
formDisabledCallback(isDisabled) {
|
|
89
|
+
this.formDisabled = isDisabled;
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
const groupName = this.name || `${this.groupId}-group`;
|
|
93
|
+
return (h(Host, { key: 'fd588544d9cdebaaeb1961f4ecb5c5630e8e4699' }, this.label && (h("span", { key: '58ade8d7858d6e12d71778bc07337ab485be383d', class: "group-label", id: this.labelId }, this.label)), h("div", { key: 'b872fc7e4a2dc678dbc1c9cf7c30d66ce24ebcac', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), h("span", { class: "label-text" }, option.label)))))));
|
|
94
|
+
}
|
|
95
|
+
static get formAssociated() { return true; }
|
|
96
|
+
static get watchers() { return {
|
|
97
|
+
"value": [{
|
|
98
|
+
"syncForm": 0
|
|
99
|
+
}],
|
|
100
|
+
"required": [{
|
|
101
|
+
"syncForm": 0
|
|
102
|
+
}]
|
|
103
|
+
}; }
|
|
104
|
+
};
|
|
105
|
+
ChSegmentedControl.style = chSegmentedControlCss();
|
|
106
|
+
|
|
107
|
+
export { ChSegmentedControl as ch_segmented_control };
|
|
108
|
+
//# sourceMappingURL=ch-segmented-control.entry.js.map
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=ch-segmented-control.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-segmented-control.entry.js","sources":["src/components/ch-segmented-control/ch-segmented-control.css?tag=ch-segmented-control&encapsulation=shadow","src/components/ch-segmented-control/ch-segmented-control.tsx"],"sourcesContent":[":host {\n display: inline-block;\n max-width: 100%;\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.segmented {\n display: inline-flex;\n align-items: stretch;\n max-width: 100%;\n padding: var(--spacing-2xs);\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius-pill);\n background: var(--surface);\n}\n\n.control {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--radius-pill);\n cursor: pointer;\n transition: background-color var(--duration-normal) var(--easing-default);\n}\n\n.control:hover:not(.control--disabled) {\n background: var(--surface-hover);\n}\n\n.control--disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.input {\n position: absolute;\n inset: 0;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n}\n\n.input:checked ~ .label-text {\n background: var(--accent);\n color: var(--color-accent-text);\n font-weight: var(--typography-weight-semibold);\n}\n\n.input:focus-visible ~ .label-text {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n.label-text {\n display: block;\n padding: var(--spacing-2xs) var(--spacing-3xl);\n border-radius: inherit;\n font-size: var(--typography-size-sm);\n white-space: nowrap;\n transition:\n background-color var(--duration-normal) var(--easing-default),\n color var(--duration-normal) var(--easing-default);\n}\n\n.segmented--sm .label-text {\n padding: var(--spacing-2xs) var(--spacing-2xl);\n font-size: var(--typography-size-xs);\n}\n\n:host([data-touched]:invalid) .segmented,\n:host(:user-invalid) .segmented {\n border-color: var(--color-status-warning);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .control,\n .label-text {\n transition: none;\n }\n}\n","import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nexport interface ChSegmentedControlOption {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nexport type ChSegmentedControlSize = 'sm' | 'md';\n\nlet segmentedIds = 0;\n\n/**\n * Compact control for switching between a few mutually exclusive options\n * (all/in/out, movement type, and similar filters).\n *\n * Built on native radio inputs sharing a name inside a `role=\"radiogroup\"`,\n * so arrow-key navigation, a single tab stop, `:focus-visible` and native form\n * participation come from the platform instead of hand-rolled key handling.\n * It is form-associated like the other controls: inside a `<form>` the selected\n * value is submitted under `name`, and `required` with an empty value is\n * invalid.\n *\n * It differs from `ch-radio` in presentation only — segments in a joined track\n * instead of a vertical list of radio marks — so it is meant for compact\n * filters, not for long option lists.\n */\n@Component({\n tag: 'ch-segmented-control',\n styleUrl: 'ch-segmented-control.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChSegmentedControl {\n private readonly groupId = `ch-segmented-${++segmentedIds}`;\n private readonly labelId = `${this.groupId}-label`;\n private initialValue: string | undefined;\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /**\n * Visible label describing the group, associated with it via\n * `aria-labelledby`.\n */\n @Prop() label?: string;\n\n /**\n * The list of options rendered as segments.\n */\n @Prop() options: ChSegmentedControlOption[] = [];\n\n /**\n * The value of the selected option.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The size of the segments. Either `sm` or `md`.\n */\n @Prop() size: ChSegmentedControlSize = 'md';\n\n /**\n * The name shared by all radio inputs in the group, also used to submit the\n * value. Defaults to an auto-generated group name so options are mutually\n * exclusive out of the box.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * Whether all segments are disabled.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * Whether a value is required.\n */\n @Prop({ reflect: true }) required = 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 @Watch('value')\n @Watch('required')\n protected syncForm(): void {\n const internals = this.internals;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n internals.setFormValue(this.value ?? null);\n const flags: ValidityStateFlags = {};\n if (this.required && !this.value) {\n flags.valueMissing = true;\n }\n internals.setValidity(flags, flags.valueMissing ? 'Please fill out this field.' : undefined);\n }\n\n componentDidLoad() {\n this.initialValue = this.value;\n this.syncForm();\n this.host.addEventListener('change', this.markTouched);\n this.host.addEventListener('focusout', this.markTouched);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n };\n\n formResetCallback(): void {\n this.value = this.initialValue;\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\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={{ segmented: true, [`segmented--${this.size}`]: true }} role=\"radiogroup\" aria-labelledby={this.label ? this.labelId : undefined}>\n {this.options.map(option => (\n <label class={{ 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled }}>\n <input\n class=\"input\"\n type=\"radio\"\n name={groupName}\n value={option.value}\n checked={option.value === this.value}\n disabled={this.disabled || this.formDisabled || option.disabled}\n onChange={this.handleChange}\n />\n <span class=\"label-text\">{option.label}</span>\n </label>\n ))}\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -84,7 +84,7 @@ const ChTabs = class {
|
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
86
|
const active = this.activeValue;
|
|
87
|
-
return (h(Host, { key: '
|
|
87
|
+
return (h(Host, { key: '8b0757158cca856bd984e99b86b9f1c3a79e1dfb' }, h("div", { key: 'e1ecf05df41e26787ed3702c113a393edcc6dea4', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
|
|
88
88
|
const selected = tab.value === active;
|
|
89
89
|
return (h("button", { key: tab.value, type: "button", class: { 'tab': true, 'tab--active': selected, 'tab--disabled': Boolean(tab.disabled) }, role: "tab", id: this.tabId(tab.value), "data-value": tab.value, "aria-selected": selected ? 'true' : 'false', "aria-controls": this.panelId(tab.value), tabIndex: selected ? FIRST_TAB_INDEX : LAST_TAB_INDEX, disabled: tab.disabled, onClick: () => this.select(tab.value) }, tab.label));
|
|
90
90
|
})), this.tabs.map(tab => (h("div", { key: `${tab.value}-panel`, class: "tabpanel", id: this.panelId(tab.value), role: "tabpanel", "aria-labelledby": this.tabId(tab.value), tabIndex: FIRST_TAB_INDEX, hidden: tab.value !== active }, h("slot", { name: `panel-${tab.value}` }))))));
|
|
@@ -125,7 +125,7 @@ const ChTextarea = class {
|
|
|
125
125
|
return undefined;
|
|
126
126
|
}
|
|
127
127
|
render() {
|
|
128
|
-
return (h(Host, { key: '
|
|
128
|
+
return (h(Host, { key: '35cdb2ec4cb35cb33492c4827f6f69251eea64be' }, this.label && (h("label", { key: '157579852d461707fddc660f33acd21768f7d3fe', class: "label", htmlFor: this.textareaId }, this.label)), h("textarea", { key: 'bf43052c6c66c24a906f6e4fae4256675a1b9f89', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, 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: '3dcacf048dccc3474d9397f917da32b334a072fd', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '22e706a1e0b17112b39e296d267d33a1bced06ee', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
129
129
|
}
|
|
130
130
|
static get formAssociated() { return true; }
|
|
131
131
|
static get watchers() { return {
|
|
@@ -69,7 +69,7 @@ const ChTooltip = class {
|
|
|
69
69
|
trigger.setAttribute('aria-describedby', content.id);
|
|
70
70
|
};
|
|
71
71
|
render() {
|
|
72
|
-
return (h(Host, { key: '
|
|
72
|
+
return (h(Host, { key: '89e1b0de9e5d2a33edba2cc0b479788694c5a202' }, h("span", { key: 'c7a31597ba6fd6a7c68cdd74cf8170d14b9e85ba', class: "anchor" }, h("slot", { key: 'eac54ebeffa8ccbfdd0c4e42e26cd4c40e81d649', name: "trigger", onSlotchange: this.associate }), h("span", { key: '326581a3f64a2165a9031818782a50de7fe05fa7', class: { 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible } }, h("slot", { key: '739d4b50a611cc4db8fdc802f2f39deb68f974eb', name: "content", onSlotchange: this.associate })))));
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
ChTooltip.style = chTooltipCss();
|
package/dist/esm/chucao.js
CHANGED
|
@@ -16,7 +16,7 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["ch-
|
|
19
|
+
return bootstrapLazy([["ch-accordion",[[769,"ch-accordion",{"items":[16],"value":[1025]}]]],["ch-checkbox",[[577,"ch-checkbox",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-divider",[[513,"ch-divider",{"orientation":[1]}]]],["ch-drawer",[[769,"ch-drawer",{"open":[1028],"side":[1],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-emoji",[[513,"ch-emoji",{"name":[1],"alt":[1],"size":[1],"extIndex":[32],"loaded":[32]},null,{"name":[{"handleNameChange":0}]}]]],["ch-link",[[769,"ch-link",{"href":[1],"target":[1],"variant":[1],"disabled":[4]}]]],["ch-modal",[[769,"ch-modal",{"open":[1028],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-radio",[[577,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-segmented-control",[[577,"ch-segmented-control",{"label":[1],"options":[16],"value":[1025],"size":[1],"name":[513],"disabled":[516],"required":[516],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}]}]]],["ch-tabs",[[769,"ch-tabs",{"tabs":[16],"value":[1025],"label":[1]}]]],["ch-textarea",[[577,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-tooltip",[[769,"ch-tooltip",{"placement":[1],"hovered":[32],"focused":[32],"dismissed":[32]},[[1,"mouseenter","handleMouseEnter"],[1,"mouseleave","handleMouseLeave"],[0,"focusin","handleFocusIn"],[0,"focusout","handleFocusOut"],[4,"keydown","handleKeyDown"]]]]],["ch-alert_8",[[769,"ch-button",{"variant":[1],"size":[1],"disabled":[4],"loading":[4],"href":[1],"target":[1],"label":[1]}],[769,"ch-alert",{"variant":[1],"dismissLabel":[1,"dismiss-label"]}],[769,"ch-badge",{"variant":[1]}],[257,"ch-card"],[577,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-switch",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[513,"ch-spinner",{"size":[1],"label":[1]}]]]], options);
|
|
20
20
|
});
|
|
21
21
|
//# sourceMappingURL=chucao.js.map
|
|
22
22
|
|
package/dist/esm/loader.js
CHANGED
|
@@ -4,7 +4,7 @@ export { s as setNonce } from './index-DWC12BJ-.js';
|
|
|
4
4
|
const defineCustomElements = async (win, options) => {
|
|
5
5
|
if (typeof window === 'undefined') return undefined;
|
|
6
6
|
await globalScripts();
|
|
7
|
-
return bootstrapLazy([["ch-
|
|
7
|
+
return bootstrapLazy([["ch-accordion",[[769,"ch-accordion",{"items":[16],"value":[1025]}]]],["ch-checkbox",[[577,"ch-checkbox",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-divider",[[513,"ch-divider",{"orientation":[1]}]]],["ch-drawer",[[769,"ch-drawer",{"open":[1028],"side":[1],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-emoji",[[513,"ch-emoji",{"name":[1],"alt":[1],"size":[1],"extIndex":[32],"loaded":[32]},null,{"name":[{"handleNameChange":0}]}]]],["ch-link",[[769,"ch-link",{"href":[1],"target":[1],"variant":[1],"disabled":[4]}]]],["ch-modal",[[769,"ch-modal",{"open":[1028],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-radio",[[577,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-segmented-control",[[577,"ch-segmented-control",{"label":[1],"options":[16],"value":[1025],"size":[1],"name":[513],"disabled":[516],"required":[516],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}]}]]],["ch-tabs",[[769,"ch-tabs",{"tabs":[16],"value":[1025],"label":[1]}]]],["ch-textarea",[[577,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}]]],["ch-tooltip",[[769,"ch-tooltip",{"placement":[1],"hovered":[32],"focused":[32],"dismissed":[32]},[[1,"mouseenter","handleMouseEnter"],[1,"mouseleave","handleMouseLeave"],[0,"focusin","handleFocusIn"],[0,"focusout","handleFocusOut"],[4,"keydown","handleKeyDown"]]]]],["ch-alert_8",[[769,"ch-button",{"variant":[1],"size":[1],"disabled":[4],"loading":[4],"href":[1],"target":[1],"label":[1]}],[769,"ch-alert",{"variant":[1],"dismissLabel":[1,"dismiss-label"]}],[769,"ch-badge",{"variant":[1]}],[257,"ch-card"],[577,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[513],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"value":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[577,"ch-switch",{"label":[1],"name":[513],"value":[1],"checked":[1028],"disabled":[516],"required":[516],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4],"formDisabled":[32]},null,{"checked":[{"syncForm":0}],"required":[{"syncForm":0}],"invalid":[{"syncForm":0}],"errorMessage":[{"syncForm":0}]}],[513,"ch-spinner",{"size":[1],"label":[1]}]]]], options);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { defineCustomElements };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
let openOverlays = 0;
|
|
2
|
+
let previousOverflow = '';
|
|
3
|
+
let previousPaddingRight = '';
|
|
4
|
+
/**
|
|
5
|
+
* Prevents the page behind an overlay from scrolling, compensating for the
|
|
6
|
+
* scrollbar it removes so the layout does not shift.
|
|
7
|
+
*
|
|
8
|
+
* Reference-counted on a module-level counter, so concurrent overlays (a modal
|
|
9
|
+
* over a drawer, several stacked dialogs) cannot unlock the page early:
|
|
10
|
+
* whichever overlay closes first only decrements the count, and the last one
|
|
11
|
+
* restores the original styles.
|
|
12
|
+
*
|
|
13
|
+
* Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.
|
|
14
|
+
*/
|
|
15
|
+
function lockScroll() {
|
|
16
|
+
openOverlays += 1;
|
|
17
|
+
if (openOverlays > 1) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const root = document.documentElement;
|
|
21
|
+
const scrollbar = window.innerWidth - root.clientWidth;
|
|
22
|
+
previousOverflow = root.style.overflow;
|
|
23
|
+
previousPaddingRight = root.style.paddingRight;
|
|
24
|
+
root.style.overflow = 'hidden';
|
|
25
|
+
if (scrollbar > 0) {
|
|
26
|
+
root.style.paddingRight = `${scrollbar}px`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Releases one scroll lock. Only the last lock restores the page; earlier calls
|
|
31
|
+
* are a no-op so the overlay still open keeps the page frozen.
|
|
32
|
+
*/
|
|
33
|
+
function unlockScroll() {
|
|
34
|
+
openOverlays -= 1;
|
|
35
|
+
if (openOverlays > 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const root = document.documentElement;
|
|
39
|
+
root.style.overflow = previousOverflow;
|
|
40
|
+
root.style.paddingRight = previousPaddingRight;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { lockScroll as l, unlockScroll as u };
|
|
44
|
+
//# sourceMappingURL=scroll-lock-d8DfpzMR.js.map
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=scroll-lock-d8DfpzMR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-lock-d8DfpzMR.js","sources":["src/utils/scroll-lock.ts"],"sourcesContent":["let openOverlays = 0;\nlet previousOverflow = '';\nlet previousPaddingRight = '';\n\n/**\n * Prevents the page behind an overlay from scrolling, compensating for the\n * scrollbar it removes so the layout does not shift.\n *\n * Reference-counted on a module-level counter, so concurrent overlays (a modal\n * over a drawer, several stacked dialogs) cannot unlock the page early:\n * whichever overlay closes first only decrements the count, and the last one\n * restores the original styles.\n *\n * Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.\n */\nexport function lockScroll() {\n openOverlays += 1;\n if (openOverlays > 1) {\n return;\n }\n const root = document.documentElement;\n const scrollbar = window.innerWidth - root.clientWidth;\n previousOverflow = root.style.overflow;\n previousPaddingRight = root.style.paddingRight;\n root.style.overflow = 'hidden';\n if (scrollbar > 0) {\n root.style.paddingRight = `${scrollbar}px`;\n }\n}\n\n/**\n * Releases one scroll lock. Only the last lock restores the page; earlier calls\n * are a no-op so the overlay still open keeps the page frozen.\n */\nexport function unlockScroll() {\n openOverlays -= 1;\n if (openOverlays > 0) {\n return;\n }\n const root = document.documentElement;\n root.style.overflow = previousOverflow;\n root.style.paddingRight = previousPaddingRight;\n}\n"],"names":[],"mappings":"AAAA,IAAI,YAAY,GAAG,CAAC;AACpB,IAAI,gBAAgB,GAAG,EAAE;AACzB,IAAI,oBAAoB,GAAG,EAAE;AAE7B;;;;;;;;;;AAUG;SACa,UAAU,GAAA;IACxB,YAAY,IAAI,CAAC;AACjB,IAAA,IAAI,YAAY,GAAG,CAAC,EAAE;QACpB;;AAEF,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe;IACrC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW;AACtD,IAAA,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ;AACtC,IAAA,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY;AAC9C,IAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ;AAC9B,IAAA,IAAI,SAAS,GAAG,CAAC,EAAE;QACjB,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,CAAA,EAAG,SAAS,IAAI;;AAE9C;AAEA;;;AAGG;SACa,YAAY,GAAA;IAC1B,YAAY,IAAI,CAAC;AACjB,IAAA,IAAI,YAAY,GAAG,CAAC,EAAE;QACpB;;AAEF,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe;AACrC,IAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,gBAAgB;AACtC,IAAA,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,oBAAoB;AAChD;;;;"}
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
export type ChButtonVariant = 'primary' | 'secondary';
|
|
2
|
+
export type ChButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
3
|
+
export type ChButtonSize = 'sm' | 'md' | 'lg';
|
|
3
4
|
export declare class ChButton {
|
|
4
5
|
/**
|
|
5
|
-
* The visual style of the button.
|
|
6
|
+
* The visual style of the button. One of `primary`, `secondary`, `ghost`,
|
|
7
|
+
* or `danger`.
|
|
6
8
|
*/
|
|
7
9
|
variant: ChButtonVariant;
|
|
10
|
+
/**
|
|
11
|
+
* The size of the button. One of `sm`, `md`, or `lg`.
|
|
12
|
+
*/
|
|
13
|
+
size: ChButtonSize;
|
|
8
14
|
/**
|
|
9
15
|
* Whether the button is disabled.
|
|
10
16
|
*/
|
|
11
17
|
disabled: boolean;
|
|
12
18
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
19
|
+
* Whether the button is loading. Shows a spinner, disables interaction, and
|
|
20
|
+
* announces the busy state with `aria-busy`.
|
|
21
|
+
*/
|
|
22
|
+
loading: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When set, the button renders as an `<a>` pointing to this URL while
|
|
25
|
+
* keeping the button styling.
|
|
26
|
+
*/
|
|
27
|
+
href?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The browsing context the link opens in (e.g. `_blank`). Only used when
|
|
30
|
+
* `href` is set. For `_blank`, a `noopener noreferrer` `rel` is added
|
|
31
|
+
* automatically.
|
|
32
|
+
*/
|
|
33
|
+
target?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Accessible label set as `aria-label` on the native element. Use it when
|
|
36
|
+
* the button's content doesn't convey its purpose on its own (e.g. an
|
|
37
|
+
* icon-only button).
|
|
16
38
|
*/
|
|
17
39
|
label?: string;
|
|
18
40
|
/**
|
|
@@ -20,5 +42,7 @@ export declare class ChButton {
|
|
|
20
42
|
*/
|
|
21
43
|
chClick: EventEmitter<MouseEvent>;
|
|
22
44
|
private handleClick;
|
|
45
|
+
private get spinnerSize();
|
|
46
|
+
private renderContent;
|
|
23
47
|
render(): any;
|
|
24
48
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
export type ChDrawerSide = 'start' | 'end' | 'top' | 'bottom';
|
|
3
|
+
/**
|
|
4
|
+
* Sliding side panel for navigation, editing forms and quick detail views.
|
|
5
|
+
*
|
|
6
|
+
* Built on the native `<dialog>` element and opened with `showModal()`, exactly
|
|
7
|
+
* like `ch-modal`, so the browser owns focus management, the inert background,
|
|
8
|
+
* `Escape`, the top layer, `::backdrop`, and the implicit `dialog` role with
|
|
9
|
+
* `aria-modal="true"`. The only differences are placement — anchored to one
|
|
10
|
+
* edge instead of centred — and the longer content it is meant for, which is
|
|
11
|
+
* why it exposes `header` and `footer` slots around a scrollable body.
|
|
12
|
+
*
|
|
13
|
+
* Scroll locking is shared with `ch-modal` through `utils/scroll-lock`, so a
|
|
14
|
+
* drawer and a modal opened together cannot unlock the page early.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ChDrawer {
|
|
17
|
+
/**
|
|
18
|
+
* Whether the drawer is open. Kept in sync when the user closes it with
|
|
19
|
+
* `Escape`, the close button or a click outside.
|
|
20
|
+
*/
|
|
21
|
+
open: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The edge the panel slides in from. `start`/`end` follow the writing
|
|
24
|
+
* direction, so `start` is the left edge in LTR and the right edge in RTL.
|
|
25
|
+
*/
|
|
26
|
+
side: ChDrawerSide;
|
|
27
|
+
/**
|
|
28
|
+
* Accessible name for the drawer, set as `aria-label`. A slotted heading
|
|
29
|
+
* cannot be referenced with `aria-labelledby` across the shadow boundary, so
|
|
30
|
+
* the name comes through this prop — and a modal dialog needs one, so pass
|
|
31
|
+
* the same text as the heading.
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Accessible label for the close button, set as `aria-label`. Setting it is
|
|
36
|
+
* what adds the button: its only content is a decorative glyph, so without a
|
|
37
|
+
* label it would have no accessible name.
|
|
38
|
+
*/
|
|
39
|
+
closeLabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Emitted after the drawer opens.
|
|
42
|
+
*/
|
|
43
|
+
chOpen: EventEmitter<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Emitted after the drawer closes, however it was closed.
|
|
46
|
+
*/
|
|
47
|
+
chClose: EventEmitter<void>;
|
|
48
|
+
private dialog?;
|
|
49
|
+
private scrollLocked;
|
|
50
|
+
private pointerDownedOutside;
|
|
51
|
+
componentDidLoad(): void;
|
|
52
|
+
disconnectedCallback(): void;
|
|
53
|
+
handleOpenChange(open: boolean): void;
|
|
54
|
+
private showDialog;
|
|
55
|
+
private closeDialog;
|
|
56
|
+
private lockScroll;
|
|
57
|
+
private unlockScroll;
|
|
58
|
+
/**
|
|
59
|
+
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
60
|
+
* target for its own box only, and the coordinates fall outside that box.
|
|
61
|
+
*/
|
|
62
|
+
private isOnBackdrop;
|
|
63
|
+
private handlePointerDown;
|
|
64
|
+
private handleClick;
|
|
65
|
+
private handleNativeClose;
|
|
66
|
+
private handleCloseClick;
|
|
67
|
+
render(): any;
|
|
68
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
export interface ChSegmentedControlOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type ChSegmentedControlSize = 'sm' | 'md';
|
|
8
|
+
/**
|
|
9
|
+
* Compact control for switching between a few mutually exclusive options
|
|
10
|
+
* (all/in/out, movement type, and similar filters).
|
|
11
|
+
*
|
|
12
|
+
* Built on native radio inputs sharing a name inside a `role="radiogroup"`,
|
|
13
|
+
* so arrow-key navigation, a single tab stop, `:focus-visible` and native form
|
|
14
|
+
* participation come from the platform instead of hand-rolled key handling.
|
|
15
|
+
* It is form-associated like the other controls: inside a `<form>` the selected
|
|
16
|
+
* value is submitted under `name`, and `required` with an empty value is
|
|
17
|
+
* invalid.
|
|
18
|
+
*
|
|
19
|
+
* It differs from `ch-radio` in presentation only — segments in a joined track
|
|
20
|
+
* instead of a vertical list of radio marks — so it is meant for compact
|
|
21
|
+
* filters, not for long option lists.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ChSegmentedControl {
|
|
24
|
+
private readonly groupId;
|
|
25
|
+
private readonly labelId;
|
|
26
|
+
private initialValue;
|
|
27
|
+
internals: ElementInternals;
|
|
28
|
+
formDisabled: boolean;
|
|
29
|
+
private host;
|
|
30
|
+
/**
|
|
31
|
+
* Visible label describing the group, associated with it via
|
|
32
|
+
* `aria-labelledby`.
|
|
33
|
+
*/
|
|
34
|
+
label?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The list of options rendered as segments.
|
|
37
|
+
*/
|
|
38
|
+
options: ChSegmentedControlOption[];
|
|
39
|
+
/**
|
|
40
|
+
* The value of the selected option.
|
|
41
|
+
*/
|
|
42
|
+
value?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The size of the segments. Either `sm` or `md`.
|
|
45
|
+
*/
|
|
46
|
+
size: ChSegmentedControlSize;
|
|
47
|
+
/**
|
|
48
|
+
* The name shared by all radio inputs in the group, also used to submit the
|
|
49
|
+
* value. Defaults to an auto-generated group name so options are mutually
|
|
50
|
+
* exclusive out of the box.
|
|
51
|
+
*/
|
|
52
|
+
name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether all segments are disabled.
|
|
55
|
+
*/
|
|
56
|
+
disabled: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether a value is required.
|
|
59
|
+
*/
|
|
60
|
+
required: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Emitted when a new option is selected, with the selected value.
|
|
63
|
+
*/
|
|
64
|
+
chChange: EventEmitter<string>;
|
|
65
|
+
private handleChange;
|
|
66
|
+
protected syncForm(): void;
|
|
67
|
+
componentDidLoad(): void;
|
|
68
|
+
private markTouched;
|
|
69
|
+
formResetCallback(): void;
|
|
70
|
+
formDisabledCallback(isDisabled: boolean): void;
|
|
71
|
+
render(): any;
|
|
72
|
+
}
|