@galaxy-io/dls 2.4.0 → 2.5.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/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 +7 -4
- package/dist/navigation/Tabs.d.ts +2 -1
- package/dist/navigation/Tabs.js +25 -23
- 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/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/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* SSR: ids come from `useId`; focus moves run in an effect; nothing touches `window` or
|
|
15
15
|
* `document` at module scope.
|
|
16
16
|
*/
|
|
17
|
-
import { type AriaAttributes, type CSSProperties } from "react";
|
|
17
|
+
import { type AriaAttributes, type CSSProperties, type ReactNode } from "react";
|
|
18
18
|
/** Canonical rungs; KeyValueInput supports all five. Every field and button in it uses the rung. */
|
|
19
19
|
export declare enum KeyValueInputSize {
|
|
20
20
|
/** 20px rows, 4px gaps. */
|
|
@@ -72,8 +72,12 @@ export interface KeyValueInputProps extends AriaAttributes {
|
|
|
72
72
|
* @default false
|
|
73
73
|
*/
|
|
74
74
|
isGhost?: boolean;
|
|
75
|
-
/** Label above the rows, rendered through `Field`. For a
|
|
75
|
+
/** Label above the rows, rendered through `Field`. For a horizontal layout or `actions`, wrap it in `Field`. */
|
|
76
76
|
label?: string;
|
|
77
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
78
|
+
labelTooltip?: string | ReactNode;
|
|
79
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
80
|
+
description?: ReactNode;
|
|
77
81
|
/** Message from the app ("Header names must be unique"), shown under the rows through `Field`. It also marks every field invalid. */
|
|
78
82
|
error?: string;
|
|
79
83
|
/**
|
|
@@ -168,7 +168,7 @@ function parseLines(text) {
|
|
|
168
168
|
}
|
|
169
169
|
/** The group, its rows and the add button, wired to the nearest Field (the input's own or the app's). */
|
|
170
170
|
function KeyValueGroup({ keyValueProps, forwardedRef, isRoot }) {
|
|
171
|
-
const { value, defaultValue = [], onChange, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = keyValueProps;
|
|
171
|
+
const { value, defaultValue = [], onChange, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = keyValueProps;
|
|
172
172
|
const { field, controlId: groupId, describedBy: fieldDescribedBy, isInvalid, hasName } = useFieldWiring({
|
|
173
173
|
id,
|
|
174
174
|
ariaLabel,
|
|
@@ -352,11 +352,13 @@ function KeyValueGroup({ keyValueProps, forwardedRef, isRoot }) {
|
|
|
352
352
|
}
|
|
353
353
|
/** Editable key/value rows (headers, environment variables) with add, remove and `.env` paste. */
|
|
354
354
|
var KeyValueInput = forwardRef(function KeyValueInput(props, ref) {
|
|
355
|
-
const { label, error, isRequired = false, size = "MEDIUM", fillWidth = false, id, className, style } = props;
|
|
355
|
+
const { label, error, labelTooltip, description, isRequired = false, size = "MEDIUM", fillWidth = false, id, className, style } = props;
|
|
356
356
|
const ownField = useOwnField({
|
|
357
357
|
componentName: "KeyValueInput",
|
|
358
358
|
label,
|
|
359
359
|
error,
|
|
360
|
+
labelTooltip,
|
|
361
|
+
description,
|
|
360
362
|
isRequired,
|
|
361
363
|
size: KEY_VALUE_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
362
364
|
id,
|
|
@@ -54,8 +54,12 @@ export interface MultiSelectInputBaseProps<TId extends string = string> extends
|
|
|
54
54
|
* @default false
|
|
55
55
|
*/
|
|
56
56
|
isGhost?: boolean;
|
|
57
|
-
/** Label above the field, rendered through `Field`. For a
|
|
57
|
+
/** Label above the field, rendered through `Field`. For a horizontal layout or `actions`, wrap it in `Field`. */
|
|
58
58
|
label?: string;
|
|
59
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
60
|
+
labelTooltip?: string | ReactNode;
|
|
61
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
62
|
+
description?: ReactNode;
|
|
59
63
|
/**
|
|
60
64
|
* Shown in the field while nothing is selected, and in the search field while it is empty. Never the label.
|
|
61
65
|
* @default Select options…
|
|
@@ -22,7 +22,8 @@ import { MinusIcon, PlusIcon } from "@phosphor-icons/react";
|
|
|
22
22
|
* `inputs/Input`. It never validates: out-of-range values are clamped, not rejected.
|
|
23
23
|
*
|
|
24
24
|
* Replaces 1.x `NumberInput` (`type="number"` and per-keystroke clamping are gone; `width` →
|
|
25
|
-
* `fillWidth`, `isMonospace` → `family
|
|
25
|
+
* `fillWidth`, `isMonospace` → `family`; `labelTooltip` and `description` render through the
|
|
26
|
+
* input's own Field since 2.5).
|
|
26
27
|
*/
|
|
27
28
|
/** Tabular digits, so the value keeps its width while stepping (lands on Input's root). */
|
|
28
29
|
var NUMBER_INPUT_CSS = "gx-NumberInput-NUMBER_INPUT_CSS-n19kajw4";
|
|
@@ -16,7 +16,8 @@ import { EyeIcon, EyeSlashIcon } from "@phosphor-icons/react";
|
|
|
16
16
|
*
|
|
17
17
|
* PasswordInput holds no strength or matching rules: the app validates and passes `error`.
|
|
18
18
|
* Replaces 1.x `PasswordInput` (its unnamed bare toggle is now a named `aria-pressed` Button;
|
|
19
|
-
* `width` → `fillWidth`, `isMonospace` → `family
|
|
19
|
+
* `width` → `fillWidth`, `isMonospace` → `family`; `labelTooltip` and `description` render through
|
|
20
|
+
* the input's own Field since 2.5).
|
|
20
21
|
*/
|
|
21
22
|
/** A masked single-line field with a "Show password" toggle: `Input` with `type="password"`. */
|
|
22
23
|
var PasswordInput = forwardRef(function PasswordInput(props, ref) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type CSSProperties, type InputHTMLAttributes } from "react";
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
/** Canonical rungs; PinInput exposes three (EXAMPLES §14). Boxes are squares of the rung height. */
|
|
3
3
|
export declare enum PinInputSize {
|
|
4
4
|
/** 24px boxes, body_md mono characters. */
|
|
@@ -77,8 +77,12 @@ export interface PinInputProps extends AriaAttributes, PinInputNativeProps {
|
|
|
77
77
|
* @default false
|
|
78
78
|
*/
|
|
79
79
|
isGhost?: boolean;
|
|
80
|
-
/** Label above the boxes, rendered through `Field`. For a
|
|
80
|
+
/** Label above the boxes, rendered through `Field`. For a horizontal layout or `actions`, wrap the PinInput in `Field`. */
|
|
81
81
|
label?: string;
|
|
82
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
83
|
+
labelTooltip?: string | ReactNode;
|
|
84
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
85
|
+
description?: ReactNode;
|
|
82
86
|
/** Message from the app ("Code is incorrect"), shown under the boxes through `Field`. Also turns every box's border red and sets `aria-invalid`. */
|
|
83
87
|
error?: string;
|
|
84
88
|
/**
|
package/dist/inputs/PinInput.js
CHANGED
|
@@ -139,7 +139,7 @@ var ERROR_CSS = "gx-PinInput-ERROR_CSS-emv6pcb";
|
|
|
139
139
|
var DISABLED_CSS = "gx-PinInput-DISABLED_CSS-dz9kczs";
|
|
140
140
|
/** The boxes, wired to the nearest Field (the PinInput's own or the app's). */
|
|
141
141
|
function PinGroup({ pinProps, forwardedRef, isRoot }) {
|
|
142
|
-
const { length: lengthProp = 6, value, defaultValue = "", onChange, onComplete, type = "NUMERIC", isMasked = false, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, ariaLabel, autoFocus = false, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = pinProps;
|
|
142
|
+
const { length: lengthProp = 6, value, defaultValue = "", onChange, onComplete, type = "NUMERIC", isMasked = false, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, ariaLabel, autoFocus = false, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = pinProps;
|
|
143
143
|
const length = Math.max(1, Math.floor(Number.isFinite(lengthProp) ? lengthProp : 1));
|
|
144
144
|
const { field, controlId, describedBy, isInvalid, isRequired: isRequiredState, hasName } = useFieldWiring({
|
|
145
145
|
id,
|
|
@@ -334,11 +334,13 @@ function PinGroup({ pinProps, forwardedRef, isRoot }) {
|
|
|
334
334
|
/** One box per character, for OTP and confirmation codes. */
|
|
335
335
|
var PinInput = forwardRef(function PinInput(props, ref) {
|
|
336
336
|
const { label, error, isRequired = false, size = "MEDIUM" } = props;
|
|
337
|
-
const { id, className, style } = props;
|
|
337
|
+
const { labelTooltip, description, id, className, style } = props;
|
|
338
338
|
const ownField = useOwnField({
|
|
339
339
|
componentName: "PinInput",
|
|
340
340
|
label,
|
|
341
341
|
error,
|
|
342
|
+
labelTooltip,
|
|
343
|
+
description,
|
|
342
344
|
isRequired,
|
|
343
345
|
size: PIN_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
344
346
|
id,
|
|
@@ -50,8 +50,12 @@ export interface RadioGroupProps<TId extends string = string> extends AriaAttrib
|
|
|
50
50
|
defaultValue?: TId | null;
|
|
51
51
|
/** Called with the id the user selects. The user cannot clear a selection. */
|
|
52
52
|
onChange?: (value: TId) => void;
|
|
53
|
-
/** The question, rendered through `Field` above the options. For a
|
|
53
|
+
/** The question, rendered through `Field` above the options. For a horizontal layout or `actions`, wrap the group in `Field`. */
|
|
54
54
|
label?: string;
|
|
55
|
+
/** Hint behind an info icon beside the question, shown in a `Tooltip` (through `Field`). */
|
|
56
|
+
labelTooltip?: string | ReactNode;
|
|
57
|
+
/** Help copy under the question, above the options, through `Field`. Text and inline `Link`s only. */
|
|
58
|
+
description?: ReactNode;
|
|
55
59
|
/** Message from the app, shown under the options through `Field`. It also marks the group invalid. */
|
|
56
60
|
error?: string;
|
|
57
61
|
/**
|
|
@@ -94,7 +94,7 @@ var RADIO_GROUP_SIZE_TO_FIELD_SIZE_MAP = {
|
|
|
94
94
|
};
|
|
95
95
|
/** The radiogroup and its radios, wired to the nearest Field (the group's own or the app's). */
|
|
96
96
|
function GroupBody({ groupProps, forwardedRef, isRoot }) {
|
|
97
|
-
const { options, value, defaultValue, onChange, label: _label, error, isError = false, isRequired = false, orientation = Orientation.VERTICAL, size = "MEDIUM", variant = "PRIMARY", isGhost = false, isDisabled = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = groupProps;
|
|
97
|
+
const { options, value, defaultValue, onChange, label: _label, labelTooltip: _labelTooltip, description: _description, error, isError = false, isRequired = false, orientation = Orientation.VERTICAL, size = "MEDIUM", variant = "PRIMARY", isGhost = false, isDisabled = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = groupProps;
|
|
98
98
|
const wiring = useFieldWiring({
|
|
99
99
|
id,
|
|
100
100
|
ariaLabel,
|
|
@@ -147,11 +147,13 @@ function GroupBody({ groupProps, forwardedRef, isRoot }) {
|
|
|
147
147
|
/** A set of radios answering one question; the value is the selected id. */
|
|
148
148
|
var RadioGroupBase = forwardRef(function RadioGroup(props, ref) {
|
|
149
149
|
const { label, error, isRequired = false, size = "MEDIUM" } = props;
|
|
150
|
-
const { id, className, style } = props;
|
|
150
|
+
const { labelTooltip, description, id, className, style } = props;
|
|
151
151
|
const ownField = useOwnField({
|
|
152
152
|
componentName: "RadioGroup",
|
|
153
153
|
label,
|
|
154
154
|
error,
|
|
155
|
+
labelTooltip,
|
|
156
|
+
description,
|
|
155
157
|
isRequired,
|
|
156
158
|
size: RADIO_GROUP_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
157
159
|
id,
|
|
@@ -79,8 +79,12 @@ export interface SelectInputProps<TId extends string = string> extends AriaAttri
|
|
|
79
79
|
* @default false
|
|
80
80
|
*/
|
|
81
81
|
isGhost?: boolean;
|
|
82
|
-
/** Label above the field, rendered through `Field`. For a
|
|
82
|
+
/** Label above the field, rendered through `Field`. For a horizontal layout or `actions`, wrap the select in `Field`. */
|
|
83
83
|
label?: string;
|
|
84
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
85
|
+
labelTooltip?: string | ReactNode;
|
|
86
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
87
|
+
description?: ReactNode;
|
|
84
88
|
/**
|
|
85
89
|
* Shown in the field while nothing is selected, and in the search field while it is empty. Never the label.
|
|
86
90
|
* @default Select an option…
|
|
@@ -588,7 +588,7 @@ function openIndex(nav, target) {
|
|
|
588
588
|
}
|
|
589
589
|
/** The field, the trailing parts, the panel and the engine, wired to the nearest Field. */
|
|
590
590
|
function SelectInputFrame({ rootProps, forwardedRef, isRoot }) {
|
|
591
|
-
const { options, selectedIds, isMultiple, onOptionSelect, onClear, renderSelection, getSelectionText, limitReason, onCreate, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, placeholder = "Select an option…", error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, isOpen, defaultIsOpen = false, onOpenChange, isSearchable = false, onSearch, isClearable = false, isLoading = false, emptyMessage = "No results", onEndReached, renderOption, pinnedIds, placement = Placement.BOTTOM_START, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = rootProps;
|
|
591
|
+
const { options, selectedIds, isMultiple, onOptionSelect, onClear, renderSelection, getSelectionText, limitReason, onCreate, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, placeholder = "Select an option…", error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, isOpen, defaultIsOpen = false, onOpenChange, isSearchable = false, onSearch, isClearable = false, isLoading = false, emptyMessage = "No results", onEndReached, renderOption, pinnedIds, placement = Placement.BOTTOM_START, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = rootProps;
|
|
592
592
|
const isBare = useIsBareField();
|
|
593
593
|
const { field, controlId, describedBy, isInvalid, isRequired: isRequiredState, hasName } = useFieldWiring({
|
|
594
594
|
id,
|
|
@@ -1265,12 +1265,14 @@ function SelectInputFrame({ rootProps, forwardedRef, isRoot }) {
|
|
|
1265
1265
|
* virtualization.
|
|
1266
1266
|
*/
|
|
1267
1267
|
var SelectInputRootInner = forwardRef(function SelectInputRoot(props, ref) {
|
|
1268
|
-
const { label, error, isRequired = false, componentName = "SelectInput", size = "MEDIUM", fillWidth = false } = props;
|
|
1268
|
+
const { label, error, labelTooltip, description, isRequired = false, componentName = "SelectInput", size = "MEDIUM", fillWidth = false } = props;
|
|
1269
1269
|
const { id, className, style } = props;
|
|
1270
1270
|
const ownField = useOwnField({
|
|
1271
1271
|
componentName,
|
|
1272
1272
|
label,
|
|
1273
1273
|
error,
|
|
1274
|
+
labelTooltip,
|
|
1275
|
+
description,
|
|
1274
1276
|
isRequired,
|
|
1275
1277
|
size: SELECT_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
1276
1278
|
id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type CSSProperties } from "react";
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type ReactNode } from "react";
|
|
2
2
|
/** Canonical rungs; SliderInput supports all five. The track area is the rung height. */
|
|
3
3
|
export declare enum SliderInputSize {
|
|
4
4
|
/** 20px track area, 2px rail, 10px thumb. */
|
|
@@ -77,8 +77,12 @@ export interface SliderInputBaseProps extends AriaAttributes {
|
|
|
77
77
|
* @default false
|
|
78
78
|
*/
|
|
79
79
|
isGhost?: boolean;
|
|
80
|
-
/** Label above the slider, rendered through `Field`. For a
|
|
80
|
+
/** Label above the slider, rendered through `Field`. For a horizontal layout or `actions`, wrap it in `Field`. */
|
|
81
81
|
label?: string;
|
|
82
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
83
|
+
labelTooltip?: string | ReactNode;
|
|
84
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
85
|
+
description?: ReactNode;
|
|
82
86
|
/** Message from the app, shown under the slider through `Field`. Also turns the rail's hairline red and sets `aria-invalid`. */
|
|
83
87
|
error?: string;
|
|
84
88
|
/**
|
|
@@ -171,7 +171,7 @@ var READ_ONLY_CSS = "gx-SliderInput-READ_ONLY_CSS-r24kxar";
|
|
|
171
171
|
var FILL_WIDTH_CSS = "gx-SliderInput-FILL_WIDTH_CSS-fz4wyc9";
|
|
172
172
|
/** The track, thumbs and marks, wired to the nearest Field (the slider's own or the app's). */
|
|
173
173
|
function SliderBody({ sliderProps, forwardedRef, isRoot }) {
|
|
174
|
-
const { isRange = false, value, defaultValue, onChange, onChangeEnd, min: minProp = 0, max: maxProp = 100, step: stepProp = 1, marks, formatValue = String, hasValueTooltip = false, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabelAttribute, className, style, ...rest } = sliderProps;
|
|
174
|
+
const { isRange = false, value, defaultValue, onChange, onChangeEnd, min: minProp = 0, max: maxProp = 100, step: stepProp = 1, marks, formatValue = String, hasValueTooltip = false, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabelAttribute, className, style, ...rest } = sliderProps;
|
|
175
175
|
const min = Number.isFinite(minProp) ? minProp : 0;
|
|
176
176
|
const max = Number.isFinite(maxProp) ? Math.max(maxProp, min) : Math.max(100, min);
|
|
177
177
|
const step = Number.isFinite(stepProp) && stepProp > 0 ? stepProp : 1;
|
|
@@ -427,12 +427,14 @@ function SliderBody({ sliderProps, forwardedRef, isRoot }) {
|
|
|
427
427
|
}
|
|
428
428
|
/** A number, or a `[low, high]` range, set by dragging thumbs along a rail. */
|
|
429
429
|
var SliderInput = forwardRef(function SliderInput(props, ref) {
|
|
430
|
-
const { label, error, isRequired = false, size = "MEDIUM", fillWidth = false } = props;
|
|
430
|
+
const { label, error, labelTooltip, description, isRequired = false, size = "MEDIUM", fillWidth = false } = props;
|
|
431
431
|
const { id, className, style } = props;
|
|
432
432
|
const ownField = useOwnField({
|
|
433
433
|
componentName: "SliderInput",
|
|
434
434
|
label,
|
|
435
435
|
error,
|
|
436
|
+
labelTooltip,
|
|
437
|
+
description,
|
|
436
438
|
isRequired,
|
|
437
439
|
size: SLIDER_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
438
440
|
id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type CSSProperties, type InputHTMLAttributes } from "react";
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
/** Canonical rungs; TagInput supports all five. One line of the field is the rung height. */
|
|
3
3
|
export declare enum TagInputSize {
|
|
4
4
|
/** 20px line, 16px chips, caption text. */
|
|
@@ -67,8 +67,12 @@ export interface TagInputProps extends AriaAttributes, TagInputNativeProps {
|
|
|
67
67
|
* @default false
|
|
68
68
|
*/
|
|
69
69
|
isGhost?: boolean;
|
|
70
|
-
/** Label above the field, rendered through `Field`. For a
|
|
70
|
+
/** Label above the field, rendered through `Field`. For a horizontal layout or `actions`, wrap it in `Field`. */
|
|
71
71
|
label?: string;
|
|
72
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
73
|
+
labelTooltip?: string | ReactNode;
|
|
74
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
75
|
+
description?: ReactNode;
|
|
72
76
|
/** Hint shown while there are no tags and nothing is typed. It is never the label. */
|
|
73
77
|
placeholder?: string;
|
|
74
78
|
/** Message from the app, shown under the field through `Field`. It also turns the border red and sets `aria-invalid`. */
|
package/dist/inputs/TagInput.js
CHANGED
|
@@ -181,7 +181,7 @@ function countText(count, invalidCount) {
|
|
|
181
181
|
}
|
|
182
182
|
/** The frame, its chips and the text input, wired to the nearest Field (the input's own or the app's). */
|
|
183
183
|
function TagFrame({ tagProps, forwardedRef, isRoot }) {
|
|
184
|
-
const { value, defaultValue = [], onChange, separators = TAG_INPUT_DEFAULT_SEPARATORS, isTagInvalid, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, placeholder, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, onBlur, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = tagProps;
|
|
184
|
+
const { value, defaultValue = [], onChange, separators = TAG_INPUT_DEFAULT_SEPARATORS, isTagInvalid, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, placeholder, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, onBlur, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = tagProps;
|
|
185
185
|
const wiring = useFieldWiring({
|
|
186
186
|
id,
|
|
187
187
|
ariaLabel,
|
|
@@ -376,11 +376,13 @@ function TagFrame({ tagProps, forwardedRef, isRoot }) {
|
|
|
376
376
|
}
|
|
377
377
|
/** A field of free-form tags: type and press Enter or a separator, paste a list, remove with × or Backspace. */
|
|
378
378
|
var TagInput = forwardRef(function TagInput(props, ref) {
|
|
379
|
-
const { label, error, isRequired = false, size = "MEDIUM", fillWidth = false, id, className, style } = props;
|
|
379
|
+
const { label, error, labelTooltip, description, isRequired = false, size = "MEDIUM", fillWidth = false, id, className, style } = props;
|
|
380
380
|
const ownField = useOwnField({
|
|
381
381
|
componentName: "TagInput",
|
|
382
382
|
label,
|
|
383
383
|
error,
|
|
384
|
+
labelTooltip,
|
|
385
|
+
description,
|
|
384
386
|
isRequired,
|
|
385
387
|
size: TAG_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
386
388
|
id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type CSSProperties, type TextareaHTMLAttributes } from "react";
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type ReactNode, type TextareaHTMLAttributes } from "react";
|
|
2
2
|
import { FontFamily } from "../theme/enums.js";
|
|
3
3
|
/** Canonical rungs; TextAreaInput supports all five. The rung sets the text step, the padding and the height of one row. */
|
|
4
4
|
export declare enum TextAreaInputSize {
|
|
@@ -76,8 +76,12 @@ export interface TextAreaInputProps extends AriaAttributes, TextAreaInputNativeP
|
|
|
76
76
|
* @default false
|
|
77
77
|
*/
|
|
78
78
|
isGhost?: boolean;
|
|
79
|
-
/** Label above the field, rendered through `Field`. For a
|
|
79
|
+
/** Label above the field, rendered through `Field`. For a counter, a horizontal layout or `actions`, wrap the field in `Field`. */
|
|
80
80
|
label?: string;
|
|
81
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
82
|
+
labelTooltip?: string | ReactNode;
|
|
83
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
84
|
+
description?: ReactNode;
|
|
81
85
|
/** Hint shown while the value is empty. It is never the label. */
|
|
82
86
|
placeholder?: string;
|
|
83
87
|
/** Message from the app, shown under the field through `Field`. It also turns the border red and sets `aria-invalid`. */
|
|
@@ -26,7 +26,8 @@ import { useMergeRefs } from "@floating-ui/react";
|
|
|
26
26
|
* `Field`'s `maxLength` + `count`, and the message is the app's `error`. Replaces 1.x
|
|
27
27
|
* `TextAreaInput` (`InputSize` / `InputVariant` → `TextAreaInputSize` / `TextAreaInputVariant`,
|
|
28
28
|
* `lines` → `minRows`, `required` / `disabled` → `isRequired` / `isDisabled`; `min` / `max`,
|
|
29
|
-
* `width`, `height`, `fillHeight`, `noBorder
|
|
29
|
+
* `width`, `height`, `fillHeight`, `noBorder` and `noPadding` are gone; `labelTooltip` and
|
|
30
|
+
* `description` render through the input's own Field since 2.5).
|
|
30
31
|
*/
|
|
31
32
|
/** Canonical rungs; TextAreaInput supports all five. The rung sets the text step, the padding and the height of one row. */
|
|
32
33
|
var TextAreaInputSize = /* @__PURE__ */ function(TextAreaInputSize) {
|
|
@@ -171,7 +172,7 @@ function toRows(rows) {
|
|
|
171
172
|
}
|
|
172
173
|
/** `Root`, the textarea, the mirror and the loading overlay, wired to the nearest Field. */
|
|
173
174
|
function TextAreaFrame({ textAreaProps, forwardedRef, isRoot }) {
|
|
174
|
-
const { value, defaultValue = "", onChange, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, placeholder, error, isError = false, minRows = 3, maxRows, isAutoGrow = false, isResizable = false, isLoading = false, isDisabled = false, isReadOnly = false, isRequired = false, family = FontFamily.SANS, fillWidth = false, ariaLabel, autoComplete = "off", id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = textAreaProps;
|
|
175
|
+
const { value, defaultValue = "", onChange, size = "MEDIUM", variant = "PRIMARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, placeholder, error, isError = false, minRows = 3, maxRows, isAutoGrow = false, isResizable = false, isLoading = false, isDisabled = false, isReadOnly = false, isRequired = false, family = FontFamily.SANS, fillWidth = false, ariaLabel, autoComplete = "off", id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = textAreaProps;
|
|
175
176
|
const { controlId: textAreaId, describedBy, isInvalid, isRequired: isRequiredState, hasName } = useFieldWiring({
|
|
176
177
|
id,
|
|
177
178
|
ariaLabel,
|
|
@@ -286,11 +287,13 @@ function TextAreaFrame({ textAreaProps, forwardedRef, isRoot }) {
|
|
|
286
287
|
}
|
|
287
288
|
/** The multi-line text field, sized in rows, with optional auto-grow and a vertical resize handle. */
|
|
288
289
|
var TextAreaInput = forwardRef(function TextAreaInput(props, ref) {
|
|
289
|
-
const { label, error, isRequired = false, size = "MEDIUM", fillWidth = false, id, className, style } = props;
|
|
290
|
+
const { label, error, labelTooltip, description, isRequired = false, size = "MEDIUM", fillWidth = false, id, className, style } = props;
|
|
290
291
|
const ownField = useOwnField({
|
|
291
292
|
componentName: "TextAreaInput",
|
|
292
293
|
label,
|
|
293
294
|
error,
|
|
295
|
+
labelTooltip,
|
|
296
|
+
description,
|
|
294
297
|
isRequired,
|
|
295
298
|
size: TEXT_AREA_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
296
299
|
id,
|
|
@@ -75,8 +75,12 @@ export interface ToggleInputProps<TId extends string = string> extends AriaAttri
|
|
|
75
75
|
* @default false
|
|
76
76
|
*/
|
|
77
77
|
isGhost?: boolean;
|
|
78
|
-
/** Label above the control, rendered through `Field`. For a
|
|
78
|
+
/** Label above the control, rendered through `Field`. For a horizontal layout or `actions`, wrap the control in `Field`. */
|
|
79
79
|
label?: string;
|
|
80
|
+
/** Hint behind an info icon beside the label, shown in a `Tooltip` (through `Field`). */
|
|
81
|
+
labelTooltip?: string | ReactNode;
|
|
82
|
+
/** Help copy under the label, through `Field`. Text and inline `Link`s only. */
|
|
83
|
+
description?: ReactNode;
|
|
80
84
|
/** Message from the app, shown under the control through `Field`. It also turns the track border red and sets `aria-invalid`. */
|
|
81
85
|
error?: string;
|
|
82
86
|
/**
|
|
@@ -145,7 +145,7 @@ var TOGGLE_INPUT_SIZE_TO_ICON_PX_MAP = {
|
|
|
145
145
|
};
|
|
146
146
|
/** The radiogroup and its segments, wired to the nearest Field (its own or the app's). */
|
|
147
147
|
function TrackBody({ trackProps, forwardedRef, isRoot }) {
|
|
148
|
-
const { options, value, defaultValue, onChange, size = "MEDIUM", variant = "SECONDARY", isGhost = false, label: _label, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = trackProps;
|
|
148
|
+
const { options, value, defaultValue, onChange, size = "MEDIUM", variant = "SECONDARY", isGhost = false, label: _label, labelTooltip: _labelTooltip, description: _description, error, isError = false, isDisabled = false, isReadOnly = false, isRequired = false, fillWidth = false, ariaLabel, id, "aria-describedby": ariaDescribedBy, className, style, ...rest } = trackProps;
|
|
149
149
|
const { field, controlId: trackId, describedBy, isInvalid, isRequired: isRequiredState, hasName } = useFieldWiring({
|
|
150
150
|
id,
|
|
151
151
|
ariaLabel,
|
|
@@ -260,12 +260,14 @@ function TrackBody({ trackProps, forwardedRef, isRoot }) {
|
|
|
260
260
|
}
|
|
261
261
|
/** A segmented control; the value is the chosen option's id. */
|
|
262
262
|
var ToggleInputBase = forwardRef(function ToggleInput(props, ref) {
|
|
263
|
-
const { label, error, isRequired = false, size = "MEDIUM", fillWidth = false } = props;
|
|
263
|
+
const { label, error, labelTooltip, description, isRequired = false, size = "MEDIUM", fillWidth = false } = props;
|
|
264
264
|
const { id, className, style } = props;
|
|
265
265
|
const ownField = useOwnField({
|
|
266
266
|
componentName: "ToggleInput",
|
|
267
267
|
label,
|
|
268
268
|
error,
|
|
269
|
+
labelTooltip,
|
|
270
|
+
description,
|
|
269
271
|
isRequired,
|
|
270
272
|
size: TOGGLE_INPUT_SIZE_TO_FIELD_SIZE_MAP[size],
|
|
271
273
|
id,
|
|
@@ -8,6 +8,10 @@ export interface OwnFieldOptions {
|
|
|
8
8
|
label: string | undefined;
|
|
9
9
|
/** The input's `error`. */
|
|
10
10
|
error: string | undefined;
|
|
11
|
+
/** The input's `labelTooltip`, forwarded to the Field (the info icon beside the label). */
|
|
12
|
+
labelTooltip?: FieldProps["labelTooltip"];
|
|
13
|
+
/** The input's `description`, forwarded to the Field (the help copy under the label). */
|
|
14
|
+
description?: FieldProps["description"];
|
|
11
15
|
/** The input's `isRequired`, forwarded to the Field (the asterisk and `aria-required`). */
|
|
12
16
|
isRequired: boolean;
|
|
13
17
|
/** The Field rung, from the component's own `<COMPONENT>_SIZE_TO_FIELD_SIZE_MAP`. */
|
|
@@ -29,13 +33,14 @@ export interface OwnFieldOptions {
|
|
|
29
33
|
isEnabled?: boolean;
|
|
30
34
|
}
|
|
31
35
|
/** @internal The props of the Field an input renders for itself. */
|
|
32
|
-
export type OwnFieldProps = Pick<FieldProps, "label" | "error" | "isRequired" | "size" | "fillWidth" | "id" | "className" | "style">;
|
|
36
|
+
export type OwnFieldProps = Pick<FieldProps, "label" | "error" | "labelTooltip" | "description" | "isRequired" | "size" | "fillWidth" | "id" | "className" | "style">;
|
|
33
37
|
/**
|
|
34
|
-
* @internal The Field props when the input must render its own Field (standalone, with a `label
|
|
35
|
-
*
|
|
36
|
-
* app's Field). Warns once, in development, when an input inside a Field also
|
|
38
|
+
* @internal The Field props when the input must render its own Field (standalone, with a `label`,
|
|
39
|
+
* an `error`, a `labelTooltip` or a `description`), or `null` when the frame renders alone (none of
|
|
40
|
+
* those, or inside an app's Field). Warns once, in development, when an input inside a Field also
|
|
41
|
+
* has its own `label`.
|
|
37
42
|
*/
|
|
38
|
-
export declare function useOwnField({ componentName, label, error, isRequired, size, id, className, style, rootClassName, fillWidth, isEnabled, }: OwnFieldOptions): OwnFieldProps | null;
|
|
43
|
+
export declare function useOwnField({ componentName, label, error, labelTooltip, description, isRequired, size, id, className, style, rootClassName, fillWidth, isEnabled, }: OwnFieldOptions): OwnFieldProps | null;
|
|
39
44
|
/**
|
|
40
45
|
* @internal The frame's `style`, only when the frame is the root (an own Field takes it otherwise).
|
|
41
46
|
* Spread onto the frame: `{...rootStyle(isRoot, style)}`.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useDevWarning } from "./devWarn.js";
|
|
2
2
|
import { useField } from "../../hooks/useField.js";
|
|
3
|
-
import { isFilled } from "./predicates.js";
|
|
3
|
+
import { hasContent, isFilled } from "./predicates.js";
|
|
4
4
|
import { cx } from "@linaria/core";
|
|
5
5
|
//#region src/inputs/internal/ownField.tsx
|
|
6
6
|
/**
|
|
7
|
-
* @internal The own-Field shell every labelled input shares. A standalone input with `label
|
|
8
|
-
* `error` renders a `Field` around its frame; inside an app's Field it never wraps itself again
|
|
7
|
+
* @internal The own-Field shell every labelled input shares. A standalone input with `label`,
|
|
8
|
+
* `error`, `labelTooltip` or `description` renders a `Field` around its frame; inside an app's Field it never wraps itself again
|
|
9
9
|
* and reads the Field's wiring instead (`useField()`). The shell also decides where `className`
|
|
10
10
|
* and `style` go: on the Field when the input renders one, otherwise on the frame (the root).
|
|
11
11
|
* Private on purpose (an `internal/` module: built, never a package export).
|
|
@@ -25,20 +25,25 @@ import { cx } from "@linaria/core";
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
/**
|
|
28
|
-
* @internal The Field props when the input must render its own Field (standalone, with a `label
|
|
29
|
-
*
|
|
30
|
-
* app's Field). Warns once, in development, when an input inside a Field also
|
|
28
|
+
* @internal The Field props when the input must render its own Field (standalone, with a `label`,
|
|
29
|
+
* an `error`, a `labelTooltip` or a `description`), or `null` when the frame renders alone (none of
|
|
30
|
+
* those, or inside an app's Field). Warns once, in development, when an input inside a Field also
|
|
31
|
+
* has its own `label`.
|
|
31
32
|
*/
|
|
32
|
-
function useOwnField({ componentName, label, error, isRequired, size, id, className, style, rootClassName, fillWidth, isEnabled = true }) {
|
|
33
|
+
function useOwnField({ componentName, label, error, labelTooltip, description, isRequired, size, id, className, style, rootClassName, fillWidth, isEnabled = true }) {
|
|
33
34
|
const field = useField();
|
|
34
35
|
const hasLabel = isFilled(label);
|
|
35
36
|
const hasError = isFilled(error);
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
const hasTooltip = hasContent(labelTooltip);
|
|
38
|
+
const hasDescription = hasContent(description);
|
|
39
|
+
useDevWarning(isEnabled && field !== null && (hasLabel || hasTooltip || hasDescription), `[@galaxy-io/dls] ${componentName} inside a Field ignores its own \`label\`, \`labelTooltip\` and \`description\`. Put them on the Field only.`);
|
|
40
|
+
if (!isEnabled || field !== null || !hasLabel && !hasError && !hasTooltip && !hasDescription) return null;
|
|
38
41
|
const fieldClassName = cx(rootClassName, className);
|
|
39
42
|
return {
|
|
40
43
|
...hasLabel ? { label } : {},
|
|
41
44
|
...hasError ? { error } : {},
|
|
45
|
+
...hasTooltip ? { labelTooltip } : {},
|
|
46
|
+
...hasDescription ? { description } : {},
|
|
42
47
|
isRequired,
|
|
43
48
|
size,
|
|
44
49
|
...fillWidth === void 0 ? {} : { fillWidth },
|
package/dist/layout/Box.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties, type ElementType, type ReactNode } from "react";
|
|
2
|
-
import { Radius,
|
|
2
|
+
import type { Radius, SpaceShorthand } from "../theme/enums.js";
|
|
3
3
|
/** Surface step the box fills with (surface set, Constitution V-A). Leave `variant` unset for no fill. */
|
|
4
4
|
export declare enum BoxVariant {
|
|
5
5
|
/** The canvas, `background.base`. */
|
package/dist/layout/Box.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Radius } from "../theme/enums.js";
|
|
2
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";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { styled } from "@linaria/react";
|
|
5
5
|
import { forwardRef } from "react";
|
|
@@ -35,34 +35,27 @@ var Root = /*#__PURE__*/ styled("div")({
|
|
|
35
35
|
propsAsIs: false
|
|
36
36
|
});
|
|
37
37
|
var BOX_VARIANT_TO_CSS_MAP = {
|
|
38
|
-
["BASE"]:
|
|
39
|
-
["PRIMARY"]:
|
|
40
|
-
["SECONDARY"]:
|
|
41
|
-
["TERTIARY"]:
|
|
38
|
+
["BASE"]: BASE_SURFACE_CSS,
|
|
39
|
+
["PRIMARY"]: PRIMARY_SURFACE_CSS,
|
|
40
|
+
["SECONDARY"]: SECONDARY_SURFACE_CSS,
|
|
41
|
+
["TERTIARY"]: TERTIARY_SURFACE_CSS
|
|
42
42
|
};
|
|
43
|
-
var
|
|
44
|
-
[Radius.SM]: "gx-Box-Radius_SM-r1duzr06",
|
|
45
|
-
[Radius.MD]: "gx-Box-Radius_MD-r501792",
|
|
46
|
-
[Radius.LG]: "gx-Box-Radius_LG-rxydgx9",
|
|
47
|
-
[Radius.PILL]: "gx-Box-Radius_PILL-rrn38q3"
|
|
48
|
-
};
|
|
49
|
-
var BORDER_CSS = "gx-Box-BORDER_CSS-b1aq7688";
|
|
50
|
-
var FILL_WIDTH_CSS = "gx-Box-FILL_WIDTH_CSS-f1nw7r38";
|
|
43
|
+
var FILL_WIDTH_CSS = "gx-Box-FILL_WIDTH_CSS-fn7d3r";
|
|
51
44
|
/** Each block reads the `--gx-box-<property>` custom property the component sets beside it. */
|
|
52
45
|
var BOX_CSS_PROPERTY_TO_CSS_MAP = {
|
|
53
|
-
padding: "gx-Box-padding-
|
|
54
|
-
width: "gx-Box-width-
|
|
55
|
-
height: "gx-Box-height-
|
|
56
|
-
"min-width": "gx-Box-min-width-
|
|
57
|
-
"max-width": "gx-Box-max-width-
|
|
58
|
-
"min-height": "gx-Box-min-height-
|
|
59
|
-
"max-height": "gx-Box-max-height-
|
|
60
|
-
overflow: "gx-Box-overflow-
|
|
61
|
-
position: "gx-Box-position-
|
|
62
|
-
top: "gx-Box-top-
|
|
63
|
-
right: "gx-Box-right-
|
|
64
|
-
bottom: "gx-Box-bottom-
|
|
65
|
-
left: "gx-Box-left-
|
|
46
|
+
padding: "gx-Box-padding-p1tb0t1s",
|
|
47
|
+
width: "gx-Box-width-wngj0ew",
|
|
48
|
+
height: "gx-Box-height-h1vd7izj",
|
|
49
|
+
"min-width": "gx-Box-min-width-m1duzr06",
|
|
50
|
+
"max-width": "gx-Box-max-width-m501792",
|
|
51
|
+
"min-height": "gx-Box-min-height-mxydgx9",
|
|
52
|
+
"max-height": "gx-Box-max-height-mrn38q3",
|
|
53
|
+
overflow: "gx-Box-overflow-o1aq7688",
|
|
54
|
+
position: "gx-Box-position-p1nw7r38",
|
|
55
|
+
top: "gx-Box-top-toq987s",
|
|
56
|
+
right: "gx-Box-right-r1dvt2z3",
|
|
57
|
+
bottom: "gx-Box-bottom-bpkzdg3",
|
|
58
|
+
left: "gx-Box-left-l1w4kn1o"
|
|
66
59
|
};
|
|
67
60
|
/** A length prop as CSS (number → px), or `undefined` when unset. */
|
|
68
61
|
var toLength = (value) => value === void 0 ? void 0 : getCssSizeValue(value);
|
|
@@ -96,7 +89,7 @@ var Box = forwardRef(function Box({ children, variant, hasBorder = false, radius
|
|
|
96
89
|
as,
|
|
97
90
|
ref,
|
|
98
91
|
id,
|
|
99
|
-
className: cx(variant !== void 0 && BOX_VARIANT_TO_CSS_MAP[variant], hasBorder && BORDER_CSS, radius !== void 0 && RADIUS_TO_CSS_MAP[radius], fillWidth && FILL_WIDTH_CSS, ...classNames, className),
|
|
92
|
+
className: cx(variant !== void 0 && BOX_VARIANT_TO_CSS_MAP[variant], hasBorder && "gx-surface-BORDER_CSS-b9a3ryy", radius !== void 0 && RADIUS_TO_CSS_MAP[radius], fillWidth && FILL_WIDTH_CSS, ...classNames, className),
|
|
100
93
|
style: {
|
|
101
94
|
...variables,
|
|
102
95
|
...style
|
package/dist/layout/Flex.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { type AriaAttributes, type CSSProperties, type ElementType, type MouseEvent, type ReactNode, type UIEvent } from "react";
|
|
2
|
-
import type { Space, SpaceShorthand } from "../theme/enums.js";
|
|
2
|
+
import type { Radius, Space, SpaceShorthand } from "../theme/enums.js";
|
|
3
|
+
/** Surface step the container fills with (surface set, Constitution V-A). Leave `variant` unset for no fill. */
|
|
4
|
+
export declare enum FlexVariant {
|
|
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
|
/** Main-axis direction of the flex container (`flex-direction`). */
|
|
4
15
|
export declare enum FlexDirection {
|
|
5
16
|
/** Left to right. */
|
|
@@ -51,6 +62,18 @@ export declare enum FlexWrap {
|
|
|
51
62
|
export interface FlexProps extends AriaAttributes {
|
|
52
63
|
/** Content of the flex container. */
|
|
53
64
|
children?: ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Surface step the container fills with, as on `Box`. Unset draws no fill: the parent shows through.
|
|
67
|
+
* @default undefined (no fill)
|
|
68
|
+
*/
|
|
69
|
+
variant?: FlexVariant;
|
|
70
|
+
/**
|
|
71
|
+
* Draw the 1px hairline border (`border.primary`), as on `Box`.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
hasBorder?: boolean;
|
|
75
|
+
/** Corner radius from the scale, as on `Box`. Square corners when omitted. */
|
|
76
|
+
radius?: Radius;
|
|
54
77
|
/**
|
|
55
78
|
* Main-axis direction.
|
|
56
79
|
* @default FlexDirection.ROW
|