@lanfermann/ui 0.0.0-stage → 0.1.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/LICENSE +24 -0
- package/README.md +17 -2
- package/TRADEMARK.md +10 -0
- package/brand/app-icon.svg +1 -0
- package/brand/avatar.svg +1 -0
- package/brand/favicon.svg +1 -0
- package/dist/components/accordion/accordion.d.ts +26 -0
- package/dist/components/accordion/accordion.js +78 -0
- package/dist/components/alert/alert.d.ts +19 -0
- package/dist/components/alert/alert.js +68 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +20 -0
- package/dist/components/alert-dialog/alert-dialog.js +75 -0
- package/dist/components/anchor-heading/anchor-heading.d.ts +19 -0
- package/dist/components/anchor-heading/anchor-heading.js +39 -0
- package/dist/components/avatar/avatar.d.ts +14 -0
- package/dist/components/avatar/avatar.js +42 -0
- package/dist/components/badge/badge.d.ts +12 -0
- package/dist/components/badge/badge.js +27 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +23 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +63 -0
- package/dist/components/button/button-variants.d.ts +15 -0
- package/dist/components/button/button-variants.js +76 -0
- package/dist/components/button/button.d.ts +25 -0
- package/dist/components/button/button.js +50 -0
- package/dist/components/calendar/calendar-selection.js +216 -0
- package/dist/components/calendar/calendar.d.ts +44 -0
- package/dist/components/calendar/calendar.js +208 -0
- package/dist/components/callout/callout.d.ts +21 -0
- package/dist/components/callout/callout.js +75 -0
- package/dist/components/card/card.d.ts +16 -0
- package/dist/components/card/card.js +53 -0
- package/dist/components/checkbox/checkbox.d.ts +9 -0
- package/dist/components/checkbox/checkbox.js +33 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +18 -0
- package/dist/components/checkbox-group/checkbox-group.js +33 -0
- package/dist/components/code/code.d.ts +7 -0
- package/dist/components/code/code.js +16 -0
- package/dist/components/code-block/code-block-frame.js +146 -0
- package/dist/components/code-block/code-block-live.d.ts +45 -0
- package/dist/components/code-block/code-block-live.js +51 -0
- package/dist/components/code-block/code-block.d.ts +36 -0
- package/dist/components/code-block/code-block.js +51 -0
- package/dist/components/code-block/code-copy.d.ts +12 -0
- package/dist/components/code-block/code-copy.js +71 -0
- package/dist/components/code-block/code-lines-view.d.ts +16 -0
- package/dist/components/code-block/code-lines-view.js +48 -0
- package/dist/components/code-block/code-lines.js +17 -0
- package/dist/components/code-block/code-scroll.js +29 -0
- package/dist/components/code-block/code-surface.js +13 -0
- package/dist/components/code-block/code-tabs-frame.js +85 -0
- package/dist/components/code-block/code-tabs-store.js +25 -0
- package/dist/components/code-block/code-tabs.d.ts +28 -0
- package/dist/components/code-block/code-tabs.js +29 -0
- package/dist/components/code-block/highlight.d.ts +34 -0
- package/dist/components/code-block/highlight.js +258 -0
- package/dist/components/code-block/lines.d.ts +5 -0
- package/dist/components/code-block/lines.js +40 -0
- package/dist/components/collapsible/collapsible.d.ts +19 -0
- package/dist/components/collapsible/collapsible.js +54 -0
- package/dist/components/combobox/combobox.d.ts +84 -0
- package/dist/components/combobox/combobox.js +169 -0
- package/dist/components/container/container.d.ts +16 -0
- package/dist/components/container/container.js +30 -0
- package/dist/components/copy-pill/copy-pill.d.ts +52 -0
- package/dist/components/copy-pill/copy-pill.js +232 -0
- package/dist/components/cta/cta.d.ts +109 -0
- package/dist/components/cta/cta.js +375 -0
- package/dist/components/date-field/date-field.d.ts +40 -0
- package/dist/components/date-field/date-field.js +99 -0
- package/dist/components/date-range-field/date-range-field.d.ts +41 -0
- package/dist/components/date-range-field/date-range-field.js +155 -0
- package/dist/components/dialog/dialog.d.ts +29 -0
- package/dist/components/dialog/dialog.js +96 -0
- package/dist/components/docs-layout/docs-layout.d.ts +17 -0
- package/dist/components/docs-layout/docs-layout.js +46 -0
- package/dist/components/drawer/drawer.d.ts +39 -0
- package/dist/components/drawer/drawer.js +181 -0
- package/dist/components/field/field.d.ts +18 -0
- package/dist/components/field/field.js +77 -0
- package/dist/components/fieldset/fieldset.d.ts +8 -0
- package/dist/components/fieldset/fieldset.js +25 -0
- package/dist/components/figure/figure.d.ts +14 -0
- package/dist/components/figure/figure.js +35 -0
- package/dist/components/form/form.d.ts +31 -0
- package/dist/components/form/form.js +55 -0
- package/dist/components/ground/ground.d.ts +20 -0
- package/dist/components/ground/ground.js +31 -0
- package/dist/components/heading/heading.d.ts +16 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/icon/icon.d.ts +22 -0
- package/dist/components/icon/icon.js +24 -0
- package/dist/components/input/input.d.ts +19 -0
- package/dist/components/input/input.js +46 -0
- package/dist/components/input-group/input-group.d.ts +34 -0
- package/dist/components/input-group/input-group.js +61 -0
- package/dist/components/kbd/kbd.d.ts +6 -0
- package/dist/components/kbd/kbd.js +15 -0
- package/dist/components/link/link-variants.d.ts +13 -0
- package/dist/components/link/link-variants.js +27 -0
- package/dist/components/link/link.d.ts +9 -0
- package/dist/components/link/link.js +18 -0
- package/dist/components/logo/logo-paths.js +22 -0
- package/dist/components/logo/logomark.d.ts +19 -0
- package/dist/components/logo/logomark.js +49 -0
- package/dist/components/logo/wordmark.d.ts +35 -0
- package/dist/components/logo/wordmark.js +48 -0
- package/dist/components/menu/menu.d.ts +26 -0
- package/dist/components/menu/menu.js +132 -0
- package/dist/components/meter/meter.d.ts +29 -0
- package/dist/components/meter/meter.js +68 -0
- package/dist/components/navigation-menu/navigation-menu-variants.d.ts +12 -0
- package/dist/components/navigation-menu/navigation-menu-variants.js +18 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu/navigation-menu.js +128 -0
- package/dist/components/number-field/number-field.d.ts +32 -0
- package/dist/components/number-field/number-field.js +85 -0
- package/dist/components/page-header/page-header.d.ts +27 -0
- package/dist/components/page-header/page-header.js +48 -0
- package/dist/components/pager/pager.d.ts +24 -0
- package/dist/components/pager/pager.js +51 -0
- package/dist/components/parameter-list/parameter-list.d.ts +34 -0
- package/dist/components/parameter-list/parameter-list.js +70 -0
- package/dist/components/popover/popover.d.ts +15 -0
- package/dist/components/popover/popover.js +64 -0
- package/dist/components/progress/progress.d.ts +19 -0
- package/dist/components/progress/progress.js +67 -0
- package/dist/components/prose/prose.d.ts +13 -0
- package/dist/components/prose/prose.js +22 -0
- package/dist/components/quote/quote.d.ts +21 -0
- package/dist/components/quote/quote.js +46 -0
- package/dist/components/radio/radio.d.ts +12 -0
- package/dist/components/radio/radio.js +37 -0
- package/dist/components/reference-entry/reference-entry.d.ts +25 -0
- package/dist/components/reference-entry/reference-entry.js +66 -0
- package/dist/components/section/section.d.ts +13 -0
- package/dist/components/section/section.js +30 -0
- package/dist/components/segmented-control/segmented-control.d.ts +42 -0
- package/dist/components/segmented-control/segmented-control.js +413 -0
- package/dist/components/select/select.d.ts +70 -0
- package/dist/components/select/select.js +189 -0
- package/dist/components/separator/separator.d.ts +12 -0
- package/dist/components/separator/separator.js +29 -0
- package/dist/components/side-nav/side-nav.d.ts +48 -0
- package/dist/components/side-nav/side-nav.js +89 -0
- package/dist/components/site-footer/site-footer-floor.js +48 -0
- package/dist/components/site-footer/site-footer.d.ts +38 -0
- package/dist/components/site-footer/site-footer.js +96 -0
- package/dist/components/site-header/site-header.d.ts +77 -0
- package/dist/components/site-header/site-header.js +214 -0
- package/dist/components/slider/slider.d.ts +42 -0
- package/dist/components/slider/slider.js +279 -0
- package/dist/components/spinner/spinner.d.ts +15 -0
- package/dist/components/spinner/spinner.js +34 -0
- package/dist/components/switch/switch.d.ts +8 -0
- package/dist/components/switch/switch.js +28 -0
- package/dist/components/table/table.d.ts +83 -0
- package/dist/components/table/table.js +123 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +32 -0
- package/dist/components/table-of-contents/table-of-contents.js +187 -0
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +124 -0
- package/dist/components/text/text.d.ts +16 -0
- package/dist/components/text/text.js +63 -0
- package/dist/components/textarea/textarea.d.ts +19 -0
- package/dist/components/textarea/textarea.js +30 -0
- package/dist/components/time-field/time-field.d.ts +40 -0
- package/dist/components/time-field/time-field.js +123 -0
- package/dist/components/toast/toast.d.ts +55 -0
- package/dist/components/toast/toast.js +129 -0
- package/dist/components/tooltip/tooltip.d.ts +16 -0
- package/dist/components/tooltip/tooltip.js +41 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +77 -0
- package/dist/internal/arrow.js +41 -0
- package/dist/internal/disclosure.js +20 -0
- package/dist/internal/field-context.js +21 -0
- package/dist/internal/field.d.ts +23 -0
- package/dist/internal/field.js +49 -0
- package/dist/internal/glyphs.js +84 -0
- package/dist/internal/iso-date.d.ts +2 -0
- package/dist/internal/iso-date.js +268 -0
- package/dist/internal/overlay.js +40 -0
- package/dist/internal/picker-sheet.js +74 -0
- package/dist/internal/popup.js +37 -0
- package/dist/internal/range-shape.js +295 -0
- package/dist/internal/reduced-motion.js +19 -0
- package/dist/internal/scroll-edges.js +45 -0
- package/dist/internal/trough.js +39 -0
- package/dist/internal/typed-input.d.ts +16 -0
- package/dist/internal/typed-input.js +133 -0
- package/dist/lib/cn.d.ts +11 -0
- package/dist/lib/cn.js +98 -0
- package/dist/motion/inertia.js +111 -0
- package/dist/motion/spring-step.js +35 -0
- package/dist/motion/springs.d.ts +78 -0
- package/dist/motion/springs.js +81 -0
- package/package.json +107 -4
- package/src/styles/base.css +93 -0
- package/src/styles/calendar.css +117 -0
- package/src/styles/code.css +252 -0
- package/src/styles/density.css +53 -0
- package/src/styles/depth.css +501 -0
- package/src/styles/grounds.css +191 -0
- package/src/styles/marks.css +50 -0
- package/src/styles/motion.css +55 -0
- package/src/styles/motion.generated.css +101 -0
- package/src/styles/prose.css +252 -0
- package/src/styles/radius.css +20 -0
- package/src/styles/segmented.css +208 -0
- package/src/styles/slider.css +110 -0
- package/src/styles/status.css +108 -0
- package/src/styles/tabs.css +39 -0
- package/src/styles/toast.css +106 -0
- package/src/styles/touch.css +41 -0
- package/src/styles/type.css +54 -0
- package/src/styles.css +38 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The moving parts of a slider.
|
|
3
|
+
*
|
|
4
|
+
* Everything that travels here is a transform (`translate`, `scale`), never a width, an inset or
|
|
5
|
+
* a padding: transforms are animated by the compositor at the screen's full rate (120Hz on a
|
|
6
|
+
* phone), where anything that needs layout is redone on the main thread, at half that or less.
|
|
7
|
+
*
|
|
8
|
+
* Places are worked out in CSS from one number per thumb, `--p` (0 at the lowest value, 1 at the
|
|
9
|
+
* highest), and the width of the control (`100cqw`: the control is a size container). Nothing is
|
|
10
|
+
* measured in JavaScript, so the first frame is already right.
|
|
11
|
+
*
|
|
12
|
+
* What follows a finger eases on `--slider-chase`: the `snap` spring written as a plain bezier
|
|
13
|
+
* (within 0.02 of it; a test compares the two). Safari's compositor takes a bezier whose values
|
|
14
|
+
* stay between 0 and 1 and nothing else, so a `linear()` spring would run on its main thread,
|
|
15
|
+
* which an iPhone holds at 60 frames a second.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/* On the control: the lengths the parts below share. */
|
|
19
|
+
@utility slider-geometry {
|
|
20
|
+
container-type: inline-size;
|
|
21
|
+
--slider-thumb: calc(var(--switch-h) - 4px);
|
|
22
|
+
/* How far a thumb's centre can go: it stops inside the trough, 2px from its wall. */
|
|
23
|
+
--slider-travel: calc(100cqw - var(--slider-thumb));
|
|
24
|
+
--slider-chase: cubic-bezier(0.3, 0.95, 0.25, 1);
|
|
25
|
+
--slider-dir: 1;
|
|
26
|
+
&:dir(rtl) {
|
|
27
|
+
--slider-dir: -1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* A part that rides with a thumb. Set `--p` on it; its box starts where the travel starts. */
|
|
32
|
+
@utility slider-at {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 50%;
|
|
35
|
+
inset-inline-start: 0;
|
|
36
|
+
translate: calc(var(--slider-dir) * var(--p, 0) * var(--slider-travel)) -50%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* How a travelling part moves: on `glide` when the value was set by a key, a press on the trough
|
|
41
|
+
* or from outside; chasing the pointer while it is dragged, which also evens out the steps of a
|
|
42
|
+
* coarse value.
|
|
43
|
+
*/
|
|
44
|
+
@utility slider-travels {
|
|
45
|
+
transition-property: translate;
|
|
46
|
+
transition-timing-function: var(--ease-spring-glide);
|
|
47
|
+
transition-duration: var(--transition-duration-spring-glide);
|
|
48
|
+
|
|
49
|
+
:where([data-dragging]) & {
|
|
50
|
+
transition-timing-function: var(--slider-chase);
|
|
51
|
+
transition-duration: var(--transition-duration-spring-snap);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
* The part that deforms: the thumb's face, and the cap of the fill that holds it. It is centred
|
|
57
|
+
* in its rider. Set `--size` (its length at rest), `--s` (how stretched: 1 at rest) and `--d`
|
|
58
|
+
* (the way it travels on screen: 1 to the right, -1 to the left).
|
|
59
|
+
*
|
|
60
|
+
* Stretched, it is longer and a little thinner, and it moves back by half of what it gained:
|
|
61
|
+
* the leading edge stays under the finger and the trailing side lags. `--squash` is how much
|
|
62
|
+
* thinner (0.3 of the stretch); the cap sets it to 0 and keeps the height of the fill it ends,
|
|
63
|
+
* or a step would show where the two meet.
|
|
64
|
+
*/
|
|
65
|
+
@utility slider-body {
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 50%;
|
|
68
|
+
left: 50%;
|
|
69
|
+
scale: var(--s, 1) calc(1 - (var(--s, 1) - 1) * var(--squash, 0.3));
|
|
70
|
+
translate: calc(-50% + var(--d, 1) * (var(--s, 1) - 1) * var(--size) / -2) -50%;
|
|
71
|
+
/*
|
|
72
|
+
* Let go, the shape comes back on `rebound`, whose swing past the rest shape is the squash.
|
|
73
|
+
* The width is the widening while the thumb is held: a state, so it seats like the switch's.
|
|
74
|
+
*/
|
|
75
|
+
transition:
|
|
76
|
+
scale var(--transition-duration-spring-rebound) var(--ease-spring-rebound),
|
|
77
|
+
translate var(--transition-duration-spring-rebound) var(--ease-spring-rebound),
|
|
78
|
+
width var(--transition-duration-spring-seat) var(--ease-spring-seat),
|
|
79
|
+
box-shadow var(--transition-duration-spring-seat) var(--ease-spring-seat),
|
|
80
|
+
background-color var(--transition-duration-spring-seat) var(--ease-spring-seat);
|
|
81
|
+
|
|
82
|
+
/* While the thumb travels the stretch follows its speed at once, without a swing. */
|
|
83
|
+
:where([data-moving]) & {
|
|
84
|
+
transition:
|
|
85
|
+
scale var(--transition-duration-spring-snap) var(--slider-chase),
|
|
86
|
+
translate var(--transition-duration-spring-snap) var(--slider-chase),
|
|
87
|
+
width var(--transition-duration-spring-seat) var(--ease-spring-seat),
|
|
88
|
+
box-shadow var(--transition-duration-spring-seat) var(--ease-spring-seat),
|
|
89
|
+
background-color var(--transition-duration-spring-seat) var(--ease-spring-seat);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* The fill is a bar as long as the trough that is pushed out of it at the start, so only its end
|
|
95
|
+
* shows: `--fill-end` is where it ends, from the start of the trough. In a range a window with
|
|
96
|
+
* the same trick cuts its beginning: `--fill-start`.
|
|
97
|
+
*/
|
|
98
|
+
@utility slider-fill-window {
|
|
99
|
+
position: absolute;
|
|
100
|
+
inset-block: 0;
|
|
101
|
+
inset-inline-start: 0;
|
|
102
|
+
width: 100%;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
translate: calc(var(--slider-dir) * var(--fill-start, 0px));
|
|
105
|
+
}
|
|
106
|
+
@utility slider-fill-bar {
|
|
107
|
+
position: absolute;
|
|
108
|
+
inset: 0;
|
|
109
|
+
translate: calc(var(--slider-dir) * (var(--fill-end, 0px) - var(--fill-start, 0px) - 100%));
|
|
110
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Status colours: a UI-only extension. The kit has none ("severity is said in words"), so a status
|
|
3
|
+
* here always arrives WITH words and an icon; colour alone never carries it.
|
|
4
|
+
*
|
|
5
|
+
* Each hue is the accent's lightness and chroma on that ground, turned to its hue angle, so the
|
|
6
|
+
* four sit beside Indigo and Ink instead of fighting them. Info reuses the Indigo/Tint family.
|
|
7
|
+
*
|
|
8
|
+
* Per status: `<s>` text, icon and edge (4.5:1 on ground, surface and its own soft fill),
|
|
9
|
+
* `<s>-soft` wash, `<s>-solid` fill, `on-<s>` text on the solid fill. Contrast is asserted in
|
|
10
|
+
* src/styles/tokens.test.ts.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
:root,
|
|
14
|
+
[data-theme="paper"],
|
|
15
|
+
[data-theme="tint"] {
|
|
16
|
+
--lf-danger: #bd1f3d;
|
|
17
|
+
--lf-danger-soft: #ffebea;
|
|
18
|
+
--lf-danger-solid: #bd1f3d;
|
|
19
|
+
--lf-on-danger: #ffffff;
|
|
20
|
+
|
|
21
|
+
--lf-warning: #8a5600;
|
|
22
|
+
--lf-warning-soft: #feefcf;
|
|
23
|
+
--lf-warning-solid: #f4b93c;
|
|
24
|
+
--lf-on-warning: #13121c;
|
|
25
|
+
|
|
26
|
+
--lf-success: #07703f;
|
|
27
|
+
--lf-success-soft: #dff8e6;
|
|
28
|
+
--lf-success-solid: #07703f;
|
|
29
|
+
--lf-on-success: #ffffff;
|
|
30
|
+
|
|
31
|
+
--lf-info: #5f50d0;
|
|
32
|
+
--lf-info-soft: #edeafc;
|
|
33
|
+
--lf-info-solid: #5f50d0;
|
|
34
|
+
--lf-on-info: #ffffff;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* On Tint the info wash would vanish into the ground, so it steps to white. */
|
|
38
|
+
[data-theme="tint"] {
|
|
39
|
+
--lf-info-soft: #ffffff;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dark,
|
|
43
|
+
[data-theme="ink"] {
|
|
44
|
+
--lf-danger: #f1878c;
|
|
45
|
+
--lf-danger-soft: #4b1d20;
|
|
46
|
+
--lf-danger-solid: #f1878c;
|
|
47
|
+
--lf-on-danger: #13121c;
|
|
48
|
+
|
|
49
|
+
--lf-warning: #eebb58;
|
|
50
|
+
--lf-warning-soft: #3b2b0d;
|
|
51
|
+
--lf-warning-solid: #eebb58;
|
|
52
|
+
--lf-on-warning: #13121c;
|
|
53
|
+
|
|
54
|
+
--lf-success: #6cd092;
|
|
55
|
+
--lf-success-soft: #143320;
|
|
56
|
+
--lf-success-solid: #6cd092;
|
|
57
|
+
--lf-on-success: #13121c;
|
|
58
|
+
|
|
59
|
+
--lf-info: #a6a1fd;
|
|
60
|
+
--lf-info-soft: #2b2654;
|
|
61
|
+
--lf-info-solid: #a6a1fd;
|
|
62
|
+
--lf-on-info: #13121c;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Indigo is the ask: nothing competes with it. Statuses there are white, in words. */
|
|
66
|
+
[data-theme="indigo"] {
|
|
67
|
+
--lf-danger: #ffffff;
|
|
68
|
+
--lf-danger-soft: #5244c2;
|
|
69
|
+
--lf-danger-solid: #ffffff;
|
|
70
|
+
--lf-on-danger: #bd1f3d;
|
|
71
|
+
|
|
72
|
+
--lf-warning: #ffffff;
|
|
73
|
+
--lf-warning-soft: #5244c2;
|
|
74
|
+
--lf-warning-solid: #ffffff;
|
|
75
|
+
--lf-on-warning: #8a5600;
|
|
76
|
+
|
|
77
|
+
--lf-success: #ffffff;
|
|
78
|
+
--lf-success-soft: #5244c2;
|
|
79
|
+
--lf-success-solid: #ffffff;
|
|
80
|
+
--lf-on-success: #07703f;
|
|
81
|
+
|
|
82
|
+
--lf-info: #ffffff;
|
|
83
|
+
--lf-info-soft: #5244c2;
|
|
84
|
+
--lf-info-solid: #ffffff;
|
|
85
|
+
--lf-on-info: #5f50d0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@theme inline {
|
|
89
|
+
--color-danger: var(--lf-danger);
|
|
90
|
+
--color-danger-soft: var(--lf-danger-soft);
|
|
91
|
+
--color-danger-solid: var(--lf-danger-solid);
|
|
92
|
+
--color-on-danger: var(--lf-on-danger);
|
|
93
|
+
|
|
94
|
+
--color-warning: var(--lf-warning);
|
|
95
|
+
--color-warning-soft: var(--lf-warning-soft);
|
|
96
|
+
--color-warning-solid: var(--lf-warning-solid);
|
|
97
|
+
--color-on-warning: var(--lf-on-warning);
|
|
98
|
+
|
|
99
|
+
--color-success: var(--lf-success);
|
|
100
|
+
--color-success-soft: var(--lf-success-soft);
|
|
101
|
+
--color-success-solid: var(--lf-success-solid);
|
|
102
|
+
--color-on-success: var(--lf-on-success);
|
|
103
|
+
|
|
104
|
+
--color-info: var(--lf-info);
|
|
105
|
+
--color-info-soft: var(--lf-info-soft);
|
|
106
|
+
--color-info-solid: var(--lf-info-solid);
|
|
107
|
+
--color-on-info: var(--lf-on-info);
|
|
108
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A row of tabs wider than its place scrolls sideways inside itself (tabs.tsx), and its edges
|
|
3
|
+
* fade where more tabs wait, as a code block's long lines do (code.css): a tab cut by the edge
|
|
4
|
+
* says that the row goes on. The two lengths are registered so the mask moves on a spring;
|
|
5
|
+
* `useScrollEdges` sets `data-overflow` from the scroll position. A row that fits has no mask.
|
|
6
|
+
*/
|
|
7
|
+
@property --tabs-fade-start {
|
|
8
|
+
syntax: "<length>";
|
|
9
|
+
inherits: false;
|
|
10
|
+
initial-value: 0px;
|
|
11
|
+
}
|
|
12
|
+
@property --tabs-fade-end {
|
|
13
|
+
syntax: "<length>";
|
|
14
|
+
inherits: false;
|
|
15
|
+
initial-value: 0px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@layer components {
|
|
19
|
+
[data-slot="tabs-list"] {
|
|
20
|
+
transition:
|
|
21
|
+
--tabs-fade-start var(--transition-duration-spring-settle) var(--ease-spring-settle),
|
|
22
|
+
--tabs-fade-end var(--transition-duration-spring-settle) var(--ease-spring-settle);
|
|
23
|
+
}
|
|
24
|
+
[data-slot="tabs-list"][data-overflow] {
|
|
25
|
+
mask-image: linear-gradient(
|
|
26
|
+
to right,
|
|
27
|
+
transparent,
|
|
28
|
+
#000 var(--tabs-fade-start),
|
|
29
|
+
#000 calc(100% - var(--tabs-fade-end)),
|
|
30
|
+
transparent
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
[data-slot="tabs-list"][data-overflow~="start"] {
|
|
34
|
+
--tabs-fade-start: 2.5rem;
|
|
35
|
+
}
|
|
36
|
+
[data-slot="tabs-list"][data-overflow~="end"] {
|
|
37
|
+
--tabs-fade-end: 2.5rem;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Toasts: the geometry of the stack. Colours, depth and type come from utilities on the
|
|
3
|
+
* component; this file only says where a toast sits and how it gets there.
|
|
4
|
+
*
|
|
5
|
+
* Ported from Base UI's reference styles. Base UI sets the variables on each toast:
|
|
6
|
+
* --toast-index 0 for the newest, counting up behind it
|
|
7
|
+
* --toast-height its natural height
|
|
8
|
+
* --toast-frontmost-height the newest toast's height (on the viewport)
|
|
9
|
+
* --toast-offset-y its distance from the bottom when the stack is expanded
|
|
10
|
+
* --toast-swipe-movement-x/y how far it is being dragged
|
|
11
|
+
*
|
|
12
|
+
* Collapsed, older toasts peek out above the newest one, scaled down. Hovering or focusing the
|
|
13
|
+
* stack expands it into a list. A toast enters by rising from below (`sheet`), leaves by fading
|
|
14
|
+
* where it is, and one that was swiped away keeps going in the direction it was thrown.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@utility toast-stack {
|
|
18
|
+
--gap: 0.625rem;
|
|
19
|
+
--peek: 0.625rem;
|
|
20
|
+
--scale: calc(max(0, 1 - (var(--toast-index) * 0.06)));
|
|
21
|
+
--shrink: calc(1 - var(--scale));
|
|
22
|
+
--height: var(--toast-frontmost-height, var(--toast-height));
|
|
23
|
+
--offset-y: calc(
|
|
24
|
+
var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) +
|
|
25
|
+
var(--toast-swipe-movement-y)
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
position: absolute;
|
|
29
|
+
right: 0;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
left: auto;
|
|
32
|
+
z-index: calc(1000 - var(--toast-index));
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: var(--height);
|
|
35
|
+
transform-origin: bottom center;
|
|
36
|
+
user-select: none;
|
|
37
|
+
transform: translateX(var(--toast-swipe-movement-x))
|
|
38
|
+
translateY(
|
|
39
|
+
calc(
|
|
40
|
+
var(--toast-swipe-movement-y) - (var(--toast-index) * var(--peek)) -
|
|
41
|
+
(var(--shrink) * var(--height))
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
scale(var(--scale));
|
|
45
|
+
transition:
|
|
46
|
+
transform var(--transition-duration-spring-sheet) var(--ease-spring-sheet),
|
|
47
|
+
opacity var(--transition-duration-spring-sheet) var(--ease-spring-sheet),
|
|
48
|
+
height 150ms ease-out;
|
|
49
|
+
|
|
50
|
+
&[data-expanded] {
|
|
51
|
+
height: var(--toast-height);
|
|
52
|
+
transform: translateX(var(--toast-swipe-movement-x)) translateY(var(--offset-y));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-starting-style] {
|
|
56
|
+
transform: translateY(150%);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Over the limit: kept mounted, out of sight. */
|
|
60
|
+
&[data-limited] {
|
|
61
|
+
opacity: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* While a finger drags it, the toast follows at once. */
|
|
65
|
+
&[data-swiping] {
|
|
66
|
+
transition-duration: 0s, 0s, 150ms;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&[data-ending-style] {
|
|
70
|
+
opacity: 0;
|
|
71
|
+
transition-duration: var(--transition-duration-spring-leave);
|
|
72
|
+
transition-timing-function: var(--ease-spring-leave);
|
|
73
|
+
|
|
74
|
+
&[data-swipe-direction="up"] {
|
|
75
|
+
transform: translateY(calc(var(--toast-swipe-movement-y) - 150%));
|
|
76
|
+
}
|
|
77
|
+
&[data-swipe-direction="down"] {
|
|
78
|
+
transform: translateY(calc(var(--toast-swipe-movement-y) + 150%));
|
|
79
|
+
}
|
|
80
|
+
&[data-swipe-direction="left"] {
|
|
81
|
+
transform: translateX(calc(var(--toast-swipe-movement-x) - 150%)) translateY(var(--offset-y));
|
|
82
|
+
}
|
|
83
|
+
&[data-swipe-direction="right"] {
|
|
84
|
+
transform: translateX(calc(var(--toast-swipe-movement-x) + 150%)) translateY(var(--offset-y));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Fills the gap to the toast below, so the pointer does not leave the stack between toasts. */
|
|
89
|
+
&::after {
|
|
90
|
+
content: "";
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: 100%;
|
|
93
|
+
left: 0;
|
|
94
|
+
width: 100%;
|
|
95
|
+
height: calc(var(--gap) + 1px);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media (prefers-reduced-motion: reduce) {
|
|
99
|
+
transition-property: opacity, height;
|
|
100
|
+
|
|
101
|
+
&[data-starting-style] {
|
|
102
|
+
opacity: 0;
|
|
103
|
+
transform: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Touch: what changes when the pointer is a finger (`pointer: coarse`).
|
|
3
|
+
*
|
|
4
|
+
* Controls keep their size and their look. A control smaller than 44px gets an invisible target
|
|
5
|
+
* of that size around it (`touch-target`), so a thumb can still hit it. The control has to be
|
|
6
|
+
* positioned (`relative` or `absolute`) and must not clip.
|
|
7
|
+
*
|
|
8
|
+
* Two things do grow, because an invisible target cannot help them: the text of a field is 16px
|
|
9
|
+
* on touch (`pointer-coarse:text-base` in the field recipe; below that iOS zooms in on focus),
|
|
10
|
+
* and the days of a calendar, which stand edge to edge, are larger cells.
|
|
11
|
+
*
|
|
12
|
+
* `data-pointer="coarse"` on any element turns the targets on for its subtree without a touch
|
|
13
|
+
* device: for a kiosk, and for looking at them on a desk (see the Foundations/Touch board).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* The target is the control's `::after`: centred on it, at least 44px each way, never smaller
|
|
18
|
+
* than the control itself. A press on it is a press on the control.
|
|
19
|
+
*/
|
|
20
|
+
@utility touch-target {
|
|
21
|
+
@media (pointer: coarse) {
|
|
22
|
+
&::after {
|
|
23
|
+
content: "";
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 50%;
|
|
26
|
+
left: 50%;
|
|
27
|
+
width: max(100%, 2.75rem);
|
|
28
|
+
height: max(100%, 2.75rem);
|
|
29
|
+
translate: -50% -50%;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
&:where([data-pointer="coarse"] *)::after {
|
|
33
|
+
content: "";
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 50%;
|
|
36
|
+
left: 50%;
|
|
37
|
+
width: max(100%, 2.75rem);
|
|
38
|
+
height: max(100%, 2.75rem);
|
|
39
|
+
translate: -50% -50%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Type. One family, Sofia Sans, in the kit's four weights (400 body, 500 display and control
|
|
3
|
+
* labels, 600 heads and the highlighted datum, 700 the wordmark and <b>). JetBrains Mono only for
|
|
4
|
+
* strings a machine reads.
|
|
5
|
+
*
|
|
6
|
+
* Sofia Sans is small on its em (x-height 488/1000): 16px of it reads like 14.3px of Inter. So the
|
|
7
|
+
* kit's document scale IS the UI scale: 16px body, 13.5px for secondary text. The one size off the
|
|
8
|
+
* scale is `text-control` (density.css): control and field labels, 15px in compact density.
|
|
9
|
+
*
|
|
10
|
+
* The fonts are not shipped here. Apps provide them and expose two variables on <html>:
|
|
11
|
+
* --font-sofia-sans, --font-jetbrains-mono (next/font does this)
|
|
12
|
+
* or load the Fontsource variable packages, whose family names are the fallbacks below.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@theme inline {
|
|
16
|
+
--font-sans: var(--font-sofia-sans, "Sofia Sans Variable", "Sofia Sans"), Arial, sans-serif;
|
|
17
|
+
--font-mono:
|
|
18
|
+
var(--font-jetbrains-mono, "JetBrains Mono Variable", "JetBrains Mono"), "Courier New",
|
|
19
|
+
monospace;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* The scale sits on Tailwind's t-shirt keys so tailwind-merge resolves conflicts without extra
|
|
24
|
+
* config. Role names (title, lead, label …) live in the Text and Heading components.
|
|
25
|
+
* Kit rule: display sizes are tracked negatively, body sizes not at all, nothing positively.
|
|
26
|
+
*/
|
|
27
|
+
@theme {
|
|
28
|
+
--text-xs: 0.75rem; /* 12: the floor. Legal lines only, never a control. */
|
|
29
|
+
--text-xs--line-height: 1.45;
|
|
30
|
+
--text-sm: 0.84375rem; /* 13.5: helper, error, group label, small controls */
|
|
31
|
+
--text-sm--line-height: 1.45;
|
|
32
|
+
--text-base: 1rem; /* 16: body; control labels in comfortable density */
|
|
33
|
+
--text-base--line-height: 1.5;
|
|
34
|
+
--text-lg: 1.25rem; /* 20: lead, dialog title */
|
|
35
|
+
--text-lg--line-height: 1.4;
|
|
36
|
+
--text-xl: 1.5rem; /* 24: section heading under a rule */
|
|
37
|
+
--text-xl--line-height: 1.2;
|
|
38
|
+
--text-xl--letter-spacing: -0.008em;
|
|
39
|
+
--text-2xl: 2.25rem; /* 36: page title */
|
|
40
|
+
--text-2xl--line-height: 1.12;
|
|
41
|
+
--text-2xl--letter-spacing: -0.017em;
|
|
42
|
+
--text-3xl: 3.375rem; /* 54: display */
|
|
43
|
+
--text-3xl--line-height: 1.04;
|
|
44
|
+
--text-3xl--letter-spacing: -0.022em;
|
|
45
|
+
--text-4xl: 4.5rem; /* 72 */
|
|
46
|
+
--text-4xl--line-height: 1.06;
|
|
47
|
+
--text-4xl--letter-spacing: -0.017em;
|
|
48
|
+
--text-5xl: 6.75rem; /* 108 */
|
|
49
|
+
--text-5xl--line-height: 1.04;
|
|
50
|
+
--text-5xl--letter-spacing: -0.022em;
|
|
51
|
+
--text-6xl: 10.125rem; /* 162 */
|
|
52
|
+
--text-6xl--line-height: 0.98;
|
|
53
|
+
--text-6xl--letter-spacing: -0.025em;
|
|
54
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @lanfermann/ui: tokens, depth, motion and source registration for Tailwind CSS v4.
|
|
3
|
+
*
|
|
4
|
+
* Consumers import it right after Tailwind in their global stylesheet:
|
|
5
|
+
* @import "tailwindcss";
|
|
6
|
+
* @import "@lanfermann/ui/styles.css";
|
|
7
|
+
*
|
|
8
|
+
* Contract: components use only the semantic tokens defined in ./styles (bg-ground, text-fg,
|
|
9
|
+
* border-line, depth-raised, spring-settle, …), never raw palette colours and never a `dark:`
|
|
10
|
+
* variant. Grounds switch with `data-theme="paper|tint|ink|indigo"` on any element; `.dark` is an
|
|
11
|
+
* alias for Ink. Control size switches with `data-density="compact|comfortable"` (compact is the
|
|
12
|
+
* default). The partials are private: import this file only.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@import "./styles/grounds.css";
|
|
16
|
+
@import "./styles/status.css";
|
|
17
|
+
@import "./styles/code.css";
|
|
18
|
+
@import "./styles/type.css";
|
|
19
|
+
@import "./styles/radius.css";
|
|
20
|
+
@import "./styles/density.css";
|
|
21
|
+
@import "./styles/touch.css";
|
|
22
|
+
@import "./styles/depth.css";
|
|
23
|
+
@import "./styles/motion.generated.css";
|
|
24
|
+
@import "./styles/motion.css";
|
|
25
|
+
@import "./styles/marks.css";
|
|
26
|
+
@import "./styles/toast.css";
|
|
27
|
+
@import "./styles/slider.css";
|
|
28
|
+
@import "./styles/segmented.css";
|
|
29
|
+
@import "./styles/tabs.css";
|
|
30
|
+
@import "./styles/calendar.css";
|
|
31
|
+
@import "./styles/prose.css";
|
|
32
|
+
@import "./styles/base.css";
|
|
33
|
+
|
|
34
|
+
/* Let the consumer's Tailwind see the class names used in the compiled components. */
|
|
35
|
+
@source "../dist";
|
|
36
|
+
|
|
37
|
+
/* For app code that wants a dark variant: it follows the Ink ground. */
|
|
38
|
+
@custom-variant dark (&:where(.dark, .dark *, [data-theme="ink"], [data-theme="ink"] *));
|