@zazz-ui/core 0.1.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/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/sri.json +75 -0
- package/dist/zazz.css +1 -0
- package/dist/zazz.js +1 -0
- package/examples/about.html +590 -0
- package/examples/components.html +1040 -0
- package/examples/forms.html +511 -0
- package/examples/index.html +268 -0
- package/examples/layout.html +320 -0
- package/examples/products.html +846 -0
- package/examples/responsive.html +339 -0
- package/package.json +85 -0
- package/src/base/_layers.css +12 -0
- package/src/base/_layout.css +568 -0
- package/src/base/_reset.css +515 -0
- package/src/base/_typography.css +495 -0
- package/src/base/_utilities.css +6628 -0
- package/src/base/_variables.css +682 -0
- package/src/base/_view-transitions.css +103 -0
- package/src/base/command-score.d.ts +12 -0
- package/src/base/command-score.d.ts.map +1 -0
- package/src/base/command-score.js +151 -0
- package/src/base/command-score.ts +192 -0
- package/src/base/dialog-lifecycle.d.ts +11 -0
- package/src/base/dialog-lifecycle.d.ts.map +1 -0
- package/src/base/dialog-lifecycle.js +65 -0
- package/src/base/dialog-lifecycle.ts +80 -0
- package/src/base/embla.d.ts +90 -0
- package/src/base/embla.d.ts.map +1 -0
- package/src/base/embla.js +643 -0
- package/src/base/embla.ts +791 -0
- package/src/base/hotkeys.d.ts +82 -0
- package/src/base/hotkeys.d.ts.map +1 -0
- package/src/base/hotkeys.js +141 -0
- package/src/base/hotkeys.ts +195 -0
- package/src/base/navigation.d.ts +2 -0
- package/src/base/navigation.d.ts.map +1 -0
- package/src/base/navigation.js +136 -0
- package/src/base/navigation.ts +151 -0
- package/src/base/reveal.d.ts +80 -0
- package/src/base/reveal.d.ts.map +1 -0
- package/src/base/reveal.js +305 -0
- package/src/base/reveal.ts +379 -0
- package/src/base/signals.d.ts +89 -0
- package/src/base/signals.d.ts.map +1 -0
- package/src/base/signals.js +134 -0
- package/src/base/signals.ts +164 -0
- package/src/base/typeahead.d.ts +105 -0
- package/src/base/typeahead.d.ts.map +1 -0
- package/src/base/typeahead.js +411 -0
- package/src/base/typeahead.ts +500 -0
- package/src/base/utils.d.ts +56 -0
- package/src/base/utils.d.ts.map +1 -0
- package/src/base/utils.js +88 -0
- package/src/base/utils.ts +98 -0
- package/src/base/zazz-element.d.ts +44 -0
- package/src/base/zazz-element.d.ts.map +1 -0
- package/src/base/zazz-element.js +59 -0
- package/src/base/zazz-element.ts +73 -0
- package/src/globals.d.ts +148 -0
- package/src/head.d.ts +95 -0
- package/src/head.d.ts.map +1 -0
- package/src/head.js +311 -0
- package/src/head.ts +433 -0
- package/src/index.css +71 -0
- package/src/index.d.ts +36 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +35 -0
- package/src/index.ts +36 -0
- package/src/manifest.d.ts +90 -0
- package/src/manifest.d.ts.map +1 -0
- package/src/manifest.js +614 -0
- package/src/manifest.ts +667 -0
- package/src/primitives/accordion/accordion.css +104 -0
- package/src/primitives/accordion/accordion.html +69 -0
- package/src/primitives/alert-dialog/alert-dialog.css +38 -0
- package/src/primitives/alert-dialog/alert-dialog.html +53 -0
- package/src/primitives/autocomplete/autocomplete-groups.html +77 -0
- package/src/primitives/autocomplete/autocomplete.css +114 -0
- package/src/primitives/autocomplete/autocomplete.d.ts +30 -0
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -0
- package/src/primitives/autocomplete/autocomplete.html +66 -0
- package/src/primitives/autocomplete/autocomplete.js +41 -0
- package/src/primitives/autocomplete/autocomplete.ts +46 -0
- package/src/primitives/avatar/avatar.html +44 -0
- package/src/primitives/badge/badge-icon.html +36 -0
- package/src/primitives/badge/badge.css +251 -0
- package/src/primitives/badge/badge.html +7 -0
- package/src/primitives/breadcrumbs/breadcrumbs.html +9 -0
- package/src/primitives/button/button-icon-only.html +84 -0
- package/src/primitives/button/button-icon.html +82 -0
- package/src/primitives/button/button.css +319 -0
- package/src/primitives/button/button.html +8 -0
- package/src/primitives/button-group/button-group-vertical.html +6 -0
- package/src/primitives/button-group/button-group.css +94 -0
- package/src/primitives/button-group/button-group.html +64 -0
- package/src/primitives/card/card-subgrid.html +118 -0
- package/src/primitives/card/card.html +53 -0
- package/src/primitives/carousel/carousel.css +61 -0
- package/src/primitives/carousel/carousel.d.ts +16 -0
- package/src/primitives/carousel/carousel.d.ts.map +1 -0
- package/src/primitives/carousel/carousel.html +315 -0
- package/src/primitives/carousel/carousel.js +73 -0
- package/src/primitives/carousel/carousel.ts +84 -0
- package/src/primitives/checkbox/checkbox-tasklist.html +71 -0
- package/src/primitives/checkbox/checkbox.css +82 -0
- package/src/primitives/checkbox/checkbox.d.ts +21 -0
- package/src/primitives/checkbox/checkbox.d.ts.map +1 -0
- package/src/primitives/checkbox/checkbox.html +17 -0
- package/src/primitives/checkbox/checkbox.js +190 -0
- package/src/primitives/checkbox/checkbox.ts +219 -0
- package/src/primitives/combobox/combobox-multiselect.html +91 -0
- package/src/primitives/combobox/combobox.css +307 -0
- package/src/primitives/combobox/combobox.d.ts +100 -0
- package/src/primitives/combobox/combobox.d.ts.map +1 -0
- package/src/primitives/combobox/combobox.html +73 -0
- package/src/primitives/combobox/combobox.js +503 -0
- package/src/primitives/combobox/combobox.ts +559 -0
- package/src/primitives/command/command-actions.d.ts +31 -0
- package/src/primitives/command/command-actions.d.ts.map +1 -0
- package/src/primitives/command/command-actions.html +89 -0
- package/src/primitives/command/command-actions.js +70 -0
- package/src/primitives/command/command-actions.ts +77 -0
- package/src/primitives/command/command-dialog.html +77 -0
- package/src/primitives/command/command.css +151 -0
- package/src/primitives/command/command.d.ts +52 -0
- package/src/primitives/command/command.d.ts.map +1 -0
- package/src/primitives/command/command.html +119 -0
- package/src/primitives/command/command.js +146 -0
- package/src/primitives/command/command.ts +157 -0
- package/src/primitives/dialog/dialog-with-form.html +200 -0
- package/src/primitives/dialog/dialog.css +229 -0
- package/src/primitives/dialog/dialog.html +90 -0
- package/src/primitives/fields/fields.css +278 -0
- package/src/primitives/input/input-icon-leading.html +19 -0
- package/src/primitives/input/input-icon-trailing.html +18 -0
- package/src/primitives/input/input.css +114 -0
- package/src/primitives/input/input.html +61 -0
- package/src/primitives/input-group/input-group-password-group.html +108 -0
- package/src/primitives/input-group/input-group.css +215 -0
- package/src/primitives/input-group/input-group.html +132 -0
- package/src/primitives/kbd/kbd-group.html +18 -0
- package/src/primitives/kbd/kbd.css +87 -0
- package/src/primitives/kbd/kbd.html +7 -0
- package/src/primitives/lightbox/lightbox.css +459 -0
- package/src/primitives/lightbox/lightbox.d.ts +7 -0
- package/src/primitives/lightbox/lightbox.d.ts.map +1 -0
- package/src/primitives/lightbox/lightbox.html +665 -0
- package/src/primitives/lightbox/lightbox.js +96 -0
- package/src/primitives/lightbox/lightbox.ts +113 -0
- package/src/primitives/menu/menu-interest.html +52 -0
- package/src/primitives/menu/menu.css +55 -0
- package/src/primitives/menu/menu.d.ts +38 -0
- package/src/primitives/menu/menu.d.ts.map +1 -0
- package/src/primitives/menu/menu.html +70 -0
- package/src/primitives/menu/menu.js +117 -0
- package/src/primitives/menu/menu.ts +131 -0
- package/src/primitives/menubar/menubar-help-search.html +103 -0
- package/src/primitives/menubar/menubar.html +166 -0
- package/src/primitives/meter/meter.css +178 -0
- package/src/primitives/meter/meter.html +38 -0
- package/src/primitives/mobile-menu/mobile-menu.css +145 -0
- package/src/primitives/mobile-menu/mobile-menu.html +614 -0
- package/src/primitives/navigation-menu/navigation-menu-featured.html +76 -0
- package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +158 -0
- package/src/primitives/navigation-menu/navigation-menu-interest.html +103 -0
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +141 -0
- package/src/primitives/navigation-menu/navigation-menu-simple.html +96 -0
- package/src/primitives/navigation-menu/navigation-menu.css +295 -0
- package/src/primitives/navigation-menu/navigation-menu.html +576 -0
- package/src/primitives/otp/otp.css +126 -0
- package/src/primitives/otp/otp.d.ts +89 -0
- package/src/primitives/otp/otp.d.ts.map +1 -0
- package/src/primitives/otp/otp.html +22 -0
- package/src/primitives/otp/otp.js +226 -0
- package/src/primitives/otp/otp.ts +279 -0
- package/src/primitives/password-group/password-group.css +238 -0
- package/src/primitives/password-group/password-group.d.ts +25 -0
- package/src/primitives/password-group/password-group.d.ts.map +1 -0
- package/src/primitives/password-group/password-group.html +109 -0
- package/src/primitives/password-group/password-group.js +76 -0
- package/src/primitives/password-group/password-group.ts +95 -0
- package/src/primitives/popover/popover.css +233 -0
- package/src/primitives/progress/progress-indeterminate.html +1 -0
- package/src/primitives/progress/progress.css +105 -0
- package/src/primitives/progress/progress.html +7 -0
- package/src/primitives/prose/prose.html +65 -0
- package/src/primitives/radio/radio.css +84 -0
- package/src/primitives/radio/radio.html +17 -0
- package/src/primitives/reveal/reveal.css +167 -0
- package/src/primitives/select/multiselect.d.ts +43 -0
- package/src/primitives/select/multiselect.d.ts.map +1 -0
- package/src/primitives/select/multiselect.js +147 -0
- package/src/primitives/select/multiselect.ts +188 -0
- package/src/primitives/select/select-align.html +49 -0
- package/src/primitives/select/select-multiple.html +12 -0
- package/src/primitives/select/select-sides.html +65 -0
- package/src/primitives/select/select.css +481 -0
- package/src/primitives/select/select.html +16 -0
- package/src/primitives/separator/separator.css +49 -0
- package/src/primitives/separator/separator.html +16 -0
- package/src/primitives/slider/slider.css +122 -0
- package/src/primitives/slider/slider.html +1 -0
- package/src/primitives/switch/switch.css +126 -0
- package/src/primitives/switch/switch.html +13 -0
- package/src/primitives/table/table-alternating.html +36 -0
- package/src/primitives/table/table-grid.html +30 -0
- package/src/primitives/table/table-size-sm.html +26 -0
- package/src/primitives/table/table.css +158 -0
- package/src/primitives/table/table.html +45 -0
- package/src/primitives/tabs/tabs.css +328 -0
- package/src/primitives/tabs/tabs.d.ts +35 -0
- package/src/primitives/tabs/tabs.d.ts.map +1 -0
- package/src/primitives/tabs/tabs.html +75 -0
- package/src/primitives/tabs/tabs.js +84 -0
- package/src/primitives/tabs/tabs.ts +93 -0
- package/src/primitives/textarea/textarea.css +78 -0
- package/src/primitives/textarea/textarea.html +10 -0
- package/src/primitives/toaster/toaster.css +309 -0
- package/src/primitives/toaster/toaster.d.ts +138 -0
- package/src/primitives/toaster/toaster.d.ts.map +1 -0
- package/src/primitives/toaster/toaster.html +77 -0
- package/src/primitives/toaster/toaster.js +736 -0
- package/src/primitives/toaster/toaster.ts +823 -0
- package/src/primitives/toggle/toggle.css +295 -0
- package/src/primitives/toggle/toggle.html +68 -0
- package/src/primitives/toggle-group/toggle-group-multiple.html +14 -0
- package/src/primitives/toggle-group/toggle-group-vertical.html +14 -0
- package/src/primitives/toggle-group/toggle-group.css +73 -0
- package/src/primitives/toggle-group/toggle-group.html +53 -0
- package/src/primitives/toolbar/toolbar.html +45 -0
- package/src/primitives/tooltip/tooltip-disabled.html +19 -0
- package/src/primitives/tooltip/tooltip-sides.html +57 -0
- package/src/primitives/tooltip/tooltip-with-kbd.html +31 -0
- package/src/primitives/tooltip/tooltip.css +235 -0
- package/src/primitives/tooltip/tooltip.html +12 -0
- package/src/primitives/utilities/aspect-ratio.html +17 -0
- package/src/primitives/utilities/basis.html +27 -0
- package/src/primitives/utilities/col-span.html +23 -0
- package/src/primitives/utilities/compose.html +19 -0
- package/src/primitives/utilities/flex-align.html +26 -0
- package/src/primitives/utilities/flex-direction.html +36 -0
- package/src/primitives/utilities/flex-grow.html +17 -0
- package/src/primitives/utilities/gap.html +62 -0
- package/src/primitives/utilities/grid-cols.html +20 -0
- package/src/primitives/utilities/grid-pile.html +5 -0
- package/src/primitives/utilities/grid-responsive.html +31 -0
- package/src/primitives/utilities/margin-auto.html +13 -0
- package/src/primitives/utilities/object-fit.html +41 -0
- package/src/primitives/utilities/order.html +17 -0
- package/src/primitives/utilities/overflow.html +26 -0
- package/src/primitives/utilities/padding-compose.html +23 -0
- package/src/primitives/utilities/padding.html +30 -0
- package/src/primitives/utilities/position.html +13 -0
- package/src/primitives/utilities/responsive-flex.html +22 -0
- package/src/primitives/utilities/responsive-grid.html +31 -0
- package/src/primitives/utilities/size.html +22 -0
- package/src/primitives/utilities/width.html +22 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview `<ui-password>`: HTML web component for password visibility.
|
|
4
|
+
* @description Light-DOM custom element that adds show/hide behavior to a
|
|
5
|
+
* standard password field. Wrap the existing `.password-group` markup: the
|
|
6
|
+
* element finds the input and the `[data-slot~="password-group-toggle"]` button, flips the
|
|
7
|
+
* input between `type="password"` and `type="text"` on click, and keeps
|
|
8
|
+
* `aria-pressed` and `aria-label` in sync. The icon swap is pure CSS, driven
|
|
9
|
+
* by `aria-pressed` (see _password-group.css).
|
|
10
|
+
*
|
|
11
|
+
* The revealed/hidden state is a signal (`base/signals.ts`): the click handler
|
|
12
|
+
* is the input adapter, `resolveToggleState` is the pure derivation, and one
|
|
13
|
+
* effect is the output adapter that writes `type`, `aria-pressed`, and
|
|
14
|
+
* `aria-label` together. The effect also runs once on connect, so the toggle
|
|
15
|
+
* self-corrects to match the input's actual starting type even if the
|
|
16
|
+
* markup's static attributes drift from it.
|
|
17
|
+
*
|
|
18
|
+
* Without JavaScript the field degrades to a regular password input; the
|
|
19
|
+
* toggle button simply does nothing.
|
|
20
|
+
*
|
|
21
|
+
* Configuration (attributes on `<ui-password>`):
|
|
22
|
+
* - `data-label-show`: Toggle label while the password is hidden (default "Show password").
|
|
23
|
+
* - `data-label-hide`: Toggle label while the password is visible (default "Hide password").
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <ui-password>
|
|
27
|
+
* <label class="password-group">
|
|
28
|
+
* <input class="input" type="password" autocomplete="current-password" />
|
|
29
|
+
* <span data-slot="password-group-addon" data-align="inline-end">
|
|
30
|
+
* <button class="button" data-slot="password-group-toggle" type="button"
|
|
31
|
+
* aria-pressed="false" aria-label="Show password">…</button>
|
|
32
|
+
* </span>
|
|
33
|
+
* </label>
|
|
34
|
+
* </ui-password>
|
|
35
|
+
*/
|
|
36
|
+
import { effect, state } from "../../base/signals.js";
|
|
37
|
+
import { ZazzElement, defineZazzElement } from "../../base/zazz-element.js";
|
|
38
|
+
/**
|
|
39
|
+
* @description Derives the input type, `aria-pressed`, and `aria-label` for a
|
|
40
|
+
* given reveal state. Pure: the effect in `connectedCallback` is the only
|
|
41
|
+
* place that writes it to the DOM.
|
|
42
|
+
*
|
|
43
|
+
* @param revealed - Whether the password is currently shown as plain text.
|
|
44
|
+
* @param labelShow - Toggle label while hidden.
|
|
45
|
+
* @param labelHide - Toggle label while revealed.
|
|
46
|
+
* @returns The derived DOM state.
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
function resolveToggleState(revealed, labelShow, labelHide) {
|
|
50
|
+
return {
|
|
51
|
+
type: revealed ? "text" : "password",
|
|
52
|
+
ariaPressed: revealed ? "true" : "false",
|
|
53
|
+
ariaLabel: revealed ? labelHide : labelShow,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
class UiPassword extends ZazzElement {
|
|
57
|
+
setup(signal) {
|
|
58
|
+
const input = this.querySelector('input[type="password"], input[type="text"]');
|
|
59
|
+
const toggle = this.querySelector('[data-slot~="password-group-toggle"]');
|
|
60
|
+
if (!(input instanceof HTMLInputElement) || !(toggle instanceof HTMLElement))
|
|
61
|
+
return;
|
|
62
|
+
const revealed = state(input.type === "text");
|
|
63
|
+
toggle.addEventListener("click", () => revealed.set(!revealed.get()), { signal });
|
|
64
|
+
effect(() => {
|
|
65
|
+
const labelShow = this.getAttribute("data-label-show") || "Show password";
|
|
66
|
+
const labelHide = this.getAttribute("data-label-hide") || "Hide password";
|
|
67
|
+
const next = resolveToggleState(revealed.get(), labelShow, labelHide);
|
|
68
|
+
input.type = next.type;
|
|
69
|
+
toggle.setAttribute("aria-pressed", next.ariaPressed);
|
|
70
|
+
toggle.setAttribute("aria-label", next.ariaLabel);
|
|
71
|
+
}, { signal });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
defineZazzElement("ui-password", UiPassword);
|
|
75
|
+
// resolveToggleState is exported for unit tests only: not part of the public API.
|
|
76
|
+
export { UiPassword, resolveToggleState };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview `<ui-password>`: HTML web component for password visibility.
|
|
5
|
+
* @description Light-DOM custom element that adds show/hide behavior to a
|
|
6
|
+
* standard password field. Wrap the existing `.password-group` markup: the
|
|
7
|
+
* element finds the input and the `[data-slot~="password-group-toggle"]` button, flips the
|
|
8
|
+
* input between `type="password"` and `type="text"` on click, and keeps
|
|
9
|
+
* `aria-pressed` and `aria-label` in sync. The icon swap is pure CSS, driven
|
|
10
|
+
* by `aria-pressed` (see _password-group.css).
|
|
11
|
+
*
|
|
12
|
+
* The revealed/hidden state is a signal (`base/signals.ts`): the click handler
|
|
13
|
+
* is the input adapter, `resolveToggleState` is the pure derivation, and one
|
|
14
|
+
* effect is the output adapter that writes `type`, `aria-pressed`, and
|
|
15
|
+
* `aria-label` together. The effect also runs once on connect, so the toggle
|
|
16
|
+
* self-corrects to match the input's actual starting type even if the
|
|
17
|
+
* markup's static attributes drift from it.
|
|
18
|
+
*
|
|
19
|
+
* Without JavaScript the field degrades to a regular password input; the
|
|
20
|
+
* toggle button simply does nothing.
|
|
21
|
+
*
|
|
22
|
+
* Configuration (attributes on `<ui-password>`):
|
|
23
|
+
* - `data-label-show`: Toggle label while the password is hidden (default "Show password").
|
|
24
|
+
* - `data-label-hide`: Toggle label while the password is visible (default "Hide password").
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <ui-password>
|
|
28
|
+
* <label class="password-group">
|
|
29
|
+
* <input class="input" type="password" autocomplete="current-password" />
|
|
30
|
+
* <span data-slot="password-group-addon" data-align="inline-end">
|
|
31
|
+
* <button class="button" data-slot="password-group-toggle" type="button"
|
|
32
|
+
* aria-pressed="false" aria-label="Show password">…</button>
|
|
33
|
+
* </span>
|
|
34
|
+
* </label>
|
|
35
|
+
* </ui-password>
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { effect, state } from "../../base/signals.ts";
|
|
39
|
+
import { ZazzElement, defineZazzElement } from "../../base/zazz-element.ts";
|
|
40
|
+
|
|
41
|
+
/** Derived DOM state for one toggle configuration. */
|
|
42
|
+
interface ToggleState {
|
|
43
|
+
type: "password" | "text";
|
|
44
|
+
ariaPressed: "true" | "false";
|
|
45
|
+
ariaLabel: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @description Derives the input type, `aria-pressed`, and `aria-label` for a
|
|
50
|
+
* given reveal state. Pure: the effect in `connectedCallback` is the only
|
|
51
|
+
* place that writes it to the DOM.
|
|
52
|
+
*
|
|
53
|
+
* @param revealed - Whether the password is currently shown as plain text.
|
|
54
|
+
* @param labelShow - Toggle label while hidden.
|
|
55
|
+
* @param labelHide - Toggle label while revealed.
|
|
56
|
+
* @returns The derived DOM state.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
function resolveToggleState(revealed: boolean, labelShow: string, labelHide: string): ToggleState {
|
|
60
|
+
return {
|
|
61
|
+
type: revealed ? "text" : "password",
|
|
62
|
+
ariaPressed: revealed ? "true" : "false",
|
|
63
|
+
ariaLabel: revealed ? labelHide : labelShow,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class UiPassword extends ZazzElement {
|
|
68
|
+
protected setup(signal: AbortSignal): void {
|
|
69
|
+
const input = this.querySelector('input[type="password"], input[type="text"]');
|
|
70
|
+
const toggle = this.querySelector('[data-slot~="password-group-toggle"]');
|
|
71
|
+
if (!(input instanceof HTMLInputElement) || !(toggle instanceof HTMLElement)) return;
|
|
72
|
+
|
|
73
|
+
const revealed = state(input.type === "text");
|
|
74
|
+
|
|
75
|
+
toggle.addEventListener("click", () => revealed.set(!revealed.get()), { signal });
|
|
76
|
+
|
|
77
|
+
effect(
|
|
78
|
+
() => {
|
|
79
|
+
const labelShow = this.getAttribute("data-label-show") || "Show password";
|
|
80
|
+
const labelHide = this.getAttribute("data-label-hide") || "Hide password";
|
|
81
|
+
const next = resolveToggleState(revealed.get(), labelShow, labelHide);
|
|
82
|
+
input.type = next.type;
|
|
83
|
+
toggle.setAttribute("aria-pressed", next.ariaPressed);
|
|
84
|
+
toggle.setAttribute("aria-label", next.ariaLabel);
|
|
85
|
+
},
|
|
86
|
+
{ signal },
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
defineZazzElement("ui-password", UiPassword);
|
|
92
|
+
|
|
93
|
+
// resolveToggleState is exported for unit tests only: not part of the public API.
|
|
94
|
+
export { UiPassword, resolveToggleState };
|
|
95
|
+
export type { ToggleState };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* popover.css: Shared [popover] primitive (Tier 3 owner for --ui-popover-*)
|
|
3
|
+
*
|
|
4
|
+
* @layer variables, reset, components
|
|
5
|
+
* @requires layers.css, _variables.css (--popover, --popover-foreground)
|
|
6
|
+
* @uses [popover], popovertarget, :popover-open: Popover API
|
|
7
|
+
* (Chromium-first; polyfill may use .\:popover-open class)
|
|
8
|
+
* @uses @starting-style + allow-discrete: enter/exit opacity/transform
|
|
9
|
+
* @uses anchor-name, position-anchor, position-area, position-try-fallbacks:
|
|
10
|
+
* anchor positioning (gated behind @supports; Firefox/Safari fall
|
|
11
|
+
* back to UA-centered popover)
|
|
12
|
+
* @uses backdrop-filter: popover surface blur
|
|
13
|
+
* @tokens --ui-popover-* (Tier 3 owner; @layer variables)
|
|
14
|
+
* @consumedby select.css (picker placement), menu.css, navigation-menu.css, tooltip.css, toaster.css,
|
|
15
|
+
* autocomplete.css, combobox.css, command.css
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
@layer variables {
|
|
19
|
+
:root {
|
|
20
|
+
/* Styles */
|
|
21
|
+
--ui-popover-border: var(--border);
|
|
22
|
+
--ui-popover-radius: var(--radius-md);
|
|
23
|
+
--ui-popover-button-radius: var(--radius-sm);
|
|
24
|
+
--ui-popover-shadow: var(--shadow-md);
|
|
25
|
+
--ui-popover-padding: var(--step-1_5);
|
|
26
|
+
--ui-popover-min-inline-size: var(--article-xs);
|
|
27
|
+
--ui-popover-max-inline-size: 100vi;
|
|
28
|
+
|
|
29
|
+
/* Reveal transitions/animations */
|
|
30
|
+
--ui-popover-scale--start: 0.98;
|
|
31
|
+
--ui-popover-translate--start: 0, 0, 0;
|
|
32
|
+
--ui-popover-opacity--start: 0;
|
|
33
|
+
--ui-popover-scale--end: 1;
|
|
34
|
+
--ui-popover-translate--end: 0, 0, 0;
|
|
35
|
+
--ui-popover-opacity--end: 1;
|
|
36
|
+
|
|
37
|
+
/* Positioning */
|
|
38
|
+
--ui-popover-origin: top center;
|
|
39
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
40
|
+
--ui-popover-margin-inline: 0;
|
|
41
|
+
--ui-popover-position-area: block-end inline-start;
|
|
42
|
+
--ui-popover-position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
|
|
43
|
+
--ui-popover-backdrop-filter: blur(4px);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@layer reset {
|
|
48
|
+
/* ===========================================================================
|
|
49
|
+
POPOVER ELEMENT ENHANCEMENTS
|
|
50
|
+
- [popover] is a shared primitive (menu, navigation-menu, …). Token
|
|
51
|
+
defaults live in @layer variables above; this block wires native open/close
|
|
52
|
+
motion and anchor positioning. Surface chrome is in @layer zazz.components below.
|
|
53
|
+
=========================================================================== */
|
|
54
|
+
|
|
55
|
+
:where([popover]) {
|
|
56
|
+
color: var(--popover-foreground);
|
|
57
|
+
background-color: var(--popover);
|
|
58
|
+
|
|
59
|
+
align-content: start;
|
|
60
|
+
transform-origin: var(--ui-popover-origin);
|
|
61
|
+
border-radius: var(--ui-popover-radius);
|
|
62
|
+
box-shadow: var(--ui-popover-shadow);
|
|
63
|
+
opacity: var(--ui-popover-opacity--start);
|
|
64
|
+
backdrop-filter: var(--ui-popover-backdrop-filter);
|
|
65
|
+
transform: scale(var(--ui-popover-scale--start)) translate3d(var(--ui-popover-translate--start));
|
|
66
|
+
transition:
|
|
67
|
+
opacity var(--default-transition-duration) var(--default-transition-timing-function),
|
|
68
|
+
transform var(--default-transition-duration) var(--default-transition-timing-function),
|
|
69
|
+
padding var(--default-transition-duration) var(--default-transition-timing-function),
|
|
70
|
+
block-size var(--default-transition-duration) var(--default-transition-timing-function),
|
|
71
|
+
inline-size var(--default-transition-duration) var(--default-transition-timing-function),
|
|
72
|
+
overlay var(--default-transition-duration) var(--default-transition-timing-function)
|
|
73
|
+
allow-discrete,
|
|
74
|
+
display var(--default-transition-duration) var(--default-transition-timing-function)
|
|
75
|
+
allow-discrete;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Anchor positioning tethers the popover to its trigger and lets the browser
|
|
79
|
+
flip it away from viewport edges (Chromium 125+ today). It is gated behind
|
|
80
|
+
@supports so browsers without anchor positioning (Firefox, Safari) keep the
|
|
81
|
+
UA-centered popover (inset: 0 + margin: auto) instead of a mispositioned
|
|
82
|
+
top-left box. Detection key is anchor-name — the entry property of the API. */
|
|
83
|
+
@supports (anchor-name: --zazz) {
|
|
84
|
+
:where([popover]) {
|
|
85
|
+
position: fixed;
|
|
86
|
+
inset: auto;
|
|
87
|
+
margin-block: var(--ui-popover-margin-block);
|
|
88
|
+
margin-inline: var(--ui-popover-margin-inline);
|
|
89
|
+
position-area: var(--ui-popover-position-area);
|
|
90
|
+
position-try-fallbacks: var(--ui-popover-position-try-fallbacks);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* .\:popover-open must be set for the polyfill to work with discrete animations */
|
|
95
|
+
[popover]:where(:popover-open, .\:popover-open) {
|
|
96
|
+
display: grid;
|
|
97
|
+
align-content: start;
|
|
98
|
+
opacity: var(--ui-popover-opacity--end);
|
|
99
|
+
transform: scale(var(--ui-popover-scale--end)) translate3d(var(--ui-popover-translate--end));
|
|
100
|
+
|
|
101
|
+
@starting-style {
|
|
102
|
+
opacity: var(--ui-popover-opacity--start);
|
|
103
|
+
transform: scale(var(--ui-popover-scale--start))
|
|
104
|
+
translate3d(var(--ui-popover-translate--start));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@layer zazz.components {
|
|
110
|
+
/* ===========================================================================
|
|
111
|
+
POPOVER SURFACE — shared chrome for every [popover] consumer
|
|
112
|
+
=========================================================================== */
|
|
113
|
+
|
|
114
|
+
[popover] {
|
|
115
|
+
border: 1px solid var(--ui-popover-border);
|
|
116
|
+
padding: var(--ui-popover-padding);
|
|
117
|
+
min-inline-size: var(--ui-popover-min-inline-size);
|
|
118
|
+
max-inline-size: var(--ui-popover-max-inline-size);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[popover] .ui-button {
|
|
122
|
+
--ui-button-radius: var(--ui-popover-button-radius);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* ===========================================================================
|
|
126
|
+
POSITIONING — side × align (row/block first, column/inline second per MDN)
|
|
127
|
+
|
|
128
|
+
The single placement matrix for every anchored surface. It assigns the
|
|
129
|
+
--ui-popover-position-* tokens; each surface applies them itself (popover
|
|
130
|
+
below, ::picker(select) in select.css) because the properties are gated on
|
|
131
|
+
anchor support. .ui-select joins by selector rather than by [popover]: a
|
|
132
|
+
<select> is not a popover, but custom properties set on it inherit into
|
|
133
|
+
::picker(select). Zero specificity (:where) so components can override a
|
|
134
|
+
cell — see navigation-menu.css.
|
|
135
|
+
=========================================================================== */
|
|
136
|
+
|
|
137
|
+
/* bottom — and .ui-select's default side, so a select with only data-align
|
|
138
|
+
(or no attributes at all) still drops below its trigger */
|
|
139
|
+
:where([popover], .ui-select)[data-side="bottom"]:not([data-align]),
|
|
140
|
+
:where([popover], .ui-select)[data-side="bottom"][data-align="start"],
|
|
141
|
+
:where(.ui-select:not([data-side]):not([data-align])),
|
|
142
|
+
:where(.ui-select:not([data-side])[data-align="start"]) {
|
|
143
|
+
--ui-popover-position-area: block-end span-inline-end;
|
|
144
|
+
--ui-popover-origin: top center;
|
|
145
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
146
|
+
--ui-popover-margin-inline: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:where([popover], .ui-select)[data-side="bottom"][data-align="center"],
|
|
150
|
+
:where(.ui-select:not([data-side])[data-align="center"]) {
|
|
151
|
+
--ui-popover-position-area: block-end span-all;
|
|
152
|
+
--ui-popover-origin: top center;
|
|
153
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
154
|
+
--ui-popover-margin-inline: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:where([popover], .ui-select)[data-side="bottom"][data-align="end"],
|
|
158
|
+
:where(.ui-select:not([data-side])[data-align="end"]) {
|
|
159
|
+
--ui-popover-position-area: block-end span-inline-start;
|
|
160
|
+
--ui-popover-origin: top center;
|
|
161
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
162
|
+
--ui-popover-margin-inline: 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* top */
|
|
166
|
+
:where([popover], .ui-select)[data-side="top"]:not([data-align]),
|
|
167
|
+
:where([popover], .ui-select)[data-side="top"][data-align="start"] {
|
|
168
|
+
--ui-popover-position-area: block-start span-inline-end;
|
|
169
|
+
--ui-popover-origin: bottom center;
|
|
170
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
171
|
+
--ui-popover-margin-inline: 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
:where([popover], .ui-select)[data-side="top"][data-align="center"] {
|
|
175
|
+
--ui-popover-position-area: block-start span-all;
|
|
176
|
+
--ui-popover-origin: bottom center;
|
|
177
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
178
|
+
--ui-popover-margin-inline: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:where([popover], .ui-select)[data-side="top"][data-align="end"] {
|
|
182
|
+
--ui-popover-position-area: block-start span-inline-start;
|
|
183
|
+
--ui-popover-origin: bottom center;
|
|
184
|
+
--ui-popover-margin-block: var(--step-1_5);
|
|
185
|
+
--ui-popover-margin-inline: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* right */
|
|
189
|
+
:where([popover], .ui-select)[data-side="right"]:not([data-align]),
|
|
190
|
+
:where([popover], .ui-select)[data-side="right"][data-align="start"] {
|
|
191
|
+
--ui-popover-position-area: inline-end span-block-end;
|
|
192
|
+
--ui-popover-origin: bottom left;
|
|
193
|
+
--ui-popover-margin-block: 0;
|
|
194
|
+
--ui-popover-margin-inline: var(--step-1_5);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
:where([popover], .ui-select)[data-side="right"][data-align="center"] {
|
|
198
|
+
--ui-popover-position-area: inline-end span-all;
|
|
199
|
+
--ui-popover-origin: center left;
|
|
200
|
+
--ui-popover-margin-block: 0;
|
|
201
|
+
--ui-popover-margin-inline: var(--step-1_5);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:where([popover], .ui-select)[data-side="right"][data-align="end"] {
|
|
205
|
+
--ui-popover-position-area: inline-end span-block-start;
|
|
206
|
+
--ui-popover-origin: top left;
|
|
207
|
+
--ui-popover-margin-block: 0;
|
|
208
|
+
--ui-popover-margin-inline: var(--step-1_5);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* left */
|
|
212
|
+
:where([popover], .ui-select)[data-side="left"]:not([data-align]),
|
|
213
|
+
:where([popover], .ui-select)[data-side="left"][data-align="start"] {
|
|
214
|
+
--ui-popover-position-area: inline-start span-block-end;
|
|
215
|
+
--ui-popover-origin: bottom right;
|
|
216
|
+
--ui-popover-margin-block: 0;
|
|
217
|
+
--ui-popover-margin-inline: var(--step-1_5);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
:where([popover], .ui-select)[data-side="left"][data-align="center"] {
|
|
221
|
+
--ui-popover-position-area: inline-start span-all;
|
|
222
|
+
--ui-popover-origin: center right;
|
|
223
|
+
--ui-popover-margin-block: 0;
|
|
224
|
+
--ui-popover-margin-inline: var(--step-1_5);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
:where([popover], .ui-select)[data-side="left"][data-align="end"] {
|
|
228
|
+
--ui-popover-position-area: inline-start span-block-start;
|
|
229
|
+
--ui-popover-origin: top right;
|
|
230
|
+
--ui-popover-margin-block: 0;
|
|
231
|
+
--ui-popover-margin-inline: var(--step-1_5);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<progress class="ui-progress" aria-label="Loading"></progress>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* progress.css — Progress (.ui-progress on native <progress>)
|
|
3
|
+
*
|
|
4
|
+
* @layer variables, reset, components
|
|
5
|
+
* @requires layers.css, _variables.css, _reset.css
|
|
6
|
+
* @uses appearance: none — element box becomes the track; only the fill
|
|
7
|
+
* needs vendor pseudo-elements (::-webkit-progress-value,
|
|
8
|
+
* ::-moz-progress-bar) — never combine the two vendors in one
|
|
9
|
+
* selector list (an unknown pseudo invalidates the whole rule)
|
|
10
|
+
* @uses :indeterminate — animated stripe on the element background
|
|
11
|
+
* @tokens --ui-progress-* (@layer variables)
|
|
12
|
+
* @consumedby meter.css
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@layer variables {
|
|
16
|
+
:root {
|
|
17
|
+
--ui-progress-inline-size: 100%;
|
|
18
|
+
/* Matches the slider track so the two bars read as one family */
|
|
19
|
+
--ui-progress-height: var(--step-1_5);
|
|
20
|
+
--ui-progress-radius: var(--radius-full);
|
|
21
|
+
--ui-progress-track-background: var(--muted);
|
|
22
|
+
--ui-progress-track-border: 1px solid transparent;
|
|
23
|
+
--ui-progress-bar-background: var(--primary);
|
|
24
|
+
/* One tile (--step-4) of travel per cycle */
|
|
25
|
+
--ui-progress-indeterminate-duration: 1s;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@layer reset {
|
|
30
|
+
/* ===========================================================================
|
|
31
|
+
PROGRESS — native <progress> fill redraw
|
|
32
|
+
- The appearance strip lives in _reset.css; the element box is the themed
|
|
33
|
+
track (overflow clips the fill's corners), so only the fill pseudos are
|
|
34
|
+
redrawn here. One rule per vendor pseudo, by necessity.
|
|
35
|
+
=========================================================================== */
|
|
36
|
+
|
|
37
|
+
:where(.ui-progress) {
|
|
38
|
+
inline-size: var(--ui-progress-inline-size);
|
|
39
|
+
block-size: var(--ui-progress-height);
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
background-color: var(--ui-progress-track-background);
|
|
42
|
+
border: var(--ui-progress-track-border);
|
|
43
|
+
border-radius: var(--ui-progress-radius);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:where(.ui-progress)::-webkit-progress-bar {
|
|
47
|
+
background: transparent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:where(.ui-progress)::-webkit-progress-value {
|
|
51
|
+
background-color: var(--ui-progress-bar-background);
|
|
52
|
+
border-radius: inherit;
|
|
53
|
+
transition: inline-size var(--default-transition-duration)
|
|
54
|
+
var(--default-transition-timing-function);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:where(.ui-progress)::-moz-progress-bar {
|
|
58
|
+
background-color: var(--ui-progress-bar-background);
|
|
59
|
+
border-radius: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Indeterminate — a moving stripe on the element itself, so it renders the
|
|
63
|
+
same in every engine; the vendor fills go transparent to avoid a phantom
|
|
64
|
+
bar underneath. Percentage stops in a square tile wrap seamlessly at 45°,
|
|
65
|
+
and animating by exactly one tile keeps the loop jump-free; clipping to
|
|
66
|
+
the padding box keeps stripes out of the border ring. */
|
|
67
|
+
:where(.ui-progress:indeterminate) {
|
|
68
|
+
--_stripe: color-mix(in oklch, var(--ui-progress-bar-background) 30%, transparent);
|
|
69
|
+
background-image: linear-gradient(
|
|
70
|
+
-45deg,
|
|
71
|
+
var(--_stripe) 25%,
|
|
72
|
+
transparent 25% 50%,
|
|
73
|
+
var(--_stripe) 50% 75%,
|
|
74
|
+
transparent 75%
|
|
75
|
+
);
|
|
76
|
+
background-size: var(--step-4) var(--step-4);
|
|
77
|
+
background-origin: padding-box;
|
|
78
|
+
background-clip: padding-box;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:where(.ui-progress:indeterminate)::-webkit-progress-value {
|
|
82
|
+
background: transparent;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:where(.ui-progress:indeterminate)::-moz-progress-bar {
|
|
86
|
+
background: transparent;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
90
|
+
:where(.ui-progress:indeterminate) {
|
|
91
|
+
animation: ui-progress-slide var(--ui-progress-indeterminate-duration) linear infinite;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* One full tile per cycle — the wrap lands on an identical frame */
|
|
96
|
+
@keyframes ui-progress-slide {
|
|
97
|
+
from {
|
|
98
|
+
background-position: 0 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
to {
|
|
102
|
+
background-position: var(--step-4) 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<div class="ui-field">
|
|
2
|
+
<label class="flex items-center justify-between" data-slot="field-label" for="f-upload">
|
|
3
|
+
<span>Reticulating splines…</span>
|
|
4
|
+
<span class="text-xs text-muted-foreground">62%</span>
|
|
5
|
+
</label>
|
|
6
|
+
<progress class="ui-progress" id="f-upload" max="100" value="62">62%</progress>
|
|
7
|
+
</div>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<article class="ui-prose container py-lg" data-variant="article">
|
|
2
|
+
<hgroup>
|
|
3
|
+
<span class="text-eyebrow">Heading 1</span>
|
|
4
|
+
<h1>How vexingly quick daft zebras jump.</h1>
|
|
5
|
+
<p class="text-xl text-muted-foreground">The Art of Typography</p>
|
|
6
|
+
</hgroup>
|
|
7
|
+
<hgroup>
|
|
8
|
+
<span class="text-eyebrow">Heading 2</span>
|
|
9
|
+
<h2>How vexingly quick daft zebras jump.</h2>
|
|
10
|
+
</hgroup>
|
|
11
|
+
<hgroup>
|
|
12
|
+
<span class="text-eyebrow">Heading 3</span>
|
|
13
|
+
<h3>How vexingly quick daft zebras jump.</h3>
|
|
14
|
+
</hgroup>
|
|
15
|
+
<hgroup>
|
|
16
|
+
<span class="text-eyebrow">Heading 4</span>
|
|
17
|
+
<h4>How vexingly quick daft zebras jump.</h4>
|
|
18
|
+
</hgroup>
|
|
19
|
+
<hgroup>
|
|
20
|
+
<span class="text-eyebrow">Heading 5</span>
|
|
21
|
+
<h5>How vexingly quick daft zebras jump.</h5>
|
|
22
|
+
</hgroup>
|
|
23
|
+
<hgroup>
|
|
24
|
+
<span class="text-eyebrow">Heading 6</span>
|
|
25
|
+
<h6>How vexingly quick daft zebras jump.</h6>
|
|
26
|
+
</hgroup>
|
|
27
|
+
<hr />
|
|
28
|
+
<p class="text-xl">
|
|
29
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum
|
|
30
|
+
mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis
|
|
31
|
+
dolor.
|
|
32
|
+
</p>
|
|
33
|
+
<p class="text-lg">
|
|
34
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum
|
|
35
|
+
mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis
|
|
36
|
+
dolor.
|
|
37
|
+
</p>
|
|
38
|
+
<p>
|
|
39
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum
|
|
40
|
+
mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis
|
|
41
|
+
dolor.
|
|
42
|
+
</p>
|
|
43
|
+
<p class="text-sm">
|
|
44
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum
|
|
45
|
+
mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis
|
|
46
|
+
dolor.
|
|
47
|
+
</p>
|
|
48
|
+
<p class="text-xs">
|
|
49
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum
|
|
50
|
+
mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis
|
|
51
|
+
dolor.
|
|
52
|
+
</p>
|
|
53
|
+
<hr />
|
|
54
|
+
<figure>
|
|
55
|
+
<img
|
|
56
|
+
sizes="auto"
|
|
57
|
+
loading="lazy"
|
|
58
|
+
width="800"
|
|
59
|
+
height="400"
|
|
60
|
+
src="https://placehold.co/800x400"
|
|
61
|
+
alt="Placeholder demonstrating figure and image styling within prose"
|
|
62
|
+
/>
|
|
63
|
+
<figcaption>Figure 1: A placeholder image styled with .ui-prose</figcaption>
|
|
64
|
+
</figure>
|
|
65
|
+
</article>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* radio.css — Radio (.ui-radio, .ui-radio-group)
|
|
3
|
+
*
|
|
4
|
+
* @layer variables, components
|
|
5
|
+
* @requires layers.css, _variables.css, fields.css (.ui-field-group layout)
|
|
6
|
+
* @uses appearance: none — custom circle + radial-gradient dot when :checked
|
|
7
|
+
* @tokens --ui-radio-* (@layer variables)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
@layer variables {
|
|
11
|
+
:root {
|
|
12
|
+
--ui-radio-size: var(--step-4_5);
|
|
13
|
+
--ui-radio-background: var(--input);
|
|
14
|
+
--ui-radio-background--checked: var(--primary);
|
|
15
|
+
--ui-radio-border: var(--border);
|
|
16
|
+
--ui-radio-border--hover: var(--primary);
|
|
17
|
+
--ui-radio-border--checked: var(--primary);
|
|
18
|
+
--ui-radio-radius: var(--radius-full);
|
|
19
|
+
--ui-radio-background-size: 90%;
|
|
20
|
+
--ui-radio-dot-foreground: var(--primary-foreground);
|
|
21
|
+
--ui-radio-dot-inner-stop: 28%;
|
|
22
|
+
--ui-radio-dot-outer-stop: 30%;
|
|
23
|
+
--ui-radio-dot-gradient: radial-gradient(
|
|
24
|
+
circle,
|
|
25
|
+
var(--ui-radio-dot-foreground) 0 var(--ui-radio-dot-inner-stop),
|
|
26
|
+
transparent var(--ui-radio-dot-outer-stop)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@layer zazz.components {
|
|
32
|
+
/* ===========================================================================
|
|
33
|
+
RADIO — .ui-radio (+ .ui-radio-group)
|
|
34
|
+
- appearance: none redraws the circle from theme tokens; the checked dot is a
|
|
35
|
+
radial-gradient so it tracks --ui-radio-dot-foreground, not colour alone.
|
|
36
|
+
- Group by shared `name`; wrap in a <fieldset>/<legend> or .ui-radio-group for an
|
|
37
|
+
accessible labelled set.
|
|
38
|
+
=========================================================================== */
|
|
39
|
+
|
|
40
|
+
.ui-radio {
|
|
41
|
+
appearance: none;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
inline-size: var(--ui-radio-size);
|
|
44
|
+
block-size: var(--ui-radio-size);
|
|
45
|
+
|
|
46
|
+
background-color: var(--ui-radio-background);
|
|
47
|
+
border: 1px solid var(--ui-radio-border);
|
|
48
|
+
border-radius: var(--ui-radio-radius);
|
|
49
|
+
|
|
50
|
+
background-repeat: no-repeat;
|
|
51
|
+
background-position: center;
|
|
52
|
+
background-size: var(--ui-radio-background-size);
|
|
53
|
+
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
|
|
56
|
+
/* ring renders as box-shadow; transparent outline twin keeps focus visible
|
|
57
|
+
in forced-colors / high-contrast modes */
|
|
58
|
+
--_ring-offset-width: 0px;
|
|
59
|
+
--_ring-width: 0px;
|
|
60
|
+
box-shadow:
|
|
61
|
+
0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
|
|
62
|
+
0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring));
|
|
63
|
+
outline: var(--outline-width) var(--outline-style) transparent;
|
|
64
|
+
outline-offset: var(--outline-offset);
|
|
65
|
+
|
|
66
|
+
transition: var(--default-transition);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ui-radio:hover {
|
|
70
|
+
border-color: var(--ui-radio-border--hover);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ui-radio:focus-visible {
|
|
74
|
+
--_ring-offset-width: var(--ring-offset-width);
|
|
75
|
+
--_ring-width: var(--ring-width);
|
|
76
|
+
outline-color: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ui-radio:checked {
|
|
80
|
+
background-color: var(--ui-radio-background--checked);
|
|
81
|
+
border-color: var(--ui-radio-border--checked);
|
|
82
|
+
background-image: var(--ui-radio-dot-gradient);
|
|
83
|
+
}
|
|
84
|
+
}
|