rift-ds 1.24.0 → 1.26.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/README.md +5 -4
- package/chat/ChatThreads.d.ts +3 -1
- package/chat/ChatThreads.js +3 -1
- package/chat/ChatWidget.css +166 -15
- package/chat/ChatWidget.d.ts +6 -2
- package/chat/ChatWidget.js +17 -3
- package/components/ActionCard/ActionCard.d.ts +1 -1
- package/components/Attachment/Attachment.css +8 -0
- package/components/Attachment/AttachmentViewer.js +26 -5
- package/components/Attachment/fileTypes.d.ts +4 -0
- package/components/ContextMenu/ContextMenu.css +11 -0
- package/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/components/ContextMenu/ContextMenu.js +3 -1
- package/components/CurrencyInput/CurrencyInput.css +12 -0
- package/components/CurrencyInput/CurrencyInput.d.ts +51 -0
- package/components/CurrencyInput/CurrencyInput.js +158 -0
- package/components/DataTable/columnTypes.js +4 -16
- package/components/DatePicker/DatePicker.d.ts +2 -0
- package/components/DatePicker/DatePicker.js +44 -131
- package/components/DatePicker/MonthGrid.d.ts +56 -0
- package/components/DatePicker/MonthGrid.js +65 -0
- package/components/DatePicker/calendar.d.ts +42 -0
- package/components/DatePicker/calendar.js +108 -0
- package/components/DateRangePicker/DateRangePicker.css +92 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +86 -0
- package/components/DateRangePicker/DateRangePicker.js +294 -0
- package/components/Deadline/Deadline.css +82 -0
- package/components/Deadline/Deadline.d.ts +44 -0
- package/components/Deadline/Deadline.js +94 -0
- package/components/Deadline/deadlineStatus.d.ts +15 -0
- package/components/Deadline/deadlineStatus.js +13 -0
- package/components/DescriptionList/DescriptionList.css +184 -0
- package/components/DescriptionList/DescriptionList.d.ts +64 -0
- package/components/DescriptionList/DescriptionList.js +100 -0
- package/components/DescriptionList/DescriptionListCopy.d.ts +18 -0
- package/components/DescriptionList/DescriptionListCopy.js +45 -0
- package/components/DocumentViewer/DocumentViewer.css +188 -0
- package/components/DocumentViewer/DocumentViewer.d.ts +59 -0
- package/components/DocumentViewer/DocumentViewer.js +185 -0
- package/components/DropdownMenu/DropdownMenu.css +38 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +4 -0
- package/components/DropdownMenu/DropdownMenu.js +11 -5
- package/components/DropdownMenu/ShortcutHint.d.ts +9 -0
- package/components/DropdownMenu/ShortcutHint.js +6 -0
- package/components/ErrorSummary/ErrorSummary.css +94 -0
- package/components/ErrorSummary/ErrorSummary.d.ts +34 -0
- package/components/ErrorSummary/ErrorSummary.js +70 -0
- package/components/ErrorSummary/fieldErrors.d.ts +36 -0
- package/components/ErrorSummary/fieldErrors.js +19 -0
- package/components/Field/Field.css +12 -0
- package/components/Field/Field.d.ts +10 -2
- package/components/Field/Field.js +12 -5
- package/components/Heading/Heading.css +129 -0
- package/components/Heading/Heading.d.ts +31 -0
- package/components/Heading/Heading.js +39 -0
- package/components/Input/Input.css +120 -0
- package/components/Input/Input.d.ts +20 -1
- package/components/Input/Input.js +70 -5
- package/components/InterruptCard/InterruptCard.d.ts +1 -1
- package/components/Link/Link.css +84 -0
- package/components/Link/Link.d.ts +43 -0
- package/components/Link/Link.js +74 -0
- package/components/List/List.css +173 -0
- package/components/List/List.d.ts +44 -0
- package/components/List/List.js +60 -0
- package/components/MaskedInput/MaskedInput.css +16 -0
- package/components/MaskedInput/MaskedInput.d.ts +57 -0
- package/components/MaskedInput/MaskedInput.js +142 -0
- package/components/MaskedInput/mask.d.ts +58 -0
- package/components/MaskedInput/mask.js +106 -0
- package/components/MessageCard/MessageCard.css +17 -6
- package/components/MessageCard/MessageCard.d.ts +1 -1
- package/components/ShaderScene/ShaderScene.css +19 -0
- package/components/ShaderScene/ShaderScene.d.ts +82 -0
- package/components/ShaderScene/ShaderScene.js +167 -0
- package/components/ShaderScene/assemble.d.ts +5 -0
- package/components/ShaderScene/assemble.js +76 -0
- package/components/ShaderScene/common.glsl.d.ts +6 -0
- package/components/ShaderScene/common.glsl.js +49 -0
- package/components/ShaderScene/passes.d.ts +2 -0
- package/components/ShaderScene/passes.js +93 -0
- package/components/ShaderScene/renderer.d.ts +39 -0
- package/components/ShaderScene/renderer.js +170 -0
- package/components/ShaderScene/scenes.d.ts +76 -0
- package/components/ShaderScene/scenes.js +752 -0
- package/components/ShaderScene/types.d.ts +83 -0
- package/components/ShaderScene/types.js +8 -0
- package/components/SignaturePad/SignaturePad.css +141 -0
- package/components/SignaturePad/SignaturePad.d.ts +68 -0
- package/components/SignaturePad/SignaturePad.js +287 -0
- package/components/SignaturePad/signature.d.ts +32 -0
- package/components/SignaturePad/signature.js +46 -0
- package/components/Text/Text.css +129 -0
- package/components/Text/Text.d.ts +36 -0
- package/components/Text/Text.js +36 -0
- package/components/ThreadPanel/ThreadPanel.css +29 -0
- package/components/ThreadPanel/ThreadPanel.d.ts +2 -0
- package/components/ThreadPanel/ThreadPanel.js +13 -2
- package/components/Widget/Widget.css +111 -0
- package/components/Widget/Widget.d.ts +15 -1
- package/components/Widget/Widget.js +63 -11
- package/components/Widget/WidgetDisclosure.d.ts +30 -0
- package/components/Widget/WidgetDisclosure.js +52 -0
- package/components/registry.json +111 -2
- package/components/registry.json.d.ts +111 -2
- package/components/registry.json.js +2 -2
- package/format/index.d.ts +15 -0
- package/format/index.js +17 -0
- package/format/money.d.ts +89 -0
- package/format/money.js +187 -0
- package/format/relative.d.ts +49 -0
- package/format/relative.js +50 -0
- package/index.d.ts +13 -0
- package/index.js +48 -1
- package/package.json +9 -2
- package/tokens/motion.d.ts +4 -0
- package/tokens/motion.js +4 -0
|
@@ -11,8 +11,27 @@ type InputOwnProps = {
|
|
|
11
11
|
size?: 'default' | 'compact';
|
|
12
12
|
/** Error state — shows error styling and message */
|
|
13
13
|
error?: boolean;
|
|
14
|
-
/** Helper
|
|
14
|
+
/** Helper text displayed below the input. With the older `error` flag and no `errorText`, it doubles as the error message. */
|
|
15
15
|
helperText?: string;
|
|
16
|
+
/** The error message, shown under the input while the helper text keeps its place. Setting it marks the input invalid; Field's spec owns the wiring. */
|
|
17
|
+
errorText?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Text or a node inside the field before the value, read by a screen reader
|
|
20
|
+
* as part of the field (a currency symbol, `https://`, a country code). Not
|
|
21
|
+
* the decorative `iconLeft`. Note: this shadows the native `prefix`
|
|
22
|
+
* attribute (an RDFa vocabulary), which Input does not expose.
|
|
23
|
+
*/
|
|
24
|
+
prefix?: React.ReactNode;
|
|
25
|
+
/** Text or a node inside the field after the value, read by a screen reader as part of the field (a unit, `.com`, `%`). Not the decorative `iconRight`. */
|
|
26
|
+
suffix?: React.ReactNode;
|
|
27
|
+
/** A control inside the field at its end, after the suffix: a show/hide button, a copy button. Unlike `suffix` it is not read as part of the field; it is a control of its own. */
|
|
28
|
+
action?: React.ReactNode;
|
|
29
|
+
/** Show a clear button while the field holds a value. It empties the field, fires `onChange` and `onValueChange` with an empty value, then `onClear`, and returns focus to the field. */
|
|
30
|
+
clearable?: boolean;
|
|
31
|
+
/** Accessible name of the clear button. Defaults to "Clear". */
|
|
32
|
+
clearLabel?: string;
|
|
33
|
+
/** Called after the clear button empties the field. */
|
|
34
|
+
onClear?: () => void;
|
|
16
35
|
/** Leading icon — Material Symbol name (string) or custom element (ReactNode) */
|
|
17
36
|
iconLeft?: string | React.ReactNode;
|
|
18
37
|
/** Trailing icon — Material Symbol name (string) or custom element (ReactNode) */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useRef, useState, useId } from "react";
|
|
4
4
|
import { Field } from "../Field/Field.js";
|
|
5
|
+
import { CircularButton } from "../CircularButton/CircularButton.js";
|
|
5
6
|
import "./Input.css";
|
|
6
7
|
import "../../fonts/material-symbols.css";
|
|
7
8
|
import { mirrorClass } from "../../behaviors/direction.js";
|
|
@@ -16,6 +17,13 @@ const Input = React.forwardRef(
|
|
|
16
17
|
required = false,
|
|
17
18
|
error = false,
|
|
18
19
|
helperText,
|
|
20
|
+
errorText,
|
|
21
|
+
prefix,
|
|
22
|
+
suffix,
|
|
23
|
+
action,
|
|
24
|
+
clearable = false,
|
|
25
|
+
clearLabel = "Clear",
|
|
26
|
+
onClear,
|
|
19
27
|
iconLeft,
|
|
20
28
|
iconRight,
|
|
21
29
|
onChange,
|
|
@@ -24,30 +32,71 @@ const Input = React.forwardRef(
|
|
|
24
32
|
ariaLabel,
|
|
25
33
|
name,
|
|
26
34
|
id,
|
|
35
|
+
defaultValue,
|
|
36
|
+
readOnly,
|
|
27
37
|
...rest
|
|
28
38
|
}, ref) => {
|
|
29
39
|
const baseClass = "ds-input";
|
|
40
|
+
const innerRef = useRef(null);
|
|
41
|
+
const setRef = (node) => {
|
|
42
|
+
innerRef.current = node;
|
|
43
|
+
if (typeof ref === "function") ref(node);
|
|
44
|
+
else if (ref) ref.current = node;
|
|
45
|
+
};
|
|
46
|
+
const [uncontrolledFilled, setUncontrolledFilled] = useState(
|
|
47
|
+
defaultValue != null && String(defaultValue) !== ""
|
|
48
|
+
);
|
|
49
|
+
const filled = value !== void 0 ? value !== "" && value != null : uncontrolledFilled;
|
|
50
|
+
const hasErrorText = errorText != null && errorText !== false && errorText !== "";
|
|
51
|
+
const invalid = error || hasErrorText;
|
|
52
|
+
const hasPrefix = prefix != null && prefix !== false && prefix !== "";
|
|
53
|
+
const hasSuffix = suffix != null && suffix !== false && suffix !== "";
|
|
54
|
+
const hasAction = action != null && action !== false;
|
|
55
|
+
const affixed = hasPrefix || hasSuffix || clearable || hasAction;
|
|
56
|
+
const showClear = clearable && filled && !disabled && !readOnly;
|
|
30
57
|
const classes = [
|
|
31
58
|
baseClass,
|
|
32
59
|
size === "compact" ? `${baseClass}--compact` : "",
|
|
33
|
-
|
|
60
|
+
invalid ? `${baseClass}--error` : "",
|
|
61
|
+
affixed ? `${baseClass}--affixed` : "",
|
|
34
62
|
disabled ? `${baseClass}--disabled` : "",
|
|
35
63
|
iconLeft ? `${baseClass}--has-icon-left` : "",
|
|
36
64
|
iconRight ? `${baseClass}--has-icon-right` : "",
|
|
37
65
|
className
|
|
38
66
|
].filter(Boolean).join(" ");
|
|
39
67
|
const handleChange = (e) => {
|
|
68
|
+
if (value === void 0) setUncontrolledFilled(e.target.value !== "");
|
|
40
69
|
onChange?.(e);
|
|
41
70
|
onValueChange?.(e.target.value);
|
|
42
71
|
};
|
|
72
|
+
const handleClear = () => {
|
|
73
|
+
const input = innerRef.current;
|
|
74
|
+
if (!input) return;
|
|
75
|
+
const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
|
76
|
+
setter?.call(input, "");
|
|
77
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
78
|
+
onClear?.();
|
|
79
|
+
input.focus();
|
|
80
|
+
};
|
|
81
|
+
const fallbackId = useId();
|
|
43
82
|
const inputId = id || name || label?.toLowerCase().replace(/\s+/g, "-");
|
|
44
|
-
const
|
|
83
|
+
const affixBase = inputId || fallbackId;
|
|
84
|
+
const prefixId = hasPrefix ? `${affixBase}-prefix` : void 0;
|
|
85
|
+
const suffixId = hasSuffix ? `${affixBase}-suffix` : void 0;
|
|
86
|
+
const describedBy = [
|
|
87
|
+
rest["aria-describedby"],
|
|
88
|
+
prefixId,
|
|
89
|
+
suffixId,
|
|
90
|
+
hasErrorText ? `${inputId}-error` : void 0,
|
|
91
|
+
helperText ? `${inputId}-helper` : void 0
|
|
92
|
+
].filter(Boolean).join(" ") || void 0;
|
|
45
93
|
return /* @__PURE__ */ jsx(
|
|
46
94
|
Field,
|
|
47
95
|
{
|
|
48
96
|
className: classes,
|
|
49
97
|
label,
|
|
50
98
|
helperText,
|
|
99
|
+
errorText,
|
|
51
100
|
error,
|
|
52
101
|
required,
|
|
53
102
|
disabled,
|
|
@@ -62,25 +111,41 @@ const Input = React.forwardRef(
|
|
|
62
111
|
children: iconLeft
|
|
63
112
|
}
|
|
64
113
|
),
|
|
114
|
+
hasPrefix && /* @__PURE__ */ jsx("span", { className: `${baseClass}__affix ${baseClass}__affix--prefix`, id: prefixId, dir: "auto", children: prefix }),
|
|
65
115
|
/* @__PURE__ */ jsx(
|
|
66
116
|
"input",
|
|
67
117
|
{
|
|
68
118
|
...rest,
|
|
69
|
-
ref,
|
|
119
|
+
ref: setRef,
|
|
70
120
|
className: `${baseClass}__field`,
|
|
71
121
|
type,
|
|
72
122
|
id: inputId,
|
|
73
123
|
name,
|
|
74
124
|
value,
|
|
125
|
+
defaultValue,
|
|
126
|
+
readOnly,
|
|
75
127
|
placeholder,
|
|
76
128
|
disabled,
|
|
77
129
|
required,
|
|
78
130
|
"aria-label": rest["aria-label"] ?? ariaLabel ?? label,
|
|
79
|
-
"aria-invalid":
|
|
131
|
+
"aria-invalid": invalid,
|
|
80
132
|
"aria-describedby": describedBy,
|
|
81
133
|
onChange: handleChange
|
|
82
134
|
}
|
|
83
135
|
),
|
|
136
|
+
hasSuffix && /* @__PURE__ */ jsx("span", { className: `${baseClass}__affix ${baseClass}__affix--suffix`, id: suffixId, dir: "auto", children: suffix }),
|
|
137
|
+
hasAction && /* @__PURE__ */ jsx("span", { className: `${baseClass}__action`, children: action }),
|
|
138
|
+
showClear && /* @__PURE__ */ jsx(
|
|
139
|
+
CircularButton,
|
|
140
|
+
{
|
|
141
|
+
className: `${baseClass}__clear`,
|
|
142
|
+
icon: "close",
|
|
143
|
+
variant: "tertiary",
|
|
144
|
+
size: "compact",
|
|
145
|
+
ariaLabel: clearLabel,
|
|
146
|
+
onClick: handleClear
|
|
147
|
+
}
|
|
148
|
+
),
|
|
84
149
|
iconRight && /* @__PURE__ */ jsx(
|
|
85
150
|
"span",
|
|
86
151
|
{
|
|
@@ -37,7 +37,7 @@ type InterruptCardOwnProps = {
|
|
|
37
37
|
title: string;
|
|
38
38
|
/** One line of context under the title. */
|
|
39
39
|
description?: string;
|
|
40
|
-
/**
|
|
40
|
+
/** A Material Symbol name trailing the title, or any custom element. No icon by default. */
|
|
41
41
|
icon?: string | React.ReactNode;
|
|
42
42
|
/** The choices, rendered as buttons left to right. */
|
|
43
43
|
options?: InterruptCardOption[];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
LINK
|
|
3
|
+
Inline: the sentence's own face and colour,
|
|
4
|
+
underlined, so a link in prose reads as part
|
|
5
|
+
of the prose. Standalone: the tertiary action
|
|
6
|
+
text colour a tertiary Button wears, in its
|
|
7
|
+
own paragraph face. Both are underlined. Neither
|
|
8
|
+
takes the action fill, which stays reserved
|
|
9
|
+
for primary actions.
|
|
10
|
+
============================================ */
|
|
11
|
+
|
|
12
|
+
/* Base */
|
|
13
|
+
.ds-link {
|
|
14
|
+
display: inline;
|
|
15
|
+
color: inherit;
|
|
16
|
+
text-decoration-line: underline;
|
|
17
|
+
text-decoration-thickness: from-font;
|
|
18
|
+
text-underline-offset: 0.2em;
|
|
19
|
+
text-decoration-color: currentColor;
|
|
20
|
+
border-radius: var(--radius-050);
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-link:focus-visible {
|
|
25
|
+
outline: var(--border-050) solid var(--color-action-primary-bg);
|
|
26
|
+
outline-offset: var(--border-050);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Both variants keep the underline at rest, so a link always reads as one
|
|
30
|
+
whatever colour a theme gives its text, and thicken it on hover. */
|
|
31
|
+
.ds-link:hover {
|
|
32
|
+
text-decoration-thickness: var(--border-050);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Standalone */
|
|
36
|
+
.ds-link--standalone {
|
|
37
|
+
color: var(--color-action-primary-text-tertiary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ds-link--standalone.ds-link--default {
|
|
41
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
42
|
+
font-size: var(--font-paragraph-emphasis-size);
|
|
43
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
44
|
+
line-height: var(--font-paragraph-emphasis-line-height);
|
|
45
|
+
letter-spacing: var(--font-paragraph-emphasis-letter-spacing);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-link--standalone.ds-link--compact {
|
|
49
|
+
font-family: var(--font-paragraph-sm-emphasis-family);
|
|
50
|
+
font-size: var(--font-paragraph-sm-emphasis-size);
|
|
51
|
+
font-weight: var(--font-paragraph-sm-emphasis-weight);
|
|
52
|
+
line-height: var(--font-paragraph-sm-emphasis-line-height);
|
|
53
|
+
letter-spacing: var(--font-paragraph-sm-emphasis-letter-spacing);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Icons: sized to the text, sitting on its line. An inline link takes the
|
|
57
|
+
size of whatever sentence it is in, so its glyph follows the text rather
|
|
58
|
+
than a step of the icon scale. */
|
|
59
|
+
.ds-link__icon {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
/* ds-allow(icon-size): an inline link's glyph is the height of the text it sits in, which can be any tier */
|
|
62
|
+
--icon-size: 1em;
|
|
63
|
+
line-height: 1;
|
|
64
|
+
vertical-align: -0.125em;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ds-link__icon--start {
|
|
69
|
+
margin-inline-end: var(--gap-050);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ds-link__icon--end {
|
|
73
|
+
margin-inline-start: var(--gap-050);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* States */
|
|
77
|
+
.ds-link--disabled {
|
|
78
|
+
opacity: 0.4;
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-link--disabled:hover {
|
|
83
|
+
text-decoration-thickness: from-font;
|
|
84
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LinkComponent } from '../../behaviors/LinkProvider';
|
|
3
|
+
/** Props owned by Link itself; everything else falls through to the anchor. */
|
|
4
|
+
type LinkOwnProps = {
|
|
5
|
+
/** Where the link goes. */
|
|
6
|
+
href: string;
|
|
7
|
+
/** The link text. */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** `inline` sits inside a sentence, underlined and in the sentence's colour; `standalone` stands on its own line or beside a control, in the tertiary action text colour and its own type face. Both are underlined. */
|
|
10
|
+
variant?: 'inline' | 'standalone';
|
|
11
|
+
/** The standalone link's type size: `default` the paragraph face, `compact` the small paragraph face. An inline link always takes the size of the text around it. Distinct from no native attribute of an anchor. */
|
|
12
|
+
size?: 'default' | 'compact';
|
|
13
|
+
/** The link leaves the app: it opens in a new tab with `rel="noopener noreferrer"`, carries an outward mark, and tells a screen reader it opens a new tab. */
|
|
14
|
+
external?: boolean;
|
|
15
|
+
/** Read after an external link's text, hidden from the eye. Defaults to "(opens in a new tab)". */
|
|
16
|
+
externalLabel?: string;
|
|
17
|
+
/** Hold the link inert: it renders as text with `aria-disabled`, at the library's disabled treatment, and goes nowhere. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** A Material Symbol name or a node before the text. A directional glyph mirrors in a right-to-left context. */
|
|
20
|
+
iconLeft?: string | React.ReactNode;
|
|
21
|
+
/** A Material Symbol name or a node after the text. A directional glyph mirrors in a right-to-left context. */
|
|
22
|
+
iconRight?: string | React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* The component the link renders with, such as Next.js's `Link`, so it
|
|
25
|
+
* navigates through the app's router; a plain `<a>` when unset. This
|
|
26
|
+
* component can render on the server, so it never reads a LinkProvider:
|
|
27
|
+
* pass the prop even under one. An external link always renders a plain
|
|
28
|
+
* `<a>`.
|
|
29
|
+
*/
|
|
30
|
+
linkComponent?: LinkComponent;
|
|
31
|
+
/** Additional CSS classes. */
|
|
32
|
+
className?: string;
|
|
33
|
+
};
|
|
34
|
+
export interface LinkProps extends LinkOwnProps, Omit<React.ComponentPropsWithRef<'a'>, keyof LinkOwnProps> {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A text link, inside a sentence or on its own. Renders through
|
|
38
|
+
* `linkComponent` so it navigates through the app's router, opens an
|
|
39
|
+
* external address in a new tab and says so, and holds still with
|
|
40
|
+
* `disabled`. Server-renderable.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Link({ href, children, variant, size, external, externalLabel, disabled, iconLeft, iconRight, linkComponent, className, ref, ...rest }: LinkProps): React.JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { mirrorClass } from "../../behaviors/direction.js";
|
|
4
|
+
import "../../behaviors/visually-hidden.css";
|
|
5
|
+
import "../../fonts/material-symbols.css";
|
|
6
|
+
import "./Link.css";
|
|
7
|
+
const renderIcon = (icon, side) => {
|
|
8
|
+
if (icon == null || icon === false) return null;
|
|
9
|
+
if (typeof icon === "string")
|
|
10
|
+
return /* @__PURE__ */ jsx("span", { className: `ds-link__icon ds-link__icon--${side} material-symbols-rounded ${mirrorClass(icon)}`, "aria-hidden": "true", children: icon });
|
|
11
|
+
return /* @__PURE__ */ jsx("span", { className: `ds-link__icon ds-link__icon--${side}`, "aria-hidden": "true", children: icon });
|
|
12
|
+
};
|
|
13
|
+
function Link({
|
|
14
|
+
href,
|
|
15
|
+
children,
|
|
16
|
+
variant = "inline",
|
|
17
|
+
size = "default",
|
|
18
|
+
external = false,
|
|
19
|
+
externalLabel = "(opens in a new tab)",
|
|
20
|
+
disabled = false,
|
|
21
|
+
iconLeft,
|
|
22
|
+
iconRight,
|
|
23
|
+
linkComponent,
|
|
24
|
+
className = "",
|
|
25
|
+
ref,
|
|
26
|
+
...rest
|
|
27
|
+
}) {
|
|
28
|
+
const Anchor = external ? "a" : linkComponent ?? "a";
|
|
29
|
+
const classes = [
|
|
30
|
+
"ds-link",
|
|
31
|
+
`ds-link--${variant}`,
|
|
32
|
+
variant === "standalone" && `ds-link--${size}`,
|
|
33
|
+
disabled && "ds-link--disabled",
|
|
34
|
+
className
|
|
35
|
+
].filter(Boolean).join(" ");
|
|
36
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
|
+
renderIcon(iconLeft, "start"),
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "ds-link__text", children }),
|
|
39
|
+
external && /* @__PURE__ */ jsx("span", { className: "ds-link__icon ds-link__icon--end ds-link__external material-symbols-rounded", "aria-hidden": "true", children: "arrow_outward" }),
|
|
40
|
+
renderIcon(iconRight, "end"),
|
|
41
|
+
external && /* @__PURE__ */ jsxs("span", { className: "ds-visually-hidden", children: [
|
|
42
|
+
" ",
|
|
43
|
+
externalLabel
|
|
44
|
+
] })
|
|
45
|
+
] });
|
|
46
|
+
if (disabled) {
|
|
47
|
+
const { target: _target, rel: _rel, download: _download, ...spanRest } = rest;
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
...spanRest,
|
|
52
|
+
ref,
|
|
53
|
+
role: "link",
|
|
54
|
+
"aria-disabled": "true",
|
|
55
|
+
className: classes,
|
|
56
|
+
children: content
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
Anchor,
|
|
62
|
+
{
|
|
63
|
+
...rest,
|
|
64
|
+
ref,
|
|
65
|
+
href,
|
|
66
|
+
className: classes,
|
|
67
|
+
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
68
|
+
children: content
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
Link
|
|
74
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
LIST
|
|
3
|
+
Every marker sits in one gutter at the list's
|
|
4
|
+
inline start: the native disc and number, the
|
|
5
|
+
form controls' check, a named icon drawn by
|
|
6
|
+
the icon font in ::before, or an item's own
|
|
7
|
+
icon. The marker box is one line of the item's
|
|
8
|
+
text tall, so it centres on the first line
|
|
9
|
+
however the label wraps.
|
|
10
|
+
============================================ */
|
|
11
|
+
|
|
12
|
+
/* Base */
|
|
13
|
+
.ds-list {
|
|
14
|
+
--ds-list-gutter: calc(var(--icon-size-500) + var(--gap-200));
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: var(--ds-list-gap);
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
padding-inline-start: var(--ds-list-gutter);
|
|
21
|
+
color: var(--color-text-primary);
|
|
22
|
+
list-style: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-list__item {
|
|
26
|
+
position: relative;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: var(--gap-050);
|
|
30
|
+
min-inline-size: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ds-list__label {
|
|
34
|
+
overflow-wrap: break-word;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ds-list__description {
|
|
38
|
+
color: var(--color-text-secondary);
|
|
39
|
+
font-family: var(--font-paragraph-sm-family);
|
|
40
|
+
font-size: var(--font-paragraph-sm-size);
|
|
41
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
42
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
43
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Sizes */
|
|
47
|
+
.ds-list--default {
|
|
48
|
+
font-family: var(--font-paragraph-family);
|
|
49
|
+
font-size: var(--font-paragraph-size);
|
|
50
|
+
font-weight: var(--font-paragraph-weight);
|
|
51
|
+
line-height: var(--font-paragraph-line-height);
|
|
52
|
+
letter-spacing: var(--font-paragraph-letter-spacing);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ds-list--compact {
|
|
56
|
+
font-family: var(--font-paragraph-sm-family);
|
|
57
|
+
font-size: var(--font-paragraph-sm-size);
|
|
58
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
59
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
60
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ds-list--compact .ds-list__description {
|
|
64
|
+
font-size: var(--font-caption-size);
|
|
65
|
+
line-height: var(--font-caption-line-height);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Spacing */
|
|
69
|
+
.ds-list--spacing-compact {
|
|
70
|
+
--ds-list-gap: var(--gap-050);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ds-list--spacing-default {
|
|
74
|
+
--ds-list-gap: var(--gap-200);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ds-list--spacing-relaxed {
|
|
78
|
+
--ds-list-gap: var(--gap-400);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Markers: the gutter box every drawn marker sits in */
|
|
82
|
+
.ds-list__marker,
|
|
83
|
+
.ds-list--marker-icon .ds-list__item::before {
|
|
84
|
+
position: absolute;
|
|
85
|
+
inset-block-start: 0;
|
|
86
|
+
inset-inline-start: calc(-1 * var(--ds-list-gutter));
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
inline-size: var(--icon-size-500);
|
|
91
|
+
block-size: 1lh;
|
|
92
|
+
--icon-size: var(--icon-size-500);
|
|
93
|
+
color: var(--color-text-secondary);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Native markers: disc and number */
|
|
97
|
+
.ds-list--marker-disc {
|
|
98
|
+
list-style: disc;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.ds-list--marker-number {
|
|
102
|
+
list-style: decimal;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ds-list--marker-disc .ds-list__item,
|
|
106
|
+
.ds-list--marker-number .ds-list__item {
|
|
107
|
+
display: list-item;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.ds-list--marker-disc .ds-list__item > * + *,
|
|
111
|
+
.ds-list--marker-number .ds-list__item > * + * {
|
|
112
|
+
margin-block-start: var(--gap-050);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ds-list--marker-disc .ds-list__description,
|
|
116
|
+
.ds-list--marker-number .ds-list__description {
|
|
117
|
+
display: block;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ds-list__item::marker {
|
|
121
|
+
color: var(--color-text-secondary);
|
|
122
|
+
font-variant-numeric: tabular-nums;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* The tick: the form controls' CheckIcon, drawn only in a check list */
|
|
126
|
+
.ds-list__tick {
|
|
127
|
+
display: none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ds-list--marker-check .ds-list__tick {
|
|
131
|
+
display: flex;
|
|
132
|
+
color: var(--color-status-positive-text);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.ds-list__tick-glyph {
|
|
136
|
+
inline-size: var(--icon-size-500);
|
|
137
|
+
block-size: var(--icon-size-500);
|
|
138
|
+
padding: var(--padding-050);
|
|
139
|
+
box-sizing: border-box;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* A named icon, drawn by the icon font from the list's custom property */
|
|
143
|
+
.ds-list--marker-icon .ds-list__item::before {
|
|
144
|
+
content: var(--ds-list-marker);
|
|
145
|
+
font-family: 'Material Symbols Rounded';
|
|
146
|
+
font-size: var(--icon-size);
|
|
147
|
+
line-height: 1;
|
|
148
|
+
font-feature-settings: 'liga';
|
|
149
|
+
-webkit-font-smoothing: antialiased;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* An item's own icon replaces the list's marker */
|
|
153
|
+
.ds-list__item--icon {
|
|
154
|
+
display: flex;
|
|
155
|
+
list-style: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.ds-list .ds-list__item--icon::before {
|
|
159
|
+
content: none;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* No marker, no gutter */
|
|
163
|
+
.ds-list--marker-none {
|
|
164
|
+
padding-inline-start: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ds-list--marker-none .ds-list__item--icon {
|
|
168
|
+
padding-inline-start: var(--ds-list-gutter);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ds-list--marker-none .ds-list__item--icon .ds-list__marker {
|
|
172
|
+
inset-inline-start: 0;
|
|
173
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** Props owned by List itself; everything else falls through to the list element. */
|
|
3
|
+
type ListOwnProps = {
|
|
4
|
+
/** `unordered` is a `ul`, `ordered` an `ol` whose order means something (steps), `plain` a `ul` with no markers and no indent. */
|
|
5
|
+
variant?: 'unordered' | 'ordered' | 'plain';
|
|
6
|
+
/** The mark before each item: a disc, the item's number, the form controls' check, nothing, or a Material Symbol name (`star`, `bolt`). Defaults to the variant's own: disc, number, none. */
|
|
7
|
+
marker?: 'disc' | 'number' | 'check' | 'none' | (string & {});
|
|
8
|
+
/** The room between items: `compact` for dense lists, `relaxed` for items with descriptions. */
|
|
9
|
+
spacing?: 'compact' | 'default' | 'relaxed';
|
|
10
|
+
/** The items' type size: `default` the paragraph face, `compact` the small paragraph face. */
|
|
11
|
+
size?: 'default' | 'compact';
|
|
12
|
+
/** The number an ordered list counts from. */
|
|
13
|
+
start?: number;
|
|
14
|
+
/** Count an ordered list down instead of up. */
|
|
15
|
+
reversed?: boolean;
|
|
16
|
+
/** The items, each a `ListItem`. */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Additional CSS classes. */
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
export interface ListProps extends ListOwnProps, Omit<React.ComponentPropsWithRef<'ul'>, keyof ListOwnProps> {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A list of items, ordered or not, marked with a disc, a number, a check or
|
|
25
|
+
* an icon, each item optionally carrying a description under it: features,
|
|
26
|
+
* steps, requirements. Server-renderable.
|
|
27
|
+
*/
|
|
28
|
+
export declare function List({ variant, marker, spacing, size, start, reversed, className, style, children, ref, ...rest }: ListProps): React.JSX.Element;
|
|
29
|
+
/** Props owned by ListItem itself; everything else falls through to the `li`. */
|
|
30
|
+
type ListItemOwnProps = {
|
|
31
|
+
/** The item's text. */
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
/** A line of quieter text under the item. */
|
|
34
|
+
description?: React.ReactNode;
|
|
35
|
+
/** A Material Symbol name or a node that replaces this item's marker. A directional glyph mirrors in a right-to-left context. */
|
|
36
|
+
icon?: string | React.ReactNode;
|
|
37
|
+
/** Additional CSS classes. */
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
40
|
+
export interface ListItemProps extends ListItemOwnProps, Omit<React.ComponentPropsWithRef<'li'>, keyof ListItemOwnProps> {
|
|
41
|
+
}
|
|
42
|
+
/** One item of a List, with an optional description and an icon of its own. Server-renderable. */
|
|
43
|
+
export declare function ListItem({ children, description, icon, className, ref, ...rest }: ListItemProps): React.JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { CheckIcon } from "../Checkbox/Checkbox.js";
|
|
4
|
+
import { mirrorClass } from "../../behaviors/direction.js";
|
|
5
|
+
import "../../fonts/material-symbols.css";
|
|
6
|
+
import "./List.css";
|
|
7
|
+
const NATIVE_MARKERS = /* @__PURE__ */ new Set(["disc", "number", "check", "none"]);
|
|
8
|
+
function List({
|
|
9
|
+
variant = "unordered",
|
|
10
|
+
marker,
|
|
11
|
+
spacing = "default",
|
|
12
|
+
size = "default",
|
|
13
|
+
start,
|
|
14
|
+
reversed,
|
|
15
|
+
className = "",
|
|
16
|
+
style,
|
|
17
|
+
children,
|
|
18
|
+
ref,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
21
|
+
const resolvedMarker = marker ?? (variant === "ordered" ? "number" : variant === "plain" ? "none" : "disc");
|
|
22
|
+
const iconMarker = !NATIVE_MARKERS.has(resolvedMarker);
|
|
23
|
+
const classes = [
|
|
24
|
+
"ds-list",
|
|
25
|
+
`ds-list--${variant}`,
|
|
26
|
+
`ds-list--marker-${iconMarker ? "icon" : resolvedMarker}`,
|
|
27
|
+
`ds-list--spacing-${spacing}`,
|
|
28
|
+
`ds-list--${size}`,
|
|
29
|
+
className
|
|
30
|
+
].filter(Boolean).join(" ");
|
|
31
|
+
const resolvedStyle = iconMarker ? { ...style, "--ds-list-marker": JSON.stringify(resolvedMarker) } : style;
|
|
32
|
+
if (variant === "ordered") {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"ol",
|
|
35
|
+
{
|
|
36
|
+
...rest,
|
|
37
|
+
ref,
|
|
38
|
+
start,
|
|
39
|
+
reversed,
|
|
40
|
+
className: classes,
|
|
41
|
+
style: resolvedStyle,
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx("ul", { ...rest, ref, className: classes, style: resolvedStyle, children });
|
|
47
|
+
}
|
|
48
|
+
function ListItem({ children, description, icon, className = "", ref, ...rest }) {
|
|
49
|
+
const hasIcon = icon != null && icon !== false;
|
|
50
|
+
const classes = ["ds-list__item", hasIcon && "ds-list__item--icon", className].filter(Boolean).join(" ");
|
|
51
|
+
return /* @__PURE__ */ jsxs("li", { ...rest, ref, className: classes, children: [
|
|
52
|
+
hasIcon ? typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: `ds-list__marker material-symbols-rounded ${mirrorClass(icon)}`, "aria-hidden": "true", children: icon }) : /* @__PURE__ */ jsx("span", { className: "ds-list__marker", "aria-hidden": "true", children: icon }) : /* @__PURE__ */ jsx("span", { className: "ds-list__marker ds-list__tick", "aria-hidden": "true", children: /* @__PURE__ */ jsx(CheckIcon, { className: "ds-list__tick-glyph" }) }),
|
|
53
|
+
/* @__PURE__ */ jsx("span", { className: "ds-list__label", children }),
|
|
54
|
+
description != null && description !== false && /* @__PURE__ */ jsx("span", { className: "ds-list__description", children: description })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
List,
|
|
59
|
+
ListItem
|
|
60
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
MASKED INPUT
|
|
3
|
+
An Input whose text the mask writes; the field,
|
|
4
|
+
its states and its action slot are Input's.
|
|
5
|
+
Tabular figures keep the separators still as
|
|
6
|
+
digits arrive, and a hidden value's dots are
|
|
7
|
+
spaced so each stands for one character.
|
|
8
|
+
============================================ */
|
|
9
|
+
|
|
10
|
+
.ds-masked-input .ds-input__field {
|
|
11
|
+
font-variant-numeric: tabular-nums;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-masked-input--concealed .ds-input__field {
|
|
15
|
+
letter-spacing: var(--font-overline-letter-spacing);
|
|
16
|
+
}
|