@antadesign/anta 0.1.1-dev.1 → 0.1.1-dev.4

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.
@@ -0,0 +1,184 @@
1
+ const ICON_SHAPES = [
2
+ "arrow-left-to-line",
3
+ "arrow-left",
4
+ "arrow-narrow-down",
5
+ "arrow-narrow-up-down",
6
+ "arrow-narrow-up",
7
+ "arrow-right",
8
+ "arrow-top-right",
9
+ "asterisk",
10
+ "book-open",
11
+ "braces",
12
+ "bug",
13
+ "calendar",
14
+ "case-sensitive",
15
+ "chat",
16
+ "check",
17
+ "chevron-down",
18
+ "chevron-left",
19
+ "chevron-right",
20
+ "chevron-up",
21
+ "chevrons-right",
22
+ "circle-check",
23
+ "circle-large",
24
+ "circle",
25
+ "click",
26
+ "clock",
27
+ "cloud-upload",
28
+ "copy",
29
+ "corner-down-right",
30
+ "cube",
31
+ "dots-vertical",
32
+ "download",
33
+ "edit",
34
+ "education-disk",
35
+ "external-link",
36
+ "file-down",
37
+ "file",
38
+ "filter",
39
+ "folder-close",
40
+ "folder-open",
41
+ "folder-tree",
42
+ "github-logo",
43
+ "gitlab-logo",
44
+ "hat-glasses",
45
+ "heart-handshake",
46
+ "help-disk",
47
+ "history-tree",
48
+ "history",
49
+ "home",
50
+ "hourglass",
51
+ "info",
52
+ "jira-logo",
53
+ "linear-logo",
54
+ "link",
55
+ "list-detail-view",
56
+ "maximize",
57
+ "megaphone",
58
+ "menu",
59
+ "minimize",
60
+ "minus",
61
+ "moon",
62
+ "more",
63
+ "move-horizontal",
64
+ "not-equal",
65
+ "play",
66
+ "plus",
67
+ "presentation",
68
+ "refresh-ccw-dot",
69
+ "refresh",
70
+ "regex",
71
+ "repeat",
72
+ "rss",
73
+ "runs-history",
74
+ "scroll-text",
75
+ "search-check",
76
+ "search",
77
+ "send",
78
+ "sparkles",
79
+ "sun",
80
+ "swatch-book",
81
+ "table-2",
82
+ "text-highlight",
83
+ "text-initial",
84
+ "timer",
85
+ "trash",
86
+ "trello-logo",
87
+ "view",
88
+ "warning-triangle",
89
+ "webhook",
90
+ "workflow",
91
+ "x"
92
+ ];
93
+ const ICON_SYNONYMS = {
94
+ "swatch-book": ["palette", "color", "swatch", "paint", "design"],
95
+ "hat-glasses": ["accessibility", "vision", "disguise", "person"],
96
+ "heart-handshake": ["credits", "thanks", "agreement", "deal", "partnership"],
97
+ "hourglass": ["progress", "time", "wait", "loading", "timer"],
98
+ "text-initial": ["text", "typography", "letter", "a"],
99
+ "chevron-down": ["arrow", "expand", "open", "down"],
100
+ "chevron-up": ["arrow", "collapse", "close", "up"],
101
+ "chevron-left": ["arrow", "back", "previous"],
102
+ "chevron-right": ["arrow", "forward", "next"],
103
+ "chevrons-right": ["skip", "fast forward"],
104
+ "arrow-narrow-down": ["download", "fall", "down"],
105
+ "arrow-narrow-up": ["upload", "rise", "up"],
106
+ "arrow-left": ["back", "previous", "prev"],
107
+ "arrow-right": ["forward", "next"],
108
+ "arrow-narrow-up-down": ["sort", "swap", "transfer", "reorder"],
109
+ "arrow-top-right": ["external", "open", "leave"],
110
+ "arrow-left-to-line": ["dock", "snap", "align"],
111
+ "move-horizontal": ["resize", "swap", "horizontal"],
112
+ "external-link": ["open", "link", "share", "outbound"],
113
+ "check": ["tick", "ok", "done", "confirm", "approve"],
114
+ "circle-check": ["success", "ok", "done"],
115
+ "x": ["close", "cancel", "dismiss", "remove", "no"],
116
+ "plus": ["add", "new", "create"],
117
+ "minus": ["remove", "subtract"],
118
+ "menu": ["hamburger", "list", "more"],
119
+ "dots-vertical": ["more", "kebab", "options"],
120
+ "search": ["find", "magnify", "lookup"],
121
+ "search-check": ["found", "validated"],
122
+ "copy": ["duplicate", "clone"],
123
+ "trash": ["delete", "remove", "bin"],
124
+ "edit": ["pencil", "modify", "rename"],
125
+ "view": ["eye", "show", "display", "preview"],
126
+ "click": ["tap", "press", "touch"],
127
+ "send": ["submit", "share", "deliver"],
128
+ "play": ["start", "run", "execute"],
129
+ "refresh": ["reload", "sync", "update"],
130
+ "regex": ["pattern", "match"],
131
+ "repeat": ["loop", "retry", "rerun"],
132
+ "info": ["information", "about", "i"],
133
+ "warning-triangle": ["alert", "danger", "caution"],
134
+ "bug": ["defect", "issue", "error"],
135
+ "asterisk": ["star", "wildcard"],
136
+ "braces": ["code", "brackets", "json"],
137
+ "case-sensitive": ["aA", "capitalize", "case"],
138
+ "text-highlight": ["mark", "highlight"],
139
+ "list-detail-view": ["list", "items"],
140
+ "table-2": ["table", "grid", "data", "spreadsheet", "rows", "columns"],
141
+ "folder-open": ["directory", "browse"],
142
+ "folder-close": ["directory"],
143
+ "folder-tree": ["hierarchy", "structure", "tree"],
144
+ "file": ["document", "page"],
145
+ "file-down": ["download", "save"],
146
+ "calendar": ["date", "schedule"],
147
+ "clock": ["time"],
148
+ "timer": ["stopwatch", "countdown", "time"],
149
+ "history": ["log", "past"],
150
+ "history-tree": ["log", "past"],
151
+ "runs-history": ["log", "past"],
152
+ "github-logo": ["github", "git", "repo"],
153
+ "gitlab-logo": ["gitlab", "git", "repo"],
154
+ "trello-logo": ["trello", "board", "kanban"],
155
+ "jira-logo": ["jira", "ticket", "issue"],
156
+ "linear-logo": ["linear", "ticket", "issue"],
157
+ "chat": ["message", "comment", "discuss"],
158
+ "presentation": ["slides", "deck"],
159
+ "education-disk": ["learn", "school", "academic"],
160
+ "book-open": ["read", "docs", "documentation"],
161
+ "help-disk": ["question", "faq", "support", "help"],
162
+ "sparkles": ["ai", "magic", "generate"],
163
+ "cube": ["box", "package"],
164
+ "circle": ["dot", "point"],
165
+ "circle-large": ["dot", "marker"],
166
+ "not-equal": ["neq", "different"],
167
+ "corner-down-right": ["branch", "indent", "return"],
168
+ "rss": ["feed", "subscribe"],
169
+ "scroll-text": ["log", "output", "console"],
170
+ "workflow": ["pipeline", "process", "flow"],
171
+ "webhook": ["integration", "hook"],
172
+ "megaphone": ["announcement", "broadcast"],
173
+ "maximize": ["fullscreen", "expand"],
174
+ "minimize": ["collapse", "shrink"],
175
+ "filter": ["sort", "narrow"],
176
+ "download": ["save", "import"],
177
+ "cloud-upload": ["save", "sync", "upload", "send", "export"],
178
+ "link": ["url", "href", "anchor"],
179
+ "more": ["options", "extra"]
180
+ };
181
+ export {
182
+ ICON_SHAPES,
183
+ ICON_SYNONYMS
184
+ };
@@ -1,65 +1,70 @@
1
- a-progress {
2
- --progress-bg: hsla(300, 10%, 96%, 1);
3
- --progress-border-color: hsla(300, 6%, 87%, 1);
4
- --progress-indicator-bg: hsla(300, 7%, 92%, 1);
5
- --progress-indicator-edge: linear-gradient(90deg, hsla(300, 6%, 87%, 0) 0%, hsla(300, 6%, 87%, 1) 100%);
6
- --progress-label-color: var(--fg-1);
7
-
8
- display: block;
9
- container-type: inline-size;
10
- padding: 4px 8px;
11
- min-height: 8px;
12
- background: var(--progress-bg);
13
- border: 0px solid var(--progress-border-color);
14
- border-radius: 0;
15
- }
16
-
17
- .dark a-progress {
18
- --progress-bg: hsla(278, 8%, 9%, 1);
19
- --progress-border-color: hsla(278, 8%, 23%, 1);
20
- --progress-indicator-bg: hsla(278, 8%, 15%, 1);
21
- --progress-indicator-edge: linear-gradient(90deg, hsla(278, 8%, 23%, 0) 0%, hsla(278, 8%, 23%, 1) 100%);
22
- }
23
-
24
- a-progress[tone="info"] {
25
- --progress-bg: #E7F4FF;
26
- --progress-border-color: #B8DCF6;
27
- --progress-indicator-bg: #DBEDFA;
28
- --progress-indicator-edge: linear-gradient(90deg, hsla(205, 79%, 85%, 0) 0%, hsla(205, 79%, 85%, 1) 100%);
29
- --progress-label-color: var(--fg-1-blue);
30
- }
31
-
32
- .dark a-progress[tone="info"] {
33
- --progress-bg: #021A2D;
34
- --progress-border-color: #062F4C;
35
- --progress-indicator-bg: #05253F;
36
- --progress-indicator-edge: linear-gradient(90deg, hsla(207, 85%, 16%, 0) 0%, hsla(207, 85%, 16%, 1) 100%);
37
- }
38
-
39
- a-progress-label {
40
- display: flex;
41
- align-items: flex-start;
42
- gap: 0.5ch;
43
- font-variant-numeric: tabular-nums;
44
- font-feature-settings: 'ss02', 'ss05';
45
- letter-spacing: 0.03em;
46
- font-size: 13px;
47
- line-height: 16px;
48
- }
49
-
50
- a-progress-number {
51
- flex-shrink: 0;
52
- color: var(--progress-label-color);
53
- }
54
-
55
- a-progress-text {
56
- flex: 1 1 auto;
57
- min-width: 0;
58
- color: var(--fg-2);
59
- }
60
-
61
- a-progress-hint {
62
- flex-shrink: 0;
63
- margin-left: auto;
64
- color: var(--fg-3);
1
+ @layer anta {
2
+ a-progress {
3
+ --progress-bg: var(--bg-block);
4
+ --progress-border-color: var(--border-2);
5
+ --progress-indicator-bg: var(--bg-spot);
6
+ /* Right-edge fade: from the indicator's own bg to the border
7
+ colour, both opaque. Two opaque endpoints + `in oklch`
8
+ interpolation give a perceptually-uniform fade with no alpha
9
+ pre-multiplication artefacts. Tone variants automatically
10
+ re-tint because both endpoint tokens (`--progress-indicator-bg`,
11
+ `--progress-border-color`) get re-aliased per tone. */
12
+ --progress-indicator-edge: linear-gradient(
13
+ 90deg in oklch,
14
+ var(--progress-indicator-bg) 0%,
15
+ var(--progress-border-color) 100%
16
+ );
17
+ --progress-text-color: var(--text-2);
18
+ --progress-hint-color: var(--text-3);
19
+
20
+ display: block;
21
+ container-type: inline-size;
22
+ padding: 4px 8px;
23
+ min-height: 8px;
24
+ background: var(--progress-bg);
25
+ /* Per-component reset, same spirit as Tailwind preflight: declare
26
+ width / style / colour at a known state so a consumer only has
27
+ to change ONE property to opt in. Writing `border-width: 4px`
28
+ in your own CSS (or via the Anta playground's CSS tab) gives a
29
+ 4px solid themed border immediately — no need to also specify
30
+ `border-style: solid` or `border-color`. */
31
+ border: 0px solid var(--progress-border-color);
32
+ border-radius: 0;
33
+ }
34
+
35
+ a-progress[tone="info"] {
36
+ --progress-bg: var(--bg-block-info);
37
+ --progress-border-color: var(--border-2-info);
38
+ --progress-indicator-bg: var(--bg-spot-info);
39
+ --progress-text-color: var(--text-2-info);
40
+ --progress-hint-color: var(--text-3-info);
41
+ }
42
+
43
+ a-progress-label {
44
+ display: flex;
45
+ align-items: flex-start;
46
+ gap: 0.5ch;
47
+ font-variant-numeric: tabular-nums;
48
+ font-feature-settings: 'ss02', 'ss05';
49
+ letter-spacing: 0.03em;
50
+ font-size: 13px;
51
+ line-height: 16px;
52
+ }
53
+
54
+ a-progress-number {
55
+ flex-shrink: 0;
56
+ color: var(--progress-text-color);
57
+ }
58
+
59
+ a-progress-text {
60
+ flex: 1 1 auto;
61
+ min-width: 0;
62
+ color: var(--progress-text-color);
63
+ }
64
+
65
+ a-progress-hint {
66
+ flex-shrink: 0;
67
+ margin-left: auto;
68
+ color: var(--progress-hint-color);
69
+ }
65
70
  }
@@ -1,4 +1,5 @@
1
- export declare class AProgressElement extends HTMLElement {
1
+ import { HTMLElementBase } from '../anta_helpers';
2
+ export declare class AProgressElement extends HTMLElementBase {
2
3
  static observedAttributes: string[];
3
4
  indicator: HTMLDivElement;
4
5
  constructor();
@@ -1,4 +1,5 @@
1
- class AProgressElement extends HTMLElement {
1
+ import { HTMLElementBase } from "../anta_helpers";
2
+ class AProgressElement extends HTMLElementBase {
2
3
  static observedAttributes = ["value", "max", "tone"];
3
4
  indicator;
4
5
  constructor() {
@@ -54,6 +55,7 @@ class AProgressElement extends HTMLElement {
54
55
  }
55
56
  }
56
57
  function register_a_progress() {
58
+ if (typeof customElements === "undefined") return;
57
59
  if (!customElements.get("a-progress")) {
58
60
  customElements.define("a-progress", AProgressElement);
59
61
  }
@@ -0,0 +1,77 @@
1
+ @layer anta {
2
+ a-text {
3
+ --text-color: var(--text-1);
4
+ --text-link-color: var(--link-color);
5
+ --text-link-hover: var(--link-color-hover);
6
+
7
+ display: block;
8
+ color: var(--text-color);
9
+ }
10
+
11
+ a-text[inline] {
12
+ display: inline-block;
13
+ }
14
+
15
+ /* Truncation, the expandable mask, the chevron button, and the
16
+ expanded-state toggle live in shadow DOM — see
17
+ src/elements/a-text.ts. The one external concern is `min-width: 0`:
18
+ the host needs it to shrink inside flex/grid parents so the inner
19
+ clamp can actually clip content. */
20
+ a-text[truncate] {
21
+ min-width: 0;
22
+ }
23
+
24
+ /* Neutral priority overrides. Levels 1 & 2 keep the brand link color;
25
+ levels 3-5 mute the link to currentColor and step the hover up by one
26
+ level (3→2, 4→3, 5→4). */
27
+ a-text[priority="secondary"] { --text-color: var(--text-2); }
28
+ a-text[priority="tertiary"] { --text-color: var(--text-3); --text-link-color: currentColor; --text-link-hover: var(--text-2); }
29
+ a-text[priority="quaternary"] { --text-color: var(--text-4); --text-link-color: currentColor; --text-link-hover: var(--text-3); }
30
+ a-text[priority="quinary"] { --text-color: var(--text-5); --text-link-color: currentColor; --text-link-hover: var(--text-4); }
31
+
32
+ /* Tinted — text color uses --text-{N}-{tone} tokens; links are always
33
+ muted (currentColor) and hover steps up one level of the same tint.
34
+ Level 1 has no level above; hover keeps the color, only the underline
35
+ alpha changes. */
36
+ a-text[tone="brand"] { --text-color: var(--text-1-brand); --text-link-color: currentColor; --text-link-hover: var(--text-1-brand); }
37
+ a-text[tone="brand"][priority="secondary"] { --text-color: var(--text-2-brand); --text-link-hover: var(--text-1-brand); }
38
+ a-text[tone="brand"][priority="tertiary"] { --text-color: var(--text-3-brand); --text-link-hover: var(--text-2-brand); }
39
+ a-text[tone="brand"][priority="quaternary"] { --text-color: var(--text-4-brand); --text-link-hover: var(--text-3-brand); }
40
+ a-text[tone="brand"][priority="quinary"] { --text-color: var(--text-5-brand); --text-link-hover: var(--text-4-brand); }
41
+
42
+ a-text[tone="success"] { --text-color: var(--text-1-success); --text-link-color: currentColor; --text-link-hover: var(--text-1-success); }
43
+ a-text[tone="success"][priority="secondary"] { --text-color: var(--text-2-success); --text-link-hover: var(--text-1-success); }
44
+ a-text[tone="success"][priority="tertiary"] { --text-color: var(--text-3-success); --text-link-hover: var(--text-2-success); }
45
+ a-text[tone="success"][priority="quaternary"] { --text-color: var(--text-4-success); --text-link-hover: var(--text-3-success); }
46
+ a-text[tone="success"][priority="quinary"] { --text-color: var(--text-5-success); --text-link-hover: var(--text-4-success); }
47
+
48
+ a-text[tone="critical"] { --text-color: var(--text-1-critical); --text-link-color: currentColor; --text-link-hover: var(--text-1-critical); }
49
+ a-text[tone="critical"][priority="secondary"] { --text-color: var(--text-2-critical); --text-link-hover: var(--text-1-critical); }
50
+ a-text[tone="critical"][priority="tertiary"] { --text-color: var(--text-3-critical); --text-link-hover: var(--text-2-critical); }
51
+ a-text[tone="critical"][priority="quaternary"] { --text-color: var(--text-4-critical); --text-link-hover: var(--text-3-critical); }
52
+ a-text[tone="critical"][priority="quinary"] { --text-color: var(--text-5-critical); --text-link-hover: var(--text-4-critical); }
53
+
54
+ a-text[tone="warning"] { --text-color: var(--text-1-warning); --text-link-color: currentColor; --text-link-hover: var(--text-1-warning); }
55
+ a-text[tone="warning"][priority="secondary"] { --text-color: var(--text-2-warning); --text-link-hover: var(--text-1-warning); }
56
+ a-text[tone="warning"][priority="tertiary"] { --text-color: var(--text-3-warning); --text-link-hover: var(--text-2-warning); }
57
+ a-text[tone="warning"][priority="quaternary"] { --text-color: var(--text-4-warning); --text-link-hover: var(--text-3-warning); }
58
+ a-text[tone="warning"][priority="quinary"] { --text-color: var(--text-5-warning); --text-link-hover: var(--text-4-warning); }
59
+
60
+ a-text[tone="info"] { --text-color: var(--text-1-info); --text-link-color: currentColor; --text-link-hover: var(--text-1-info); }
61
+ a-text[tone="info"][priority="secondary"] { --text-color: var(--text-2-info); --text-link-hover: var(--text-1-info); }
62
+ a-text[tone="info"][priority="tertiary"] { --text-color: var(--text-3-info); --text-link-hover: var(--text-2-info); }
63
+ a-text[tone="info"][priority="quaternary"] { --text-color: var(--text-4-info); --text-link-hover: var(--text-3-info); }
64
+ a-text[tone="info"][priority="quinary"] { --text-color: var(--text-5-info); --text-link-hover: var(--text-4-info); }
65
+
66
+ /* Link colors layered on top of anta's global `a` defaults — only
67
+ overriding what the priority/tone cascade dictates (color and the
68
+ one-step-up hover color). Underline / thickness / offset / alpha
69
+ are inherited from the global rule in reset.css.
70
+ On hover the underline color is repeated so it tracks the priority
71
+ color rather than the global --link-color-hover. */
72
+ a-text a, a-text a:link, a-text a:visited { color: var(--text-link-color); }
73
+ a-text a:hover {
74
+ color: var(--text-link-hover);
75
+ text-decoration-color: var(--text-link-hover);
76
+ }
77
+ }
@@ -0,0 +1,10 @@
1
+ import { HTMLElementBase } from '../anta_helpers';
2
+ export declare class ATextElement extends HTMLElementBase {
3
+ static observedAttributes: string[];
4
+ private slotEl;
5
+ private expandBtn;
6
+ constructor();
7
+ attributeChangedCallback(): void;
8
+ private handleExpand;
9
+ }
10
+ export declare function register_a_text(): void;
@@ -0,0 +1,143 @@
1
+ import { HTMLElementBase } from "../anta_helpers";
2
+ const SHADOW_STYLE = `
3
+ :host {
4
+ display: block;
5
+ position: relative;
6
+ }
7
+ :host([inline]) {
8
+ display: inline-block;
9
+ }
10
+
11
+ /* Default: slot disappears from layout so slotted nodes flow as
12
+ direct children of the host. Truncation rules below give the slot
13
+ a real display so it becomes the wrapper that holds the clamp. */
14
+ slot {
15
+ display: contents;
16
+ }
17
+
18
+ :host([truncate]) slot {
19
+ display: -webkit-box;
20
+ -webkit-box-orient: vertical;
21
+ -webkit-line-clamp: var(--line-clamp, 1);
22
+ overflow: hidden;
23
+ }
24
+
25
+ /* Expandable \u2014 vertical fade for multi-line. */
26
+ :host([truncate][expandable]) slot:not(.expanded) {
27
+ -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 2em), transparent 97%);
28
+ mask-image: linear-gradient(to bottom, black calc(100% - 2em), transparent 97%);
29
+ }
30
+
31
+ /* Expandable \u2014 horizontal right-edge fade for single-line. */
32
+ :host([truncate="1"][expandable]) slot:not(.expanded) {
33
+ -webkit-mask-image: linear-gradient(to right, black calc(100% - 7ch), transparent 97%);
34
+ mask-image: linear-gradient(to right, black calc(100% - 7ch), transparent 97%);
35
+ }
36
+
37
+ /* Expanded \u2014 drop truncation entirely. */
38
+ :host([truncate]) slot.expanded {
39
+ display: block;
40
+ -webkit-line-clamp: unset;
41
+ overflow: visible;
42
+ }
43
+
44
+ /* Expand button. The whole button is the click target; the chevron
45
+ icon is positioned absolutely in the button's bottom-right corner. */
46
+ .expand-btn {
47
+ appearance: none;
48
+ background: transparent;
49
+ border: none;
50
+ margin: 0;
51
+ padding: 0;
52
+ color: var(--text-3);
53
+ cursor: pointer;
54
+ font: inherit;
55
+ display: none;
56
+ position: absolute;
57
+ z-index: 1;
58
+ opacity: 0;
59
+ transition: opacity 150ms ease-out, color 150ms ease-out;
60
+ }
61
+ .expand-btn:hover {
62
+ color: var(--text-1);
63
+ }
64
+ .expand-btn::before {
65
+ content: '';
66
+ position: absolute;
67
+ right: -1px;
68
+ bottom: -1px;
69
+ width: 14px;
70
+ height: 14px;
71
+ background-color: currentColor;
72
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
73
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
74
+ -webkit-mask-position: center;
75
+ mask-position: center;
76
+ -webkit-mask-repeat: no-repeat;
77
+ mask-repeat: no-repeat;
78
+ -webkit-mask-size: contain;
79
+ mask-size: contain;
80
+ }
81
+
82
+ /* Multi-line \u2014 full-width strip pinned to the bottom of the host. */
83
+ :host([truncate][expandable]) .expand-btn:not(.hidden) {
84
+ display: block;
85
+ left: 0;
86
+ right: 0;
87
+ bottom: 0;
88
+ height: 1.5em;
89
+ }
90
+
91
+ /* Single-line \u2014 narrow region pinned to the right side. */
92
+ :host([truncate="1"][expandable]) .expand-btn:not(.hidden) {
93
+ left: auto;
94
+ top: 0;
95
+ bottom: 0;
96
+ width: 3em;
97
+ }
98
+
99
+ :host([truncate][expandable]:hover) .expand-btn:not(.hidden),
100
+ :host([truncate][expandable]:focus-within) .expand-btn:not(.hidden) {
101
+ opacity: 1;
102
+ }
103
+ `;
104
+ class ATextElement extends HTMLElementBase {
105
+ static observedAttributes = ["expandable", "truncate"];
106
+ slotEl;
107
+ expandBtn;
108
+ constructor() {
109
+ super();
110
+ const shadow = this.attachShadow({ mode: "open" });
111
+ const style = document.createElement("style");
112
+ style.textContent = SHADOW_STYLE;
113
+ this.slotEl = document.createElement("slot");
114
+ this.expandBtn = document.createElement("button");
115
+ this.expandBtn.className = "expand-btn";
116
+ this.expandBtn.type = "button";
117
+ this.expandBtn.setAttribute("aria-label", "Show more");
118
+ this.expandBtn.setAttribute("aria-expanded", "false");
119
+ this.expandBtn.addEventListener("click", this.handleExpand);
120
+ shadow.append(style, this.slotEl, this.expandBtn);
121
+ }
122
+ attributeChangedCallback() {
123
+ this.slotEl.classList.remove("expanded");
124
+ this.expandBtn.classList.remove("hidden");
125
+ this.expandBtn.setAttribute("aria-expanded", "false");
126
+ }
127
+ handleExpand = () => {
128
+ if (this.slotEl.classList.contains("expanded")) return;
129
+ this.slotEl.classList.add("expanded");
130
+ this.expandBtn.classList.add("hidden");
131
+ this.expandBtn.setAttribute("aria-expanded", "true");
132
+ };
133
+ }
134
+ function register_a_text() {
135
+ if (typeof customElements === "undefined") return;
136
+ if (!customElements.get("a-text")) {
137
+ customElements.define("a-text", ATextElement);
138
+ }
139
+ }
140
+ export {
141
+ ATextElement,
142
+ register_a_text
143
+ };
@@ -1,2 +1,7 @@
1
1
  import './a-progress.css';
2
+ import './a-text.css';
3
+ import './a-icon.css';
4
+ import './a-icon.shapes.css';
2
5
  export { AProgressElement, register_a_progress } from './a-progress';
6
+ export { ATextElement, register_a_text } from './a-text';
7
+ export { AIconElement, register_a_icon } from './a-icon';
@@ -1,10 +1,23 @@
1
1
  import { register_a_progress } from "./a-progress";
2
+ import { register_a_text } from "./a-text";
3
+ import { register_a_icon } from "./a-icon";
2
4
  import "./a-progress.css";
5
+ import "./a-text.css";
6
+ import "./a-icon.css";
7
+ import "./a-icon.shapes.css";
3
8
  import { AProgressElement, register_a_progress as register_a_progress2 } from "./a-progress";
9
+ import { ATextElement, register_a_text as register_a_text2 } from "./a-text";
10
+ import { AIconElement, register_a_icon as register_a_icon2 } from "./a-icon";
4
11
  if (typeof customElements !== "undefined") {
5
12
  register_a_progress();
13
+ register_a_text();
14
+ register_a_icon();
6
15
  }
7
16
  export {
17
+ AIconElement,
8
18
  AProgressElement,
9
- register_a_progress2 as register_a_progress
19
+ ATextElement,
20
+ register_a_icon2 as register_a_icon,
21
+ register_a_progress2 as register_a_progress,
22
+ register_a_text2 as register_a_text
10
23
  };