@arclux/arc-ui 1.0.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/LICENSE +21 -0
- package/README.md +64 -0
- package/package.json +186 -0
- package/src/content/accordion-item.js +27 -0
- package/src/content/accordion.js +151 -0
- package/src/content/animated-number.js +160 -0
- package/src/content/aspect-ratio.js +78 -0
- package/src/content/avatar-group.js +101 -0
- package/src/content/avatar.js +92 -0
- package/src/content/badge.js +98 -0
- package/src/content/callout.js +141 -0
- package/src/content/card.js +75 -0
- package/src/content/carousel.js +300 -0
- package/src/content/code-block.js +152 -0
- package/src/content/collapsible.js +142 -0
- package/src/content/color-swatch.js +86 -0
- package/src/content/column.js +28 -0
- package/src/content/data-table.js +332 -0
- package/src/content/divider.js +153 -0
- package/src/content/empty-state.js +78 -0
- package/src/content/feature-card.js +142 -0
- package/src/content/highlight.js +63 -0
- package/src/content/icon-library.js +30 -0
- package/src/content/icon-registry.js +39 -0
- package/src/content/icon.js +95 -0
- package/src/content/index.js +44 -0
- package/src/content/infinite-scroll.js +144 -0
- package/src/content/kbd.js +40 -0
- package/src/content/markdown.js +294 -0
- package/src/content/marquee.js +166 -0
- package/src/content/meter.js +167 -0
- package/src/content/scroll-area.js +107 -0
- package/src/content/skeleton.js +85 -0
- package/src/content/spinner.js +77 -0
- package/src/content/stack.js +68 -0
- package/src/content/stat.js +72 -0
- package/src/content/step.js +22 -0
- package/src/content/stepper.js +202 -0
- package/src/content/table.js +134 -0
- package/src/content/tag.js +156 -0
- package/src/content/text.js +111 -0
- package/src/content/timeline-item.js +29 -0
- package/src/content/timeline.js +170 -0
- package/src/content/truncate.js +161 -0
- package/src/content/value-card.js +94 -0
- package/src/feedback/alert.js +187 -0
- package/src/feedback/command-item.js +28 -0
- package/src/feedback/command-palette.js +346 -0
- package/src/feedback/context-menu.js +299 -0
- package/src/feedback/dialog.js +298 -0
- package/src/feedback/dropdown-menu.js +259 -0
- package/src/feedback/hover-card.js +186 -0
- package/src/feedback/index.js +17 -0
- package/src/feedback/modal.js +226 -0
- package/src/feedback/notification-panel.js +196 -0
- package/src/feedback/popover.js +184 -0
- package/src/feedback/progress.js +169 -0
- package/src/feedback/sheet.js +249 -0
- package/src/feedback/toast.js +207 -0
- package/src/feedback/tooltip.js +189 -0
- package/src/icons/lucide.d.ts +1915 -0
- package/src/icons/lucide.js +1915 -0
- package/src/icons/phosphor.d.ts +1517 -0
- package/src/icons/phosphor.js +1517 -0
- package/src/icons/types.d.ts +8 -0
- package/src/index.js +9 -0
- package/src/input/button.js +127 -0
- package/src/input/calendar.js +340 -0
- package/src/input/checkbox.js +159 -0
- package/src/input/chip.js +120 -0
- package/src/input/color-picker.js +461 -0
- package/src/input/combobox.js +295 -0
- package/src/input/copy-button.js +144 -0
- package/src/input/date-picker.js +534 -0
- package/src/input/file-upload.js +333 -0
- package/src/input/form.js +179 -0
- package/src/input/icon-button.js +179 -0
- package/src/input/index.js +31 -0
- package/src/input/input.js +158 -0
- package/src/input/multi-select.js +392 -0
- package/src/input/number-input.js +239 -0
- package/src/input/otp-input.js +221 -0
- package/src/input/pin-input.js +294 -0
- package/src/input/radio-group.js +177 -0
- package/src/input/radio.js +28 -0
- package/src/input/rating.js +195 -0
- package/src/input/search.js +371 -0
- package/src/input/segmented-control.js +174 -0
- package/src/input/select.js +267 -0
- package/src/input/slider.js +217 -0
- package/src/input/sortable-list.js +345 -0
- package/src/input/suggestion.js +26 -0
- package/src/input/textarea.js +203 -0
- package/src/input/theme-toggle.js +196 -0
- package/src/input/toggle.js +166 -0
- package/src/layout/app-shell.js +266 -0
- package/src/layout/auth-shell.js +153 -0
- package/src/layout/container.js +37 -0
- package/src/layout/dashboard-grid.js +62 -0
- package/src/layout/index.js +15 -0
- package/src/layout/page-header.js +100 -0
- package/src/layout/page-layout.js +112 -0
- package/src/layout/resizable.js +221 -0
- package/src/layout/section.js +54 -0
- package/src/layout/settings-layout.js +91 -0
- package/src/layout/split-pane.js +172 -0
- package/src/layout/status-bar.js +84 -0
- package/src/layout/toolbar.js +92 -0
- package/src/navigation/breadcrumb-item.js +26 -0
- package/src/navigation/breadcrumb.js +129 -0
- package/src/navigation/drawer.js +183 -0
- package/src/navigation/footer.js +99 -0
- package/src/navigation/index.js +22 -0
- package/src/navigation/link.js +120 -0
- package/src/navigation/nav-item.js +46 -0
- package/src/navigation/navigation-menu.js +687 -0
- package/src/navigation/pagination.js +186 -0
- package/src/navigation/scroll-spy.js +198 -0
- package/src/navigation/scroll-to-top.js +163 -0
- package/src/navigation/sidebar-link.js +28 -0
- package/src/navigation/sidebar-section.js +45 -0
- package/src/navigation/sidebar.js +336 -0
- package/src/navigation/spy-link.js +26 -0
- package/src/navigation/tab.js +26 -0
- package/src/navigation/tabs.js +202 -0
- package/src/navigation/top-bar.js +263 -0
- package/src/navigation/tree-item.js +38 -0
- package/src/navigation/tree-view.js +255 -0
- package/src/shared/index.js +6 -0
- package/src/shared/menu-divider.js +9 -0
- package/src/shared/menu-item.js +30 -0
- package/src/shared/option.js +31 -0
- package/src/shared-styles.js +81 -0
- package/src/tokens.js +445 -0
- package/types/index.d.ts +973 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arclight Digital, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @arclux/arc-ui
|
|
2
|
+
|
|
3
|
+
Lit web components implementing the Arclight design system. This is the canonical source -- all framework wrapper packages are generated from these components by [Prism](../../prism.config.js).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @arclux/arc-ui lit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// Import all components
|
|
15
|
+
import '@arclux/arc-ui';
|
|
16
|
+
|
|
17
|
+
// Or import individually for smaller bundles
|
|
18
|
+
import '@arclux/arc-ui/button';
|
|
19
|
+
import '@arclux/arc-ui/card';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<arc-button variant="primary">Get Started</arc-button>
|
|
24
|
+
|
|
25
|
+
<arc-card>
|
|
26
|
+
<h3>Card Title</h3>
|
|
27
|
+
<p>Card content.</p>
|
|
28
|
+
</arc-card>
|
|
29
|
+
|
|
30
|
+
<arc-input label="Email" type="email" placeholder="you@example.com"></arc-input>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Styling
|
|
34
|
+
|
|
35
|
+
Components use Shadow DOM. Override styles via CSS custom properties or `::part()` selectors:
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
arc-button {
|
|
39
|
+
--accent-primary: #3b82f6;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Framework Wrappers
|
|
44
|
+
|
|
45
|
+
If you are using a framework, prefer the dedicated wrapper package:
|
|
46
|
+
|
|
47
|
+
| Framework | Package |
|
|
48
|
+
|-----------|---------|
|
|
49
|
+
| React | [`@arclux/arc-ui-react`](../react/) |
|
|
50
|
+
| Vue 3 | [`@arclux/arc-ui-vue`](../vue/) |
|
|
51
|
+
| Svelte 5 | [`@arclux/arc-ui-svelte`](../svelte/) |
|
|
52
|
+
| Angular | [`@arclux/arc-ui-angular`](../angular/) |
|
|
53
|
+
| Solid | [`@arclux/arc-ui-solid`](../solid/) |
|
|
54
|
+
| Preact | [`@arclux/arc-ui-preact`](../preact/) |
|
|
55
|
+
| Plain HTML/CSS | [`@arclux/arc-ui-html`](../html/) |
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
Full component docs and interactive examples: [arcui.dev](https://arcui.dev)
|
|
60
|
+
|
|
61
|
+
## Links
|
|
62
|
+
|
|
63
|
+
- [Root README](../../README.md)
|
|
64
|
+
- [License](../../LICENSE)
|
package/package.json
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arclux/arc-ui",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ARC UI — Lit Web Components implementing the Arclight design system.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"module": "src/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./types/index.d.ts",
|
|
12
|
+
"default": "./src/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./content": {
|
|
15
|
+
"types": "./types/index.d.ts",
|
|
16
|
+
"default": "./src/content/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./input": "./src/input/input.js",
|
|
19
|
+
"./feedback": {
|
|
20
|
+
"types": "./types/index.d.ts",
|
|
21
|
+
"default": "./src/feedback/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./navigation": {
|
|
24
|
+
"types": "./types/index.d.ts",
|
|
25
|
+
"default": "./src/navigation/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./layout": {
|
|
28
|
+
"types": "./types/index.d.ts",
|
|
29
|
+
"default": "./src/layout/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./shared": {
|
|
32
|
+
"types": "./types/index.d.ts",
|
|
33
|
+
"default": "./src/shared/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./accordion": "./src/content/accordion.js",
|
|
36
|
+
"./accordion-item": "./src/content/accordion-item.js",
|
|
37
|
+
"./animated-number": "./src/content/animated-number.js",
|
|
38
|
+
"./aspect-ratio": "./src/content/aspect-ratio.js",
|
|
39
|
+
"./avatar": "./src/content/avatar.js",
|
|
40
|
+
"./avatar-group": "./src/content/avatar-group.js",
|
|
41
|
+
"./badge": "./src/content/badge.js",
|
|
42
|
+
"./callout": "./src/content/callout.js",
|
|
43
|
+
"./card": "./src/content/card.js",
|
|
44
|
+
"./carousel": "./src/content/carousel.js",
|
|
45
|
+
"./code-block": "./src/content/code-block.js",
|
|
46
|
+
"./collapsible": "./src/content/collapsible.js",
|
|
47
|
+
"./color-swatch": "./src/content/color-swatch.js",
|
|
48
|
+
"./column": "./src/content/column.js",
|
|
49
|
+
"./data-table": "./src/content/data-table.js",
|
|
50
|
+
"./divider": "./src/content/divider.js",
|
|
51
|
+
"./empty-state": "./src/content/empty-state.js",
|
|
52
|
+
"./feature-card": "./src/content/feature-card.js",
|
|
53
|
+
"./highlight": "./src/content/highlight.js",
|
|
54
|
+
"./icon": "./src/content/icon.js",
|
|
55
|
+
"./icon-library": "./src/content/icon-library.js",
|
|
56
|
+
"./icon-registry": "./src/content/icon-registry.js",
|
|
57
|
+
"./infinite-scroll": "./src/content/infinite-scroll.js",
|
|
58
|
+
"./kbd": "./src/content/kbd.js",
|
|
59
|
+
"./markdown": "./src/content/markdown.js",
|
|
60
|
+
"./marquee": "./src/content/marquee.js",
|
|
61
|
+
"./meter": "./src/content/meter.js",
|
|
62
|
+
"./scroll-area": "./src/content/scroll-area.js",
|
|
63
|
+
"./skeleton": "./src/content/skeleton.js",
|
|
64
|
+
"./spinner": "./src/content/spinner.js",
|
|
65
|
+
"./stack": "./src/content/stack.js",
|
|
66
|
+
"./stat": "./src/content/stat.js",
|
|
67
|
+
"./step": "./src/content/step.js",
|
|
68
|
+
"./stepper": "./src/content/stepper.js",
|
|
69
|
+
"./table": "./src/content/table.js",
|
|
70
|
+
"./tag": "./src/content/tag.js",
|
|
71
|
+
"./text": "./src/content/text.js",
|
|
72
|
+
"./timeline": "./src/content/timeline.js",
|
|
73
|
+
"./timeline-item": "./src/content/timeline-item.js",
|
|
74
|
+
"./truncate": "./src/content/truncate.js",
|
|
75
|
+
"./value-card": "./src/content/value-card.js",
|
|
76
|
+
"./button": "./src/input/button.js",
|
|
77
|
+
"./calendar": "./src/input/calendar.js",
|
|
78
|
+
"./checkbox": "./src/input/checkbox.js",
|
|
79
|
+
"./chip": "./src/input/chip.js",
|
|
80
|
+
"./color-picker": "./src/input/color-picker.js",
|
|
81
|
+
"./combobox": "./src/input/combobox.js",
|
|
82
|
+
"./copy-button": "./src/input/copy-button.js",
|
|
83
|
+
"./date-picker": "./src/input/date-picker.js",
|
|
84
|
+
"./file-upload": "./src/input/file-upload.js",
|
|
85
|
+
"./form": "./src/input/form.js",
|
|
86
|
+
"./icon-button": "./src/input/icon-button.js",
|
|
87
|
+
"./multi-select": "./src/input/multi-select.js",
|
|
88
|
+
"./number-input": "./src/input/number-input.js",
|
|
89
|
+
"./otp-input": "./src/input/otp-input.js",
|
|
90
|
+
"./pin-input": "./src/input/pin-input.js",
|
|
91
|
+
"./radio": "./src/input/radio.js",
|
|
92
|
+
"./radio-group": "./src/input/radio-group.js",
|
|
93
|
+
"./rating": "./src/input/rating.js",
|
|
94
|
+
"./search": "./src/input/search.js",
|
|
95
|
+
"./segmented-control": "./src/input/segmented-control.js",
|
|
96
|
+
"./select": "./src/input/select.js",
|
|
97
|
+
"./slider": "./src/input/slider.js",
|
|
98
|
+
"./sortable-list": "./src/input/sortable-list.js",
|
|
99
|
+
"./suggestion": "./src/input/suggestion.js",
|
|
100
|
+
"./textarea": "./src/input/textarea.js",
|
|
101
|
+
"./theme-toggle": "./src/input/theme-toggle.js",
|
|
102
|
+
"./toggle": "./src/input/toggle.js",
|
|
103
|
+
"./alert": "./src/feedback/alert.js",
|
|
104
|
+
"./command-item": "./src/feedback/command-item.js",
|
|
105
|
+
"./command-palette": "./src/feedback/command-palette.js",
|
|
106
|
+
"./context-menu": "./src/feedback/context-menu.js",
|
|
107
|
+
"./dialog": "./src/feedback/dialog.js",
|
|
108
|
+
"./dropdown-menu": "./src/feedback/dropdown-menu.js",
|
|
109
|
+
"./hover-card": "./src/feedback/hover-card.js",
|
|
110
|
+
"./modal": "./src/feedback/modal.js",
|
|
111
|
+
"./notification-panel": "./src/feedback/notification-panel.js",
|
|
112
|
+
"./popover": "./src/feedback/popover.js",
|
|
113
|
+
"./progress": "./src/feedback/progress.js",
|
|
114
|
+
"./sheet": "./src/feedback/sheet.js",
|
|
115
|
+
"./toast": "./src/feedback/toast.js",
|
|
116
|
+
"./tooltip": "./src/feedback/tooltip.js",
|
|
117
|
+
"./breadcrumb": "./src/navigation/breadcrumb.js",
|
|
118
|
+
"./breadcrumb-item": "./src/navigation/breadcrumb-item.js",
|
|
119
|
+
"./drawer": "./src/navigation/drawer.js",
|
|
120
|
+
"./footer": "./src/navigation/footer.js",
|
|
121
|
+
"./link": "./src/navigation/link.js",
|
|
122
|
+
"./nav-item": "./src/navigation/nav-item.js",
|
|
123
|
+
"./navigation-menu": "./src/navigation/navigation-menu.js",
|
|
124
|
+
"./pagination": "./src/navigation/pagination.js",
|
|
125
|
+
"./scroll-spy": "./src/navigation/scroll-spy.js",
|
|
126
|
+
"./scroll-to-top": "./src/navigation/scroll-to-top.js",
|
|
127
|
+
"./sidebar": "./src/navigation/sidebar.js",
|
|
128
|
+
"./sidebar-link": "./src/navigation/sidebar-link.js",
|
|
129
|
+
"./sidebar-section": "./src/navigation/sidebar-section.js",
|
|
130
|
+
"./spy-link": "./src/navigation/spy-link.js",
|
|
131
|
+
"./tab": "./src/navigation/tab.js",
|
|
132
|
+
"./tabs": "./src/navigation/tabs.js",
|
|
133
|
+
"./top-bar": "./src/navigation/top-bar.js",
|
|
134
|
+
"./tree-item": "./src/navigation/tree-item.js",
|
|
135
|
+
"./tree-view": "./src/navigation/tree-view.js",
|
|
136
|
+
"./app-shell": "./src/layout/app-shell.js",
|
|
137
|
+
"./auth-shell": "./src/layout/auth-shell.js",
|
|
138
|
+
"./container": "./src/layout/container.js",
|
|
139
|
+
"./dashboard-grid": "./src/layout/dashboard-grid.js",
|
|
140
|
+
"./page-header": "./src/layout/page-header.js",
|
|
141
|
+
"./page-layout": "./src/layout/page-layout.js",
|
|
142
|
+
"./resizable": "./src/layout/resizable.js",
|
|
143
|
+
"./section": "./src/layout/section.js",
|
|
144
|
+
"./settings-layout": "./src/layout/settings-layout.js",
|
|
145
|
+
"./split-pane": "./src/layout/split-pane.js",
|
|
146
|
+
"./status-bar": "./src/layout/status-bar.js",
|
|
147
|
+
"./toolbar": "./src/layout/toolbar.js",
|
|
148
|
+
"./option": "./src/shared/option.js",
|
|
149
|
+
"./menu-item": "./src/shared/menu-item.js",
|
|
150
|
+
"./menu-divider": "./src/shared/menu-divider.js",
|
|
151
|
+
"./tokens": "./src/tokens.js",
|
|
152
|
+
"./icons/phosphor": "./src/icons/phosphor.js",
|
|
153
|
+
"./icons/lucide": "./src/icons/lucide.js",
|
|
154
|
+
"./icons/types": "./src/icons/types.d.ts"
|
|
155
|
+
},
|
|
156
|
+
"files": [
|
|
157
|
+
"src/",
|
|
158
|
+
"types/"
|
|
159
|
+
],
|
|
160
|
+
"sideEffects": false,
|
|
161
|
+
"dependencies": {
|
|
162
|
+
"lit": "^3.3.0"
|
|
163
|
+
},
|
|
164
|
+
"license": "MIT",
|
|
165
|
+
"keywords": [
|
|
166
|
+
"web-components",
|
|
167
|
+
"lit",
|
|
168
|
+
"design-system",
|
|
169
|
+
"arclight"
|
|
170
|
+
],
|
|
171
|
+
"repository": {
|
|
172
|
+
"type": "git",
|
|
173
|
+
"url": "https://github.com/arclight-digital/arc-ui",
|
|
174
|
+
"directory": "packages/web-components"
|
|
175
|
+
},
|
|
176
|
+
"homepage": "https://arcui.dev",
|
|
177
|
+
"bugs": {
|
|
178
|
+
"url": "https://github.com/arclight-digital/arc-ui/issues"
|
|
179
|
+
},
|
|
180
|
+
"publishConfig": {
|
|
181
|
+
"access": "public"
|
|
182
|
+
},
|
|
183
|
+
"scripts": {
|
|
184
|
+
"build": "echo 'No build step — plain JS modules'"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export class ArcAccordionItem extends LitElement {
|
|
4
|
+
static properties = {
|
|
5
|
+
question: { type: String, reflect: true },
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
static styles = css`
|
|
9
|
+
:host { display: none; }
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.question = '';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Answer content from slotted children */
|
|
18
|
+
get answer() {
|
|
19
|
+
return this.textContent.trim();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
return html`<slot></slot>`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
customElements.define('arc-accordion-item', ArcAccordionItem);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
import './accordion-item.js';
|
|
4
|
+
|
|
5
|
+
export class ArcAccordion extends LitElement {
|
|
6
|
+
static properties = {
|
|
7
|
+
_items: { state: true },
|
|
8
|
+
_openItems: { state: true },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
static styles = [
|
|
12
|
+
tokenStyles,
|
|
13
|
+
css`
|
|
14
|
+
:host { display: block; }
|
|
15
|
+
|
|
16
|
+
.accordion {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 1px;
|
|
20
|
+
background: var(--border-subtle);
|
|
21
|
+
border: 1px solid var(--border-subtle);
|
|
22
|
+
border-radius: var(--radius-lg);
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.accordion__item { background: var(--bg-card); }
|
|
27
|
+
|
|
28
|
+
.accordion__trigger {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
gap: var(--space-md);
|
|
33
|
+
width: 100%;
|
|
34
|
+
padding: var(--space-lg) var(--space-xl);
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
font-family: var(--font-body);
|
|
37
|
+
font-size: var(--text-md);
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
color: var(--text-primary);
|
|
40
|
+
background: none;
|
|
41
|
+
border: none;
|
|
42
|
+
text-align: left;
|
|
43
|
+
transition: background var(--transition-fast);
|
|
44
|
+
min-height: var(--touch-min);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.accordion__trigger:hover { background: var(--bg-elevated); }
|
|
48
|
+
.accordion__trigger[aria-expanded="true"] { background: var(--bg-elevated); }
|
|
49
|
+
.accordion__trigger:focus-visible {
|
|
50
|
+
outline: none;
|
|
51
|
+
box-shadow: inset 0 0 0 2px var(--accent-primary);
|
|
52
|
+
background: var(--bg-elevated);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.accordion__chevron {
|
|
56
|
+
color: var(--text-muted);
|
|
57
|
+
font-size: var(--text-sm);
|
|
58
|
+
transition: transform 300ms ease;
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.accordion__trigger[aria-expanded="true"] .accordion__chevron {
|
|
64
|
+
transform: rotate(180deg);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.accordion__content {
|
|
68
|
+
display: grid;
|
|
69
|
+
grid-template-rows: 0fr;
|
|
70
|
+
transition: grid-template-rows 300ms ease;
|
|
71
|
+
}
|
|
72
|
+
.accordion__content.is-open { grid-template-rows: 1fr; }
|
|
73
|
+
|
|
74
|
+
.accordion__body { overflow: hidden; }
|
|
75
|
+
|
|
76
|
+
.accordion__body p {
|
|
77
|
+
color: var(--text-secondary);
|
|
78
|
+
font-family: var(--font-body);
|
|
79
|
+
font-size: var(--text-sm);
|
|
80
|
+
line-height: 1.75;
|
|
81
|
+
padding: var(--space-xs) var(--space-lg) var(--space-md);
|
|
82
|
+
margin: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.accordion__slot-host { display: none; }
|
|
86
|
+
|
|
87
|
+
@media (prefers-reduced-motion: reduce) {
|
|
88
|
+
:host *,
|
|
89
|
+
:host *::before,
|
|
90
|
+
:host *::after {
|
|
91
|
+
animation-duration: 0.01ms !important;
|
|
92
|
+
animation-iteration-count: 1 !important;
|
|
93
|
+
transition-duration: 0.01ms !important;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`,
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
constructor() {
|
|
100
|
+
super();
|
|
101
|
+
this._items = [];
|
|
102
|
+
this._openItems = new Set();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_onSlotChange(e) {
|
|
106
|
+
this._items = e.target.assignedElements({ flatten: true })
|
|
107
|
+
.filter(el => el.tagName === 'ARC-ACCORDION-ITEM');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_toggle(index) {
|
|
111
|
+
const next = new Set(this._openItems);
|
|
112
|
+
if (next.has(index)) {
|
|
113
|
+
next.delete(index);
|
|
114
|
+
} else {
|
|
115
|
+
next.add(index);
|
|
116
|
+
}
|
|
117
|
+
this._openItems = next;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
render() {
|
|
121
|
+
return html`
|
|
122
|
+
<div class="accordion__slot-host">
|
|
123
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
124
|
+
</div>
|
|
125
|
+
<div class="accordion" part="accordion">
|
|
126
|
+
${this._items.map((item, i) => {
|
|
127
|
+
const isOpen = this._openItems.has(i);
|
|
128
|
+
return html`
|
|
129
|
+
<div class="accordion__item">
|
|
130
|
+
<button
|
|
131
|
+
class="accordion__trigger"
|
|
132
|
+
aria-expanded=${isOpen ? 'true' : 'false'}
|
|
133
|
+
@click=${() => this._toggle(i)}
|
|
134
|
+
>
|
|
135
|
+
<span>${item.question}</span>
|
|
136
|
+
<span class="accordion__chevron">▾</span>
|
|
137
|
+
</button>
|
|
138
|
+
<div class="accordion__content ${isOpen ? 'is-open' : ''}">
|
|
139
|
+
<div class="accordion__body">
|
|
140
|
+
<p>${item.answer}</p>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
`;
|
|
145
|
+
})}
|
|
146
|
+
</div>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
customElements.define('arc-accordion', ArcAccordion);
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcAnimatedNumber extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
value: { type: Number, reflect: true },
|
|
7
|
+
duration: { type: Number },
|
|
8
|
+
format: { type: String, reflect: true },
|
|
9
|
+
prefix: { type: String },
|
|
10
|
+
suffix: { type: String },
|
|
11
|
+
decimals: { type: Number },
|
|
12
|
+
locale: { type: String },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
static styles = [
|
|
16
|
+
tokenStyles,
|
|
17
|
+
css`
|
|
18
|
+
:host {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
font-family: var(--font-mono);
|
|
21
|
+
font-variant-numeric: tabular-nums;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.value {
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
}
|
|
27
|
+
`,
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.value = 0;
|
|
33
|
+
this.duration = 1000;
|
|
34
|
+
this.format = 'number';
|
|
35
|
+
this.prefix = '';
|
|
36
|
+
this.suffix = '';
|
|
37
|
+
this.decimals = 0;
|
|
38
|
+
this.locale = 'en-US';
|
|
39
|
+
|
|
40
|
+
/** @private */
|
|
41
|
+
this._displayValue = 0;
|
|
42
|
+
/** @private */
|
|
43
|
+
this._previousValue = 0;
|
|
44
|
+
/** @private */
|
|
45
|
+
this._rafId = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
super.disconnectedCallback();
|
|
50
|
+
if (this._rafId != null) {
|
|
51
|
+
cancelAnimationFrame(this._rafId);
|
|
52
|
+
this._rafId = null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
willUpdate(changed) {
|
|
57
|
+
if (changed.has('value')) {
|
|
58
|
+
const oldVal = changed.get('value');
|
|
59
|
+
this._previousValue = oldVal != null ? oldVal : 0;
|
|
60
|
+
this._animate(this._previousValue, this.value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Ease-out-expo: fast start, satisfying deceleration. */
|
|
65
|
+
_easeOutExpo(t) {
|
|
66
|
+
return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Check if the user prefers reduced motion. */
|
|
70
|
+
_prefersReducedMotion() {
|
|
71
|
+
return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Animate from `from` to `to`. */
|
|
75
|
+
_animate(from, to) {
|
|
76
|
+
if (this._rafId != null) {
|
|
77
|
+
cancelAnimationFrame(this._rafId);
|
|
78
|
+
this._rafId = null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Skip animation when motion is reduced or duration is zero
|
|
82
|
+
if (this._prefersReducedMotion() || this.duration <= 0) {
|
|
83
|
+
this._displayValue = to;
|
|
84
|
+
this.requestUpdate();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const start = performance.now();
|
|
89
|
+
const delta = to - from;
|
|
90
|
+
|
|
91
|
+
const step = (now) => {
|
|
92
|
+
const elapsed = now - start;
|
|
93
|
+
const progress = Math.min(elapsed / this.duration, 1);
|
|
94
|
+
const eased = this._easeOutExpo(progress);
|
|
95
|
+
|
|
96
|
+
this._displayValue = from + delta * eased;
|
|
97
|
+
this.requestUpdate();
|
|
98
|
+
|
|
99
|
+
if (progress < 1) {
|
|
100
|
+
this._rafId = requestAnimationFrame(step);
|
|
101
|
+
} else {
|
|
102
|
+
this._displayValue = to;
|
|
103
|
+
this._rafId = null;
|
|
104
|
+
this.requestUpdate();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
this._rafId = requestAnimationFrame(step);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Format the current display value using Intl.NumberFormat. */
|
|
112
|
+
_formatValue(num) {
|
|
113
|
+
const opts = {
|
|
114
|
+
minimumFractionDigits: this.decimals,
|
|
115
|
+
maximumFractionDigits: this.decimals,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
if (this.format === 'currency') {
|
|
119
|
+
// Use Intl currency formatting when no custom prefix is supplied
|
|
120
|
+
if (!this.prefix) {
|
|
121
|
+
opts.style = 'currency';
|
|
122
|
+
opts.currency = 'USD';
|
|
123
|
+
}
|
|
124
|
+
} else if (this.format === 'percent') {
|
|
125
|
+
// Intl percent expects 0.5 for 50%, but we treat value as 50 for 50%.
|
|
126
|
+
// So we format manually to keep the API intuitive.
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let formatted;
|
|
130
|
+
try {
|
|
131
|
+
formatted = new Intl.NumberFormat(this.locale, opts).format(num);
|
|
132
|
+
} catch {
|
|
133
|
+
formatted = num.toFixed(this.decimals);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Build the full string with prefix/suffix
|
|
137
|
+
const parts = [];
|
|
138
|
+
if (this.prefix) parts.push(this.prefix);
|
|
139
|
+
parts.push(formatted);
|
|
140
|
+
if (this.format === 'percent' && !this.suffix) {
|
|
141
|
+
parts.push('%');
|
|
142
|
+
} else if (this.suffix) {
|
|
143
|
+
parts.push(this.suffix);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return parts.join('');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
render() {
|
|
150
|
+
return html`
|
|
151
|
+
<span class="value"
|
|
152
|
+
part="value"
|
|
153
|
+
role="status"
|
|
154
|
+
aria-live="polite"
|
|
155
|
+
>${this._formatValue(this._displayValue)}</span>
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
customElements.define('arc-animated-number', ArcAnimatedNumber);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcAspectRatio extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
ratio: { type: String, reflect: true },
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
static styles = [
|
|
10
|
+
tokenStyles,
|
|
11
|
+
css`
|
|
12
|
+
:host { display: block; }
|
|
13
|
+
|
|
14
|
+
.aspect-ratio {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: 100%;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
border-radius: var(--radius-md);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.aspect-ratio__inner {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
::slotted(*) {
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
object-fit: cover;
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
`,
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
this.ratio = '16/9';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parse the ratio string ('W/H') into a CSS-safe aspect-ratio value.
|
|
42
|
+
* Falls back to 16/9 if the format is invalid.
|
|
43
|
+
*/
|
|
44
|
+
get _aspectRatio() {
|
|
45
|
+
const match = this.ratio?.match(/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/);
|
|
46
|
+
if (!match) return '16 / 9';
|
|
47
|
+
return `${match[1]} / ${match[2]}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Compute a padding-top percentage fallback for browsers
|
|
52
|
+
* that don't support the aspect-ratio CSS property.
|
|
53
|
+
*/
|
|
54
|
+
get _paddingFallback() {
|
|
55
|
+
const match = this.ratio?.match(/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/);
|
|
56
|
+
if (!match) return '56.25%';
|
|
57
|
+
const w = parseFloat(match[1]);
|
|
58
|
+
const h = parseFloat(match[2]);
|
|
59
|
+
if (w === 0) return '56.25%';
|
|
60
|
+
return `${(h / w) * 100}%`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
return html`
|
|
65
|
+
<div
|
|
66
|
+
class="aspect-ratio"
|
|
67
|
+
part="container"
|
|
68
|
+
style="aspect-ratio: ${this._aspectRatio};"
|
|
69
|
+
>
|
|
70
|
+
<div class="aspect-ratio__inner" part="inner">
|
|
71
|
+
<slot></slot>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
customElements.define('arc-aspect-ratio', ArcAspectRatio);
|