@galaxy-io/dls 2.4.1 → 2.5.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/dist/beacons/Beacon.d.ts +6 -6
- package/dist/beacons/Beacon.js +22 -19
- package/dist/buttons/Button.d.ts +6 -0
- package/dist/buttons/Button.js +3 -2
- package/dist/charts/BarChart.d.ts +2 -2
- package/dist/charts/ChartLegend.js +2 -1
- package/dist/charts/LineChart.js +1 -0
- package/dist/charts/PieChart.js +1 -0
- package/dist/charts/Sparkline.d.ts +5 -4
- package/dist/charts/Sparkline.js +21 -18
- package/dist/charts/barChartGeometry.d.ts +2 -2
- package/dist/charts/barChartLegend.js +2 -0
- package/dist/charts/chartPalette.d.ts +9 -5
- package/dist/charts/chartPalette.js +8 -2
- package/dist/charts/types.d.ts +7 -5
- package/dist/charts/useSeriesColorResolver.d.ts +2 -1
- package/dist/chips/Chip.d.ts +6 -5
- package/dist/chips/Chip.js +24 -21
- package/dist/feedback/EmptyState.d.ts +29 -3
- package/dist/feedback/EmptyState.js +39 -13
- package/dist/feedback/ProgressBar.d.ts +5 -4
- package/dist/feedback/ProgressBar.js +25 -22
- package/dist/feedback/ProgressCircle.d.ts +5 -4
- package/dist/feedback/ProgressCircle.js +25 -22
- package/dist/inputs/CheckboxGroup.d.ts +5 -1
- package/dist/inputs/CheckboxGroup.js +4 -2
- package/dist/inputs/ColorInput.d.ts +6 -2
- package/dist/inputs/ColorInput.js +4 -2
- package/dist/inputs/CopyInput.d.ts +6 -2
- package/dist/inputs/CopyInput.js +1 -1
- package/dist/inputs/CronInput.d.ts +6 -2
- package/dist/inputs/CronInput.js +4 -2
- package/dist/inputs/DateInput.d.ts +6 -2
- package/dist/inputs/DateInput.js +4 -2
- package/dist/inputs/DurationInput.d.ts +6 -2
- package/dist/inputs/DurationInput.js +4 -2
- package/dist/inputs/FileInput.d.ts +5 -1
- package/dist/inputs/FileInput.js +4 -2
- package/dist/inputs/Input.d.ts +7 -1
- package/dist/inputs/Input.js +7 -4
- package/dist/inputs/KeyValueInput.d.ts +6 -2
- package/dist/inputs/KeyValueInput.js +4 -2
- package/dist/inputs/MultiSelectInput.d.ts +5 -1
- package/dist/inputs/NumberInput.js +2 -1
- package/dist/inputs/PasswordInput.js +2 -1
- package/dist/inputs/PinInput.d.ts +6 -2
- package/dist/inputs/PinInput.js +4 -2
- package/dist/inputs/RadioGroup.d.ts +5 -1
- package/dist/inputs/RadioGroup.js +4 -2
- package/dist/inputs/SelectInput.d.ts +5 -1
- package/dist/inputs/SelectInput.js +4 -2
- package/dist/inputs/SliderInput.d.ts +6 -2
- package/dist/inputs/SliderInput.js +4 -2
- package/dist/inputs/TagInput.d.ts +6 -2
- package/dist/inputs/TagInput.js +4 -2
- package/dist/inputs/TextAreaInput.d.ts +6 -2
- package/dist/inputs/TextAreaInput.js +6 -3
- package/dist/inputs/ToggleInput.d.ts +5 -1
- package/dist/inputs/ToggleInput.js +4 -2
- package/dist/inputs/internal/ownField.d.ts +10 -5
- package/dist/inputs/internal/ownField.js +14 -9
- package/dist/layout/Box.d.ts +1 -1
- package/dist/layout/Box.js +20 -27
- package/dist/layout/Flex.d.ts +24 -1
- package/dist/layout/Flex.js +25 -5
- package/dist/layout/FlexItem.d.ts +24 -1
- package/dist/layout/FlexItem.js +22 -3
- package/dist/layout/internal/surface.d.ts +13 -0
- package/dist/layout/internal/surface.js +28 -0
- package/dist/lists/DescriptionList.d.ts +6 -0
- package/dist/lists/DescriptionList.js +13 -11
- package/dist/modal/ConfirmDialog.d.ts +4 -0
- package/dist/modal/ConfirmDialog.js +14 -12
- package/dist/shapes/Circle.d.ts +6 -5
- package/dist/shapes/Circle.js +21 -18
- package/dist/shapes/Square.d.ts +6 -5
- package/dist/shapes/Square.js +21 -18
- package/dist/styles.css +1 -1
- package/dist/table/TableCore.js +3 -2
- package/dist/text/MarkdownText.js +1 -1
- package/dist/theme/enums.d.ts +1 -1
- package/dist/theme/enums.js +1 -1
- package/dist/theme/tokens/palette.d.ts +5 -1
- package/dist/theme/tokens/palette.js +9 -1
- package/dist/theme/tokens/types.d.ts +9 -1
- package/dist/timeline/Timeline.d.ts +6 -5
- package/dist/timeline/Timeline.js +20 -17
- package/dist/toast/ToastProvider.js +1 -1
- package/dist/toast/useToast.d.ts +1 -1
- package/package.json +1 -1
package/dist/layout/Flex.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { gapToCss, getCssSizeValue, spaceToCss } from "../utils/css.js";
|
|
2
|
+
import { BASE_SURFACE_CSS, PRIMARY_SURFACE_CSS, RADIUS_TO_CSS_MAP, SECONDARY_SURFACE_CSS, TERTIARY_SURFACE_CSS } from "./internal/surface.js";
|
|
2
3
|
/* empty css */
|
|
3
4
|
import { styled } from "@linaria/react";
|
|
4
5
|
import { forwardRef } from "react";
|
|
@@ -7,8 +8,9 @@ import { cx } from "@linaria/core";
|
|
|
7
8
|
//#region src/layout/Flex.tsx
|
|
8
9
|
/**
|
|
9
10
|
* The flexbox layout primitive: a `display: flex` element with every flex and sizing knob as a
|
|
10
|
-
* prop
|
|
11
|
-
*
|
|
11
|
+
* prop, plus the surface props of `Box` (`variant`, `hasBorder`, `radius`) so a bordered island
|
|
12
|
+
* that also flexes is one element. Replaces 1.x `FlexWrapper`. Spacing is `gap` and `padding`
|
|
13
|
+
* from the space scale; there is no `margin` (Constitution II.5).
|
|
12
14
|
*
|
|
13
15
|
* The four flex axes are enums, each a `Record` of `css` blocks. Continuous values (`gap`,
|
|
14
16
|
* `padding`, `grow` / `shrink` / `basis`, sizes, `overflow`) are set as `--gx-flex-*` custom
|
|
@@ -16,6 +18,18 @@ import { cx } from "@linaria/core";
|
|
|
16
18
|
* set. So a nested `Flex` never inherits its parent's values, and nothing extra reaches a custom
|
|
17
19
|
* `as` component (Linaria forwards `$`-props to one).
|
|
18
20
|
*/
|
|
21
|
+
/** Surface step the container fills with (surface set, Constitution V-A). Leave `variant` unset for no fill. */
|
|
22
|
+
var FlexVariant = /* @__PURE__ */ function(FlexVariant) {
|
|
23
|
+
/** The canvas, `background.base`. */
|
|
24
|
+
FlexVariant["BASE"] = "BASE";
|
|
25
|
+
/** A panel, `background.primary`. */
|
|
26
|
+
FlexVariant["PRIMARY"] = "PRIMARY";
|
|
27
|
+
/** A raised surface, `background.secondary`. */
|
|
28
|
+
FlexVariant["SECONDARY"] = "SECONDARY";
|
|
29
|
+
/** The most elevated surface, `background.tertiary`. */
|
|
30
|
+
FlexVariant["TERTIARY"] = "TERTIARY";
|
|
31
|
+
return FlexVariant;
|
|
32
|
+
}({});
|
|
19
33
|
/** Main-axis direction of the flex container (`flex-direction`). */
|
|
20
34
|
var FlexDirection = /* @__PURE__ */ function(FlexDirection) {
|
|
21
35
|
/** Left to right. */
|
|
@@ -101,6 +115,12 @@ var FLEX_WRAP_TO_CSS_MAP = {
|
|
|
101
115
|
};
|
|
102
116
|
var FILL_WIDTH_CSS = "gx-Flex-FILL_WIDTH_CSS-fy5wrww";
|
|
103
117
|
var CLICKABLE_CSS = "gx-Flex-CLICKABLE_CSS-cactce2";
|
|
118
|
+
var FLEX_VARIANT_TO_CSS_MAP = {
|
|
119
|
+
["BASE"]: BASE_SURFACE_CSS,
|
|
120
|
+
["PRIMARY"]: PRIMARY_SURFACE_CSS,
|
|
121
|
+
["SECONDARY"]: SECONDARY_SURFACE_CSS,
|
|
122
|
+
["TERTIARY"]: TERTIARY_SURFACE_CSS
|
|
123
|
+
};
|
|
104
124
|
/** Each block reads the `--gx-flex-<property>` custom property the component sets beside it. */
|
|
105
125
|
var FLEX_CSS_PROPERTY_TO_CSS_MAP = {
|
|
106
126
|
gap: "gx-Flex-gap-gykdsqa",
|
|
@@ -119,7 +139,7 @@ var FLEX_CSS_PROPERTY_TO_CSS_MAP = {
|
|
|
119
139
|
/** A length prop as CSS (number → px), or `undefined` when unset. */
|
|
120
140
|
var toLength = (value) => value === void 0 ? void 0 : getCssSizeValue(value);
|
|
121
141
|
/** The flexbox layout primitive: direction, alignment, wrapping, `gap`, `padding` and sizing. */
|
|
122
|
-
var Flex = forwardRef(function Flex({ children, direction = "ROW", alignItems = "STRETCH", justifyContent = "START", wrap = "NOWRAP", gap, padding, grow, shrink, basis, width, height, minWidth, maxWidth, minHeight, maxHeight, fillWidth = false, overflow, as = "div", onClick, onMouseDown, onMouseEnter, onMouseLeave, onScroll, id, className, style, ...rest }, ref) {
|
|
142
|
+
var Flex = forwardRef(function Flex({ children, direction = "ROW", alignItems = "STRETCH", justifyContent = "START", wrap = "NOWRAP", gap, padding, grow, shrink, basis, width, height, minWidth, maxWidth, minHeight, maxHeight, fillWidth = false, overflow, variant, hasBorder = false, radius, as = "div", onClick, onMouseDown, onMouseEnter, onMouseLeave, onScroll, id, className, style, ...rest }, ref) {
|
|
123
143
|
const values = {
|
|
124
144
|
gap: gap === void 0 ? void 0 : gapToCss(gap),
|
|
125
145
|
padding: padding === void 0 ? void 0 : spaceToCss(padding),
|
|
@@ -152,7 +172,7 @@ var Flex = forwardRef(function Flex({ children, direction = "ROW", alignItems =
|
|
|
152
172
|
onMouseEnter,
|
|
153
173
|
onMouseLeave,
|
|
154
174
|
onScroll,
|
|
155
|
-
className: cx(FLEX_DIRECTION_TO_CSS_MAP[direction], ALIGN_ITEMS_TO_CSS_MAP[alignItems], JUSTIFY_CONTENT_TO_CSS_MAP[justifyContent], FLEX_WRAP_TO_CSS_MAP[wrap], fillWidth && FILL_WIDTH_CSS, onClick !== void 0 && CLICKABLE_CSS, ...classNames, className),
|
|
175
|
+
className: cx(FLEX_DIRECTION_TO_CSS_MAP[direction], ALIGN_ITEMS_TO_CSS_MAP[alignItems], JUSTIFY_CONTENT_TO_CSS_MAP[justifyContent], FLEX_WRAP_TO_CSS_MAP[wrap], variant !== void 0 && FLEX_VARIANT_TO_CSS_MAP[variant], hasBorder && "gx-surface-BORDER_CSS-b9a3ryy", radius !== void 0 && RADIUS_TO_CSS_MAP[radius], fillWidth && FILL_WIDTH_CSS, onClick !== void 0 && CLICKABLE_CSS, ...classNames, className),
|
|
156
176
|
style: {
|
|
157
177
|
...variables,
|
|
158
178
|
...style
|
|
@@ -162,4 +182,4 @@ var Flex = forwardRef(function Flex({ children, direction = "ROW", alignItems =
|
|
|
162
182
|
});
|
|
163
183
|
Flex.displayName = "Flex";
|
|
164
184
|
//#endregion
|
|
165
|
-
export { AlignItems, FlexDirection, FlexWrap, JustifyContent, Flex as default };
|
|
185
|
+
export { AlignItems, FlexDirection, FlexVariant, FlexWrap, JustifyContent, Flex as default };
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties, type ElementType, type MouseEvent, type ReactNode } from "react";
|
|
2
|
-
import type { SpaceShorthand } from "../theme/enums.js";
|
|
2
|
+
import type { Radius, SpaceShorthand } from "../theme/enums.js";
|
|
3
|
+
/** Surface step the item fills with (surface set, Constitution V-A). Leave `variant` unset for no fill. */
|
|
4
|
+
export declare enum FlexItemVariant {
|
|
5
|
+
/** The canvas, `background.base`. */
|
|
6
|
+
BASE = "BASE",
|
|
7
|
+
/** A panel, `background.primary`. */
|
|
8
|
+
PRIMARY = "PRIMARY",
|
|
9
|
+
/** A raised surface, `background.secondary`. */
|
|
10
|
+
SECONDARY = "SECONDARY",
|
|
11
|
+
/** The most elevated surface, `background.tertiary`. */
|
|
12
|
+
TERTIARY = "TERTIARY"
|
|
13
|
+
}
|
|
3
14
|
export interface FlexItemProps extends AriaAttributes {
|
|
4
15
|
/** Content of the item. Laid out in normal flow; nest a `Flex` to arrange it. */
|
|
5
16
|
children?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Surface step the item fills with, as on `Box`. Unset draws no fill: the parent shows through.
|
|
19
|
+
* @default undefined (no fill)
|
|
20
|
+
*/
|
|
21
|
+
variant?: FlexItemVariant;
|
|
22
|
+
/**
|
|
23
|
+
* Draw the 1px hairline border (`border.primary`), as on `Box`.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
hasBorder?: boolean;
|
|
27
|
+
/** Corner radius from the scale, as on `Box`. Square corners when omitted. */
|
|
28
|
+
radius?: Radius;
|
|
6
29
|
/**
|
|
7
30
|
* `flex-grow`: this item's share of the parent's spare main-axis space.
|
|
8
31
|
* @default 0
|
package/dist/layout/FlexItem.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getCssSizeValue, spaceToCss } from "../utils/css.js";
|
|
2
|
+
import { BASE_SURFACE_CSS, PRIMARY_SURFACE_CSS, RADIUS_TO_CSS_MAP, SECONDARY_SURFACE_CSS, TERTIARY_SURFACE_CSS } from "./internal/surface.js";
|
|
2
3
|
/* empty css */
|
|
3
4
|
import { styled } from "@linaria/react";
|
|
4
5
|
import { forwardRef } from "react";
|
|
@@ -17,6 +18,18 @@ import { cx } from "@linaria/core";
|
|
|
17
18
|
* `width: auto`, `position: static`, `overflow: visible`), and nothing extra reaches a custom `as`
|
|
18
19
|
* component (Linaria forwards `$`-props to one).
|
|
19
20
|
*/
|
|
21
|
+
/** Surface step the item fills with (surface set, Constitution V-A). Leave `variant` unset for no fill. */
|
|
22
|
+
var FlexItemVariant = /* @__PURE__ */ function(FlexItemVariant) {
|
|
23
|
+
/** The canvas, `background.base`. */
|
|
24
|
+
FlexItemVariant["BASE"] = "BASE";
|
|
25
|
+
/** A panel, `background.primary`. */
|
|
26
|
+
FlexItemVariant["PRIMARY"] = "PRIMARY";
|
|
27
|
+
/** A raised surface, `background.secondary`. */
|
|
28
|
+
FlexItemVariant["SECONDARY"] = "SECONDARY";
|
|
29
|
+
/** The most elevated surface, `background.tertiary`. */
|
|
30
|
+
FlexItemVariant["TERTIARY"] = "TERTIARY";
|
|
31
|
+
return FlexItemVariant;
|
|
32
|
+
}({});
|
|
20
33
|
var Root = /*#__PURE__*/ styled("div")({
|
|
21
34
|
name: "Root",
|
|
22
35
|
class: "gx-FlexItem-r10jnoxq",
|
|
@@ -24,6 +37,12 @@ var Root = /*#__PURE__*/ styled("div")({
|
|
|
24
37
|
});
|
|
25
38
|
var FILL_WIDTH_CSS = "gx-FlexItem-FILL_WIDTH_CSS-f11ur0tg";
|
|
26
39
|
var CLICKABLE_CSS = "gx-FlexItem-CLICKABLE_CSS-c1phfxjv";
|
|
40
|
+
var FLEX_ITEM_VARIANT_TO_CSS_MAP = {
|
|
41
|
+
["BASE"]: BASE_SURFACE_CSS,
|
|
42
|
+
["PRIMARY"]: PRIMARY_SURFACE_CSS,
|
|
43
|
+
["SECONDARY"]: SECONDARY_SURFACE_CSS,
|
|
44
|
+
["TERTIARY"]: TERTIARY_SURFACE_CSS
|
|
45
|
+
};
|
|
27
46
|
/** Each block reads the `--gx-flex-item-<property>` custom property the component sets beside it. */
|
|
28
47
|
var FLEX_ITEM_CSS_PROPERTY_TO_CSS_MAP = {
|
|
29
48
|
"flex-grow": "gx-FlexItem-flex-grow-f19z5ofo",
|
|
@@ -42,7 +61,7 @@ var FLEX_ITEM_CSS_PROPERTY_TO_CSS_MAP = {
|
|
|
42
61
|
/** A length prop as CSS (number → px), or `undefined` when unset. */
|
|
43
62
|
var toLength = (value) => value === void 0 ? void 0 : getCssSizeValue(value);
|
|
44
63
|
/** One child of a `Flex` with its own grow, shrink, basis and sizing. Not a flex container. */
|
|
45
|
-
var FlexItem = forwardRef(function FlexItem({ children, grow, shrink, basis, width, height, minWidth, maxWidth, minHeight, maxHeight, fillWidth = false, padding, overflow, position, as = "div", onClick, id, className, style, ...rest }, ref) {
|
|
64
|
+
var FlexItem = forwardRef(function FlexItem({ children, grow, shrink, basis, width, height, minWidth, maxWidth, minHeight, maxHeight, fillWidth = false, padding, overflow, position, variant, hasBorder = false, radius, as = "div", onClick, id, className, style, ...rest }, ref) {
|
|
46
65
|
const values = {
|
|
47
66
|
"flex-grow": grow === void 0 ? void 0 : String(grow),
|
|
48
67
|
"flex-shrink": shrink === void 0 ? void 0 : String(shrink),
|
|
@@ -71,7 +90,7 @@ var FlexItem = forwardRef(function FlexItem({ children, grow, shrink, basis, wid
|
|
|
71
90
|
ref,
|
|
72
91
|
id,
|
|
73
92
|
onClick,
|
|
74
|
-
className: cx(fillWidth && FILL_WIDTH_CSS, onClick !== void 0 && CLICKABLE_CSS, ...classNames, className),
|
|
93
|
+
className: cx(variant !== void 0 && FLEX_ITEM_VARIANT_TO_CSS_MAP[variant], hasBorder && "gx-surface-BORDER_CSS-b9a3ryy", radius !== void 0 && RADIUS_TO_CSS_MAP[radius], fillWidth && FILL_WIDTH_CSS, onClick !== void 0 && CLICKABLE_CSS, ...classNames, className),
|
|
75
94
|
style: {
|
|
76
95
|
...variables,
|
|
77
96
|
...style
|
|
@@ -81,4 +100,4 @@ var FlexItem = forwardRef(function FlexItem({ children, grow, shrink, basis, wid
|
|
|
81
100
|
});
|
|
82
101
|
FlexItem.displayName = "FlexItem";
|
|
83
102
|
//#endregion
|
|
84
|
-
export { FlexItem as default };
|
|
103
|
+
export { FlexItemVariant, FlexItem as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Radius } from "../../theme/enums.js";
|
|
2
|
+
/** The canvas, `background.base`. */
|
|
3
|
+
export declare const BASE_SURFACE_CSS: import("@linaria/core").LinariaClassName;
|
|
4
|
+
/** A panel, `background.primary`. */
|
|
5
|
+
export declare const PRIMARY_SURFACE_CSS: import("@linaria/core").LinariaClassName;
|
|
6
|
+
/** A raised surface, `background.secondary`. */
|
|
7
|
+
export declare const SECONDARY_SURFACE_CSS: import("@linaria/core").LinariaClassName;
|
|
8
|
+
/** The most elevated surface, `background.tertiary`. */
|
|
9
|
+
export declare const TERTIARY_SURFACE_CSS: import("@linaria/core").LinariaClassName;
|
|
10
|
+
/** Corner radius per step of the scale. */
|
|
11
|
+
export declare const RADIUS_TO_CSS_MAP: Record<Radius, string>;
|
|
12
|
+
/** The 1px hairline border, `border.primary`. */
|
|
13
|
+
export declare const BORDER_CSS: import("@linaria/core").LinariaClassName;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Radius } from "../../theme/enums.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
//#region src/layout/internal/surface.ts
|
|
4
|
+
/**
|
|
5
|
+
* @internal The surface blocks `Box`, `Flex` and `FlexItem` share: one `css` block per surface
|
|
6
|
+
* step, the radius map and the hairline. Each layout component keys its own `<Component>Variant`
|
|
7
|
+
* enum onto these, so the four fills are written once. Private on purpose (an `internal/` module:
|
|
8
|
+
* built, never a package export).
|
|
9
|
+
*/
|
|
10
|
+
/** The canvas, `background.base`. */
|
|
11
|
+
var BASE_SURFACE_CSS = "gx-surface-BASE_SURFACE_CSS-b1mo8pwf";
|
|
12
|
+
/** A panel, `background.primary`. */
|
|
13
|
+
var PRIMARY_SURFACE_CSS = "gx-surface-PRIMARY_SURFACE_CSS-p1m48mr7";
|
|
14
|
+
/** A raised surface, `background.secondary`. */
|
|
15
|
+
var SECONDARY_SURFACE_CSS = "gx-surface-SECONDARY_SURFACE_CSS-s1pzz23i";
|
|
16
|
+
/** The most elevated surface, `background.tertiary`. */
|
|
17
|
+
var TERTIARY_SURFACE_CSS = "gx-surface-TERTIARY_SURFACE_CSS-t12aes5t";
|
|
18
|
+
/** Corner radius per step of the scale. */
|
|
19
|
+
var RADIUS_TO_CSS_MAP = {
|
|
20
|
+
[Radius.SM]: "gx-surface-Radius_SM-r1tdghn5",
|
|
21
|
+
[Radius.MD]: "gx-surface-Radius_MD-rel0w7v",
|
|
22
|
+
[Radius.LG]: "gx-surface-Radius_LG-r4i8935",
|
|
23
|
+
[Radius.PILL]: "gx-surface-Radius_PILL-r1su3y0g"
|
|
24
|
+
};
|
|
25
|
+
/** The 1px hairline border, `border.primary`. */
|
|
26
|
+
var BORDER_CSS = "gx-surface-BORDER_CSS-b9a3ryy";
|
|
27
|
+
//#endregion
|
|
28
|
+
export { BASE_SURFACE_CSS, BORDER_CSS, PRIMARY_SURFACE_CSS, RADIUS_TO_CSS_MAP, SECONDARY_SURFACE_CSS, TERTIARY_SURFACE_CSS };
|
|
@@ -77,6 +77,12 @@ export interface DescriptionListProps extends AriaAttributes {
|
|
|
77
77
|
* @default 1
|
|
78
78
|
*/
|
|
79
79
|
columns?: DescriptionListColumns;
|
|
80
|
+
/**
|
|
81
|
+
* Align every value (and its copy button) to the end of its track instead of the start: the
|
|
82
|
+
* detail-pane layout where labels sit at the left edge and values at the right.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
isValueTrailing?: boolean;
|
|
80
86
|
/** DOM id on the root `<dl>`. */
|
|
81
87
|
id?: string;
|
|
82
88
|
/** Any `data-*` attribute, forwarded to the root `<dl>`. */
|
|
@@ -62,21 +62,23 @@ var Details = /*#__PURE__*/ styled("dd")({
|
|
|
62
62
|
* center on the strut's line.
|
|
63
63
|
*/
|
|
64
64
|
var NODE_VALUE_CSS = "gx-DescriptionList-NODE_VALUE_CSS-n1mikopx";
|
|
65
|
+
/** Values at the end of their track; the value cell is a flex row, so its content follows. */
|
|
66
|
+
var VALUE_TRAILING_CSS = "gx-DescriptionList-VALUE_TRAILING_CSS-v17z38i7";
|
|
65
67
|
var DESCRIPTION_LIST_ORIENTATION_TO_CSS_MAP = {
|
|
66
|
-
[Orientation.HORIZONTAL]: "gx-DescriptionList-Orientation_HORIZONTAL-
|
|
67
|
-
[Orientation.VERTICAL]: "gx-DescriptionList-Orientation_VERTICAL-
|
|
68
|
+
[Orientation.HORIZONTAL]: "gx-DescriptionList-Orientation_HORIZONTAL-oarm5a8",
|
|
69
|
+
[Orientation.VERTICAL]: "gx-DescriptionList-Orientation_VERTICAL-o1itek1z"
|
|
68
70
|
};
|
|
69
71
|
var DESCRIPTION_LIST_COLUMNS_TO_CSS_MAP = {
|
|
70
|
-
1: "gx-DescriptionList-1-
|
|
71
|
-
2: "gx-DescriptionList-2-
|
|
72
|
-
3: "gx-DescriptionList-3-
|
|
73
|
-
4: "gx-DescriptionList-4-
|
|
72
|
+
1: "gx-DescriptionList-1-_19oquh",
|
|
73
|
+
2: "gx-DescriptionList-2-_108p3ql",
|
|
74
|
+
3: "gx-DescriptionList-3-_10x7q9y",
|
|
75
|
+
4: "gx-DescriptionList-4-_1g4xmgd"
|
|
74
76
|
};
|
|
75
77
|
/** Applied only when some item is copyable: every row is as tall as a row with a copy button. */
|
|
76
78
|
var DESCRIPTION_LIST_SIZE_TO_ROW_CSS_MAP = {
|
|
77
|
-
["SMALL"]: "gx-DescriptionList-SMALL-
|
|
78
|
-
["MEDIUM"]: "gx-DescriptionList-MEDIUM-
|
|
79
|
-
["LARGE"]: "gx-DescriptionList-LARGE-
|
|
79
|
+
["SMALL"]: "gx-DescriptionList-SMALL-s1s7hmki",
|
|
80
|
+
["MEDIUM"]: "gx-DescriptionList-MEDIUM-m1t8g3vn",
|
|
81
|
+
["LARGE"]: "gx-DescriptionList-LARGE-l1k8wc0x"
|
|
80
82
|
};
|
|
81
83
|
var DESCRIPTION_LIST_SIZE_TO_TEXT_SIZE_MAP = {
|
|
82
84
|
["SMALL"]: TextSize.BODY_SM,
|
|
@@ -97,7 +99,7 @@ var getCopyText = (item) => {
|
|
|
97
99
|
return isText(item.value) && !isEmpty(item.value) ? String(item.value) : void 0;
|
|
98
100
|
};
|
|
99
101
|
/** Labelled values in a `<dl>`: labels aligned in one column, or above their values. */
|
|
100
|
-
var DescriptionList = forwardRef(function DescriptionList({ items, size = "MEDIUM", orientation = Orientation.HORIZONTAL, columns = 1, id, className, style, ...rest }, ref) {
|
|
102
|
+
var DescriptionList = forwardRef(function DescriptionList({ items, size = "MEDIUM", orientation = Orientation.HORIZONTAL, columns = 1, isValueTrailing = false, id, className, style, ...rest }, ref) {
|
|
101
103
|
const textSize = DESCRIPTION_LIST_SIZE_TO_TEXT_SIZE_MAP[size];
|
|
102
104
|
const hasCopy = items.some((item) => item.isCopyable === true);
|
|
103
105
|
const entries = items.map((item, position) => ({
|
|
@@ -108,7 +110,7 @@ var DescriptionList = forwardRef(function DescriptionList({ items, size = "MEDIU
|
|
|
108
110
|
...rest,
|
|
109
111
|
ref,
|
|
110
112
|
id,
|
|
111
|
-
className: cx(DESCRIPTION_LIST_ORIENTATION_TO_CSS_MAP[orientation], DESCRIPTION_LIST_COLUMNS_TO_CSS_MAP[columns], hasCopy && DESCRIPTION_LIST_SIZE_TO_ROW_CSS_MAP[size], className),
|
|
113
|
+
className: cx(DESCRIPTION_LIST_ORIENTATION_TO_CSS_MAP[orientation], DESCRIPTION_LIST_COLUMNS_TO_CSS_MAP[columns], hasCopy && DESCRIPTION_LIST_SIZE_TO_ROW_CSS_MAP[size], isValueTrailing && VALUE_TRAILING_CSS, className),
|
|
112
114
|
style,
|
|
113
115
|
children: entries.map(({ item, position }) => {
|
|
114
116
|
const copyText = getCopyText(item);
|
|
@@ -30,6 +30,10 @@ export interface ConfirmDialogProps extends AriaAttributes {
|
|
|
30
30
|
isDestructive?: boolean;
|
|
31
31
|
/** Type-to-confirm. When set, the user must type this text exactly (surrounding spaces ignored) before the confirm button enables. */
|
|
32
32
|
confirmValue?: string;
|
|
33
|
+
/** Replaces the default comparison of what was typed against `confirmValue` (trimmed equality): accept an alias, ignore case, normalise a glyph. */
|
|
34
|
+
isMatch?: (typed: string, confirmValue: string) => boolean;
|
|
35
|
+
/** Block content between the description and the confirm field: an `Alert` with what the action also does, a `BulletedList` of what is removed. Never a form. */
|
|
36
|
+
children?: ReactNode;
|
|
33
37
|
/** A message under the description, for an action that failed. The app sets it, usually after `onConfirm` rejects. */
|
|
34
38
|
error?: string;
|
|
35
39
|
/** Controlled open state. When set, ConfirmDialog calls `onOpenChange` and lets the caller decide. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FontFamily } from "../theme/enums.js";
|
|
2
1
|
import Text, { TextVariant } from "../text/Text.js";
|
|
3
2
|
import { useControlledOpenState } from "../hooks/useControlledOpenState.js";
|
|
4
3
|
import Flex, { FlexDirection } from "../layout/Flex.js";
|
|
5
4
|
import Button, { ButtonVariant } from "../buttons/Button.js";
|
|
6
|
-
import Span from "../text/Span.js";
|
|
7
5
|
import TextInput from "../inputs/TextInput.js";
|
|
6
|
+
import Code from "../text/Code.js";
|
|
7
|
+
import Selectable from "../text/Selectable.js";
|
|
8
8
|
import Modal, { ModalSize } from "./Modal.js";
|
|
9
9
|
import { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -26,10 +26,12 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
26
26
|
*/
|
|
27
27
|
/** The fixed text of the dismiss button (as Modal's "Close"). */
|
|
28
28
|
var CANCEL_LABEL = "Cancel";
|
|
29
|
+
/** The default `isMatch`: what was typed equals `confirmValue`, surrounding spaces ignored. */
|
|
30
|
+
var isTrimmedEqual = (typed, confirmValue) => typed.trim() === confirmValue.trim();
|
|
29
31
|
/** A value with a `then` method: what `await` would treat as a promise. */
|
|
30
32
|
var isThenable = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
|
|
31
33
|
/** A yes/no question before an action: title, description, optional type-to-confirm, Cancel + action. */
|
|
32
|
-
var ConfirmDialog = forwardRef(function ConfirmDialog({ header, description, label, onConfirm, isDestructive = false, confirmValue, error, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, "aria-describedby": ariaDescribedBy, className, style, ...rest }, ref) {
|
|
34
|
+
var ConfirmDialog = forwardRef(function ConfirmDialog({ header, description, label, onConfirm, isDestructive = false, confirmValue, isMatch = isTrimmedEqual, children, error, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, "aria-describedby": ariaDescribedBy, className, style, ...rest }, ref) {
|
|
33
35
|
const descriptionId = useId();
|
|
34
36
|
const promptId = useId();
|
|
35
37
|
const { isOpen, setOpen } = useControlledOpenState({
|
|
@@ -59,7 +61,7 @@ var ConfirmDialog = forwardRef(function ConfirmDialog({ header, description, lab
|
|
|
59
61
|
if (!next && isPending) return;
|
|
60
62
|
setOpen(next);
|
|
61
63
|
};
|
|
62
|
-
const isMatched = confirmValue === void 0 || typed
|
|
64
|
+
const isMatched = confirmValue === void 0 || isMatch(typed, confirmValue);
|
|
63
65
|
const confirm = () => {
|
|
64
66
|
if (!isMatched || isPending) return;
|
|
65
67
|
const result = onConfirm();
|
|
@@ -78,10 +80,10 @@ var ConfirmDialog = forwardRef(function ConfirmDialog({ header, description, lab
|
|
|
78
80
|
});
|
|
79
81
|
};
|
|
80
82
|
const describedBy = ariaDescribedBy ?? (description === void 0 ? void 0 : descriptionId);
|
|
81
|
-
const hasBody = description !== void 0 || confirmValue !== void 0 || error !== void 0;
|
|
83
|
+
const hasBody = description !== void 0 || children !== void 0 || confirmValue !== void 0 || error !== void 0;
|
|
82
84
|
const footer = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
83
85
|
label: CANCEL_LABEL,
|
|
84
|
-
variant: ButtonVariant.
|
|
86
|
+
variant: ButtonVariant.SECONDARY,
|
|
85
87
|
isDisabled: isPending,
|
|
86
88
|
onClick: () => requestOpenChange(false)
|
|
87
89
|
}), /* @__PURE__ */ jsx(Button, {
|
|
@@ -112,18 +114,18 @@ var ConfirmDialog = forwardRef(function ConfirmDialog({ header, description, lab
|
|
|
112
114
|
variant: TextVariant.SECONDARY,
|
|
113
115
|
children: description
|
|
114
116
|
}),
|
|
117
|
+
children,
|
|
115
118
|
confirmValue !== void 0 && /* @__PURE__ */ jsxs(Flex, {
|
|
116
119
|
direction: FlexDirection.COLUMN,
|
|
117
120
|
gap: 8,
|
|
118
121
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
119
122
|
id: promptId,
|
|
120
123
|
children: [
|
|
121
|
-
"Type
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
" to confirm."
|
|
124
|
+
"Type",
|
|
125
|
+
" ",
|
|
126
|
+
/* @__PURE__ */ jsx(Code, { children: /* @__PURE__ */ jsx(Selectable, { children: confirmValue }) }),
|
|
127
|
+
" ",
|
|
128
|
+
"to confirm."
|
|
127
129
|
]
|
|
128
130
|
}), /* @__PURE__ */ jsx(TextInput, {
|
|
129
131
|
value: typed,
|
package/dist/shapes/Circle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties } from "react";
|
|
2
|
-
import type { Hex,
|
|
2
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
3
3
|
/** Canonical rungs; the member names the rung of the text the dot sits beside. */
|
|
4
4
|
export declare enum CircleSize {
|
|
5
5
|
/** 6px, beside `caption` (12px line). */
|
|
@@ -72,11 +72,12 @@ interface CircleColorProps {
|
|
|
72
72
|
*/
|
|
73
73
|
variant?: undefined;
|
|
74
74
|
/**
|
|
75
|
-
* Categorical palette family (`"blue"`, `"violet"`, …)
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* Categorical palette family (`"blue"`, `"violet"`, …) or a status role as a string
|
|
76
|
+
* (`"success"`, `"error"`): fills with `text.<name>`, the way a status variant renders. For
|
|
77
|
+
* categories and data-driven marks (a series, a source type, a run status map); a status that is
|
|
78
|
+
* meaning takes `variant`. Not with `variant`.
|
|
78
79
|
*/
|
|
79
|
-
color:
|
|
80
|
+
color: RoleColor;
|
|
80
81
|
}
|
|
81
82
|
/** Circle props. Passing both `variant` and `color` is a type error. */
|
|
82
83
|
export type CircleProps = CircleBaseProps & (CircleVariantProps | CircleColorProps);
|
package/dist/shapes/Circle.js
CHANGED
|
@@ -84,26 +84,29 @@ var CIRCLE_VARIANT_TO_CSS_MAP = {
|
|
|
84
84
|
};
|
|
85
85
|
/** Categorical `color`: `text.<family>`, the way a status variant renders. */
|
|
86
86
|
var CIRCLE_COLOR_TO_CSS_MAP = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
success: "gx-Circle-success-sisghat",
|
|
88
|
+
warning: "gx-Circle-warning-wrnyxi5",
|
|
89
|
+
error: "gx-Circle-error-emlehi9",
|
|
90
|
+
red: "gx-Circle-red-rx4zu59",
|
|
91
|
+
orange: "gx-Circle-orange-omm7dfa",
|
|
92
|
+
amber: "gx-Circle-amber-a15qmdzt",
|
|
93
|
+
yellow: "gx-Circle-yellow-y1p4fg4l",
|
|
94
|
+
lime: "gx-Circle-lime-l6eszpj",
|
|
95
|
+
green: "gx-Circle-green-g1kmyxwu",
|
|
96
|
+
emerald: "gx-Circle-emerald-er4sdq5",
|
|
97
|
+
teal: "gx-Circle-teal-tw9vccf",
|
|
98
|
+
cyan: "gx-Circle-cyan-c1rmact7",
|
|
99
|
+
sky: "gx-Circle-sky-syv0gwd",
|
|
100
|
+
blue: "gx-Circle-blue-bdx6kbq",
|
|
101
|
+
indigo: "gx-Circle-indigo-i1j11685",
|
|
102
|
+
violet: "gx-Circle-violet-vgz62lk",
|
|
103
|
+
purple: "gx-Circle-purple-pe429ux",
|
|
104
|
+
fuchsia: "gx-Circle-fuchsia-f1h7hg24",
|
|
105
|
+
pink: "gx-Circle-pink-po1cc6l",
|
|
106
|
+
rose: "gx-Circle-rose-r1ljyczc"
|
|
104
107
|
};
|
|
105
108
|
/** Declared after the variant and color maps so `hex` wins over them. */
|
|
106
|
-
var HEX_CSS = "gx-Circle-HEX_CSS-
|
|
109
|
+
var HEX_CSS = "gx-Circle-HEX_CSS-h18iedp";
|
|
107
110
|
/** A filled dot beside a label; its color is a role (`variant`), a category (`color`) or data (`hex`). */
|
|
108
111
|
var Circle = forwardRef(function Circle({ size = "MEDIUM", variant = "TERTIARY", color, hex, ariaLabel, id, className, style, ...rest }, ref) {
|
|
109
112
|
const variables = {};
|
package/dist/shapes/Square.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties } from "react";
|
|
2
|
-
import type { Hex,
|
|
2
|
+
import type { Hex, RoleColor } from "../theme/tokens/types.js";
|
|
3
3
|
/** Canonical rungs; the member names the rung of the text the mark sits beside. */
|
|
4
4
|
export declare enum SquareSize {
|
|
5
5
|
/** 6px, beside `caption` (12px line). */
|
|
@@ -72,11 +72,12 @@ interface SquareColorProps {
|
|
|
72
72
|
*/
|
|
73
73
|
variant?: undefined;
|
|
74
74
|
/**
|
|
75
|
-
* Categorical palette family (`"blue"`, `"violet"`, …)
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* Categorical palette family (`"blue"`, `"violet"`, …) or a status role as a string
|
|
76
|
+
* (`"success"`, `"error"`): fills with `text.<name>`, the way a status variant renders. For
|
|
77
|
+
* categories and data-driven marks (a series, a source type, a run status map); a status that is
|
|
78
|
+
* meaning takes `variant`. Not with `variant`.
|
|
78
79
|
*/
|
|
79
|
-
color:
|
|
80
|
+
color: RoleColor;
|
|
80
81
|
}
|
|
81
82
|
/** Square props. Passing both `variant` and `color` is a type error. */
|
|
82
83
|
export type SquareProps = SquareBaseProps & (SquareVariantProps | SquareColorProps);
|
package/dist/shapes/Square.js
CHANGED
|
@@ -85,26 +85,29 @@ var SQUARE_VARIANT_TO_CSS_MAP = {
|
|
|
85
85
|
};
|
|
86
86
|
/** Categorical `color`: `text.<family>`, the way a status variant renders. */
|
|
87
87
|
var SQUARE_COLOR_TO_CSS_MAP = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
success: "gx-Square-success-s44keg",
|
|
89
|
+
warning: "gx-Square-warning-w1czb11g",
|
|
90
|
+
error: "gx-Square-error-e11m2avz",
|
|
91
|
+
red: "gx-Square-red-r1dycb8",
|
|
92
|
+
orange: "gx-Square-orange-o13w32o7",
|
|
93
|
+
amber: "gx-Square-amber-aflvbdc",
|
|
94
|
+
yellow: "gx-Square-yellow-y1wrg0mj",
|
|
95
|
+
lime: "gx-Square-lime-lbmrs5y",
|
|
96
|
+
green: "gx-Square-green-g1229390",
|
|
97
|
+
emerald: "gx-Square-emerald-eylmgp4",
|
|
98
|
+
teal: "gx-Square-teal-tgnvnom",
|
|
99
|
+
cyan: "gx-Square-cyan-cqzrj1i",
|
|
100
|
+
sky: "gx-Square-sky-sx1evfg",
|
|
101
|
+
blue: "gx-Square-blue-b1bh3ofr",
|
|
102
|
+
indigo: "gx-Square-indigo-i15n3xo4",
|
|
103
|
+
violet: "gx-Square-violet-v1qvour9",
|
|
104
|
+
purple: "gx-Square-purple-p1g6v6vx",
|
|
105
|
+
fuchsia: "gx-Square-fuchsia-f1u3b7de",
|
|
106
|
+
pink: "gx-Square-pink-pdedn2c",
|
|
107
|
+
rose: "gx-Square-rose-rod6x1x"
|
|
105
108
|
};
|
|
106
109
|
/** Declared after the variant and color maps so `hex` wins over them. */
|
|
107
|
-
var HEX_CSS = "gx-Square-HEX_CSS-
|
|
110
|
+
var HEX_CSS = "gx-Square-HEX_CSS-h1ah0bbe";
|
|
108
111
|
/** A filled square mark beside a label; its color is a role (`variant`), a category (`color`) or data (`hex`). */
|
|
109
112
|
var Square = forwardRef(function Square({ size = "MEDIUM", variant = "TERTIARY", color, hex, ariaLabel, id, className, style, ...rest }, ref) {
|
|
110
113
|
const variables = {};
|