@devschile/chucao 1.7.0 → 1.8.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 +13 -12
- package/dist/chucao/chucao.css +1 -1
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/index.esm.js +1 -1
- package/dist/chucao/index.esm.js.map +1 -1
- package/dist/chucao/{p-9a614e82.entry.js → p-13ab5f9a.entry.js} +2 -2
- package/dist/chucao/{p-053d58a4.entry.js → p-1cc7042e.entry.js} +2 -2
- package/dist/chucao/{p-c598f978.entry.js → p-23c5220b.entry.js} +2 -2
- package/dist/chucao/p-2d7e81b2.entry.js +2 -0
- package/dist/chucao/p-2d7e81b2.entry.js.map +1 -0
- package/dist/chucao/p-421cda05.entry.js +2 -0
- package/dist/chucao/{p-0305f2eb.entry.js.map → p-421cda05.entry.js.map} +1 -1
- package/dist/chucao/p-Bvah_WQV.js +3 -0
- package/dist/chucao/p-Bvah_WQV.js.map +1 -0
- package/dist/chucao/{p-ad3206a2.entry.js → p-c16b18b7.entry.js} +2 -2
- package/dist/chucao/p-cbb2b478.entry.js +2 -0
- package/dist/chucao/p-cbb2b478.entry.js.map +1 -0
- package/dist/chucao/{p-20492b73.entry.js → p-cfb6db53.entry.js} +2 -2
- package/dist/chucao/{p-488c7838.entry.js → p-df73f786.entry.js} +2 -2
- package/dist/chucao/{p-fe8e9537.entry.js → p-e8fe65bb.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +4 -4
- package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- package/dist/cjs/ch-link.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +167 -0
- package/dist/cjs/ch-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-radio.cjs.entry.js +1 -1
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ch-tooltip.cjs.entry.js +82 -0
- package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -0
- package/dist/cjs/chucao.cjs.js +2 -2
- package/dist/cjs/{index-ls4U227d.js → index-DMeDkSQU.js} +148 -5
- package/dist/cjs/index-DMeDkSQU.js.map +1 -0
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- 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-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.css +69 -0
- package/dist/collection/components/ch-modal/ch-modal.js +278 -0
- package/dist/collection/components/ch-modal/ch-modal.js.map +1 -0
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.css +100 -0
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +168 -0
- package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -0
- package/dist/collection/tokens/tokens.js +4 -0
- package/dist/collection/tokens/tokens.js.map +1 -1
- package/dist/collection/tokens/types.js.map +1 -1
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- 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-checkbox.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-link.js +1 -1
- package/dist/components/ch-modal.d.ts +11 -0
- package/dist/components/ch-modal.js +2 -0
- package/dist/components/ch-modal.js.map +1 -0
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-spinner.js +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.d.ts +11 -0
- package/dist/components/ch-tooltip.js +2 -0
- package/dist/components/ch-tooltip.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-hyy-cLgi.js +2 -0
- package/dist/components/p-hyy-cLgi.js.map +1 -0
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/ch-alert_8.entry.js +4 -4
- package/dist/esm/ch-checkbox.entry.js +2 -2
- package/dist/esm/ch-divider.entry.js +1 -1
- package/dist/esm/ch-link.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +165 -0
- package/dist/esm/ch-modal.entry.js.map +1 -0
- package/dist/esm/ch-radio.entry.js +1 -1
- package/dist/esm/ch-tabs.entry.js +1 -1
- package/dist/esm/ch-textarea.entry.js +2 -2
- package/dist/esm/ch-tooltip.entry.js +80 -0
- package/dist/esm/ch-tooltip.entry.js.map +1 -0
- package/dist/esm/chucao.js +3 -3
- package/dist/esm/{index-pfWAsOzE.js → index-Bvah_WQV.js} +148 -6
- package/dist/esm/index-Bvah_WQV.js.map +1 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-modal/ch-modal.d.ts +67 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +47 -0
- package/dist/types/components.d.ts +216 -0
- package/dist/types/tokens/tokens.d.ts +4 -0
- package/dist/types/tokens/types.d.ts +1 -1
- package/dist-react/components.d.ts +10 -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 +15 -0
- package/dist-vue/index.ts +19 -0
- package/hydrate/index.js +409 -8
- package/hydrate/index.mjs +409 -8
- package/package.json +1 -1
- package/dist/chucao/p-0305f2eb.entry.js +0 -2
- package/dist/chucao/p-pfWAsOzE.js +0 -3
- package/dist/chucao/p-pfWAsOzE.js.map +0 -1
- package/dist/cjs/index-ls4U227d.js.map +0 -1
- package/dist/components/p-ONE3uKkF.js +0 -2
- package/dist/components/p-ONE3uKkF.js.map +0 -1
- package/dist/esm/index-pfWAsOzE.js.map +0 -1
- /package/dist/chucao/{p-9a614e82.entry.js.map → p-13ab5f9a.entry.js.map} +0 -0
- /package/dist/chucao/{p-053d58a4.entry.js.map → p-1cc7042e.entry.js.map} +0 -0
- /package/dist/chucao/{p-c598f978.entry.js.map → p-23c5220b.entry.js.map} +0 -0
- /package/dist/chucao/{p-ad3206a2.entry.js.map → p-c16b18b7.entry.js.map} +0 -0
- /package/dist/chucao/{p-20492b73.entry.js.map → p-cfb6db53.entry.js.map} +0 -0
- /package/dist/chucao/{p-488c7838.entry.js.map → p-df73f786.entry.js.map} +0 -0
- /package/dist/chucao/{p-fe8e9537.entry.js.map → p-e8fe65bb.entry.js.map} +0 -0
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -6,6 +6,7 @@ const colorBackgroundTopGlow = '#201e40';
|
|
|
6
6
|
const colorBackgroundBottomGlow = '#261226';
|
|
7
7
|
const colorSurfaceDefault = 'rgba(32, 30, 64, 0.6)';
|
|
8
8
|
const colorSurfaceHover = 'rgba(45, 212, 191, 0.08)';
|
|
9
|
+
const colorScrimDefault = 'rgba(0, 0, 0, 0.6)';
|
|
9
10
|
const colorBorderDefault = 'rgba(255, 255, 255, 0.08)';
|
|
10
11
|
const colorBorderHover = 'rgba(45, 212, 191, 0.3)';
|
|
11
12
|
const colorAccentDefault = '#2dd4bf';
|
|
@@ -75,6 +76,9 @@ const tokens = {
|
|
|
75
76
|
default: 'rgba(32, 30, 64, 0.6)',
|
|
76
77
|
hover: 'rgba(45, 212, 191, 0.08)',
|
|
77
78
|
},
|
|
79
|
+
scrim: {
|
|
80
|
+
default: 'rgba(0, 0, 0, 0.6)',
|
|
81
|
+
},
|
|
78
82
|
border: {
|
|
79
83
|
default: 'rgba(255, 255, 255, 0.08)',
|
|
80
84
|
hover: 'rgba(45, 212, 191, 0.3)',
|
|
@@ -189,6 +193,7 @@ exports.colorBorderHover = colorBorderHover;
|
|
|
189
193
|
exports.colorBrandHuemulDark = colorBrandHuemulDark;
|
|
190
194
|
exports.colorBrandHuemulLight = colorBrandHuemulLight;
|
|
191
195
|
exports.colorBrandStroke = colorBrandStroke;
|
|
196
|
+
exports.colorScrimDefault = colorScrimDefault;
|
|
192
197
|
exports.colorStatusPositive = colorStatusPositive;
|
|
193
198
|
exports.colorStatusPositiveBackground = colorStatusPositiveBackground;
|
|
194
199
|
exports.colorStatusWarning = colorStatusWarning;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["src/tokens/tokens.ts"],"sourcesContent":["/* Generated by toki v1.12.1 — do not edit */\n\nexport const colorBackgroundBase = '#100a1c';\nexport const colorBackgroundTopGlow = '#201e40';\nexport const colorBackgroundBottomGlow = '#261226';\nexport const colorSurfaceDefault = 'rgba(32, 30, 64, 0.6)';\nexport const colorSurfaceHover = 'rgba(45, 212, 191, 0.08)';\nexport const colorBorderDefault = 'rgba(255, 255, 255, 0.08)';\nexport const colorBorderHover = 'rgba(45, 212, 191, 0.3)';\nexport const colorAccentDefault = '#2dd4bf';\nexport const colorAccentHover = '#5ee8d4';\nexport const colorAccentText = '#06210f';\nexport const colorStatusPositive = '#4ade80';\nexport const colorStatusPositiveBackground = 'rgba(34, 197, 94, 0.18)';\nexport const colorStatusWarning = '#f87171';\nexport const colorStatusWarningBackground = 'rgba(248, 113, 113, 0.15)';\nexport const colorTextPrimary = '#ffffff';\nexport const colorTextSecondary = 'rgba(255, 255, 255, 0.55)';\nexport const colorBrandHuemulDark = '#85422b';\nexport const colorBrandHuemulLight = '#b45b38';\nexport const colorBrandStroke = '#1d1d1b';\nexport const typographyBody = 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif';\nexport const typographyHeading = 'Inconsolata, monospace';\nexport const typographySizeXs = '0.68rem';\nexport const typographySizeSm = '0.85rem';\nexport const typographySizeMd = '1rem';\nexport const typographySizeLg = '1.25rem';\nexport const typographySizeXl = '1.5rem';\nexport const typographyWeightRegular = '400';\nexport const typographyWeightSemibold = '600';\nexport const typographyWeightBold = '700';\nexport const typographyTrackingBadge = '0.03em';\nexport const spacing2xs = '0.18rem';\nexport const spacingXs = '0.25rem';\nexport const spacingSm = '0.35rem';\nexport const spacingMd = '0.5rem';\nexport const spacingLg = '0.6rem';\nexport const spacingXl = '0.8rem';\nexport const spacing2xl = '1rem';\nexport const spacing3xl = '1.25rem';\nexport const spacing4xl = '1.35rem';\nexport const spacing5xl = '1.5rem';\nexport const spacing6xl = '2rem';\nexport const spacingShift = '2px';\nexport const spacingElevate = '1px';\nexport const radiusSm = '6px';\nexport const radiusMd = '8px';\nexport const radiusPill = '999px';\nexport const borderWidth = '1px';\nexport const borderAccentBar = '3px';\nexport const shadowFocusRing = '0 0 0 3px rgba(45, 212, 191, 0.12)';\nexport const shadowCardHover = '0 4px 20px rgba(45, 212, 191, 0.06)';\nexport const effectBlur = '10px';\nexport const durationFast = '150ms';\nexport const durationNormal = '200ms';\nexport const durationSpin = '800ms';\nexport const easingDefault = 'ease';\nexport const easingLinear = 'linear';\nexport const focusOutlineWidth = '2px';\nexport const focusOutlineOffset = '2px';\nexport const opacityDisabled = 0.5;\nexport const zIndexBase = 0;\nexport const zIndexDropdown = 100;\nexport const zIndexModal = 1000;\nexport const layoutMaxWidth = '68rem';\n\nexport const tokens = {\n 'color': {\n background: {\n base: '#100a1c',\n topGlow: '#201e40',\n bottomGlow: '#261226',\n },\n surface: {\n default: 'rgba(32, 30, 64, 0.6)',\n hover: 'rgba(45, 212, 191, 0.08)',\n },\n border: {\n default: 'rgba(255, 255, 255, 0.08)',\n hover: 'rgba(45, 212, 191, 0.3)',\n },\n accent: {\n default: '#2dd4bf',\n hover: '#5ee8d4',\n text: '#06210f',\n },\n status: {\n positive: '#4ade80',\n positiveBackground: 'rgba(34, 197, 94, 0.18)',\n warning: '#f87171',\n warningBackground: 'rgba(248, 113, 113, 0.15)',\n },\n text: {\n primary: '#ffffff',\n secondary: 'rgba(255, 255, 255, 0.55)',\n },\n brand: {\n huemulDark: '#85422b',\n huemulLight: '#b45b38',\n stroke: '#1d1d1b',\n },\n },\n 'typography': {\n body: 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif',\n heading: 'Inconsolata, monospace',\n size: {\n xs: '0.68rem',\n sm: '0.85rem',\n md: '1rem',\n lg: '1.25rem',\n xl: '1.5rem',\n },\n weight: {\n regular: '400',\n semibold: '600',\n bold: '700',\n },\n tracking: {\n badge: '0.03em',\n },\n },\n 'spacing': {\n '2xs': '0.18rem',\n 'xs': '0.25rem',\n 'sm': '0.35rem',\n 'md': '0.5rem',\n 'lg': '0.6rem',\n 'xl': '0.8rem',\n '2xl': '1rem',\n '3xl': '1.25rem',\n '4xl': '1.35rem',\n '5xl': '1.5rem',\n '6xl': '2rem',\n 'shift': '2px',\n 'elevate': '1px',\n },\n 'radius': {\n sm: '6px',\n md: '8px',\n pill: '999px',\n },\n 'border': {\n width: '1px',\n accentBar: '3px',\n },\n 'shadow': {\n focusRing: '0 0 0 3px rgba(45, 212, 191, 0.12)',\n cardHover: '0 4px 20px rgba(45, 212, 191, 0.06)',\n },\n 'effect': {\n blur: '10px',\n },\n 'duration': {\n fast: '150ms',\n normal: '200ms',\n spin: '800ms',\n },\n 'easing': {\n default: 'ease',\n linear: 'linear',\n },\n 'focus': {\n outlineWidth: '2px',\n outlineOffset: '2px',\n },\n 'opacity': {\n disabled: 0.5,\n },\n 'z-index': {\n base: 0,\n dropdown: 100,\n modal: 1000,\n },\n 'layout': {\n maxWidth: '68rem',\n },\n} as const;\n\nexport type TokenCategory = keyof typeof tokens;\n"],"names":[],"mappings":";;AAAA;AAEO,MAAM,mBAAmB,GAAG;AAC5B,MAAM,sBAAsB,GAAG;AAC/B,MAAM,yBAAyB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AACD,IAAA,UAAU,EAAE;AACV,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,MAAM,EAAE,OAAO;AACf,QAAA,IAAI,EAAE,OAAO;AACd,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,MAAM,EAAE,QAAQ;AACjB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,YAAY,EAAE,KAAK;AACnB,QAAA,aAAa,EAAE,KAAK;AACrB,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,QAAQ,EAAE,GAAG;AACd,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,QAAQ,EAAE,OAAO;AAClB,KAAA
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["src/tokens/tokens.ts"],"sourcesContent":["/* Generated by toki v1.12.1 — do not edit */\n\nexport const colorBackgroundBase = '#100a1c';\nexport const colorBackgroundTopGlow = '#201e40';\nexport const colorBackgroundBottomGlow = '#261226';\nexport const colorSurfaceDefault = 'rgba(32, 30, 64, 0.6)';\nexport const colorSurfaceHover = 'rgba(45, 212, 191, 0.08)';\nexport const colorScrimDefault = 'rgba(0, 0, 0, 0.6)';\nexport const colorBorderDefault = 'rgba(255, 255, 255, 0.08)';\nexport const colorBorderHover = 'rgba(45, 212, 191, 0.3)';\nexport const colorAccentDefault = '#2dd4bf';\nexport const colorAccentHover = '#5ee8d4';\nexport const colorAccentText = '#06210f';\nexport const colorStatusPositive = '#4ade80';\nexport const colorStatusPositiveBackground = 'rgba(34, 197, 94, 0.18)';\nexport const colorStatusWarning = '#f87171';\nexport const colorStatusWarningBackground = 'rgba(248, 113, 113, 0.15)';\nexport const colorTextPrimary = '#ffffff';\nexport const colorTextSecondary = 'rgba(255, 255, 255, 0.55)';\nexport const colorBrandHuemulDark = '#85422b';\nexport const colorBrandHuemulLight = '#b45b38';\nexport const colorBrandStroke = '#1d1d1b';\nexport const typographyBody = 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif';\nexport const typographyHeading = 'Inconsolata, monospace';\nexport const typographySizeXs = '0.68rem';\nexport const typographySizeSm = '0.85rem';\nexport const typographySizeMd = '1rem';\nexport const typographySizeLg = '1.25rem';\nexport const typographySizeXl = '1.5rem';\nexport const typographyWeightRegular = '400';\nexport const typographyWeightSemibold = '600';\nexport const typographyWeightBold = '700';\nexport const typographyTrackingBadge = '0.03em';\nexport const spacing2xs = '0.18rem';\nexport const spacingXs = '0.25rem';\nexport const spacingSm = '0.35rem';\nexport const spacingMd = '0.5rem';\nexport const spacingLg = '0.6rem';\nexport const spacingXl = '0.8rem';\nexport const spacing2xl = '1rem';\nexport const spacing3xl = '1.25rem';\nexport const spacing4xl = '1.35rem';\nexport const spacing5xl = '1.5rem';\nexport const spacing6xl = '2rem';\nexport const spacingShift = '2px';\nexport const spacingElevate = '1px';\nexport const radiusSm = '6px';\nexport const radiusMd = '8px';\nexport const radiusPill = '999px';\nexport const borderWidth = '1px';\nexport const borderAccentBar = '3px';\nexport const shadowFocusRing = '0 0 0 3px rgba(45, 212, 191, 0.12)';\nexport const shadowCardHover = '0 4px 20px rgba(45, 212, 191, 0.06)';\nexport const effectBlur = '10px';\nexport const durationFast = '150ms';\nexport const durationNormal = '200ms';\nexport const durationSpin = '800ms';\nexport const easingDefault = 'ease';\nexport const easingLinear = 'linear';\nexport const focusOutlineWidth = '2px';\nexport const focusOutlineOffset = '2px';\nexport const opacityDisabled = 0.5;\nexport const zIndexBase = 0;\nexport const zIndexDropdown = 100;\nexport const zIndexModal = 1000;\nexport const layoutMaxWidth = '68rem';\n\nexport const tokens = {\n 'color': {\n background: {\n base: '#100a1c',\n topGlow: '#201e40',\n bottomGlow: '#261226',\n },\n surface: {\n default: 'rgba(32, 30, 64, 0.6)',\n hover: 'rgba(45, 212, 191, 0.08)',\n },\n scrim: {\n default: 'rgba(0, 0, 0, 0.6)',\n },\n border: {\n default: 'rgba(255, 255, 255, 0.08)',\n hover: 'rgba(45, 212, 191, 0.3)',\n },\n accent: {\n default: '#2dd4bf',\n hover: '#5ee8d4',\n text: '#06210f',\n },\n status: {\n positive: '#4ade80',\n positiveBackground: 'rgba(34, 197, 94, 0.18)',\n warning: '#f87171',\n warningBackground: 'rgba(248, 113, 113, 0.15)',\n },\n text: {\n primary: '#ffffff',\n secondary: 'rgba(255, 255, 255, 0.55)',\n },\n brand: {\n huemulDark: '#85422b',\n huemulLight: '#b45b38',\n stroke: '#1d1d1b',\n },\n },\n 'typography': {\n body: 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif',\n heading: 'Inconsolata, monospace',\n size: {\n xs: '0.68rem',\n sm: '0.85rem',\n md: '1rem',\n lg: '1.25rem',\n xl: '1.5rem',\n },\n weight: {\n regular: '400',\n semibold: '600',\n bold: '700',\n },\n tracking: {\n badge: '0.03em',\n },\n },\n 'spacing': {\n '2xs': '0.18rem',\n 'xs': '0.25rem',\n 'sm': '0.35rem',\n 'md': '0.5rem',\n 'lg': '0.6rem',\n 'xl': '0.8rem',\n '2xl': '1rem',\n '3xl': '1.25rem',\n '4xl': '1.35rem',\n '5xl': '1.5rem',\n '6xl': '2rem',\n 'shift': '2px',\n 'elevate': '1px',\n },\n 'radius': {\n sm: '6px',\n md: '8px',\n pill: '999px',\n },\n 'border': {\n width: '1px',\n accentBar: '3px',\n },\n 'shadow': {\n focusRing: '0 0 0 3px rgba(45, 212, 191, 0.12)',\n cardHover: '0 4px 20px rgba(45, 212, 191, 0.06)',\n },\n 'effect': {\n blur: '10px',\n },\n 'duration': {\n fast: '150ms',\n normal: '200ms',\n spin: '800ms',\n },\n 'easing': {\n default: 'ease',\n linear: 'linear',\n },\n 'focus': {\n outlineWidth: '2px',\n outlineOffset: '2px',\n },\n 'opacity': {\n disabled: 0.5,\n },\n 'z-index': {\n base: 0,\n dropdown: 100,\n modal: 1000,\n },\n 'layout': {\n maxWidth: '68rem',\n },\n} as const;\n\nexport type TokenCategory = keyof typeof tokens;\n"],"names":[],"mappings":";;AAAA;AAEO,MAAM,mBAAmB,GAAG;AAC5B,MAAM,sBAAsB,GAAG;AAC/B,MAAM,yBAAyB,GAAG;AAClC,MAAM,mBAAmB,GAAG;AAC5B,MAAM,iBAAiB,GAAG;AAC1B,MAAM,iBAAiB,GAAG;AAC1B,MAAM,kBAAkB,GAAG;AAC3B,MAAM,gBAAgB,GAAG;AACzB,MAAM,kBAAkB,GAAG;AAC3B,MAAM,gBAAgB,GAAG;AACzB,MAAM,eAAe,GAAG;AACxB,MAAM,mBAAmB,GAAG;AAC5B,MAAM,6BAA6B,GAAG;AACtC,MAAM,kBAAkB,GAAG;AAC3B,MAAM,4BAA4B,GAAG;AACrC,MAAM,gBAAgB,GAAG;AACzB,MAAM,kBAAkB,GAAG;AAC3B,MAAM,oBAAoB,GAAG;AAC7B,MAAM,qBAAqB,GAAG;AAC9B,MAAM,gBAAgB,GAAG;AACzB,MAAM,cAAc,GAAG;AACvB,MAAM,iBAAiB,GAAG;AAC1B,MAAM,gBAAgB,GAAG;AACzB,MAAM,gBAAgB,GAAG;AACzB,MAAM,gBAAgB,GAAG;AACzB,MAAM,gBAAgB,GAAG;AACzB,MAAM,gBAAgB,GAAG;AACzB,MAAM,uBAAuB,GAAG;AAChC,MAAM,wBAAwB,GAAG;AACjC,MAAM,oBAAoB,GAAG;AAC7B,MAAM,uBAAuB,GAAG;AAChC,MAAM,UAAU,GAAG;AACnB,MAAM,SAAS,GAAG;AAClB,MAAM,SAAS,GAAG;AAClB,MAAM,SAAS,GAAG;AAClB,MAAM,SAAS,GAAG;AAClB,MAAM,SAAS,GAAG;AAClB,MAAM,UAAU,GAAG;AACnB,MAAM,UAAU,GAAG;AACnB,MAAM,UAAU,GAAG;AACnB,MAAM,UAAU,GAAG;AACnB,MAAM,UAAU,GAAG;AACnB,MAAM,YAAY,GAAG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AAE,OAAO;AACd,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,KAAK;AACZ,QAAA,SAAS,EAAE,KAAK;AACjB,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,SAAS,EAAE,oCAAoC;AAC/C,QAAA,SAAS,EAAE,qCAAqC;AACjD,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE,MAAM;AACb,KAAA;AACD,IAAA,UAAU,EAAE;AACV,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,MAAM,EAAE,OAAO;AACf,QAAA,IAAI,EAAE,OAAO;AACd,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,MAAM,EAAE,QAAQ;AACjB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,YAAY,EAAE,KAAK;AACnB,QAAA,aAAa,EAAE,KAAK;AACrB,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,QAAQ,EAAE,GAAG;AACd,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,QAAQ,EAAE,OAAO;AAClB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DMeDkSQU.js');
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await index.globalScripts();
|
|
8
|
-
return index.bootstrapLazy([["ch-alert_8.cjs",[[769,"ch-alert",{"variant":[1],"dismissLabel":[1,"dismiss-label"]}],[769,"ch-badge",{"variant":[1]}],[769,"ch-button",{"variant":[1],"disabled":[4],"label":[1]}],[257,"ch-card"],[513,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}],[513,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}],[513,"ch-spinner",{"size":[1],"label":[1]}],[513,"ch-switch",{"label":[1],"name":[1],"value":[1],"checked":[1028],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-accordion.cjs",[[769,"ch-accordion",{"items":[16],"value":[1025]}]]],["ch-checkbox.cjs",[[513,"ch-checkbox",{"label":[1],"name":[1],"value":[1],"checked":[1028],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-divider.cjs",[[513,"ch-divider",{"orientation":[1]}]]],["ch-link.cjs",[[769,"ch-link",{"href":[1],"target":[1],"variant":[1],"disabled":[4]}]]],["ch-radio.cjs",[[513,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-tabs.cjs",[[769,"ch-tabs",{"tabs":[16],"value":[1025],"label":[1]}]]],["ch-textarea.cjs",[[513,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]]], options);
|
|
8
|
+
return index.bootstrapLazy([["ch-alert_8.cjs",[[769,"ch-alert",{"variant":[1],"dismissLabel":[1,"dismiss-label"]}],[769,"ch-badge",{"variant":[1]}],[769,"ch-button",{"variant":[1],"disabled":[4],"label":[1]}],[257,"ch-card"],[513,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}],[513,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}],[513,"ch-spinner",{"size":[1],"label":[1]}],[513,"ch-switch",{"label":[1],"name":[1],"value":[1],"checked":[1028],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-accordion.cjs",[[769,"ch-accordion",{"items":[16],"value":[1025]}]]],["ch-checkbox.cjs",[[513,"ch-checkbox",{"label":[1],"name":[1],"value":[1],"checked":[1028],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-divider.cjs",[[513,"ch-divider",{"orientation":[1]}]]],["ch-link.cjs",[[769,"ch-link",{"href":[1],"target":[1],"variant":[1],"disabled":[4]}]]],["ch-modal.cjs",[[769,"ch-modal",{"open":[1028],"label":[1],"closeLabel":[1,"close-label"]},null,{"open":[{"handleOpenChange":0}]}]]],["ch-radio.cjs",[[513,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-tabs.cjs",[[769,"ch-tabs",{"tabs":[16],"value":[1025],"label":[1]}]]],["ch-textarea.cjs",[[513,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-tooltip.cjs",[[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"]]]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.setNonce = index.setNonce;
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
"components/ch-select/ch-select.js",
|
|
11
11
|
"components/ch-spinner/ch-spinner.js",
|
|
12
12
|
"components/ch-tabs/ch-tabs.js",
|
|
13
|
+
"components/ch-tooltip/ch-tooltip.js",
|
|
13
14
|
"components/ch-card/ch-card.js",
|
|
14
15
|
"components/ch-checkbox/ch-checkbox.js",
|
|
15
16
|
"components/ch-input/ch-input.js",
|
|
17
|
+
"components/ch-modal/ch-modal.js",
|
|
16
18
|
"components/ch-switch/ch-switch.js",
|
|
17
19
|
"components/ch-textarea/ch-textarea.js"
|
|
18
20
|
],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class ChCard {
|
|
3
3
|
render() {
|
|
4
|
-
return (h(Host, { key: '
|
|
4
|
+
return (h(Host, { key: '1541ba4361c996716356fb87cdcc73b1260d4c6a' }, h("div", { key: '924070eeb79f6c8f8e6362772bbab0dcc1c6f315', class: "card" }, h("slot", { key: '2fde36426395a519cb1ebe265ba0eef3aaf6ff38' }))));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "ch-card"; }
|
|
7
7
|
static get encapsulation() { return "shadow"; }
|
|
@@ -60,7 +60,7 @@ export class ChCheckbox {
|
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
|
-
return (h(Host, { key: '
|
|
63
|
+
return (h(Host, { key: '130d1bf88ae8c73befe7ac288a0d4b7113fd73f7' }, h("label", { key: '6a3dd5bd889a9b41dda934b7c804de3ff2a63584', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.checkboxId }, h("input", { key: '9978d057782e3cf31a2fa7b4042b5d070e015be0', 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: '8b12d266d0693b6ad710c5a72df4b3c138435ef1', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '7aa3b14ccdfb216d8bc831c820e5438e166dab1c', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'aeacbc8e1f98162182149e55fde0d8d588c97fa4', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
64
64
|
}
|
|
65
65
|
static get is() { return "ch-checkbox"; }
|
|
66
66
|
static get encapsulation() { return "shadow"; }
|
|
@@ -72,7 +72,7 @@ export class ChInput {
|
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
|
-
return (h(Host, { key: '
|
|
75
|
+
return (h(Host, { key: '56ef5eab354235c89214be28263cde91168f5dee' }, this.label && (h("label", { key: '745fe11f607591d1c571dcf7d9429d834dfa4f2b', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: '18739cebe47aa1130b55fa5aaf184a1f3fad88d2', 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: '60a43287f6329db3f4b27ad882300fced0925645', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'ea18e90000f1a244cbe51126441b5d260562e07a', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
76
76
|
}
|
|
77
77
|
static get is() { return "ch-input"; }
|
|
78
78
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.modal {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
max-width: min(32rem, calc(100vw - var(--spacing-6xl)));
|
|
4
|
+
max-height: calc(100vh - var(--spacing-6xl));
|
|
5
|
+
padding: var(--spacing-5xl);
|
|
6
|
+
border: var(--border-width) solid var(--border);
|
|
7
|
+
border-radius: var(--radius);
|
|
8
|
+
background: var(--color-background-base);
|
|
9
|
+
color: var(--text);
|
|
10
|
+
font-family: var(--font-body);
|
|
11
|
+
font-size: var(--typography-size-md);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.modal::backdrop {
|
|
15
|
+
background: var(--color-scrim-default);
|
|
16
|
+
backdrop-filter: blur(var(--effect-blur));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.modal-head {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
gap: var(--spacing-2xl);
|
|
24
|
+
margin-bottom: var(--spacing-2xl);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.modal-body {
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.modal-close {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
flex: none;
|
|
36
|
+
padding: var(--spacing-2xs) var(--spacing-md);
|
|
37
|
+
border: 0;
|
|
38
|
+
border-radius: var(--radius);
|
|
39
|
+
background: none;
|
|
40
|
+
color: var(--text-muted);
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
font-family: var(--font-heading);
|
|
43
|
+
font-size: var(--typography-size-lg);
|
|
44
|
+
line-height: 1;
|
|
45
|
+
transition: background-color var(--duration-normal) var(--easing-default);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.modal-close:hover {
|
|
49
|
+
background: var(--surface-hover);
|
|
50
|
+
color: var(--text);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.modal-close:focus-visible {
|
|
54
|
+
outline: var(--focus-outline-width) solid var(--accent);
|
|
55
|
+
outline-offset: var(--focus-outline-offset);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@media (pointer: coarse) {
|
|
59
|
+
.modal-close {
|
|
60
|
+
min-width: 44px;
|
|
61
|
+
min-height: 44px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (prefers-reduced-motion: reduce) {
|
|
66
|
+
.modal-close {
|
|
67
|
+
transition: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
let openModals = 0;
|
|
3
|
+
let previousOverflow = '';
|
|
4
|
+
let previousPaddingRight = '';
|
|
5
|
+
/**
|
|
6
|
+
* Modal dialog, built on the native `<dialog>` element and opened with
|
|
7
|
+
* `showModal()`.
|
|
8
|
+
*
|
|
9
|
+
* The browser therefore supplies the parts that are easy to get wrong: moving
|
|
10
|
+
* focus into the dialog and returning it afterwards, marking the rest of the
|
|
11
|
+
* document inert, `Escape` to close, the top layer, `::backdrop`, and the
|
|
12
|
+
* implicit `dialog` role with `aria-modal="true"`. Notably it does not trap
|
|
13
|
+
* focus, which is deliberate — the W3C APA group concluded a modal should let
|
|
14
|
+
* keyboard users reach browser UI, so a hand-rolled trap would be less
|
|
15
|
+
* correct, not more.
|
|
16
|
+
*
|
|
17
|
+
* What the platform does not cover, and this component adds: locking the page
|
|
18
|
+
* behind the dialog so it cannot scroll, and closing when the backdrop is
|
|
19
|
+
* clicked. The latter is `closedby="any"` in the platform, which Safari does
|
|
20
|
+
* not support yet, so it is implemented here for every browser alike rather
|
|
21
|
+
* than only for some.
|
|
22
|
+
*/
|
|
23
|
+
export class ChModal {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the dialog is open. Kept in sync when the user closes it with
|
|
26
|
+
* `Escape`, the close button or a click outside.
|
|
27
|
+
*/
|
|
28
|
+
open = false;
|
|
29
|
+
/**
|
|
30
|
+
* Accessible name for the dialog, set as `aria-label`. A slotted heading
|
|
31
|
+
* cannot be referenced with `aria-labelledby` across the shadow boundary, so
|
|
32
|
+
* the name comes through this prop — and a modal dialog needs one, so pass
|
|
33
|
+
* the same text as the heading.
|
|
34
|
+
*/
|
|
35
|
+
label;
|
|
36
|
+
/**
|
|
37
|
+
* Accessible label for the close button, set as `aria-label`. Setting it is
|
|
38
|
+
* what adds the button: its only content is a decorative glyph, so without a
|
|
39
|
+
* label it would have no accessible name.
|
|
40
|
+
*/
|
|
41
|
+
closeLabel;
|
|
42
|
+
/**
|
|
43
|
+
* Emitted after the dialog opens.
|
|
44
|
+
*/
|
|
45
|
+
chOpen;
|
|
46
|
+
/**
|
|
47
|
+
* Emitted after the dialog closes, however it was closed.
|
|
48
|
+
*/
|
|
49
|
+
chClose;
|
|
50
|
+
dialog;
|
|
51
|
+
scrollLocked = false;
|
|
52
|
+
pointerDownedOutside = false;
|
|
53
|
+
componentDidLoad() {
|
|
54
|
+
// Wired here rather than in JSX because Stencil derives a listener's event
|
|
55
|
+
// name from whether `on<name>` exists on `window`, which differs between
|
|
56
|
+
// the browser and the test environment for pointer events.
|
|
57
|
+
this.dialog?.addEventListener('close', this.handleNativeClose);
|
|
58
|
+
this.dialog?.addEventListener('pointerdown', this.handlePointerDown);
|
|
59
|
+
this.dialog?.addEventListener('click', this.handleClick);
|
|
60
|
+
if (this.open) {
|
|
61
|
+
this.showDialog();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
disconnectedCallback() {
|
|
65
|
+
this.dialog?.removeEventListener('close', this.handleNativeClose);
|
|
66
|
+
this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);
|
|
67
|
+
this.dialog?.removeEventListener('click', this.handleClick);
|
|
68
|
+
this.unlockScroll();
|
|
69
|
+
}
|
|
70
|
+
handleOpenChange(open) {
|
|
71
|
+
if (open) {
|
|
72
|
+
this.showDialog();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.closeDialog();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
showDialog() {
|
|
79
|
+
if (typeof this.dialog?.showModal !== 'function') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.lockScroll();
|
|
83
|
+
this.dialog.showModal();
|
|
84
|
+
this.chOpen.emit();
|
|
85
|
+
}
|
|
86
|
+
closeDialog() {
|
|
87
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
88
|
+
this.dialog.close();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
lockScroll() {
|
|
92
|
+
if (this.scrollLocked) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.scrollLocked = true;
|
|
96
|
+
openModals += 1;
|
|
97
|
+
if (openModals > 1) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const root = document.documentElement;
|
|
101
|
+
const scrollbar = window.innerWidth - root.clientWidth;
|
|
102
|
+
previousOverflow = root.style.overflow;
|
|
103
|
+
previousPaddingRight = root.style.paddingRight;
|
|
104
|
+
root.style.overflow = 'hidden';
|
|
105
|
+
if (scrollbar > 0) {
|
|
106
|
+
root.style.paddingRight = `${scrollbar}px`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
unlockScroll() {
|
|
110
|
+
if (!this.scrollLocked) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.scrollLocked = false;
|
|
114
|
+
openModals -= 1;
|
|
115
|
+
if (openModals > 0) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const root = document.documentElement;
|
|
119
|
+
root.style.overflow = previousOverflow;
|
|
120
|
+
root.style.paddingRight = previousPaddingRight;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
124
|
+
* target for its own box only, and the coordinates fall outside that box.
|
|
125
|
+
*/
|
|
126
|
+
isOnBackdrop(event) {
|
|
127
|
+
if (!this.dialog || event.target !== this.dialog) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
const box = this.dialog.getBoundingClientRect();
|
|
131
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
132
|
+
}
|
|
133
|
+
handlePointerDown = (event) => {
|
|
134
|
+
this.pointerDownedOutside = this.isOnBackdrop(event);
|
|
135
|
+
};
|
|
136
|
+
handleClick = (event) => {
|
|
137
|
+
// Requiring the press to have started on the backdrop too keeps a
|
|
138
|
+
// selection dragged out of the dialog, and a keyboard-synthesised click
|
|
139
|
+
// (which reports coordinates of 0), from closing it.
|
|
140
|
+
const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event);
|
|
141
|
+
this.pointerDownedOutside = false;
|
|
142
|
+
if (dismiss) {
|
|
143
|
+
this.closeDialog();
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
handleNativeClose = () => {
|
|
147
|
+
this.unlockScroll();
|
|
148
|
+
if (this.open) {
|
|
149
|
+
this.open = false;
|
|
150
|
+
}
|
|
151
|
+
this.chClose.emit();
|
|
152
|
+
};
|
|
153
|
+
handleCloseClick = () => {
|
|
154
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
155
|
+
this.dialog.close();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
this.open = false;
|
|
159
|
+
this.chClose.emit();
|
|
160
|
+
};
|
|
161
|
+
render() {
|
|
162
|
+
return (h(Host, { key: '92edf16d3ff079f72a4785ec9852e3e25218fd35' }, h("dialog", { key: '546fc72a098e1e2d8c05fafa2f11eac19ff83fd3', class: "modal", "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: '5a67aa39b6687db89d97533eb54d3a3b663bed56', class: "modal-head" }, h("slot", { key: '2e44b59a7c5e6af4a110a7f86362964ddd30d215', name: "heading" }), this.closeLabel && (h("button", { key: 'ce70baaa876c9f7b82865f0547e8e8cef5d5dfde', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: 'df4536a8851a1ca9d3d2c46d15d18856660a54f6', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: '5de77062134ccd90643df17d7b0d0ddb161f6a5f', class: "modal-body" }, h("slot", { key: '3b64493e9236b311a4b2f5250c5027f866bce8fd' })))));
|
|
163
|
+
}
|
|
164
|
+
static get is() { return "ch-modal"; }
|
|
165
|
+
static get encapsulation() { return "shadow"; }
|
|
166
|
+
static get originalStyleUrls() {
|
|
167
|
+
return {
|
|
168
|
+
"$": ["ch-modal.css"]
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
static get styleUrls() {
|
|
172
|
+
return {
|
|
173
|
+
"$": ["ch-modal.css"]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
static get properties() {
|
|
177
|
+
return {
|
|
178
|
+
"open": {
|
|
179
|
+
"type": "boolean",
|
|
180
|
+
"mutable": true,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "boolean",
|
|
183
|
+
"resolved": "boolean",
|
|
184
|
+
"references": {}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": false,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": "Whether the dialog is open. Kept in sync when the user closes it with\n`Escape`, the close button or a click outside."
|
|
191
|
+
},
|
|
192
|
+
"getter": false,
|
|
193
|
+
"setter": false,
|
|
194
|
+
"reflect": false,
|
|
195
|
+
"attribute": "open",
|
|
196
|
+
"defaultValue": "false"
|
|
197
|
+
},
|
|
198
|
+
"label": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"mutable": false,
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "string",
|
|
203
|
+
"resolved": "string",
|
|
204
|
+
"references": {}
|
|
205
|
+
},
|
|
206
|
+
"required": false,
|
|
207
|
+
"optional": true,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": "Accessible name for the dialog, set as `aria-label`. A slotted heading\ncannot be referenced with `aria-labelledby` across the shadow boundary, so\nthe name comes through this prop \u2014 and a modal dialog needs one, so pass\nthe same text as the heading."
|
|
211
|
+
},
|
|
212
|
+
"getter": false,
|
|
213
|
+
"setter": false,
|
|
214
|
+
"reflect": false,
|
|
215
|
+
"attribute": "label"
|
|
216
|
+
},
|
|
217
|
+
"closeLabel": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "string",
|
|
222
|
+
"resolved": "string",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": true,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Accessible label for the close button, set as `aria-label`. Setting it is\nwhat adds the button: its only content is a decorative glyph, so without a\nlabel it would have no accessible name."
|
|
230
|
+
},
|
|
231
|
+
"getter": false,
|
|
232
|
+
"setter": false,
|
|
233
|
+
"reflect": false,
|
|
234
|
+
"attribute": "close-label"
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
static get events() {
|
|
239
|
+
return [{
|
|
240
|
+
"method": "chOpen",
|
|
241
|
+
"name": "chOpen",
|
|
242
|
+
"bubbles": true,
|
|
243
|
+
"cancelable": true,
|
|
244
|
+
"composed": true,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": "Emitted after the dialog opens."
|
|
248
|
+
},
|
|
249
|
+
"complexType": {
|
|
250
|
+
"original": "void",
|
|
251
|
+
"resolved": "void",
|
|
252
|
+
"references": {}
|
|
253
|
+
}
|
|
254
|
+
}, {
|
|
255
|
+
"method": "chClose",
|
|
256
|
+
"name": "chClose",
|
|
257
|
+
"bubbles": true,
|
|
258
|
+
"cancelable": true,
|
|
259
|
+
"composed": true,
|
|
260
|
+
"docs": {
|
|
261
|
+
"tags": [],
|
|
262
|
+
"text": "Emitted after the dialog closes, however it was closed."
|
|
263
|
+
},
|
|
264
|
+
"complexType": {
|
|
265
|
+
"original": "void",
|
|
266
|
+
"resolved": "void",
|
|
267
|
+
"references": {}
|
|
268
|
+
}
|
|
269
|
+
}];
|
|
270
|
+
}
|
|
271
|
+
static get watchers() {
|
|
272
|
+
return [{
|
|
273
|
+
"propName": "open",
|
|
274
|
+
"methodName": "handleOpenChange"
|
|
275
|
+
}];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=ch-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-modal.js","sourceRoot":"","sources":["../../../../src/components/ch-modal/ch-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE1F,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,IAAI,gBAAgB,GAAG,EAAE,CAAC;AAC1B,IAAI,oBAAoB,GAAG,EAAE,CAAC;AAE9B;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,OAAO,OAAO;IAClB;;;OAGG;IACsB,IAAI,GAAG,KAAK,CAAC;IAEtC;;;;;OAKG;IACK,KAAK,CAAU;IAEvB;;;;OAIG;IACK,UAAU,CAAU;IAE5B;;OAEG;IACM,MAAM,CAAqB;IAEpC;;OAEG;IACM,OAAO,CAAqB;IAE7B,MAAM,CAAqB;IAC3B,YAAY,GAAG,KAAK,CAAC;IACrB,oBAAoB,GAAG,KAAK,CAAC;IAErC,gBAAgB;QACd,2EAA2E;QAC3E,yEAAyE;QACzE,2DAA2D;QAC3D,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAA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,CAAC,IAAI,CAAC,MAAM,GAAG,EAAuB,CAAC;gBAC9F,4DAAK,KAAK,EAAC,YAAY;oBACrB,6DAAM,IAAI,EAAC,SAAS,GAAQ;oBAC3B,IAAI,CAAC,UAAU,IAAI,CAClB,+DAAQ,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,QAAQ,gBAAa,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB;wBACnG,4EAAkB,MAAM,aAAS,CAC1B,CACV,CACG;gBACN,4DAAK,KAAK,EAAC,YAAY;oBACrB,8DAAa,CACT,CACC,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, type EventEmitter, Host, Prop, Watch, h } from '@stencil/core';\n\nlet openModals = 0;\nlet previousOverflow = '';\nlet previousPaddingRight = '';\n\n/**\n * Modal dialog, built on the native `<dialog>` element and opened with\n * `showModal()`.\n *\n * The browser therefore supplies the parts that are easy to get wrong: moving\n * focus into the dialog and returning it afterwards, marking the rest of the\n * document inert, `Escape` to close, the top layer, `::backdrop`, and the\n * implicit `dialog` role with `aria-modal=\"true\"`. Notably it does not trap\n * focus, which is deliberate — the W3C APA group concluded a modal should let\n * keyboard users reach browser UI, so a hand-rolled trap would be less\n * correct, not more.\n *\n * What the platform does not cover, and this component adds: locking the page\n * behind the dialog so it cannot scroll, and closing when the backdrop is\n * clicked. The latter is `closedby=\"any\"` in the platform, which Safari does\n * not support yet, so it is implemented here for every browser alike rather\n * than only for some.\n */\n@Component({\n tag: 'ch-modal',\n styleUrl: 'ch-modal.css',\n shadow: true,\n})\nexport class ChModal {\n /**\n * Whether the dialog is open. Kept in sync when the user closes it with\n * `Escape`, the close button or a click outside.\n */\n @Prop({ mutable: true }) open = false;\n\n /**\n * Accessible name for the dialog, set as `aria-label`. A slotted heading\n * cannot be referenced with `aria-labelledby` across the shadow boundary, so\n * the name comes through this prop — and a modal dialog needs one, so pass\n * the same text as the heading.\n */\n @Prop() label?: string;\n\n /**\n * Accessible label for the close button, set as `aria-label`. Setting it is\n * what adds the button: its only content is a decorative glyph, so without a\n * label it would have no accessible name.\n */\n @Prop() closeLabel?: string;\n\n /**\n * Emitted after the dialog opens.\n */\n @Event() chOpen: EventEmitter<void>;\n\n /**\n * Emitted after the dialog closes, however it was closed.\n */\n @Event() chClose: EventEmitter<void>;\n\n private dialog?: HTMLDialogElement;\n private scrollLocked = false;\n private pointerDownedOutside = false;\n\n componentDidLoad() {\n // Wired here rather than in JSX because Stencil derives a listener's event\n // name from whether `on<name>` exists on `window`, which differs between\n // the browser and the test environment for pointer events.\n this.dialog?.addEventListener('close', this.handleNativeClose);\n this.dialog?.addEventListener('pointerdown', this.handlePointerDown);\n this.dialog?.addEventListener('click', this.handleClick);\n if (this.open) {\n this.showDialog();\n }\n }\n\n disconnectedCallback() {\n this.dialog?.removeEventListener('close', this.handleNativeClose);\n this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);\n this.dialog?.removeEventListener('click', this.handleClick);\n this.unlockScroll();\n }\n\n @Watch('open')\n handleOpenChange(open: boolean) {\n if (open) {\n this.showDialog();\n } else {\n this.closeDialog();\n }\n }\n\n private showDialog() {\n if (typeof this.dialog?.showModal !== 'function') {\n return;\n }\n this.lockScroll();\n this.dialog.showModal();\n this.chOpen.emit();\n }\n\n private closeDialog() {\n if (typeof this.dialog?.close === 'function' && this.dialog.open) {\n this.dialog.close();\n }\n }\n\n private lockScroll() {\n if (this.scrollLocked) {\n return;\n }\n this.scrollLocked = true;\n openModals += 1;\n if (openModals > 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 private unlockScroll() {\n if (!this.scrollLocked) {\n return;\n }\n this.scrollLocked = false;\n openModals -= 1;\n if (openModals > 0) {\n return;\n }\n const root = document.documentElement;\n root.style.overflow = previousOverflow;\n root.style.paddingRight = previousPaddingRight;\n }\n\n /**\n * True for a pointer event on the backdrop: the `<dialog>` is the event\n * target for its own box only, and the coordinates fall outside that box.\n */\n private isOnBackdrop(event: MouseEvent) {\n if (!this.dialog || event.target !== this.dialog) {\n return false;\n }\n const box = this.dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n }\n\n private handlePointerDown = (event: Event) => {\n this.pointerDownedOutside = this.isOnBackdrop(event as MouseEvent);\n };\n\n private handleClick = (event: Event) => {\n // Requiring the press to have started on the backdrop too keeps a\n // selection dragged out of the dialog, and a keyboard-synthesised click\n // (which reports coordinates of 0), from closing it.\n const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event as MouseEvent);\n this.pointerDownedOutside = false;\n if (dismiss) {\n this.closeDialog();\n }\n };\n\n private handleNativeClose = () => {\n this.unlockScroll();\n if (this.open) {\n this.open = false;\n }\n this.chClose.emit();\n };\n\n private handleCloseClick = () => {\n if (typeof this.dialog?.close === 'function' && this.dialog.open) {\n this.dialog.close();\n return;\n }\n this.open = false;\n this.chClose.emit();\n };\n\n render() {\n return (\n <Host>\n <dialog class=\"modal\" aria-label={this.label} ref={el => (this.dialog = el as HTMLDialogElement)}>\n <div class=\"modal-head\">\n <slot name=\"heading\"></slot>\n {this.closeLabel && (\n <button class=\"modal-close\" type=\"button\" aria-label={this.closeLabel} onClick={this.handleCloseClick}>\n <span aria-hidden=\"true\">×</span>\n </button>\n )}\n </div>\n <div class=\"modal-body\">\n <slot></slot>\n </div>\n </dialog>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -60,7 +60,7 @@ export class ChSwitch {
|
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
|
-
return (h(Host, { key: '
|
|
63
|
+
return (h(Host, { key: 'f95f9b724e37771ea3949ff569881dc1eff370a1' }, h("label", { key: '878c3c47e380356a3b79e79fdd135df627ce37a6', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.switchId }, h("input", { key: '14ee6041b8aeb4115db1f7ca9c542314651f34ea', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { key: '0d58863f220b6e9f04babd6231a35dea039a41a2', class: "track" }, h("span", { key: '588617f6bb1c61168b860c4b2863892828fd5df5', class: "thumb" })), this.label && h("span", { key: '530e64cc85761e91a019431f977bb9d2d8e86e27', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '71ffd6b56a753673f9d5663054a217e250363ce1', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '63f9965c30d8cd2820554de31ac7edc364aee22b', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
64
64
|
}
|
|
65
65
|
static get is() { return "ch-switch"; }
|
|
66
66
|
static get encapsulation() { return "shadow"; }
|
|
@@ -73,7 +73,7 @@ export class ChTextarea {
|
|
|
73
73
|
return undefined;
|
|
74
74
|
}
|
|
75
75
|
render() {
|
|
76
|
-
return (h(Host, { key: '
|
|
76
|
+
return (h(Host, { key: '1e5846687f73807b36da2328106aec84bdecb7cb' }, this.label && (h("label", { key: '9a8d410d07bb6b9cc9a5329088786de6365af507', class: "label", htmlFor: this.textareaId }, this.label)), h("textarea", { key: '7353cc267072e7df111d94ad0466588d0b7e77d8', 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, 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: '5b953e2c568b151c502404fccc4a79d6d6e516f9', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'bc500a5bd32ac35cf4de723b02cb42f459614c39', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
77
77
|
}
|
|
78
78
|
static get is() { return "ch-textarea"; }
|
|
79
79
|
static get encapsulation() { return "shadow"; }
|