shelving 1.296.0 → 1.297.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.296.0",
3
+ "version": "1.297.1",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
package/ui/block/Card.md CHANGED
@@ -71,7 +71,7 @@ import { Card, Subheading } from "shelving/ui";
71
71
  | `--card-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
72
72
  | `--card-shadow` | Drop shadow | `none` |
73
73
  | `--card-transition` | Transition | `all var(--duration-fast)` (150ms) |
74
- | `--card-focus-border` | Focus outline | `var(--stroke-focus) solid var(--color-focus)` |
74
+ | `--card-focus-border` | Focus outline, drawn on the navigable overlay so it shows above children like `<Panel>` | `var(--stroke-focus) solid var(--color-focus)` |
75
75
 
76
76
  **Global tokens it reads** — move these to retheme broadly rather than overriding ladder steps directly: the tint ladder `--tint-00` / `--tint-80` / `--tint-90` / `--tint-95`, plus `--space-normal`, `--space-paragraph`, `--radius-normal`, `--stroke-focus`, `--color-focus`, and `--duration-fast`.
77
77
 
@@ -33,8 +33,6 @@
33
33
  color: var(--card-color, var(--tint-00));
34
34
  box-shadow: var(--card-shadow, none);
35
35
  transition: var(--card-transition, all var(--duration-fast));
36
- outline: var(--card-focus-border, var(--stroke-focus) solid var(--color-focus));
37
- outline-offset: calc(0px - var(--stroke-focus)); /* Fully inset, so it sits inside the card edge. */
38
36
 
39
37
  /* Hover/focus affordance driven by the overlay link/button. */
40
38
  &:has(.overlay:hover) {
@@ -50,11 +48,15 @@
50
48
  inset: 0;
51
49
  z-index: 1;
52
50
  border: 0;
51
+ border-radius: inherit;
53
52
 
54
53
  /* Style */
55
54
  background: transparent;
56
55
  cursor: pointer;
57
- outline: 0;
56
+
57
+ /* Focus ring — drawn on the overlay so it paints above positioned children (e.g. `.panel`). The offset pushes it out over the card border, so it sits fully inside the card edge. */
58
+ outline: var(--card-focus-border, var(--stroke-focus) solid var(--color-focus));
59
+ outline-offset: calc(var(--card-stroke, 0px) - var(--stroke-focus));
58
60
 
59
61
  /* Typography — hide the link's text visually but keep it in the accessibility tree. */
60
62
  color: transparent;
@@ -67,9 +69,9 @@
67
69
  }
68
70
 
69
71
  @layer overrides {
70
- .card {
71
- /* Show the focus ring only while the navigable overlay is keyboard-focused; hide it otherwise (including non-clickable cards, which have no overlay). */
72
- &:not(:has(.overlay:focus-visible)) {
72
+ .card > .overlay {
73
+ /* Show the focus ring only while the overlay is keyboard-focused. */
74
+ &:not(:focus-visible) {
73
75
  outline-color: transparent;
74
76
  }
75
77
  }
@@ -71,10 +71,10 @@ function DeleteButton({ onConfirm }: { onConfirm: () => void }) {
71
71
  | `--dialog-padding` | Top and bottom padding around the centred content (one length) | `var(--space-normal)` (16px) |
72
72
  | `--dialog-indent` | Left and right padding around the centred content (one length) | `var(--space-normal)` (16px) |
73
73
  | `--dialog-width` | Width of the centred content, and so of a centred `<Modal>` | `var(--width-narrow)` (36rem) |
74
- | `--dialog-background` | Overlay fill behind the content | `var(--shadow-color)` |
74
+ | `--dialog-background` | Overlay fill behind the content | `var(--color-backdrop)` |
75
75
  | `--dialog-color` | Text colour directly on the overlay | `var(--tint-100)` (white) |
76
76
  | `--dialog-close-offset` | Inset of the close button from the top-right corner | `var(--space-small)` (12px) |
77
77
 
78
78
  The fade uses the `fade` class from `<FadeTransition>`, so `--fade-transition-duration` sets its length. It runs only as the dialog opens and closes; an open dialog stays still while other dialogs open and close.
79
79
 
80
- **Global tokens it reads** — move these to retheme broadly: `--tint-100`, `--width-narrow`, `--space-normal`, `--space-small`, `--shadow-color`, and `--duration-fast` (through `<FadeTransition>`).
80
+ **Global tokens it reads** — move these to retheme broadly: `--tint-100`, `--width-narrow`, `--space-normal`, `--space-small`, `--color-backdrop`, and `--duration-fast` (through `<FadeTransition>`).
@@ -1,7 +1,6 @@
1
1
  @import url("../style/layers.css");
2
2
  @import url("../style/Color.module.css");
3
3
  @import url("../style/Space.module.css");
4
- @import url("../style/Shadow.module.css");
5
4
  @import url("../style/Tint.module.css");
6
5
  @import url("../style/Width.module.css");
7
6
 
@@ -27,7 +26,7 @@
27
26
 
28
27
  /* Style */
29
28
  color: var(--dialog-color, var(--tint-100));
30
- background: var(--dialog-background, var(--shadow-color));
29
+ background: var(--dialog-background, var(--color-backdrop));
31
30
 
32
31
  /* Flex only to centre `.content`, its one in-flow child. */
33
32
  &[open] {
@@ -33,7 +33,7 @@ export interface ModalProps extends ModalVariants, PaddingVariants, IndentVarian
33
33
  * Styled `<aside>` panel for content inside a `<Dialog>`, with dark text on a light surface.
34
34
  *
35
35
  * - Centred by default. It fades in and out with its `<Dialog>`.
36
- * - Has a `--shadow-normal` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="large"` to change it.
36
+ * - Has a `--shadow-large` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="normal"` to change it.
37
37
  * - `top`, `right`, `bottom`, or `left` pins it to that edge. It then takes its own layer in the `<Dialog>` view transition, and slides in from that edge and out to it.
38
38
  *
39
39
  * @kind component
@@ -9,7 +9,7 @@ import styles from "./Modal.module.css";
9
9
  * Styled `<aside>` panel for content inside a `<Dialog>`, with dark text on a light surface.
10
10
  *
11
11
  * - Centred by default. It fades in and out with its `<Dialog>`.
12
- * - Has a `--shadow-normal` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="large"` to change it.
12
+ * - Has a `--shadow-large` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="normal"` to change it.
13
13
  * - `top`, `right`, `bottom`, or `left` pins it to that edge. It then takes its own layer in the `<Dialog>` view transition, and slides in from that edge and out to it.
14
14
  *
15
15
  * @kind component
@@ -11,7 +11,7 @@ The panel inside a `<Dialog>`. `<Dialog>` dims the page; `Modal` gives the conte
11
11
  - A centred `Modal` fills the width of its `<Dialog>`, so set `--dialog-width` to change it. `--modal-width` sets the width of a `left` or `right` panel, and the maximum width of a `top` or `bottom` panel.
12
12
  - The `padding` variant (for example `padding="large"`) sets the top and bottom padding, and the `indent` variant sets the left and right padding, the same as on `<Panel>`.
13
13
  - The `radius` variant sets the corner radius. On a pinned panel, corners that touch a screen edge stay square.
14
- - It has a `--shadow-normal` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="large"` to change it, the same as on `<Card>`.
14
+ - It has a `--shadow-large` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="normal"` to change it, the same as on `<Card>`.
15
15
  - Set `top`, `right`, `bottom`, or `left` to pin the panel to that edge of the screen. A top or bottom panel is full width up to `--modal-width`, and centred on a wider screen. A left or right panel is full height. Use these for mobile menus, bottom sheets, and side menus.
16
16
  - A centred panel fades in and out with its `<Dialog>`. A pinned panel slides in from its edge and out to it, in its own view-transition layer. With reduced motion, a pinned panel fades in place.
17
17
 
@@ -67,8 +67,8 @@ function DeleteButton({ onConfirm }: { onConfirm: () => void }) {
67
67
  ### Shadow
68
68
 
69
69
  ```tsx
70
- <Modal shadow="large">
71
- <p>Raised above the overlay.</p>
70
+ <Modal shadow="small">
71
+ <p>Sits closer to the page.</p>
72
72
  </Modal>
73
73
  ```
74
74
 
@@ -110,6 +110,6 @@ A link click inside a `<Dialog>` closes it, so the menu slides out as the page c
110
110
  | `--modal-color` | Text colour | `var(--tint-00)` |
111
111
  | `--modal-max-height` | Maximum height of a `top` or `bottom` panel (it scrolls past this) | `100%` |
112
112
  | `--modal-transition-duration` | Length of the slide for a pinned panel. Keep it the same as `--fade-transition-duration`, so the panel and the `<Dialog>` overlay finish together | `var(--duration-fast)` (150ms) |
113
- | `--modal-shadow` | Drop shadow (the `shadow` variant wins over it) | `var(--shadow-normal)` |
113
+ | `--modal-shadow` | Drop shadow (the `shadow` variant wins over it) | `var(--shadow-large)` |
114
114
 
115
- **Global tokens it reads** — move these to retheme broadly: the tint ladder `--tint-00` / `--tint-80` / `--tint-100`, plus `--width-narrow`, `--space-normal`, `--radius-normal`, `--shadow-normal`, and `--duration-fast`.
115
+ **Global tokens it reads** — move these to retheme broadly: the tint ladder `--tint-00` / `--tint-80` / `--tint-100`, plus `--width-narrow`, `--space-normal`, `--radius-normal`, `--shadow-large`, and `--duration-fast`.
@@ -21,7 +21,7 @@
21
21
 
22
22
  /* Style */
23
23
  color: var(--modal-color, var(--tint-00));
24
- box-shadow: var(--modal-shadow, var(--shadow-normal));
24
+ box-shadow: var(--modal-shadow, var(--shadow-large));
25
25
 
26
26
  /* Pinned to an edge: fixed to the viewport, flush with the edge, and scrolls when its content is too tall. */
27
27
  &.top,
@@ -44,7 +44,7 @@ export interface ModalProps
44
44
  * Styled `<aside>` panel for content inside a `<Dialog>`, with dark text on a light surface.
45
45
  *
46
46
  * - Centred by default. It fades in and out with its `<Dialog>`.
47
- * - Has a `--shadow-normal` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="large"` to change it.
47
+ * - Has a `--shadow-large` drop shadow by default. Set `shadow="none"`, `shadow="small"` or `shadow="normal"` to change it.
48
48
  * - `top`, `right`, `bottom`, or `left` pins it to that edge. It then takes its own layer in the `<Dialog>` view transition, and slides in from that edge and out to it.
49
49
  *
50
50
  * @kind component
@@ -44,7 +44,8 @@ Layouts compose naturally as `<Router>` route values — wrap a group of routes
44
44
  | `--sidebar-layout-sidebar-background` | Sidebar column fill | `var(--tint-90)` (one shade darker than the page) |
45
45
  | `--sidebar-layout-sidebar-color` | Sidebar column text colour | `var(--tint-00)` (black) |
46
46
  | `--sidebar-layout-border` | Divider between sidebar and content, e.g. `1px solid var(--tint-80)` | `none` |
47
+ | `--sidebar-layout-shadow` | Drop shadow of the open drawer on a narrow screen | `var(--shadow-large)` |
47
48
 
48
49
  The sidebar and content columns own their own scroll behaviour directly (this layout no longer composes a shared `.layout` class).
49
50
 
50
- **Global tokens it reads** — `--tint-00` / `--tint-90` / `--tint-100`, plus `--space-normal`, `--duration-normal`, and `--color-shadow`.
51
+ **Global tokens it reads** — `--tint-00` / `--tint-90` / `--tint-100`, plus `--space-normal`, `--duration-normal`, `--shadow-large`, and `--color-backdrop`.
@@ -159,7 +159,7 @@
159
159
 
160
160
  .sidebar.open {
161
161
  transform: translateX(0);
162
- box-shadow: 0 0 1.5rem #0006;
162
+ box-shadow: var(--sidebar-layout-shadow, var(--shadow-large));
163
163
  }
164
164
 
165
165
  /* Right variant: dock the drawer to the right edge and slide it in from the right instead. */
@@ -194,7 +194,7 @@
194
194
  border: 0;
195
195
 
196
196
  /* Style */
197
- background: var(--shadow-color);
197
+ background: var(--color-backdrop);
198
198
  cursor: pointer;
199
199
 
200
200
  /* Hidden and non-interactive until open. Transition `visibility` alongside `opacity` so the overlay stays in the a11y tree (and clickable) only while shown, then flips hidden at the end of the fade-out. */
@@ -69,8 +69,8 @@ notice.close(); // Or close it immediately.
69
69
  |---|---|---|
70
70
  | `--notices-offset` | Distance of the list from the top or bottom edge, and from the left and right edges | `var(--space-normal)` (16px) |
71
71
  | `--notices-width` | Maximum width of the list and of each notice | `var(--width-narrow)` |
72
- | `--notices-shadow` | Drop shadow under each notice in the list (sets `--notice-shadow`) | `var(--shadow-small)` |
72
+ | `--notices-shadow` | Drop shadow under each notice in the list (sets `--notice-shadow`) | `var(--shadow-normal)` |
73
73
  | `--notices-gap` | Gap between notices | `var(--space-small)` (12px) |
74
74
  | `--notices-transition-duration` | Length of the slide in, slide out, and move | `var(--duration-fast)` (150ms) |
75
75
 
76
- **Global tokens it reads** — move these to retheme broadly: `--space-normal`, `--space-small`, `--shadow-small`, `--width-narrow`, and `--duration-fast`.
76
+ **Global tokens it reads** — move these to retheme broadly: `--space-normal`, `--space-small`, `--shadow-normal`, `--width-narrow`, and `--duration-fast`.
@@ -24,7 +24,7 @@
24
24
  pointer-events: auto;
25
25
 
26
26
  /* Floating notices sit above the page, so give each one a shadow. */
27
- --notice-shadow: var(--notices-shadow, var(--shadow-small));
27
+ --notice-shadow: var(--notices-shadow, var(--shadow-normal));
28
28
  }
29
29
  }
30
30
 
@@ -20,6 +20,7 @@
20
20
  --color-success: var(--color-green);
21
21
  --color-warning: var(--color-orange);
22
22
  --color-failure: var(--color-red);
23
+ --color-backdrop: #0006; /* Dims the page behind a dialog or an open sidebar drawer. */
23
24
 
24
25
  /* Brand colors */
25
26
  --color-primary: var(--color-blue); /* Primary brand color */
@@ -3,12 +3,12 @@
3
3
  @layer defaults {
4
4
  :root {
5
5
  /* Colors */
6
- --shadow-color: #0006;
6
+ --shadow-color: #0003;
7
7
 
8
- /* Shadows — elevation drop-shadows. */
9
- --shadow-small: 0 0.375rem 1.5rem -0.75rem var(--shadow-color);
10
- --shadow-normal: 0 0.5rem 2rem -1rem var(--shadow-color);
11
- --shadow-large: 0 0.75rem 3rem -1.5rem var(--shadow-color);
8
+ /* Shadows — elevation drop-shadows. Each has two layers with a negative spread, so no dark line shows under the bottom edge. The Y offset is small enough that a sliver of shadow also shows at the top. */
9
+ --shadow-small: 0 0.125rem 0.375rem -0.0625rem var(--shadow-color), 0 0.0625rem 0.25rem -0.125rem var(--shadow-color);
10
+ --shadow-normal: 0 0.3125rem 0.9375rem -0.1875rem var(--shadow-color), 0 0.125rem 0.375rem -0.25rem var(--shadow-color);
11
+ --shadow-large: 0 0.625rem 1.5625rem -0.3125rem var(--shadow-color), 0 0.25rem 0.625rem -0.375rem var(--shadow-color);
12
12
  }
13
13
  }
14
14
 
@@ -31,6 +31,7 @@ The following `:root` variables are defined by this module and can be overridden
31
31
  | `--color-success` | `var(--color-green)` | `status="success"`. |
32
32
  | `--color-warning` | `var(--color-orange)` | `status="warning"`. |
33
33
  | `--color-failure` | `var(--color-red)` | `status="error"` / `status="danger"`. |
34
+ | `--color-backdrop` | `#0006` | The backdrop that dims the page behind `<Dialog>` and an open `<SidebarLayout>` drawer. |
34
35
 
35
36
  ### Brand
36
37
 
@@ -4,12 +4,15 @@ This module's main job is to **define and document the elevation drop-shadow des
4
4
 
5
5
  ## Theme variables
6
6
 
7
- The following `:root` variables are defined by this module and can be overridden in a theme file to adjust default styling across the whole app. Each step deepens both blur and offset for a consistent elevation ramp.
7
+ The following `:root` variables are defined by this module and can be overridden in a theme file to adjust default styling across the whole app. The scale is [Tailwind's](https://tailwindcss.com/docs/box-shadow) `shadow-md`, `shadow-lg` and `shadow-xl` with half the Y offset, so a sliver of shadow always shows at the top. Each shadow has two layers of `--shadow-color`. Both layers have a negative spread, so no dark line shows under the bottom edge.
8
8
 
9
- | Variable | Default |
10
- |---|---|
11
- | `--shadow-small` | `0 0.375rem 1.5rem -0.75rem #0006` |
12
- | `--shadow-normal` | `0 0.5rem 2rem -1rem #0006` |
13
- | `--shadow-large` | `0 0.75rem 3rem -1.5rem #0006` |
9
+ | Variable | Default | Used by |
10
+ |---|---|---|
11
+ | `--shadow-color` | `#0003` (20% black) | Every layer of every shadow below. |
12
+ | `--shadow-small` | `0 2px 6px -1px`, `0 1px 4px -2px` | `<Popover>` |
13
+ | `--shadow-normal` | `0 5px 15px -3px`, `0 2px 6px -4px` | Floating `<Notices>` |
14
+ | `--shadow-large` | `0 10px 25px -5px`, `0 4px 10px -6px` | `<Modal>`, the open `<SidebarLayout>` drawer |
15
+
16
+ The table shows the values in pixels. The source uses `rem`.
14
17
 
15
18
  The `shadow=` variant prop accepts `"none"`, `"small"`, `"normal"`, or `"large"` — `"none"` removes a component's default shadow rather than mapping to a token.