@alleninstitute/cortex-ui 0.2.0 → 0.3.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 +52 -8
- package/dist/cjs/cortex-ui.cjs.js +3 -3
- package/dist/cjs/cui-divider.cjs.entry.js +49 -0
- package/dist/cjs/cui-icon.cjs.entry.js +100 -0
- package/dist/cjs/cui-progress.cjs.entry.js +4 -4
- package/dist/cjs/cui-tag.cjs.entry.js +4 -4
- package/dist/cjs/index-RBrlguTk.js +1565 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/cui-divider/cui-divider.css +100 -0
- package/dist/collection/components/cui-divider/cui-divider.js +150 -0
- package/dist/collection/components/cui-icon/cui-icon.css +134 -0
- package/dist/collection/components/cui-icon/cui-icon.js +239 -0
- package/dist/collection/components/cui-progress/cui-progress.css +12 -12
- package/dist/collection/components/cui-progress/cui-progress.js +2 -2
- package/dist/collection/components/cui-tag/cui-tag.css +19 -19
- package/dist/collection/components/cui-tag/cui-tag.js +5 -5
- package/dist/components/cui-divider.d.ts +11 -0
- package/dist/components/cui-divider.js +1 -0
- package/dist/components/cui-icon.d.ts +11 -0
- package/dist/components/cui-icon.js +1 -0
- package/dist/components/cui-progress.js +1 -1
- package/dist/components/cui-tag.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/cortex-ui/cortex-ui.css +1 -1
- package/dist/cortex-ui/cortex-ui.esm.js +1 -1
- package/dist/cortex-ui/p-0e66a721.entry.js +1 -0
- package/dist/cortex-ui/p-1af73c5a.entry.js +1 -0
- package/dist/cortex-ui/p-2d2004f0.entry.js +1 -0
- package/dist/cortex-ui/p-8925abbe.entry.js +1 -0
- package/dist/cortex-ui/p-BZmInLSX.js +3 -0
- package/dist/esm/cortex-ui.js +4 -4
- package/dist/esm/cui-divider.entry.js +47 -0
- package/dist/esm/cui-icon.entry.js +98 -0
- package/dist/esm/cui-progress.entry.js +4 -4
- package/dist/esm/cui-tag.entry.js +4 -4
- package/dist/esm/index-BZmInLSX.js +1557 -0
- package/dist/esm/loader.js +3 -3
- package/dist/fonts/AllenInstituteHeadline-Bold.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-BoldItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Italic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Light.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-LightItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Medium.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-MediumItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Regular.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-Semibold.woff2 +0 -0
- package/dist/fonts/AllenInstituteHeadline-SemiboldItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Bold.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-BoldItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Italic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Light.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-LightItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Medium.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-MediumItalic.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Regular.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-Semibold.woff2 +0 -0
- package/dist/fonts/AllenInstituteText-SemiboldItalic.woff2 +0 -0
- package/dist/fonts.css +186 -0
- package/dist/types/components/cui-divider/cui-divider.d.ts +38 -0
- package/dist/types/components/cui-icon/cui-icon.d.ts +76 -0
- package/dist/types/components/cui-tag/cui-tag.d.ts +1 -1
- package/dist/types/components.d.ts +235 -6
- package/dist/types/stencil-public-runtime.d.ts +11 -0
- package/package.json +31 -22
- package/dist/cjs/index-CJFDVa2g.js +0 -1415
- package/dist/collection/stories/assets/accessibility.svg +0 -1
- package/dist/collection/stories/assets/discord.svg +0 -1
- package/dist/collection/stories/assets/github.svg +0 -1
- package/dist/collection/stories/assets/tutorials.svg +0 -1
- package/dist/collection/stories/assets/youtube.svg +0 -1
- package/dist/cortex-ui/p-371566cd.entry.js +0 -1
- package/dist/cortex-ui/p-60c5b038.entry.js +0 -1
- package/dist/cortex-ui/p-DbXnQj5f.js +0 -2
- package/dist/esm/index-DbXnQj5f.js +0 -1408
package/README.md
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
A reusable web components library built with [Stencil.js](https://stenciljs.com/), documented with [Storybook](https://storybook.js.org/).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Using the library in your app?** Start with
|
|
6
|
+
[Getting Started](https://alleninstitute.github.io/cortex-ui/?path=/docs/getting-started--docs) in the deployed
|
|
7
|
+
Storybook — React, HTML/other frameworks, CDN, and AI-agent setup.
|
|
8
|
+
- **Contributing a component or a fix?** See [CONTRIBUTING.md](CONTRIBUTING.md). AI agents working in this repo should
|
|
9
|
+
read [AGENTS.md](AGENTS.md).
|
|
10
|
+
|
|
11
|
+
## Development Setup
|
|
12
|
+
|
|
13
|
+
Working on the library itself starts here; [CONTRIBUTING.md](CONTRIBUTING.md) covers the rest of the flow — adding a
|
|
14
|
+
component, the Definition of Done, commit conventions, and opening a PR.
|
|
6
15
|
|
|
7
16
|
### Prerequisites
|
|
8
17
|
|
|
@@ -100,11 +109,26 @@ component's maturity is also included in the machine-readable docs below so agen
|
|
|
100
109
|
|
|
101
110
|
## Using the Library
|
|
102
111
|
|
|
103
|
-
### Script tag
|
|
112
|
+
### Script tag (CDN, no build step)
|
|
104
113
|
|
|
105
|
-
|
|
114
|
+
The package is on the public npm registry, so unpkg and jsDelivr already mirror it. One module script registers every
|
|
115
|
+
component:
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
```html
|
|
118
|
+
<script
|
|
119
|
+
type="module"
|
|
120
|
+
src="https://unpkg.com/@alleninstitute/cortex-ui/dist/cortex-ui/cortex-ui.esm.js"
|
|
121
|
+
></script>
|
|
122
|
+
<link
|
|
123
|
+
rel="stylesheet"
|
|
124
|
+
href="https://unpkg.com/@alleninstitute/cortex-ui/dist/fonts.css"
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The stylesheet registers the Allen Institute typefaces — see [Fonts](#fonts).
|
|
129
|
+
|
|
130
|
+
Pin a version in production (`.../cortex-ui@0.2.0/dist/...`) — an unpinned URL follows the latest release. jsDelivr
|
|
131
|
+
serves the same file from `https://cdn.jsdelivr.net/npm/@alleninstitute/cortex-ui/dist/cortex-ui/cortex-ui.esm.js`.
|
|
108
132
|
|
|
109
133
|
Then use the components anywhere in your HTML:
|
|
110
134
|
|
|
@@ -128,6 +152,19 @@ import { defineCustomElements } from '@alleninstitute/cortex-ui/loader';
|
|
|
128
152
|
defineCustomElements();
|
|
129
153
|
```
|
|
130
154
|
|
|
155
|
+
#### Fonts
|
|
156
|
+
|
|
157
|
+
The package bundles the Allen Institute typefaces as WOFF2 — both families, weights 300–700, with italics. Register
|
|
158
|
+
them once, wherever the app imports its global CSS:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import '@alleninstitute/cortex-ui/fonts.css';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This has to happen at the document level, because a `@font-face` rule declared inside a component's shadow DOM is
|
|
165
|
+
ignored. Once it has, every component picks the font up, since `--cui-font-family-base` already names it (with
|
|
166
|
+
`--cui-font-family-headline` available for titles). Skip the import and the tokens fall back to a system font stack.
|
|
167
|
+
|
|
131
168
|
#### TypeScript support
|
|
132
169
|
|
|
133
170
|
The package ships with full type definitions. Import the generated types:
|
|
@@ -189,11 +226,18 @@ server by hand with the MCP inspector.
|
|
|
189
226
|
|
|
190
227
|
### Machine-readable docs
|
|
191
228
|
|
|
192
|
-
Every build regenerates agent-consumable docs, which are also served from the deployed Storybook site root
|
|
229
|
+
Every build regenerates agent-consumable docs, which are also served from the deployed Storybook site root — so an
|
|
230
|
+
agent with no MCP client can just fetch them:
|
|
231
|
+
|
|
232
|
+
| File | What it is |
|
|
233
|
+
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
234
|
+
| [llms.txt](https://alleninstitute.github.io/cortex-ui/llms.txt) | [llms.txt](https://llmstxt.org) index: one line per component, with maturity |
|
|
235
|
+
| [llms-full.txt](https://alleninstitute.github.io/cortex-ui/llms-full.txt) | Complete plain-text component API and token reference |
|
|
236
|
+
| [components.json](https://alleninstitute.github.io/cortex-ui/components.json) | Stencil docs-json component manifest |
|
|
237
|
+
| [tokens.json](https://alleninstitute.github.io/cortex-ui/tokens.json) | Structured `--cui-*` design tokens with light/dark values |
|
|
193
238
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
- `docs/tokens.json` — structured `--cui-*` design tokens with light/dark values
|
|
239
|
+
Pointing an agent at the `llms.txt` URL from your project's `AGENTS.md` / `CLAUDE.md` is usually enough to keep it from
|
|
240
|
+
inventing props.
|
|
197
241
|
|
|
198
242
|
### Storybook MCP addon
|
|
199
243
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
4
|
|
|
5
5
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
6
|
/*
|
|
7
|
-
Stencil Client Patch Browser v4.
|
|
7
|
+
Stencil Client Patch Browser v4.44.0 | MIT Licensed | https://stenciljs.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
var patchBrowser = () => {
|
|
@@ -18,7 +18,7 @@ var patchBrowser = () => {
|
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(async (options) => {
|
|
20
20
|
await index.globalScripts();
|
|
21
|
-
return index.bootstrapLazy([["cui-progress.cjs",[[1,"cui-progress",{"label":[1],"value":[2],"max":[2],"indeterminate":[4],"size":[1],"showValue":[4,"show-value"]}]]],["cui-tag.cjs",[[1,"cui-tag",{"label":[1],"variant":[1],"size":[1]}]]]], options);
|
|
21
|
+
return index.bootstrapLazy([["cui-divider.cjs",[[1,"cui-divider",{"orientation":[513],"spacing":[513],"variant":[1],"importance":[1]}]]],["cui-icon.cjs",[[257,"cui-icon",{"icon":[1],"variant":[1],"importance":[1],"size":[1],"label":[1]},null,{"icon":[{"onIconChange":0}],"label":[{"onLabelChange":0}]}]]],["cui-progress.cjs",[[1,"cui-progress",{"label":[1],"value":[2],"max":[2],"indeterminate":[4],"size":[1],"showValue":[4,"show-value"]}]]],["cui-tag.cjs",[[1,"cui-tag",{"label":[1],"variant":[1],"size":[1]}]]]], options);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
|
+
|
|
5
|
+
const cuiDividerCss = () => `:host{display:block;--cui-divider-gap:var(--cui-spacing-m);margin-block:var(--cui-divider-gap)}:host([hidden]){display:none}:host([spacing=none]){--cui-divider-gap:0}:host([spacing=small]){--cui-divider-gap:var(--cui-spacing-s)}:host([spacing=large]){--cui-divider-gap:var(--cui-spacing-l)}:host([orientation=vertical]){display:inline-flex;align-self:stretch;min-height:var(--cui-spacing-l);margin-block:0;margin-inline:var(--cui-divider-gap)}.cui-divider{box-sizing:border-box;margin:0;border:none}.cui-divider--horizontal{width:100%;height:var(--cui-border-width-s)}.cui-divider--vertical{width:var(--cui-border-width-s);height:auto;align-self:stretch}.cui-divider--base{background-color:var(--cui-base-divider-primary)}.cui-divider--base.cui-divider--secondary{background-color:var(--cui-base-divider-secondary)}.cui-divider--accent{background-color:var(--cui-accent-divider-primary-default)}.cui-divider--accent.cui-divider--secondary{background-color:var(--cui-accent-divider-secondary-default)}.cui-divider--highlight{background-color:var(--cui-highlight-divider-primary-default)}.cui-divider--highlight.cui-divider--secondary{background-color:var(--cui-highlight-divider-secondary-default)}.cui-divider--info{background-color:var(--cui-info-divider-primary-default)}.cui-divider--info.cui-divider--secondary{background-color:var(--cui-info-divider-secondary-default)}.cui-divider--negative{background-color:var(--cui-negative-divider-primary-default)}.cui-divider--negative.cui-divider--secondary{background-color:var(--cui-negative-divider-secondary-default)}.cui-divider--neutral{background-color:var(--cui-neutral-divider-primary-default)}.cui-divider--neutral.cui-divider--secondary{background-color:var(--cui-neutral-divider-secondary-default)}.cui-divider--positive{background-color:var(--cui-positive-divider-primary-default)}.cui-divider--positive.cui-divider--secondary{background-color:var(--cui-positive-divider-secondary-default)}.cui-divider--warning{background-color:var(--cui-warning-divider-primary-default)}.cui-divider--warning.cui-divider--secondary{background-color:var(--cui-warning-divider-secondary-default)}`;
|
|
6
|
+
|
|
7
|
+
const CuiDivider = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
// `orientation` and `spacing` are reflected because they size and space the host's own
|
|
11
|
+
// box, and only an attribute can reach `:host()` from the stylesheet. `variant` and
|
|
12
|
+
// `importance` are not: they only colour the rule, which the modifier classes handle.
|
|
13
|
+
/**
|
|
14
|
+
* Which way the rule runs. A vertical divider stretches to the height of the flex row
|
|
15
|
+
* it sits in.
|
|
16
|
+
*/
|
|
17
|
+
this.orientation = 'horizontal';
|
|
18
|
+
/** Space reserved on either side of the rule, along the axis it separates. */
|
|
19
|
+
this.spacing = 'medium';
|
|
20
|
+
/**
|
|
21
|
+
* Which intent's `divider` colour the rule is drawn in. `base` is the intent-free rule for
|
|
22
|
+
* ordinary page chrome; the seven intents tint a divider that sits inside a component
|
|
23
|
+
* already carrying that intent, such as a rule between rows of a negative-intent alert.
|
|
24
|
+
*/
|
|
25
|
+
this.variant = 'base';
|
|
26
|
+
/**
|
|
27
|
+
* Which of the two `divider` importances the rule is drawn from. Match it to the importance of
|
|
28
|
+
* the surface the divider sits on — `secondary` on a quiet tint, `primary` on a saturated fill —
|
|
29
|
+
* rather than treating it as a loudness control: on a secondary surface the primary rule is the
|
|
30
|
+
* *less* perceivable of the two. For `base`, whose surface is the page itself, `primary` is
|
|
31
|
+
* simply the stronger of the two rules.
|
|
32
|
+
*/
|
|
33
|
+
this.importance = 'primary';
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (
|
|
37
|
+
// A native <hr> carries the separator role to assistive technology for free, and
|
|
38
|
+
// is the one element that means "boundary" rather than "a box that looks like one".
|
|
39
|
+
index.h("hr", { key: 'd33f3260a5f708f379428a7d338e6329248f23ff', part: "base", class: {
|
|
40
|
+
'cui-divider': true,
|
|
41
|
+
[`cui-divider--${this.orientation}`]: true,
|
|
42
|
+
[`cui-divider--${this.variant}`]: true,
|
|
43
|
+
[`cui-divider--${this.importance}`]: true,
|
|
44
|
+
}, "aria-orientation": this.orientation === 'vertical' ? 'vertical' : undefined }));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
CuiDivider.style = cuiDividerCss();
|
|
48
|
+
|
|
49
|
+
exports.cui_divider = CuiDivider;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
|
+
|
|
5
|
+
const cuiIconCss = () => `@charset "UTF-8";:host{display:inline-flex}:host([hidden]){display:none}.cui-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}::slotted(:not([data-cui-icon-glyph])){display:none}.cui-icon--xxs{font-size:var(--cui-icon-size, var(--cui-font-size-xxs))}.cui-icon--xs{font-size:var(--cui-icon-size, var(--cui-font-size-xs))}.cui-icon--s{font-size:var(--cui-icon-size, var(--cui-font-size-s))}.cui-icon--m{font-size:var(--cui-icon-size, var(--cui-font-size-m))}.cui-icon--l{font-size:var(--cui-icon-size, var(--cui-font-size-l))}.cui-icon--xl{font-size:var(--cui-icon-size, var(--cui-font-size-xl))}.cui-icon--xxl{font-size:var(--cui-icon-size, var(--cui-font-size-xxl))}.cui-icon--display-s{font-size:var(--cui-icon-size, var(--cui-font-size-display-s))}.cui-icon--display-m{font-size:var(--cui-icon-size, var(--cui-font-size-display-m))}.cui-icon--display-l{font-size:var(--cui-icon-size, var(--cui-font-size-display-l))}.cui-icon--base.cui-icon--primary{color:var(--cui-icon-color, var(--cui-base-text-primary))}.cui-icon--base.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-base-text-secondary))}.cui-icon--accent.cui-icon--primary{color:var(--cui-icon-color, var(--cui-accent-text-primary-default))}.cui-icon--accent.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-accent-text-secondary-default))}.cui-icon--highlight.cui-icon--primary{color:var(--cui-icon-color, var(--cui-highlight-text-primary-default))}.cui-icon--highlight.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-highlight-text-secondary-default))}.cui-icon--info.cui-icon--primary{color:var(--cui-icon-color, var(--cui-info-text-primary-default))}.cui-icon--info.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-info-text-secondary-default))}.cui-icon--negative.cui-icon--primary{color:var(--cui-icon-color, var(--cui-negative-text-primary-default))}.cui-icon--negative.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-negative-text-secondary-default))}.cui-icon--neutral.cui-icon--primary{color:var(--cui-icon-color, var(--cui-neutral-text-primary-default))}.cui-icon--neutral.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-neutral-text-secondary-default))}.cui-icon--positive.cui-icon--primary{color:var(--cui-icon-color, var(--cui-positive-text-primary-default))}.cui-icon--positive.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-positive-text-secondary-default))}.cui-icon--warning.cui-icon--primary{color:var(--cui-icon-color, var(--cui-warning-text-primary-default))}.cui-icon--warning.cui-icon--secondary{color:var(--cui-icon-color, var(--cui-warning-text-secondary-default))}`;
|
|
6
|
+
|
|
7
|
+
const CuiIcon = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
/**
|
|
11
|
+
* Semantic colour set. `base` is the intent-free choice for ordinary content and is correct on
|
|
12
|
+
* a plain page background; the intents are for an icon that sits on that intent's surface.
|
|
13
|
+
* This is styling, not semantics — never let colour be the only thing conveying meaning.
|
|
14
|
+
*/
|
|
15
|
+
this.variant = 'base';
|
|
16
|
+
/**
|
|
17
|
+
* Which rung of the `text` token family to use. It tracks the surface the icon sits on:
|
|
18
|
+
* `primary` belongs on that variant's primary surface, `secondary` on its secondary surface or
|
|
19
|
+
* on a plain background. Pairing an intent's `primary` text with a plain page background is
|
|
20
|
+
* outside the token system's design and will not be legible.
|
|
21
|
+
*/
|
|
22
|
+
this.importance = 'secondary';
|
|
23
|
+
/** Size of the glyph, from the font-size token scale. */
|
|
24
|
+
this.size = 'm';
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
// Both the glyph and the host's ARIA are applied here rather than from render(): the
|
|
28
|
+
// glyph has to live in the light DOM for the consumer's document-level Font Awesome CSS
|
|
29
|
+
// to match it (selectors do not cross a shadow boundary, though @font-face and custom
|
|
30
|
+
// properties do), and setting the host's ARIA imperatively keeps it out of reach of the
|
|
31
|
+
// vdom, which on first render would otherwise overwrite a <Host> attribute with the
|
|
32
|
+
// same-named host *property* whenever a consumer also wrote that attribute in markup.
|
|
33
|
+
this.syncGlyph();
|
|
34
|
+
this.syncAria();
|
|
35
|
+
}
|
|
36
|
+
onIconChange() {
|
|
37
|
+
this.syncGlyph();
|
|
38
|
+
}
|
|
39
|
+
onLabelChange() {
|
|
40
|
+
this.syncAria();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates or updates the light-DOM glyph. Queries rather than caching a node reference, so it
|
|
44
|
+
* is idempotent: connectedCallback fires again every time the host is moved in the DOM, and a
|
|
45
|
+
* cached reference can also go stale (see below).
|
|
46
|
+
*/
|
|
47
|
+
syncGlyph() {
|
|
48
|
+
var _a;
|
|
49
|
+
const existing = this.el.querySelector(':scope > [data-cui-icon-glyph]');
|
|
50
|
+
// Font Awesome's SVG-and-JS build rewrites our <i> into an <svg> that it owns, and
|
|
51
|
+
// rebuilds the class list while doing so. Rewriting that node's classes would do nothing,
|
|
52
|
+
// so drop it and let Font Awesome convert a fresh <i> instead.
|
|
53
|
+
if (existing && existing.tagName !== 'I') {
|
|
54
|
+
existing.remove();
|
|
55
|
+
}
|
|
56
|
+
let glyph = this.el.querySelector(':scope > i[data-cui-icon-glyph]');
|
|
57
|
+
if (!glyph) {
|
|
58
|
+
glyph = document.createElement('i');
|
|
59
|
+
glyph.setAttribute('data-cui-icon-glyph', '');
|
|
60
|
+
// The glyph is always hidden in its own right; the host carries the accessible name.
|
|
61
|
+
glyph.setAttribute('aria-hidden', 'true');
|
|
62
|
+
this.el.appendChild(glyph);
|
|
63
|
+
}
|
|
64
|
+
glyph.className = (_a = this.icon) !== null && _a !== void 0 ? _a : '';
|
|
65
|
+
}
|
|
66
|
+
/** An icon is either named or hidden — never both, and never named with an empty string. */
|
|
67
|
+
syncAria() {
|
|
68
|
+
var _a;
|
|
69
|
+
const name = (_a = this.label) === null || _a === void 0 ? void 0 : _a.trim();
|
|
70
|
+
if (name) {
|
|
71
|
+
this.el.setAttribute('role', 'img');
|
|
72
|
+
this.el.setAttribute('aria-label', name);
|
|
73
|
+
this.el.removeAttribute('aria-hidden');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.el.setAttribute('aria-hidden', 'true');
|
|
77
|
+
this.el.removeAttribute('role');
|
|
78
|
+
this.el.removeAttribute('aria-label');
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return (index.h("span", { key: '76b54ef28027419bfbb5500c5cf4a88a7d01131e', part: "base", class: {
|
|
82
|
+
'cui-icon': true,
|
|
83
|
+
[`cui-icon--${this.variant}`]: true,
|
|
84
|
+
[`cui-icon--${this.importance}`]: true,
|
|
85
|
+
[`cui-icon--${this.size}`]: true,
|
|
86
|
+
} }, index.h("slot", { key: '8c4d13ffa3b1cfe3e4d7d47c29127784d62381ff' })));
|
|
87
|
+
}
|
|
88
|
+
get el() { return index.getElement(this); }
|
|
89
|
+
static get watchers() { return {
|
|
90
|
+
"icon": [{
|
|
91
|
+
"onIconChange": 0
|
|
92
|
+
}],
|
|
93
|
+
"label": [{
|
|
94
|
+
"onLabelChange": 0
|
|
95
|
+
}]
|
|
96
|
+
}; }
|
|
97
|
+
};
|
|
98
|
+
CuiIcon.style = cuiIconCss();
|
|
99
|
+
|
|
100
|
+
exports.cui_icon = CuiIcon;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
4
|
|
|
5
|
-
const cuiProgressCss = () => `:host{display:block;--cui-progress-track-color:var(--cui-base-bg-
|
|
5
|
+
const cuiProgressCss = () => `:host{display:block;--cui-progress-track-color:var(--cui-base-bg-level-2);--cui-progress-indicator-color:var(--cui-accent-surface-primary-default)}:host([hidden]){display:none}.cui-progress{font-family:var(--cui-font-family-base);display:flex;align-items:center;gap:var(--cui-spacing-s)}.cui-progress__bar{flex:1 1 auto;display:block;width:100%;border:none;-webkit-appearance:none;appearance:none;border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-track-color);box-shadow:inset 0 0 0 var(--cui-border-width-s) var(--cui-base-border-secondary)}.cui-progress__bar::-webkit-progress-bar{border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-track-color);box-shadow:inset 0 0 0 var(--cui-border-width-s) var(--cui-base-border-secondary)}.cui-progress__bar::-webkit-progress-value{border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-indicator-color);transition:width var(--cui-transition-base)}.cui-progress__bar::-moz-progress-bar{border-radius:var(--cui-border-radius-full);background-color:var(--cui-progress-indicator-color)}.cui-progress__bar:indeterminate{background-image:linear-gradient(to right, var(--cui-progress-indicator-color), var(--cui-progress-indicator-color));background-repeat:no-repeat;background-size:40% 100%;animation:cui-progress-sweep 1.5s linear infinite}.cui-progress__bar:indeterminate::-webkit-progress-bar{background-image:linear-gradient(to right, var(--cui-progress-indicator-color), var(--cui-progress-indicator-color));background-repeat:no-repeat;background-size:40% 100%;animation:cui-progress-sweep 1.5s linear infinite}.cui-progress__bar:indeterminate::-webkit-progress-value{display:none}.cui-progress__bar:indeterminate::-moz-progress-bar{background-color:transparent}.cui-progress__value{flex:0 0 auto;color:var(--cui-base-text-secondary);font-size:var(--cui-font-size-s);font-weight:var(--cui-font-weight-medium);font-variant-numeric:tabular-nums}.cui-progress--small .cui-progress__bar{height:var(--cui-spacing-xs)}.cui-progress--medium .cui-progress__bar{height:var(--cui-spacing-s)}.cui-progress--large .cui-progress__bar{height:var(--cui-spacing-m)}@keyframes cui-progress-sweep{from{background-position-x:-66.67%}to{background-position-x:166.67%}}@media (prefers-reduced-motion: reduce){.cui-progress__bar::-webkit-progress-value{transition:none}.cui-progress__bar:indeterminate{animation-duration:3s}.cui-progress__bar:indeterminate::-webkit-progress-bar{animation-duration:3s}}`;
|
|
6
6
|
|
|
7
7
|
const CuiProgress = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -35,10 +35,10 @@ const CuiProgress = class {
|
|
|
35
35
|
}
|
|
36
36
|
render() {
|
|
37
37
|
const { indeterminate, showValue } = this;
|
|
38
|
-
return (index.h("div", { key: '
|
|
38
|
+
return (index.h("div", { key: '546c0fb27b6e91a1d153d01ae154c272be633b14', part: "base", class: {
|
|
39
39
|
'cui-progress': true,
|
|
40
40
|
[`cui-progress--${this.size}`]: true,
|
|
41
|
-
} }, index.h("progress", { key: '
|
|
41
|
+
} }, index.h("progress", { key: '313a769b9ea6c2059816e40c744a74749a55c07b', part: "bar", class: "cui-progress__bar", "aria-label": this.label, max: this.resolvedMax, value: indeterminate ? undefined : this.clampedValue }), showValue && !indeterminate && (index.h("span", { key: '1a2edab01738734b397b426d826cfa2dcd4cf89b', part: "value", class: "cui-progress__value" }, Math.round(this.percent), "%"))));
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
CuiProgress.style = cuiProgressCss();
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-RBrlguTk.js');
|
|
4
4
|
|
|
5
|
-
const cuiTagCss = () => `:host{display:inline-block}.cui-tag{font-family:var(--cui-font-family-base);display:inline-flex;align-items:center;justify-content:center;border-radius:var(--cui-radius-
|
|
5
|
+
const cuiTagCss = () => `:host{display:inline-block}.cui-tag{font-family:var(--cui-font-family-base);display:inline-flex;align-items:center;justify-content:center;border-radius:var(--cui-border-radius-m);font-weight:var(--cui-font-weight-semibold);white-space:nowrap}.cui-tag--small{padding:var(--cui-spacing-xxs) var(--cui-spacing-s);font-size:var(--cui-font-size-xs)}.cui-tag--medium{padding:var(--cui-spacing-xs) var(--cui-spacing-m);font-size:var(--cui-font-size-s)}.cui-tag--accent{background-color:var(--cui-accent-surface-secondary-default);color:var(--cui-accent-text-secondary-default)}.cui-tag--highlight{background-color:var(--cui-highlight-surface-secondary-default);color:var(--cui-highlight-text-secondary-default)}.cui-tag--info{background-color:var(--cui-info-surface-secondary-default);color:var(--cui-info-text-secondary-default)}.cui-tag--negative{background-color:var(--cui-negative-surface-secondary-default);color:var(--cui-negative-text-secondary-default)}.cui-tag--neutral{background-color:var(--cui-neutral-surface-secondary-default);color:var(--cui-neutral-text-secondary-default)}.cui-tag--positive{background-color:var(--cui-positive-surface-secondary-default);color:var(--cui-positive-text-secondary-default)}.cui-tag--warning{background-color:var(--cui-warning-surface-secondary-default);color:var(--cui-warning-text-secondary-default)}`;
|
|
6
6
|
|
|
7
7
|
const CuiTag = class {
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
index.registerInstance(this, hostRef);
|
|
10
10
|
this.label = '';
|
|
11
|
-
this.variant = '
|
|
11
|
+
this.variant = 'neutral';
|
|
12
12
|
this.size = 'medium';
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (index.h("span", { key: '
|
|
15
|
+
return (index.h("span", { key: '35b8ea2176d1923abcda801fee775a9cd46a2fec', class: {
|
|
16
16
|
'cui-tag': true,
|
|
17
17
|
[`cui-tag--${this.variant}`]: true,
|
|
18
18
|
[`cui-tag--${this.size}`]: true,
|