shelving 1.237.0 → 1.239.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/package.json +1 -1
- package/ui/README.md +27 -4
- package/ui/app/App.d.ts +13 -2
- package/ui/app/App.js +15 -2
- package/ui/app/App.tsx +15 -2
- package/ui/block/Address.module.css +2 -1
- package/ui/block/Block.module.css +1 -1
- package/ui/block/Blockquote.module.css +5 -1
- package/ui/block/Caption.module.css +4 -1
- package/ui/block/Card.md +1 -1
- package/ui/block/Card.module.css +7 -1
- package/ui/block/Definitions.module.css +6 -1
- package/ui/block/Divider.module.css +4 -1
- package/ui/block/Heading.md +1 -1
- package/ui/block/Heading.module.css +5 -1
- package/ui/block/Image.module.css +2 -1
- package/ui/block/Label.module.css +6 -1
- package/ui/block/List.md +1 -1
- package/ui/block/List.module.css +2 -1
- package/ui/block/Panel.d.ts +6 -5
- package/ui/block/Panel.js +6 -5
- package/ui/block/Panel.md +1 -1
- package/ui/block/Panel.module.css +7 -5
- package/ui/block/Panel.tsx +7 -5
- package/ui/block/Paragraph.md +1 -1
- package/ui/block/Paragraph.module.css +2 -1
- package/ui/block/Preformatted.module.css +10 -1
- package/ui/block/Prose.md +1 -1
- package/ui/block/Prose.module.css +2 -1
- package/ui/block/Section.md +1 -1
- package/ui/block/Section.module.css +2 -1
- package/ui/block/Subheading.md +1 -1
- package/ui/block/Subheading.module.css +5 -1
- package/ui/block/Table.md +1 -1
- package/ui/block/Table.module.css +7 -1
- package/ui/block/Title.md +1 -1
- package/ui/block/Title.module.css +5 -1
- package/ui/block/Video.module.css +7 -1
- package/ui/dialog/Dialog.md +1 -1
- package/ui/dialog/Dialog.module.css +4 -1
- package/ui/dialog/Modal.md +2 -2
- package/ui/dialog/Modal.module.css +8 -1
- package/ui/docs/DocumentationHomePage.d.ts +15 -0
- package/ui/docs/DocumentationHomePage.js +24 -0
- package/ui/docs/DocumentationHomePage.md +42 -0
- package/ui/docs/DocumentationHomePage.test.tsx +35 -0
- package/ui/docs/DocumentationHomePage.tsx +46 -0
- package/ui/docs/index.d.ts +1 -0
- package/ui/docs/index.js +1 -0
- package/ui/docs/index.ts +1 -0
- package/ui/form/Button.md +1 -1
- package/ui/form/Button.module.css +10 -1
- package/ui/form/Field.md +1 -1
- package/ui/form/Field.module.css +6 -1
- package/ui/form/Form.md +1 -1
- package/ui/form/Form.module.css +2 -1
- package/ui/form/Input.module.css +10 -2
- package/ui/form/Popover.module.css +6 -1
- package/ui/form/Progress.module.css +4 -1
- package/ui/inline/Code.md +2 -2
- package/ui/inline/Code.module.css +7 -1
- package/ui/inline/Deleted.module.css +4 -1
- package/ui/inline/Emphasis.module.css +1 -1
- package/ui/inline/Inserted.module.css +4 -1
- package/ui/inline/Link.md +2 -2
- package/ui/inline/Link.module.css +4 -2
- package/ui/inline/Mark.md +1 -1
- package/ui/inline/Mark.module.css +3 -1
- package/ui/inline/Small.module.css +2 -1
- package/ui/inline/Strong.md +1 -1
- package/ui/inline/Strong.module.css +2 -1
- package/ui/inline/Subscript.module.css +1 -1
- package/ui/inline/Superscript.module.css +1 -1
- package/ui/layout/CenteredLayout.md +2 -2
- package/ui/layout/CenteredLayout.module.css +2 -1
- package/ui/layout/Layout.module.css +4 -2
- package/ui/layout/SidebarLayout.md +1 -1
- package/ui/layout/SidebarLayout.module.css +5 -1
- package/ui/menu/Menu.md +1 -1
- package/ui/menu/Menu.module.css +9 -1
- package/ui/menu/MenuItem.md +1 -1
- package/ui/misc/Loading.module.css +3 -1
- package/ui/misc/StatusIcon.module.css +2 -1
- package/ui/misc/Tag.md +1 -1
- package/ui/misc/Tag.module.css +9 -1
- package/ui/notice/Message.module.css +3 -1
- package/ui/notice/Notice.md +1 -1
- package/ui/notice/Notice.module.css +7 -1
- package/ui/notice/Notices.module.css +3 -1
- package/ui/style/Color.module.css +28 -1
- package/ui/style/Duration.d.ts +24 -0
- package/ui/style/Duration.js +13 -0
- package/ui/style/Duration.module.css +23 -0
- package/ui/style/Duration.tsx +31 -0
- package/ui/style/Flex.module.css +3 -1
- package/ui/style/Font.d.ts +24 -0
- package/ui/style/Font.js +13 -0
- package/ui/style/Font.module.css +50 -0
- package/ui/style/Font.tsx +31 -0
- package/ui/style/Gap.module.css +2 -1
- package/ui/style/Padding.module.css +2 -1
- package/ui/style/Radius.d.ts +24 -0
- package/ui/style/Radius.js +13 -0
- package/ui/style/Radius.module.css +43 -0
- package/ui/style/Radius.tsx +31 -0
- package/ui/style/Scroll.module.css +4 -0
- package/ui/style/Shadow.d.ts +24 -0
- package/ui/style/Shadow.js +13 -0
- package/ui/style/Shadow.module.css +42 -0
- package/ui/style/Shadow.tsx +31 -0
- package/ui/style/Size.d.ts +24 -0
- package/ui/style/Size.js +13 -0
- package/ui/style/Size.module.css +69 -0
- package/ui/style/Size.tsx +31 -0
- package/ui/style/Space.module.css +19 -1
- package/ui/style/Status.module.css +2 -1
- package/ui/style/Stroke.d.ts +24 -0
- package/ui/style/Stroke.js +13 -0
- package/ui/style/Stroke.module.css +26 -0
- package/ui/style/Stroke.tsx +31 -0
- package/ui/style/Tint.module.css +4 -1
- package/ui/style/Typography.d.ts +10 -26
- package/ui/style/Typography.js +8 -3
- package/ui/style/Typography.module.css +2 -66
- package/ui/style/Typography.tsx +17 -31
- package/ui/style/Weight.d.ts +24 -0
- package/ui/style/Weight.js +13 -0
- package/ui/style/Weight.module.css +42 -0
- package/ui/style/Weight.tsx +31 -0
- package/ui/style/Width.module.css +7 -1
- package/ui/style/getColorClass.md +47 -0
- package/ui/style/getDurationClass.md +18 -0
- package/ui/style/getFontClass.md +39 -0
- package/ui/style/getRadiusClass.md +24 -0
- package/ui/style/getShadowClass.md +23 -0
- package/ui/style/getSizeClass.md +42 -0
- package/ui/style/getSpaceClass.md +35 -0
- package/ui/style/getStrokeClass.md +20 -0
- package/ui/style/getWeightClass.md +25 -0
- package/ui/style/getWidthClass.md +18 -0
- package/ui/style/index.d.ts +7 -0
- package/ui/style/index.js +7 -0
- package/ui/style/index.tsx +7 -0
- package/ui/style/layers.css +26 -0
- package/ui/transition/FadeTransition.md +1 -1
- package/ui/transition/HorizontalTransition.md +1 -1
- package/ui/transition/Transition.md +1 -1
- package/ui/transition/VerticalTransition.md +1 -1
- package/ui/style/base.css +0 -161
package/ui/misc/Tag.module.css
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
@import "../style/
|
|
1
|
+
@import "../style/layers.css";
|
|
2
|
+
@import "../style/Color.module.css";
|
|
3
|
+
@import "../style/Font.module.css";
|
|
4
|
+
@import "../style/Radius.module.css";
|
|
5
|
+
@import "../style/Size.module.css";
|
|
6
|
+
@import "../style/Space.module.css";
|
|
7
|
+
@import "../style/Stroke.module.css";
|
|
8
|
+
@import "../style/Tint.module.css";
|
|
9
|
+
@import "../style/Weight.module.css";
|
|
2
10
|
|
|
3
11
|
@layer components {
|
|
4
12
|
.tag {
|
package/ui/notice/Notice.md
CHANGED
|
@@ -43,7 +43,7 @@ import { LOADING_NOTICE } from "shelving/ui";
|
|
|
43
43
|
| `--notice-size` | Font size | `var(--size-normal)` |
|
|
44
44
|
| `--notice-weight` | Font weight | `var(--weight-strong)` |
|
|
45
45
|
|
|
46
|
-
**Global tokens it reads** — the tint ladder `--tint-50` / `--tint-80` / `--tint-90
|
|
46
|
+
**Global tokens it reads** — the tint ladder [`--tint-50`](/ui/TINT_CLASS) / [`--tint-80`](/ui/TINT_CLASS) / [`--tint-90`](/ui/TINT_CLASS), plus [`--space-paragraph`](/ui/getSpaceClass), [`--space-small`](/ui/getSpaceClass), [`--radius-xsmall`](/ui/getRadiusClass), [`--stroke-normal`](/ui/getStrokeClass), [`--size-normal`](/ui/getSizeClass), and [`--weight-strong`](/ui/getWeightClass).
|
|
47
47
|
|
|
48
48
|
## See also
|
|
49
49
|
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
@import "../style/
|
|
1
|
+
@import "../style/layers.css";
|
|
2
|
+
@import "../style/Radius.module.css";
|
|
3
|
+
@import "../style/Size.module.css";
|
|
4
|
+
@import "../style/Space.module.css";
|
|
5
|
+
@import "../style/Stroke.module.css";
|
|
6
|
+
@import "../style/Tint.module.css";
|
|
7
|
+
@import "../style/Weight.module.css";
|
|
2
8
|
|
|
3
9
|
@layer components {
|
|
4
10
|
.notice {
|
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "layers.css";
|
|
2
2
|
@import "Tint.module.css";
|
|
3
3
|
|
|
4
|
+
@layer defaults {
|
|
5
|
+
:root {
|
|
6
|
+
/* Basic colors */
|
|
7
|
+
--color-gray: oklch(60% 0.01 240); /* Subtle blue tint so neutrals don't feel "dead". */
|
|
8
|
+
--color-red: oklch(62% 0.2 30); /* Slightly desaturated from default — takes the edge off without losing red identity. */
|
|
9
|
+
--color-orange: oklch(74% 0.157 60);
|
|
10
|
+
--color-yellow: oklch(86% 0.16 92);
|
|
11
|
+
--color-green: oklch(72% 0.185 130);
|
|
12
|
+
--color-aqua: oklch(72% 0.121 185);
|
|
13
|
+
--color-blue: oklch(57% 0.216 260); /* OKLCH form of #156ef4 — warmer hue (260) than the previous 240. */
|
|
14
|
+
--color-purple: oklch(58% 0.25 300);
|
|
15
|
+
--color-pink: oklch(68% 0.239 350);
|
|
16
|
+
|
|
17
|
+
/* Semantic colors */
|
|
18
|
+
--color-link: var(--color-blue);
|
|
19
|
+
--color-focus: var(--color-blue);
|
|
20
|
+
--color-success: var(--color-green);
|
|
21
|
+
--color-warning: var(--color-orange);
|
|
22
|
+
--color-failure: var(--color-red);
|
|
23
|
+
|
|
24
|
+
/* Brand colors */
|
|
25
|
+
--color-primary: var(--color-blue); /* Primary brand color */
|
|
26
|
+
--color-secondary: var(--color-purple); /* Secondary brand color */
|
|
27
|
+
--color-tertiary: var(--color-pink); /* Tertiary brand color */
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
4
31
|
@layer variants {
|
|
5
32
|
/* Basic colors */
|
|
6
33
|
.gray {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated transition-duration names selectable via the `duration` variant prop.
|
|
3
|
+
*
|
|
4
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/UIDuration
|
|
5
|
+
*/
|
|
6
|
+
export type UIDuration = "fast" | "normal" | "slow";
|
|
7
|
+
/**
|
|
8
|
+
* Variant props for the transition duration of an element, e.g. `duration="fast"`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/DurationVariants
|
|
11
|
+
*/
|
|
12
|
+
export interface DurationVariants {
|
|
13
|
+
/** Transition duration of the element. */
|
|
14
|
+
duration?: UIDuration | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the transition-duration class for a component from its `duration` variant prop.
|
|
18
|
+
*
|
|
19
|
+
* @param variants Variant props containing the optional `duration` name.
|
|
20
|
+
* @returns The duration class string, or `undefined` when no `duration` is set.
|
|
21
|
+
* @example getDurationClass({ duration: "fast" }) // "duration-fast"
|
|
22
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/getDurationClass
|
|
23
|
+
*/
|
|
24
|
+
export declare function getDurationClass({ duration }: DurationVariants): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import DURATION_CSS from "./Duration.module.css";
|
|
3
|
+
/**
|
|
4
|
+
* Get the transition-duration class for a component from its `duration` variant prop.
|
|
5
|
+
*
|
|
6
|
+
* @param variants Variant props containing the optional `duration` name.
|
|
7
|
+
* @returns The duration class string, or `undefined` when no `duration` is set.
|
|
8
|
+
* @example getDurationClass({ duration: "fast" }) // "duration-fast"
|
|
9
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/getDurationClass
|
|
10
|
+
*/
|
|
11
|
+
export function getDurationClass({ duration }) {
|
|
12
|
+
return duration && getModuleClass(DURATION_CSS, `duration-${duration}`);
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "layers.css";
|
|
2
|
+
|
|
3
|
+
@layer defaults {
|
|
4
|
+
:root {
|
|
5
|
+
/* Durations — transition/animation timings. */
|
|
6
|
+
--duration-fast: 150ms;
|
|
7
|
+
--duration-normal: 300ms;
|
|
8
|
+
--duration-slow: 600ms;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@layer variants {
|
|
13
|
+
/* Transition-duration variants. */
|
|
14
|
+
.duration-fast {
|
|
15
|
+
transition-duration: var(--duration-fast);
|
|
16
|
+
}
|
|
17
|
+
.duration-normal {
|
|
18
|
+
transition-duration: var(--duration-normal);
|
|
19
|
+
}
|
|
20
|
+
.duration-slow {
|
|
21
|
+
transition-duration: var(--duration-slow);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import DURATION_CSS from "./Duration.module.css";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enumerated transition-duration names selectable via the `duration` variant prop.
|
|
6
|
+
*
|
|
7
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/UIDuration
|
|
8
|
+
*/
|
|
9
|
+
export type UIDuration = "fast" | "normal" | "slow";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Variant props for the transition duration of an element, e.g. `duration="fast"`.
|
|
13
|
+
*
|
|
14
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/DurationVariants
|
|
15
|
+
*/
|
|
16
|
+
export interface DurationVariants {
|
|
17
|
+
/** Transition duration of the element. */
|
|
18
|
+
duration?: UIDuration | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the transition-duration class for a component from its `duration` variant prop.
|
|
23
|
+
*
|
|
24
|
+
* @param variants Variant props containing the optional `duration` name.
|
|
25
|
+
* @returns The duration class string, or `undefined` when no `duration` is set.
|
|
26
|
+
* @example getDurationClass({ duration: "fast" }) // "duration-fast"
|
|
27
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Duration/getDurationClass
|
|
28
|
+
*/
|
|
29
|
+
export function getDurationClass({ duration }: DurationVariants): string | undefined {
|
|
30
|
+
return duration && getModuleClass(DURATION_CSS, `duration-${duration}`);
|
|
31
|
+
}
|
package/ui/style/Flex.module.css
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated font-family names selectable via the `font` variant prop.
|
|
3
|
+
*
|
|
4
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/UIFont
|
|
5
|
+
*/
|
|
6
|
+
export type UIFont = "title" | "body" | "label" | "code" | "serif" | "sans" | "monospace";
|
|
7
|
+
/**
|
|
8
|
+
* Variant props for the font family of an element, e.g. `font="title"`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/FontVariants
|
|
11
|
+
*/
|
|
12
|
+
export interface FontVariants {
|
|
13
|
+
/** Font family of the element. */
|
|
14
|
+
font?: UIFont | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the font-family class for a component from its `font` variant prop.
|
|
18
|
+
*
|
|
19
|
+
* @param variants Variant props containing the optional `font` name.
|
|
20
|
+
* @returns The font class string, or `undefined` when no `font` is set.
|
|
21
|
+
* @example getFontClass({ font: "title" }) // "title"
|
|
22
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/getFontClass
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFontClass({ font }: FontVariants): string | undefined;
|
package/ui/style/Font.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import FONT_CSS from "./Font.module.css";
|
|
3
|
+
/**
|
|
4
|
+
* Get the font-family class for a component from its `font` variant prop.
|
|
5
|
+
*
|
|
6
|
+
* @param variants Variant props containing the optional `font` name.
|
|
7
|
+
* @returns The font class string, or `undefined` when no `font` is set.
|
|
8
|
+
* @example getFontClass({ font: "title" }) // "title"
|
|
9
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/getFontClass
|
|
10
|
+
*/
|
|
11
|
+
export function getFontClass({ font }) {
|
|
12
|
+
return font && getModuleClass(FONT_CSS, font);
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@import "layers.css";
|
|
2
|
+
|
|
3
|
+
@layer defaults {
|
|
4
|
+
:root {
|
|
5
|
+
/* Font faces */
|
|
6
|
+
--font-sans: system-ui;
|
|
7
|
+
--font-monospace: ui-monospace, "SF Mono", "Consolas", "Menlo", monospace;
|
|
8
|
+
--font-serif: "Palatino", "Garamond", serif;
|
|
9
|
+
|
|
10
|
+
/* Semantic font faces */
|
|
11
|
+
--font-title: var(--font-sans);
|
|
12
|
+
--font-body: var(--font-sans);
|
|
13
|
+
--font-label: var(--font-sans);
|
|
14
|
+
--font-code: var(--font-monospace);
|
|
15
|
+
|
|
16
|
+
/* Semantic cases */
|
|
17
|
+
--case-label: uppercase;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Baseline body font so a page with no `<Layout>` still reads correctly. */
|
|
21
|
+
body {
|
|
22
|
+
font-family: var(--font-body);
|
|
23
|
+
text-align: start;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@layer variants {
|
|
28
|
+
/* Font-family variants. */
|
|
29
|
+
.title {
|
|
30
|
+
font-family: var(--font-title);
|
|
31
|
+
}
|
|
32
|
+
.body {
|
|
33
|
+
font-family: var(--font-body);
|
|
34
|
+
}
|
|
35
|
+
.code {
|
|
36
|
+
font-family: var(--font-code);
|
|
37
|
+
}
|
|
38
|
+
.label {
|
|
39
|
+
font-family: var(--font-label);
|
|
40
|
+
}
|
|
41
|
+
.sans {
|
|
42
|
+
font-family: var(--font-sans);
|
|
43
|
+
}
|
|
44
|
+
.serif {
|
|
45
|
+
font-family: var(--font-serif);
|
|
46
|
+
}
|
|
47
|
+
.monospace {
|
|
48
|
+
font-family: var(--font-monospace);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import FONT_CSS from "./Font.module.css";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enumerated font-family names selectable via the `font` variant prop.
|
|
6
|
+
*
|
|
7
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/UIFont
|
|
8
|
+
*/
|
|
9
|
+
export type UIFont = "title" | "body" | "label" | "code" | "serif" | "sans" | "monospace";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Variant props for the font family of an element, e.g. `font="title"`.
|
|
13
|
+
*
|
|
14
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/FontVariants
|
|
15
|
+
*/
|
|
16
|
+
export interface FontVariants {
|
|
17
|
+
/** Font family of the element. */
|
|
18
|
+
font?: UIFont | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the font-family class for a component from its `font` variant prop.
|
|
23
|
+
*
|
|
24
|
+
* @param variants Variant props containing the optional `font` name.
|
|
25
|
+
* @returns The font class string, or `undefined` when no `font` is set.
|
|
26
|
+
* @example getFontClass({ font: "title" }) // "title"
|
|
27
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Font/getFontClass
|
|
28
|
+
*/
|
|
29
|
+
export function getFontClass({ font }: FontVariants): string | undefined {
|
|
30
|
+
return font && getModuleClass(FONT_CSS, font);
|
|
31
|
+
}
|
package/ui/style/Gap.module.css
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated corner-radius scale selectable via the `radius` variant prop.
|
|
3
|
+
*
|
|
4
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/UIRadius
|
|
5
|
+
*/
|
|
6
|
+
export type UIRadius = "none" | "xxsmall" | "xsmall" | "small" | "normal" | "large" | "xlarge" | "xxlarge";
|
|
7
|
+
/**
|
|
8
|
+
* Variant props for the corner radius of an element, e.g. `radius="large"`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/RadiusVariants
|
|
11
|
+
*/
|
|
12
|
+
export interface RadiusVariants {
|
|
13
|
+
/** Corner radius of the element. */
|
|
14
|
+
radius?: UIRadius | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the corner-radius class for a component from its `radius` variant prop.
|
|
18
|
+
*
|
|
19
|
+
* @param variants Variant props containing the optional `radius` scale.
|
|
20
|
+
* @returns The radius class string, or `undefined` when no `radius` is set.
|
|
21
|
+
* @example getRadiusClass({ radius: "large" }) // "radius-large"
|
|
22
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/getRadiusClass
|
|
23
|
+
*/
|
|
24
|
+
export declare function getRadiusClass({ radius }: RadiusVariants): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import RADIUS_CSS from "./Radius.module.css";
|
|
3
|
+
/**
|
|
4
|
+
* Get the corner-radius class for a component from its `radius` variant prop.
|
|
5
|
+
*
|
|
6
|
+
* @param variants Variant props containing the optional `radius` scale.
|
|
7
|
+
* @returns The radius class string, or `undefined` when no `radius` is set.
|
|
8
|
+
* @example getRadiusClass({ radius: "large" }) // "radius-large"
|
|
9
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/getRadiusClass
|
|
10
|
+
*/
|
|
11
|
+
export function getRadiusClass({ radius }) {
|
|
12
|
+
return radius && getModuleClass(RADIUS_CSS, `radius-${radius}`);
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@import "layers.css";
|
|
2
|
+
|
|
3
|
+
@layer defaults {
|
|
4
|
+
:root {
|
|
5
|
+
/* Radii — corner rounding. */
|
|
6
|
+
--radius: 1rem;
|
|
7
|
+
--radius-xxsmall: calc(var(--radius) * 0.25); /* 4px */
|
|
8
|
+
--radius-xsmall: calc(var(--radius) * 0.5); /* 8px */
|
|
9
|
+
--radius-small: calc(var(--radius) * 0.75); /* 12px */
|
|
10
|
+
--radius-normal: calc(var(--radius) * 1); /* 16px */
|
|
11
|
+
--radius-large: calc(var(--radius) * 1.5); /* 24px */
|
|
12
|
+
--radius-xlarge: calc(var(--radius) * 2); /* 32px */
|
|
13
|
+
--radius-xxlarge: calc(var(--radius) * 3); /* 48px */
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@layer variants {
|
|
18
|
+
/* Corner-radius variants. */
|
|
19
|
+
.radius-none {
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
}
|
|
22
|
+
.radius-xxsmall {
|
|
23
|
+
border-radius: var(--radius-xxsmall);
|
|
24
|
+
}
|
|
25
|
+
.radius-xsmall {
|
|
26
|
+
border-radius: var(--radius-xsmall);
|
|
27
|
+
}
|
|
28
|
+
.radius-small {
|
|
29
|
+
border-radius: var(--radius-small);
|
|
30
|
+
}
|
|
31
|
+
.radius-normal {
|
|
32
|
+
border-radius: var(--radius-normal);
|
|
33
|
+
}
|
|
34
|
+
.radius-large {
|
|
35
|
+
border-radius: var(--radius-large);
|
|
36
|
+
}
|
|
37
|
+
.radius-xlarge {
|
|
38
|
+
border-radius: var(--radius-xlarge);
|
|
39
|
+
}
|
|
40
|
+
.radius-xxlarge {
|
|
41
|
+
border-radius: var(--radius-xxlarge);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import RADIUS_CSS from "./Radius.module.css";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enumerated corner-radius scale selectable via the `radius` variant prop.
|
|
6
|
+
*
|
|
7
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/UIRadius
|
|
8
|
+
*/
|
|
9
|
+
export type UIRadius = "none" | "xxsmall" | "xsmall" | "small" | "normal" | "large" | "xlarge" | "xxlarge";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Variant props for the corner radius of an element, e.g. `radius="large"`.
|
|
13
|
+
*
|
|
14
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/RadiusVariants
|
|
15
|
+
*/
|
|
16
|
+
export interface RadiusVariants {
|
|
17
|
+
/** Corner radius of the element. */
|
|
18
|
+
radius?: UIRadius | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the corner-radius class for a component from its `radius` variant prop.
|
|
23
|
+
*
|
|
24
|
+
* @param variants Variant props containing the optional `radius` scale.
|
|
25
|
+
* @returns The radius class string, or `undefined` when no `radius` is set.
|
|
26
|
+
* @example getRadiusClass({ radius: "large" }) // "radius-large"
|
|
27
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Radius/getRadiusClass
|
|
28
|
+
*/
|
|
29
|
+
export function getRadiusClass({ radius }: RadiusVariants): string | undefined {
|
|
30
|
+
return radius && getModuleClass(RADIUS_CSS, `radius-${radius}`);
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated drop-shadow scale selectable via the `shadow` variant prop.
|
|
3
|
+
*
|
|
4
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/UIShadow
|
|
5
|
+
*/
|
|
6
|
+
export type UIShadow = "none" | "xxsmall" | "xsmall" | "small" | "normal" | "large" | "xlarge" | "xxlarge";
|
|
7
|
+
/**
|
|
8
|
+
* Variant props for the drop shadow of an element, e.g. `shadow="large"`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/ShadowVariants
|
|
11
|
+
*/
|
|
12
|
+
export interface ShadowVariants {
|
|
13
|
+
/** Drop shadow of the element. */
|
|
14
|
+
shadow?: UIShadow | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the drop-shadow class for a component from its `shadow` variant prop.
|
|
18
|
+
*
|
|
19
|
+
* @param variants Variant props containing the optional `shadow` scale.
|
|
20
|
+
* @returns The shadow class string, or `undefined` when no `shadow` is set.
|
|
21
|
+
* @example getShadowClass({ shadow: "large" }) // "shadow-large"
|
|
22
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/getShadowClass
|
|
23
|
+
*/
|
|
24
|
+
export declare function getShadowClass({ shadow }: ShadowVariants): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import SHADOW_CSS from "./Shadow.module.css";
|
|
3
|
+
/**
|
|
4
|
+
* Get the drop-shadow class for a component from its `shadow` variant prop.
|
|
5
|
+
*
|
|
6
|
+
* @param variants Variant props containing the optional `shadow` scale.
|
|
7
|
+
* @returns The shadow class string, or `undefined` when no `shadow` is set.
|
|
8
|
+
* @example getShadowClass({ shadow: "large" }) // "shadow-large"
|
|
9
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/getShadowClass
|
|
10
|
+
*/
|
|
11
|
+
export function getShadowClass({ shadow }) {
|
|
12
|
+
return shadow && getModuleClass(SHADOW_CSS, `shadow-${shadow}`);
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@import "layers.css";
|
|
2
|
+
|
|
3
|
+
@layer defaults {
|
|
4
|
+
:root {
|
|
5
|
+
/* Shadows — elevation drop-shadows. */
|
|
6
|
+
--shadow-xxsmall: 0 0.125rem 0.5rem -0.25rem #0006;
|
|
7
|
+
--shadow-xsmall: 0 0.25rem 1rem -0.5rem #0006;
|
|
8
|
+
--shadow-small: 0 0.375rem 1.5rem -0.75rem #0006;
|
|
9
|
+
--shadow-normal: 0 0.5rem 2rem -1rem #0006;
|
|
10
|
+
--shadow-large: 0 0.75rem 3rem -1.5rem #0006;
|
|
11
|
+
--shadow-xlarge: 0 1rem 4rem -2rem #0006;
|
|
12
|
+
--shadow-xxlarge: 0 1.5rem 6rem -3rem #0006;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@layer variants {
|
|
17
|
+
/* Drop-shadow variants. */
|
|
18
|
+
.shadow-none {
|
|
19
|
+
box-shadow: none;
|
|
20
|
+
}
|
|
21
|
+
.shadow-xxsmall {
|
|
22
|
+
box-shadow: var(--shadow-xxsmall);
|
|
23
|
+
}
|
|
24
|
+
.shadow-xsmall {
|
|
25
|
+
box-shadow: var(--shadow-xsmall);
|
|
26
|
+
}
|
|
27
|
+
.shadow-small {
|
|
28
|
+
box-shadow: var(--shadow-small);
|
|
29
|
+
}
|
|
30
|
+
.shadow-normal {
|
|
31
|
+
box-shadow: var(--shadow-normal);
|
|
32
|
+
}
|
|
33
|
+
.shadow-large {
|
|
34
|
+
box-shadow: var(--shadow-large);
|
|
35
|
+
}
|
|
36
|
+
.shadow-xlarge {
|
|
37
|
+
box-shadow: var(--shadow-xlarge);
|
|
38
|
+
}
|
|
39
|
+
.shadow-xxlarge {
|
|
40
|
+
box-shadow: var(--shadow-xxlarge);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import SHADOW_CSS from "./Shadow.module.css";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enumerated drop-shadow scale selectable via the `shadow` variant prop.
|
|
6
|
+
*
|
|
7
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/UIShadow
|
|
8
|
+
*/
|
|
9
|
+
export type UIShadow = "none" | "xxsmall" | "xsmall" | "small" | "normal" | "large" | "xlarge" | "xxlarge";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Variant props for the drop shadow of an element, e.g. `shadow="large"`.
|
|
13
|
+
*
|
|
14
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/ShadowVariants
|
|
15
|
+
*/
|
|
16
|
+
export interface ShadowVariants {
|
|
17
|
+
/** Drop shadow of the element. */
|
|
18
|
+
shadow?: UIShadow | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the drop-shadow class for a component from its `shadow` variant prop.
|
|
23
|
+
*
|
|
24
|
+
* @param variants Variant props containing the optional `shadow` scale.
|
|
25
|
+
* @returns The shadow class string, or `undefined` when no `shadow` is set.
|
|
26
|
+
* @example getShadowClass({ shadow: "large" }) // "shadow-large"
|
|
27
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Shadow/getShadowClass
|
|
28
|
+
*/
|
|
29
|
+
export function getShadowClass({ shadow }: ShadowVariants): string | undefined {
|
|
30
|
+
return shadow && getModuleClass(SHADOW_CSS, `shadow-${shadow}`);
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated font-size scale selectable via the `size` variant prop.
|
|
3
|
+
*
|
|
4
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Size/UISize
|
|
5
|
+
*/
|
|
6
|
+
export type UISize = "xxsmall" | "xsmall" | "small" | "normal" | "large" | "xlarge" | "xxlarge";
|
|
7
|
+
/**
|
|
8
|
+
* Variant props for the font size of an element, e.g. `size="large"`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Size/SizeVariants
|
|
11
|
+
*/
|
|
12
|
+
export interface SizeVariants {
|
|
13
|
+
/** Font size of the element. */
|
|
14
|
+
size?: UISize | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the font-size class for a component from its `size` variant prop.
|
|
18
|
+
*
|
|
19
|
+
* @param variants Variant props containing the optional `size` scale.
|
|
20
|
+
* @returns The size class string, or `undefined` when no `size` is set.
|
|
21
|
+
* @example getSizeClass({ size: "large" }) // "large"
|
|
22
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Size/getSizeClass
|
|
23
|
+
*/
|
|
24
|
+
export declare function getSizeClass({ size }: SizeVariants): string | undefined;
|
package/ui/style/Size.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getModuleClass } from "../util/css.js";
|
|
2
|
+
import SIZE_CSS from "./Size.module.css";
|
|
3
|
+
/**
|
|
4
|
+
* Get the font-size class for a component from its `size` variant prop.
|
|
5
|
+
*
|
|
6
|
+
* @param variants Variant props containing the optional `size` scale.
|
|
7
|
+
* @returns The size class string, or `undefined` when no `size` is set.
|
|
8
|
+
* @example getSizeClass({ size: "large" }) // "large"
|
|
9
|
+
* @see https://dhoulb.github.io/shelving/ui/style/Size/getSizeClass
|
|
10
|
+
*/
|
|
11
|
+
export function getSizeClass({ size }) {
|
|
12
|
+
return size && getModuleClass(SIZE_CSS, size);
|
|
13
|
+
}
|