opui-css 4.1.0 → 5.0.1
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/CHANGELOG.md +282 -247
- package/LICENSE +21 -21
- package/MIGRATING.md +127 -105
- package/README.md +87 -87
- package/astro/index.ts +46 -46
- package/components/AGENTS.md +248 -247
- package/components/Accordion/Accordion.astro +42 -42
- package/components/Anchor/Anchor.astro +51 -51
- package/components/Avatar/Avatar.astro +38 -44
- package/components/Badge/Badge.astro +59 -54
- package/components/Button/Button.astro +45 -45
- package/components/ButtonGroup/ButtonGroup.astro +29 -29
- package/components/Callout/Callout.astro +75 -75
- package/components/Card/Card.astro +36 -36
- package/components/Checkbox/Checkbox.astro +76 -76
- package/components/Checkbox/CheckboxInput.astro +32 -32
- package/components/Chip/Chip.astro +37 -37
- package/components/ClassicSelect/ClassicSelect.astro +83 -83
- package/components/DescriptionList/Description.astro +12 -12
- package/components/DescriptionList/DescriptionList.astro +22 -22
- package/components/DescriptionList/Item.astro +12 -12
- package/components/DescriptionList/Term.astro +12 -12
- package/components/DescriptionList/index.ts +12 -12
- package/components/Dialog/Dialog.astro +41 -41
- package/components/Divider/Divider.astro +17 -14
- package/components/Drawer/Drawer.astro +49 -49
- package/components/Drawer/DrawerFooter.astro +14 -14
- package/components/Drawer/DrawerHeader.astro +31 -31
- package/components/FieldDescription/FieldDescription.astro +13 -13
- package/components/FieldGroup/FieldGroup.astro +31 -31
- package/components/FieldLegend/FieldLegend.astro +15 -15
- package/components/FieldSet/FieldSet.astro +15 -15
- package/components/Form/Form.astro +15 -15
- package/components/IconButton/IconButton.astro +26 -26
- package/components/List/List.astro +36 -36
- package/components/ListItem/ListItem.astro +118 -118
- package/components/Progress/Progress.astro +41 -40
- package/components/Radio/Radio.astro +70 -70
- package/components/Radio/RadioInput.astro +24 -24
- package/components/Range/Range.astro +136 -136
- package/components/Select/Select.astro +106 -106
- package/components/Switch/Switch.astro +101 -101
- package/components/Switch/SwitchInput.astro +25 -25
- package/components/Table/Body.astro +13 -13
- package/components/Table/Cell.astro +13 -13
- package/components/Table/Column.astro +15 -15
- package/components/Table/ColumnGroup.astro +13 -13
- package/components/Table/Head.astro +13 -13
- package/components/Table/HeaderCell.astro +13 -13
- package/components/Table/Row.astro +13 -13
- package/components/Table/Table.astro +18 -15
- package/components/Table/index.ts +20 -20
- package/components/Tabs/Tabs.astro +28 -28
- package/components/Tabs/TabsItem.astro +47 -47
- package/components/Tabs/TabsPanel.astro +21 -21
- package/components/Tabs/TabsTab.astro +19 -19
- package/components/Tabs/index.ts +14 -14
- package/components/TextField/TextField.astro +128 -128
- package/components/Textarea/Textarea.astro +106 -106
- package/components/Toast/Toast.astro +42 -42
- package/components/ToggleButton/ToggleButton.astro +53 -53
- package/components/ToggleGroup/ToggleGroup.astro +49 -49
- package/components/Tooltip/Tooltip.astro +30 -30
- package/core/normalize.css +194 -194
- package/core/palette.css +59 -59
- package/core/utils.css +71 -71
- package/css/components/accordion.css +174 -174
- package/css/components/anchor.css +27 -27
- package/css/components/avatar.css +65 -65
- package/css/components/badge.css +107 -107
- package/css/components/button-group.css +179 -179
- package/css/components/button.css +215 -215
- package/css/components/callout.css +109 -109
- package/css/components/card.css +117 -117
- package/css/components/checkbox.css +205 -205
- package/css/components/chip.css +87 -87
- package/css/components/description-list.css +80 -77
- package/css/components/dialog.css +68 -68
- package/css/components/divider.css +20 -20
- package/css/components/drawer.css +171 -171
- package/css/components/form.css +146 -146
- package/css/components/icon-button.css +139 -139
- package/css/components/link.css +21 -21
- package/css/components/list.css +345 -345
- package/css/components/progress.css +102 -97
- package/css/components/radio.css +172 -172
- package/css/components/range.css +337 -337
- package/css/components/select.css +169 -169
- package/css/components/spinner.css +37 -37
- package/css/components/switch.css +268 -268
- package/css/components/table.css +179 -179
- package/css/components/tabs.css +83 -77
- package/css/components/text-field.css +450 -450
- package/css/components/text-input.css +64 -64
- package/css/components/textarea.css +24 -24
- package/css/components/toast.css +161 -161
- package/css/components/toggle-button.css +87 -87
- package/css/components/toggle-group.css +56 -56
- package/css/components/tooltip.css +67 -67
- package/css/components/typography.css +585 -585
- package/css/components.css +41 -41
- package/css/imports.css +16 -16
- package/css/js/checkbox.js +21 -21
- package/css/js/toast.js +94 -94
- package/css/theme.css +132 -132
- package/dist/op.css +65 -65
- package/dist/op.css.map +1 -1
- package/dist/opui.components.css +5159 -5145
- package/dist/opui.components.css.map +1 -1
- package/dist/opui.css +5668 -5654
- package/dist/opui.css.map +1 -1
- package/env.d.ts +14 -14
- package/open-props.css +9 -9
- package/package.json +81 -81
package/css/components.css
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Components are divided into two categories - if they are stand-alone (root) or if they are built on top of others (extended).
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/*** Root components (no dependencies) */
|
|
6
|
-
@import "./components/button.css";
|
|
7
|
-
@import "./components/callout.css";
|
|
8
|
-
@import "./components/icon-button.css";
|
|
9
|
-
@import "./components/tabs.css";
|
|
10
|
-
@import "./components/toggle-group.css";
|
|
11
|
-
@import "./components/toggle-button.css";
|
|
12
|
-
@import "./components/anchor.css";
|
|
13
|
-
@import "./components/avatar.css";
|
|
14
|
-
@import "./components/card.css";
|
|
15
|
-
@import "./components/chip.css";
|
|
16
|
-
@import "./components/description-list.css";
|
|
17
|
-
@import "./components/divider.css";
|
|
18
|
-
@import "./components/link.css";
|
|
19
|
-
@import "./components/table.css";
|
|
20
|
-
@import "./components/progress.css";
|
|
21
|
-
@import "./components/spinner.css";
|
|
22
|
-
@import "./components/checkbox.css";
|
|
23
|
-
@import "./components/radio.css";
|
|
24
|
-
@import "./components/range.css";
|
|
25
|
-
@import "./components/switch.css";
|
|
26
|
-
@import "./components/toast.css";
|
|
27
|
-
@import "./components/typography.css";
|
|
28
|
-
|
|
29
|
-
/*** Extended components (has dependencies) */
|
|
30
|
-
@import "./components/badge.css";
|
|
31
|
-
@import "./components/button-group.css";
|
|
32
|
-
@import "./components/accordion.css";
|
|
33
|
-
@import "./components/list.css";
|
|
34
|
-
@import "./components/dialog.css";
|
|
35
|
-
@import "./components/drawer.css";
|
|
36
|
-
@import "./components/form.css";
|
|
37
|
-
@import "./components/text-field.css";
|
|
38
|
-
@import "./components/select.css";
|
|
39
|
-
@import "./components/text-input.css";
|
|
40
|
-
@import "./components/textarea.css";
|
|
41
|
-
@import "./components/tooltip.css";
|
|
1
|
+
/*
|
|
2
|
+
* Components are divided into two categories - if they are stand-alone (root) or if they are built on top of others (extended).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/*** Root components (no dependencies) */
|
|
6
|
+
@import "./components/button.css";
|
|
7
|
+
@import "./components/callout.css";
|
|
8
|
+
@import "./components/icon-button.css";
|
|
9
|
+
@import "./components/tabs.css";
|
|
10
|
+
@import "./components/toggle-group.css";
|
|
11
|
+
@import "./components/toggle-button.css";
|
|
12
|
+
@import "./components/anchor.css";
|
|
13
|
+
@import "./components/avatar.css";
|
|
14
|
+
@import "./components/card.css";
|
|
15
|
+
@import "./components/chip.css";
|
|
16
|
+
@import "./components/description-list.css";
|
|
17
|
+
@import "./components/divider.css";
|
|
18
|
+
@import "./components/link.css";
|
|
19
|
+
@import "./components/table.css";
|
|
20
|
+
@import "./components/progress.css";
|
|
21
|
+
@import "./components/spinner.css";
|
|
22
|
+
@import "./components/checkbox.css";
|
|
23
|
+
@import "./components/radio.css";
|
|
24
|
+
@import "./components/range.css";
|
|
25
|
+
@import "./components/switch.css";
|
|
26
|
+
@import "./components/toast.css";
|
|
27
|
+
@import "./components/typography.css";
|
|
28
|
+
|
|
29
|
+
/*** Extended components (has dependencies) */
|
|
30
|
+
@import "./components/badge.css";
|
|
31
|
+
@import "./components/button-group.css";
|
|
32
|
+
@import "./components/accordion.css";
|
|
33
|
+
@import "./components/list.css";
|
|
34
|
+
@import "./components/dialog.css";
|
|
35
|
+
@import "./components/drawer.css";
|
|
36
|
+
@import "./components/form.css";
|
|
37
|
+
@import "./components/text-field.css";
|
|
38
|
+
@import "./components/select.css";
|
|
39
|
+
@import "./components/text-input.css";
|
|
40
|
+
@import "./components/textarea.css";
|
|
41
|
+
@import "./components/tooltip.css";
|
package/css/imports.css
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
@layer openprops, normalize, theme, components.root, components.extended, utils;
|
|
2
|
-
|
|
3
|
-
/* Open Props */
|
|
4
|
-
@import "../open-props.css";
|
|
5
|
-
|
|
6
|
-
/* Normalize */
|
|
7
|
-
@import "../core/normalize.css";
|
|
8
|
-
|
|
9
|
-
/* Theme */
|
|
10
|
-
@import "./theme.css";
|
|
11
|
-
|
|
12
|
-
/* Components */
|
|
13
|
-
@import "./components.css";
|
|
14
|
-
|
|
15
|
-
/* Utils */
|
|
16
|
-
@import "../core/utils.css";
|
|
1
|
+
@layer openprops, normalize, theme, components.root, components.extended, utils;
|
|
2
|
+
|
|
3
|
+
/* Open Props */
|
|
4
|
+
@import "../open-props.css";
|
|
5
|
+
|
|
6
|
+
/* Normalize */
|
|
7
|
+
@import "../core/normalize.css";
|
|
8
|
+
|
|
9
|
+
/* Theme */
|
|
10
|
+
@import "./theme.css";
|
|
11
|
+
|
|
12
|
+
/* Components */
|
|
13
|
+
@import "./components.css";
|
|
14
|
+
|
|
15
|
+
/* Utils */
|
|
16
|
+
@import "../core/utils.css";
|
package/css/js/checkbox.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checkbox runtime helpers.
|
|
3
|
-
*
|
|
4
|
-
* `indeterminate` is a JavaScript-only property on HTMLInputElement — the
|
|
5
|
-
* attribute alone has no effect. We mark inputs with `data-indeterminate` at
|
|
6
|
-
* render time and apply the property here, both on initial load and after
|
|
7
|
-
* Astro's view transitions swap the DOM.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export function activateIndeterminate(root = document) {
|
|
11
|
-
root
|
|
12
|
-
.querySelectorAll('input[type="checkbox"][data-indeterminate]')
|
|
13
|
-
.forEach((el) => {
|
|
14
|
-
el.indeterminate = true
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function initCheckbox() {
|
|
19
|
-
activateIndeterminate()
|
|
20
|
-
document.addEventListener("astro:after-swap", () => activateIndeterminate())
|
|
21
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox runtime helpers.
|
|
3
|
+
*
|
|
4
|
+
* `indeterminate` is a JavaScript-only property on HTMLInputElement — the
|
|
5
|
+
* attribute alone has no effect. We mark inputs with `data-indeterminate` at
|
|
6
|
+
* render time and apply the property here, both on initial load and after
|
|
7
|
+
* Astro's view transitions swap the DOM.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export function activateIndeterminate(root = document) {
|
|
11
|
+
root
|
|
12
|
+
.querySelectorAll('input[type="checkbox"][data-indeterminate]')
|
|
13
|
+
.forEach((el) => {
|
|
14
|
+
el.indeterminate = true
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function initCheckbox() {
|
|
19
|
+
activateIndeterminate()
|
|
20
|
+
document.addEventListener("astro:after-swap", () => activateIndeterminate())
|
|
21
|
+
}
|
package/css/js/toast.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Toast manager.
|
|
3
|
-
*
|
|
4
|
-
* - HTML owns structure (via <template id="toast-template">).
|
|
5
|
-
* - CSS owns lifetime (via attr(data-duration type(<time>))).
|
|
6
|
-
* - JS owns lifecycle (clone template, fill slots, append, remove on animationend).
|
|
7
|
-
*
|
|
8
|
-
* No setTimeout. No popovertargetaction. No innerHTML of user data.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const FALLBACK_TEMPLATE = `<div class="toast" role="alert">
|
|
12
|
-
<span class="icon" data-toast-icon></span>
|
|
13
|
-
<div class="content">
|
|
14
|
-
<div class="title" data-toast-title></div>
|
|
15
|
-
<div class="description" data-toast-description></div>
|
|
16
|
-
</div>
|
|
17
|
-
<button class="close-button" data-toast-close type="button" aria-label="Close">
|
|
18
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
19
|
-
</button>
|
|
20
|
-
</div>`
|
|
21
|
-
|
|
22
|
-
export function initToastManager() {
|
|
23
|
-
const manager = document.getElementById("toast-manager")
|
|
24
|
-
if (!manager) return
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
manager.showPopover()
|
|
28
|
-
} catch {
|
|
29
|
-
/* already open or unsupported */
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
manager.addEventListener("command", (event) => {
|
|
33
|
-
if (event.command !== "--show-toast") return
|
|
34
|
-
const trigger = event.source
|
|
35
|
-
if (!trigger) return
|
|
36
|
-
|
|
37
|
-
const data = trigger.dataset || {}
|
|
38
|
-
showToast(
|
|
39
|
-
{
|
|
40
|
-
description: data.description,
|
|
41
|
-
duration: data.duration,
|
|
42
|
-
severity: data.severity,
|
|
43
|
-
template: data.template,
|
|
44
|
-
title: data.title || trigger.textContent?.trim() || "",
|
|
45
|
-
},
|
|
46
|
-
manager,
|
|
47
|
-
)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
window.showToast = (options) => showToast(options || {}, manager)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function showToast(options, manager) {
|
|
54
|
-
const node = buildToast(options.template || "toast-template")
|
|
55
|
-
if (!node) return
|
|
56
|
-
|
|
57
|
-
fillSlot(node, "[data-toast-title]", options.title)
|
|
58
|
-
fillSlot(node, "[data-toast-description]", options.description)
|
|
59
|
-
|
|
60
|
-
if (options.severity) node.dataset.severity = options.severity
|
|
61
|
-
if (options.duration) node.dataset.duration = options.duration
|
|
62
|
-
|
|
63
|
-
wireToast(node)
|
|
64
|
-
manager.appendChild(node)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function buildToast(templateId) {
|
|
68
|
-
const tpl = document.getElementById(templateId)
|
|
69
|
-
if (tpl?.content?.firstElementChild) {
|
|
70
|
-
return tpl.content.firstElementChild.cloneNode(true)
|
|
71
|
-
}
|
|
72
|
-
const wrap = document.createElement("div")
|
|
73
|
-
wrap.innerHTML = FALLBACK_TEMPLATE.trim()
|
|
74
|
-
return wrap.firstElementChild
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function fillSlot(root, selector, text) {
|
|
78
|
-
const el = root.querySelector(selector)
|
|
79
|
-
if (!el) return
|
|
80
|
-
if (text == null || text === "") {
|
|
81
|
-
el.remove()
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
el.textContent = text
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function wireToast(node) {
|
|
88
|
-
node.querySelector("[data-toast-close]")?.addEventListener("click", () => {
|
|
89
|
-
node.classList.add("exiting")
|
|
90
|
-
})
|
|
91
|
-
node.addEventListener("animationend", (event) => {
|
|
92
|
-
if (event.animationName === "toast-exit") node.remove()
|
|
93
|
-
})
|
|
94
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Toast manager.
|
|
3
|
+
*
|
|
4
|
+
* - HTML owns structure (via <template id="toast-template">).
|
|
5
|
+
* - CSS owns lifetime (via attr(data-duration type(<time>))).
|
|
6
|
+
* - JS owns lifecycle (clone template, fill slots, append, remove on animationend).
|
|
7
|
+
*
|
|
8
|
+
* No setTimeout. No popovertargetaction. No innerHTML of user data.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const FALLBACK_TEMPLATE = `<div class="ui-toast" role="alert">
|
|
12
|
+
<span class="ui-icon" data-toast-icon></span>
|
|
13
|
+
<div class="ui-content">
|
|
14
|
+
<div class="ui-title" data-toast-title></div>
|
|
15
|
+
<div class="ui-description" data-toast-description></div>
|
|
16
|
+
</div>
|
|
17
|
+
<button class="ui-close-button" data-toast-close type="button" aria-label="Close">
|
|
18
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
19
|
+
</button>
|
|
20
|
+
</div>`
|
|
21
|
+
|
|
22
|
+
export function initToastManager() {
|
|
23
|
+
const manager = document.getElementById("toast-manager")
|
|
24
|
+
if (!manager) return
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
manager.showPopover()
|
|
28
|
+
} catch {
|
|
29
|
+
/* already open or unsupported */
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
manager.addEventListener("command", (event) => {
|
|
33
|
+
if (event.command !== "--show-toast") return
|
|
34
|
+
const trigger = event.source
|
|
35
|
+
if (!trigger) return
|
|
36
|
+
|
|
37
|
+
const data = trigger.dataset || {}
|
|
38
|
+
showToast(
|
|
39
|
+
{
|
|
40
|
+
description: data.description,
|
|
41
|
+
duration: data.duration,
|
|
42
|
+
severity: data.severity,
|
|
43
|
+
template: data.template,
|
|
44
|
+
title: data.title || trigger.textContent?.trim() || "",
|
|
45
|
+
},
|
|
46
|
+
manager,
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
window.showToast = (options) => showToast(options || {}, manager)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function showToast(options, manager) {
|
|
54
|
+
const node = buildToast(options.template || "toast-template")
|
|
55
|
+
if (!node) return
|
|
56
|
+
|
|
57
|
+
fillSlot(node, "[data-toast-title]", options.title)
|
|
58
|
+
fillSlot(node, "[data-toast-description]", options.description)
|
|
59
|
+
|
|
60
|
+
if (options.severity) node.dataset.severity = options.severity
|
|
61
|
+
if (options.duration) node.dataset.duration = options.duration
|
|
62
|
+
|
|
63
|
+
wireToast(node)
|
|
64
|
+
manager.appendChild(node)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function buildToast(templateId) {
|
|
68
|
+
const tpl = document.getElementById(templateId)
|
|
69
|
+
if (tpl?.content?.firstElementChild) {
|
|
70
|
+
return tpl.content.firstElementChild.cloneNode(true)
|
|
71
|
+
}
|
|
72
|
+
const wrap = document.createElement("div")
|
|
73
|
+
wrap.innerHTML = FALLBACK_TEMPLATE.trim()
|
|
74
|
+
return wrap.firstElementChild
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function fillSlot(root, selector, text) {
|
|
78
|
+
const el = root.querySelector(selector)
|
|
79
|
+
if (!el) return
|
|
80
|
+
if (text == null || text === "") {
|
|
81
|
+
el.remove()
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
el.textContent = text
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function wireToast(node) {
|
|
88
|
+
node.querySelector("[data-toast-close]")?.addEventListener("click", () => {
|
|
89
|
+
node.classList.add("ui-exiting")
|
|
90
|
+
})
|
|
91
|
+
node.addEventListener("animationend", (event) => {
|
|
92
|
+
if (event.animationName === "toast-exit") node.remove()
|
|
93
|
+
})
|
|
94
|
+
}
|
package/css/theme.css
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
/*
|
|
2
|
-
theme three theme setup
|
|
3
|
-
*/
|
|
4
|
-
@layer theme {
|
|
5
|
-
|
|
6
|
-
/* 1. Color scheme */
|
|
7
|
-
.light {
|
|
8
|
-
--color-scheme: light;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dark {
|
|
12
|
-
--color-scheme: dark;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:where(html) {
|
|
16
|
-
color-scheme: var(--color-scheme, light dark);
|
|
17
|
-
|
|
18
|
-
/* 2. Palette source - one value to rule them all. Every other color is derived from this one.
|
|
19
|
-
Both light/dark branches are wired up via light-dark() so prefers-color-scheme works
|
|
20
|
-
automatically. Set them to different OKLCH values if you want a distinct dark-mode palette. */
|
|
21
|
-
--palette-source: light-dark(oklch(0.58 calc(0.21 * 0.5) var(--hue-blue)),
|
|
22
|
-
oklch(0.58 calc(0.21 * 0.5) var(--hue-blue)));
|
|
23
|
-
--palette-hue-rotate-by: 0;
|
|
24
|
-
|
|
25
|
-
/* Gray ramp lives in core/palette.css. Override --gray-chroma or
|
|
26
|
-
--gray-hue here if this theme wants warmer/cooler grays. */
|
|
27
|
-
|
|
28
|
-
/* 3. Named colors (no severity meaning) — use when you literally want a green/red/etc. dot */
|
|
29
|
-
--blue: oklch(from var(--color-9) l 0.2 210);
|
|
30
|
-
--green: oklch(from var(--color-9) l 0.2 145);
|
|
31
|
-
--orange: oklch(from var(--color-7) l 0.2 75);
|
|
32
|
-
--red: oklch(from var(--color-9) l 0.2 25);
|
|
33
|
-
|
|
34
|
-
/* 4. Intent tokens
|
|
35
|
-
Severity (have scope classes below): --success, --info, --warning, --critical
|
|
36
|
-
Non-severity (value-only): --primary, --neutral */
|
|
37
|
-
--success: var(--green);
|
|
38
|
-
--info: var(--blue);
|
|
39
|
-
--warning: var(--orange);
|
|
40
|
-
--critical: var(--red);
|
|
41
|
-
--neutral: var(--gray-9);
|
|
42
|
-
|
|
43
|
-
/* 5. Primary */
|
|
44
|
-
--primary: var(--color-8);
|
|
45
|
-
--primary-light: oklch(from var(--primary) calc(l * 1.25) c h);
|
|
46
|
-
--primary-dark: oklch(from var(--primary) calc(l * 0.75) c h);
|
|
47
|
-
--primary-contrast: var(--gray-1);
|
|
48
|
-
|
|
49
|
-
/* 6. Text */
|
|
50
|
-
--text-primary: light-dark(var(--gray-15), var(--gray-1));
|
|
51
|
-
--text-primary-contrast: light-dark(var(--gray-2), var(--gray-15));
|
|
52
|
-
--text-muted: light-dark(var(--gray-13), var(--gray-4));
|
|
53
|
-
--text-muted-contrast: light-dark(var(--gray-4), var(--gray-13));
|
|
54
|
-
|
|
55
|
-
/* 7. Surfaces */
|
|
56
|
-
--surface-default: light-dark(var(--gray-1), var(--gray-13));
|
|
57
|
-
--surface-filled: light-dark(var(--gray-4), var(--gray-15));
|
|
58
|
-
--surface-tonal: light-dark(var(--gray-3), var(--gray-12));
|
|
59
|
-
--surface-elevated: light-dark(var(--gray-1), var(--gray-12));
|
|
60
|
-
|
|
61
|
-
/* 8. Borders */
|
|
62
|
-
--border-color: light-dark(var(--gray-4), var(--gray-12));
|
|
63
|
-
--border-radius: var(--size-2);
|
|
64
|
-
--border-width: 1px;
|
|
65
|
-
|
|
66
|
-
/* 9. Focus ring — components consume these and may override locally
|
|
67
|
-
(e.g. .button.filled { --focus-ring-offset: 3px; }, .checkbox { --focus-ring-offset: 0; }) */
|
|
68
|
-
--focus-ring-color: var(--primary);
|
|
69
|
-
--focus-ring-width: 2px;
|
|
70
|
-
--focus-ring-offset: 2px;
|
|
71
|
-
--focus-ring-style: solid;
|
|
72
|
-
|
|
73
|
-
/* 10. Typography */
|
|
74
|
-
--font-size-h1: var(--font-size-fluid-3);
|
|
75
|
-
--font-size-h2: var(--font-size-fluid-2);
|
|
76
|
-
--font-size-h3: var(--font-size-fluid-1);
|
|
77
|
-
--font-size-h4: var(--font-size-3);
|
|
78
|
-
--font-size-h5: var(--font-size-2);
|
|
79
|
-
--font-size-h6: var(--font-size-fluid-0);
|
|
80
|
-
|
|
81
|
-
/* Sneaking in an extra font size I want but Open Props doesn't provide. You can do whatever you want with your own theme. It's just CSS. */
|
|
82
|
-
--font-size-05: 0.875rem;
|
|
83
|
-
|
|
84
|
-
/* 11. Control sizes — shared scale for fields and buttons so they line up
|
|
85
|
-
visually. --field-size-* and --button-size-* alias from --control-size-*. */
|
|
86
|
-
--control-size-x-small: 28px;
|
|
87
|
-
--control-size-small: 32px;
|
|
88
|
-
--control-size: 40px;
|
|
89
|
-
--control-size-large: 46px;
|
|
90
|
-
|
|
91
|
-
--field-size-x-small: var(--control-size-x-small);
|
|
92
|
-
--field-size-small: var(--control-size-small);
|
|
93
|
-
--field-size: var(--control-size);
|
|
94
|
-
--field-size-large: var(--control-size-large);
|
|
95
|
-
|
|
96
|
-
--button-size-x-small: var(--control-size-x-small);
|
|
97
|
-
--button-size-small: var(--control-size-small);
|
|
98
|
-
--button-size: var(--control-size);
|
|
99
|
-
--button-size-large: var(--control-size-large);
|
|
100
|
-
|
|
101
|
-
/* 12. Field / input */
|
|
102
|
-
--field-border-color: var(--border-color);
|
|
103
|
-
--field-border-radius: var(--size-2);
|
|
104
|
-
--field-border-width: 1px;
|
|
105
|
-
|
|
106
|
-
/* 13. Button */
|
|
107
|
-
--button-border-radius: var(--size-2);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* 14. Severity scope classes — re-source the palette inside these contexts.
|
|
111
|
-
Authoring `<div class="warning">` paints the entire subtree warning-orange.
|
|
112
|
-
Non-severity tokens (--primary, --neutral) deliberately have no scope class. */
|
|
113
|
-
:where(.critical, [data-invalid], del) {
|
|
114
|
-
--palette-source: oklch(0.58 0.21 var(--hue-red));
|
|
115
|
-
--palette-hue-rotate-by: 1;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
:where(.info, abbr, dfn) {
|
|
119
|
-
--palette-source: oklch(0.58 0.21 var(--hue-blue));
|
|
120
|
-
--palette-hue-rotate-by: 1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
:where(.success, ins) {
|
|
124
|
-
--palette-source: oklch(0.58 0.21 var(--hue-green));
|
|
125
|
-
--palette-hue-rotate-by: 1;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
:where(.warning) {
|
|
129
|
-
--palette-source: oklch(0.58 0.21 var(--hue-orange));
|
|
130
|
-
--palette-hue-rotate-by: 1;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
theme three theme setup
|
|
3
|
+
*/
|
|
4
|
+
@layer theme {
|
|
5
|
+
|
|
6
|
+
/* 1. Color scheme */
|
|
7
|
+
.ui-light {
|
|
8
|
+
--color-scheme: light;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ui-dark {
|
|
12
|
+
--color-scheme: dark;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:where(html) {
|
|
16
|
+
color-scheme: var(--color-scheme, light dark);
|
|
17
|
+
|
|
18
|
+
/* 2. Palette source - one value to rule them all. Every other color is derived from this one.
|
|
19
|
+
Both light/dark branches are wired up via light-dark() so prefers-color-scheme works
|
|
20
|
+
automatically. Set them to different OKLCH values if you want a distinct dark-mode palette. */
|
|
21
|
+
--palette-source: light-dark(oklch(0.58 calc(0.21 * 0.5) var(--hue-blue)),
|
|
22
|
+
oklch(0.58 calc(0.21 * 0.5) var(--hue-blue)));
|
|
23
|
+
--palette-hue-rotate-by: 0;
|
|
24
|
+
|
|
25
|
+
/* Gray ramp lives in core/palette.css. Override --gray-chroma or
|
|
26
|
+
--gray-hue here if this theme wants warmer/cooler grays. */
|
|
27
|
+
|
|
28
|
+
/* 3. Named colors (no severity meaning) — use when you literally want a green/red/etc. dot */
|
|
29
|
+
--blue: oklch(from var(--color-9) l 0.2 210);
|
|
30
|
+
--green: oklch(from var(--color-9) l 0.2 145);
|
|
31
|
+
--orange: oklch(from var(--color-7) l 0.2 75);
|
|
32
|
+
--red: oklch(from var(--color-9) l 0.2 25);
|
|
33
|
+
|
|
34
|
+
/* 4. Intent tokens
|
|
35
|
+
Severity (have scope classes below): --success, --info, --warning, --critical
|
|
36
|
+
Non-severity (value-only): --primary, --neutral */
|
|
37
|
+
--success: var(--green);
|
|
38
|
+
--info: var(--blue);
|
|
39
|
+
--warning: var(--orange);
|
|
40
|
+
--critical: var(--red);
|
|
41
|
+
--neutral: var(--gray-9);
|
|
42
|
+
|
|
43
|
+
/* 5. Primary */
|
|
44
|
+
--primary: var(--color-8);
|
|
45
|
+
--primary-light: oklch(from var(--primary) calc(l * 1.25) c h);
|
|
46
|
+
--primary-dark: oklch(from var(--primary) calc(l * 0.75) c h);
|
|
47
|
+
--primary-contrast: var(--gray-1);
|
|
48
|
+
|
|
49
|
+
/* 6. Text */
|
|
50
|
+
--text-primary: light-dark(var(--gray-15), var(--gray-1));
|
|
51
|
+
--text-primary-contrast: light-dark(var(--gray-2), var(--gray-15));
|
|
52
|
+
--text-muted: light-dark(var(--gray-13), var(--gray-4));
|
|
53
|
+
--text-muted-contrast: light-dark(var(--gray-4), var(--gray-13));
|
|
54
|
+
|
|
55
|
+
/* 7. Surfaces */
|
|
56
|
+
--surface-default: light-dark(var(--gray-1), var(--gray-13));
|
|
57
|
+
--surface-filled: light-dark(var(--gray-4), var(--gray-15));
|
|
58
|
+
--surface-tonal: light-dark(var(--gray-3), var(--gray-12));
|
|
59
|
+
--surface-elevated: light-dark(var(--gray-1), var(--gray-12));
|
|
60
|
+
|
|
61
|
+
/* 8. Borders */
|
|
62
|
+
--border-color: light-dark(var(--gray-4), var(--gray-12));
|
|
63
|
+
--border-radius: var(--size-2);
|
|
64
|
+
--border-width: 1px;
|
|
65
|
+
|
|
66
|
+
/* 9. Focus ring — components consume these and may override locally
|
|
67
|
+
(e.g. .ui-button.ui-filled { --focus-ring-offset: 3px; }, .ui-checkbox { --focus-ring-offset: 0; }) */
|
|
68
|
+
--focus-ring-color: var(--primary);
|
|
69
|
+
--focus-ring-width: 2px;
|
|
70
|
+
--focus-ring-offset: 2px;
|
|
71
|
+
--focus-ring-style: solid;
|
|
72
|
+
|
|
73
|
+
/* 10. Typography */
|
|
74
|
+
--font-size-h1: var(--font-size-fluid-3);
|
|
75
|
+
--font-size-h2: var(--font-size-fluid-2);
|
|
76
|
+
--font-size-h3: var(--font-size-fluid-1);
|
|
77
|
+
--font-size-h4: var(--font-size-3);
|
|
78
|
+
--font-size-h5: var(--font-size-2);
|
|
79
|
+
--font-size-h6: var(--font-size-fluid-0);
|
|
80
|
+
|
|
81
|
+
/* Sneaking in an extra font size I want but Open Props doesn't provide. You can do whatever you want with your own theme. It's just CSS. */
|
|
82
|
+
--font-size-05: 0.875rem;
|
|
83
|
+
|
|
84
|
+
/* 11. Control sizes — shared scale for fields and buttons so they line up
|
|
85
|
+
visually. --field-size-* and --button-size-* alias from --control-size-*. */
|
|
86
|
+
--control-size-x-small: 28px;
|
|
87
|
+
--control-size-small: 32px;
|
|
88
|
+
--control-size: 40px;
|
|
89
|
+
--control-size-large: 46px;
|
|
90
|
+
|
|
91
|
+
--field-size-x-small: var(--control-size-x-small);
|
|
92
|
+
--field-size-small: var(--control-size-small);
|
|
93
|
+
--field-size: var(--control-size);
|
|
94
|
+
--field-size-large: var(--control-size-large);
|
|
95
|
+
|
|
96
|
+
--button-size-x-small: var(--control-size-x-small);
|
|
97
|
+
--button-size-small: var(--control-size-small);
|
|
98
|
+
--button-size: var(--control-size);
|
|
99
|
+
--button-size-large: var(--control-size-large);
|
|
100
|
+
|
|
101
|
+
/* 12. Field / input */
|
|
102
|
+
--field-border-color: var(--border-color);
|
|
103
|
+
--field-border-radius: var(--size-2);
|
|
104
|
+
--field-border-width: 1px;
|
|
105
|
+
|
|
106
|
+
/* 13. Button */
|
|
107
|
+
--button-border-radius: var(--size-2);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* 14. Severity scope classes — re-source the palette inside these contexts.
|
|
111
|
+
Authoring `<div class="ui-warning">` paints the entire subtree warning-orange.
|
|
112
|
+
Non-severity tokens (--primary, --neutral) deliberately have no scope class. */
|
|
113
|
+
:where(.ui-critical, [data-invalid], del) {
|
|
114
|
+
--palette-source: oklch(0.58 0.21 var(--hue-red));
|
|
115
|
+
--palette-hue-rotate-by: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:where(.ui-info, abbr, dfn) {
|
|
119
|
+
--palette-source: oklch(0.58 0.21 var(--hue-blue));
|
|
120
|
+
--palette-hue-rotate-by: 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:where(.ui-success, ins) {
|
|
124
|
+
--palette-source: oklch(0.58 0.21 var(--hue-green));
|
|
125
|
+
--palette-hue-rotate-by: 1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:where(.ui-warning) {
|
|
129
|
+
--palette-source: oklch(0.58 0.21 var(--hue-orange));
|
|
130
|
+
--palette-hue-rotate-by: 1;
|
|
131
|
+
}
|
|
132
|
+
}
|