@alto-avios/alto-ui 2.4.0 → 3.1.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 +13 -0
- package/dist/assets/AviosCurrencySymbol.css +1 -0
- package/dist/assets/Badge.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/CardSection.css +1 -1
- package/dist/assets/CreditCardNumberField.css +1 -0
- package/dist/assets/DateField.css +1 -1
- package/dist/assets/DetailsDisclosure.css +1 -0
- package/dist/assets/Dialog.css +1 -0
- package/dist/assets/Fieldset.css +1 -0
- package/dist/assets/FieldsetHeader.css +1 -0
- package/dist/assets/Form.css +1 -0
- package/dist/assets/Icon.css +1 -0
- package/dist/assets/IconBackdrop.css +1 -0
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Image.css +1 -0
- package/dist/assets/Link.css +1 -1
- package/dist/assets/NumberField.css +1 -1
- package/dist/assets/PasswordField.css +1 -0
- package/dist/assets/PhoneNumberField.css +1 -0
- package/dist/assets/Popover.css +1 -0
- package/dist/assets/Section.css +1 -1
- package/dist/assets/SelectNative.css +1 -0
- package/dist/assets/Slider.css +1 -0
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/TextAreaField.css +1 -1
- package/dist/assets/ToggleButton.css +1 -1
- package/dist/assets/ToggleIconButton.css +1 -1
- package/dist/assets/backgroundColor.css +1 -0
- package/dist/assets/flex.css +1 -1
- package/dist/assets/focusStyles.css +1 -1
- package/dist/assets/foregroundColor.css +1 -0
- package/dist/assets/global.css +1 -1
- package/dist/assets/padding.css +1 -1
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.d.ts +25 -0
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js +80 -0
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js.map +1 -0
- package/dist/components/AviosCurrencySymbol/index.d.ts +1 -0
- package/dist/components/AviosCurrencySymbol/index.js +5 -0
- package/dist/components/Badge/Badge.js +11 -11
- package/dist/components/Box/Box.d.ts +21 -2
- package/dist/components/Box/Box.js +16 -4
- package/dist/components/Box/Box.js.map +1 -1
- package/dist/components/Button/Button.d.ts +128 -36
- package/dist/components/Button/Button.js +129 -66
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/CardSection/CardSection.d.ts +12 -6
- package/dist/components/CardSection/CardSection.js +9 -7
- package/dist/components/CardSection/CardSection.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +3 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/ClearFieldButton/ClearFieldButton.d.ts +4 -6
- package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +29 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js +45 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js.map +1 -0
- package/dist/components/CreditCardNumberField/index.d.ts +1 -0
- package/dist/components/CreditCardNumberField/index.js +5 -0
- package/dist/components/CreditCardNumberField/index.js.map +1 -0
- package/dist/components/DateField/DateField.d.ts +4 -24
- package/dist/components/DateField/DateField.js +7 -19
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/DetailsDisclosure/DetailsDisclosure.d.ts +33 -0
- package/dist/components/DetailsDisclosure/DetailsDisclosure.js +39 -0
- package/dist/components/DetailsDisclosure/DetailsDisclosure.js.map +1 -0
- package/dist/components/DetailsDisclosure/index.d.ts +2 -0
- package/dist/components/DetailsDisclosure/index.js +5 -0
- package/dist/components/DetailsDisclosure/index.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +46 -0
- package/dist/components/Dialog/Dialog.js +117 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Dialog/index.js +5 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/FieldError/FieldError.d.ts +1 -1
- package/dist/components/FieldError/FieldError.js +11 -8
- package/dist/components/FieldError/FieldError.js.map +1 -1
- package/dist/components/FieldHeader/index.d.ts +1 -0
- package/dist/components/Fieldset/Fieldset.d.ts +18 -0
- package/dist/components/Fieldset/Fieldset.js +24 -0
- package/dist/components/Fieldset/Fieldset.js.map +1 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Fieldset/index.js +5 -0
- package/dist/components/Fieldset/index.js.map +1 -0
- package/dist/components/FieldsetHeader/FieldsetHeader.d.ts +7 -0
- package/dist/components/FieldsetHeader/FieldsetHeader.js +21 -0
- package/dist/components/FieldsetHeader/FieldsetHeader.js.map +1 -0
- package/dist/components/FieldsetHeader/index.d.ts +1 -0
- package/dist/components/FieldsetHeader/index.js +5 -0
- package/dist/components/FieldsetHeader/index.js.map +1 -0
- package/dist/components/Form/Form.d.ts +7 -0
- package/dist/components/Form/Form.js +17 -0
- package/dist/components/Form/Form.js.map +1 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +5 -0
- package/dist/components/Form/index.js.map +1 -0
- package/dist/components/Heading/Heading.d.ts +26 -7
- package/dist/components/Heading/Heading.js +12 -5
- package/dist/components/Heading/Heading.js.map +1 -1
- package/dist/components/Icon/Icon.d.ts +30 -4
- package/dist/components/Icon/Icon.js +98 -5
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/IconBackdrop/IconBackdrop.d.ts +24 -0
- package/dist/components/IconBackdrop/IconBackdrop.js +34 -0
- package/dist/components/IconBackdrop/IconBackdrop.js.map +1 -0
- package/dist/components/IconBackdrop/index.d.ts +1 -0
- package/dist/components/IconBackdrop/index.js +5 -0
- package/dist/components/IconBackdrop/index.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +13 -4
- package/dist/components/IconButton/IconButton.js +40 -31
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Image/Image.d.ts +24 -0
- package/dist/components/Image/Image.js +135 -0
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/Image/index.d.ts +1 -0
- package/dist/components/Image/index.js +5 -0
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Link/Link.d.ts +32 -34
- package/dist/components/Link/Link.js +34 -22
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/NumberField/NumberField.d.ts +4 -34
- package/dist/components/NumberField/NumberField.js +11 -19
- package/dist/components/NumberField/NumberField.js.map +1 -1
- package/dist/components/Paragraph/Paragraph.d.ts +9 -5
- package/dist/components/Paragraph/Paragraph.js +9 -4
- package/dist/components/Paragraph/Paragraph.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +30 -0
- package/dist/components/PasswordField/PasswordField.js +104 -0
- package/dist/components/PasswordField/PasswordField.js.map +1 -0
- package/dist/components/PasswordField/index.d.ts +1 -0
- package/dist/components/PasswordField/index.js +5 -0
- package/dist/components/PasswordField/index.js.map +1 -0
- package/dist/components/PhoneNumberField/PhoneNumberField.d.ts +53 -0
- package/dist/components/PhoneNumberField/PhoneNumberField.js +91 -0
- package/dist/components/PhoneNumberField/PhoneNumberField.js.map +1 -0
- package/dist/components/PhoneNumberField/index.d.ts +3 -0
- package/dist/components/PhoneNumberField/index.js +7 -0
- package/dist/components/PhoneNumberField/index.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +16 -0
- package/dist/components/Popover/Popover.js +68 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +5 -0
- package/dist/components/Popover/index.js.map +1 -0
- package/dist/components/Section/Section.d.ts +4 -3
- package/dist/components/Section/Section.js +18 -13
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SelectNative/SelectNative.d.ts +56 -0
- package/dist/components/SelectNative/SelectNative.js +40 -0
- package/dist/components/SelectNative/SelectNative.js.map +1 -0
- package/dist/components/SelectNative/index.d.ts +1 -0
- package/dist/components/SelectNative/index.js +5 -0
- package/dist/components/SelectNative/index.js.map +1 -0
- package/dist/components/Slider/Slider.d.ts +33 -0
- package/dist/components/Slider/Slider.js +113 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +5 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/SubHeading/SubHeading.d.ts +26 -5
- package/dist/components/SubHeading/SubHeading.js +9 -4
- package/dist/components/SubHeading/SubHeading.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +7 -0
- package/dist/components/Switch/Switch.js +18 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.js +5 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/TagGroup/TagGroup.js +1 -1
- package/dist/components/TextAreaField/TextAreaField.d.ts +1 -1
- package/dist/components/TextAreaField/TextAreaField.js +6 -18
- package/dist/components/TextAreaField/TextAreaField.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +4 -31
- package/dist/components/TextField/TextField.js +7 -17
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +6 -6
- package/dist/components/ToggleIconButton/ToggleIconButton.d.ts +9 -1
- package/dist/components/ToggleIconButton/ToggleIconButton.js +15 -8
- package/dist/components/ToggleIconButton/ToggleIconButton.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.js +3 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/_base/Field/Field.d.ts +16 -0
- package/dist/components/_base/Field/Field.js +29 -0
- package/dist/components/_base/Field/Field.js.map +1 -0
- package/dist/components/_base/Field/index.d.ts +2 -0
- package/dist/components/_base/Field/index.js +5 -0
- package/dist/components/_base/Field/index.js.map +1 -0
- package/dist/components/index.d.ts +15 -1
- package/dist/components/index.js +41 -14
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +41 -14
- package/dist/index.js.map +1 -1
- package/dist/react-number-format.es-DMLgWFZX.js +760 -0
- package/dist/react-number-format.es-DMLgWFZX.js.map +1 -0
- package/dist/utils/backgroundColor/backgroundColor.d.ts +8 -0
- package/dist/utils/backgroundColor/backgroundColor.js +102 -0
- package/dist/utils/backgroundColor/backgroundColor.js.map +1 -0
- package/dist/utils/border/border.d.ts +3 -3
- package/dist/utils/creditCard/creditCard.d.ts +7 -0
- package/dist/utils/creditCard/creditCard.js +25 -0
- package/dist/utils/creditCard/creditCard.js.map +1 -0
- package/dist/utils/flex/flex.d.ts +3 -3
- package/dist/utils/flex/flex.js +49 -35
- package/dist/utils/flex/flex.js.map +1 -1
- package/dist/utils/focus/focusStyles.d.ts +1 -1
- package/dist/utils/focus/focusStyles.js +2 -2
- package/dist/utils/foregroundColour/foregroundColor.d.ts +8 -0
- package/dist/utils/foregroundColour/foregroundColor.js +125 -0
- package/dist/utils/foregroundColour/foregroundColor.js.map +1 -0
- package/dist/utils/forms/formProps.d.ts +2 -0
- package/dist/utils/forms/formProps.js +2 -0
- package/dist/utils/forms/formProps.js.map +1 -0
- package/dist/utils/padding/padding.d.ts +7 -7
- package/dist/utils/padding/padding.js +98 -98
- package/dist/utils/phoneNumber/phoneNumber.d.ts +24 -0
- package/dist/utils/phoneNumber/phoneNumber.js +566 -0
- package/dist/utils/phoneNumber/phoneNumber.js.map +1 -0
- package/dist/utils/stories/iconPropsArgTypes.js +50 -13
- package/dist/utils/stories/iconPropsArgTypes.js.map +1 -1
- package/package.json +39 -19
- package/dist/assets/NewButton.css +0 -1
- package/dist/assets/backgroundColour.css +0 -1
- package/dist/assets/fgColor.css +0 -1
- package/dist/components/NewButton/NewButton.d.ts +0 -87
- package/dist/components/NewButton/NewButton.js +0 -189
- package/dist/components/NewButton/NewButton.js.map +0 -1
- package/dist/components/NewButton/index.d.ts +0 -1
- package/dist/components/NewButton/index.js +0 -5
- package/dist/utils/backgroundColour/backgroundColour.d.ts +0 -8
- package/dist/utils/backgroundColour/backgroundColour.js +0 -102
- package/dist/utils/backgroundColour/backgroundColour.js.map +0 -1
- package/dist/utils/fgColour/fgColor.d.ts +0 -5
- package/dist/utils/fgColour/fgColor.js +0 -84
- package/dist/utils/fgColour/fgColor.js.map +0 -1
- /package/dist/components/{NewButton → AviosCurrencySymbol}/index.js.map +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Slider as Slider$1, SliderTrack, SliderThumb } from "react-aria-components";
|
|
3
|
+
import { useId, useRef } from "react";
|
|
4
|
+
import { Box } from "../Box/Box.js";
|
|
5
|
+
import { FieldHeader } from "../FieldHeader/FieldHeader.js";
|
|
6
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
7
|
+
import '../../assets/Slider.css';const fieldHeaderWrapper = "_fieldHeaderWrapper_12sym_1";
|
|
8
|
+
const output = "_output_12sym_5";
|
|
9
|
+
const sliderContainer = "_sliderContainer_12sym_14";
|
|
10
|
+
const track = "_track_12sym_21";
|
|
11
|
+
const fill = "_fill_12sym_30";
|
|
12
|
+
const thumbContainer = "_thumbContainer_12sym_37";
|
|
13
|
+
const thumb = "_thumb_12sym_37";
|
|
14
|
+
const slider = "_slider_12sym_14";
|
|
15
|
+
const styles = {
|
|
16
|
+
fieldHeaderWrapper,
|
|
17
|
+
output,
|
|
18
|
+
sliderContainer,
|
|
19
|
+
track,
|
|
20
|
+
fill,
|
|
21
|
+
thumbContainer,
|
|
22
|
+
thumb,
|
|
23
|
+
slider
|
|
24
|
+
};
|
|
25
|
+
const CustomThumb = ({
|
|
26
|
+
index,
|
|
27
|
+
state,
|
|
28
|
+
formatValue,
|
|
29
|
+
isDisabled,
|
|
30
|
+
showTooltip = false,
|
|
31
|
+
label,
|
|
32
|
+
minValue,
|
|
33
|
+
maxValue,
|
|
34
|
+
isRange
|
|
35
|
+
}) => {
|
|
36
|
+
const isDragging = state.isThumbDragging(index);
|
|
37
|
+
const isFocused = state.focusedThumb === index;
|
|
38
|
+
const isTooltipVisible = showTooltip && (isDragging || isFocused);
|
|
39
|
+
const thumbRef = useRef(null);
|
|
40
|
+
const value = state.values[index];
|
|
41
|
+
const thumbLabel = isRange ? `${index === 0 ? "Minimum" : "Maximum"} value for ${label}` : label;
|
|
42
|
+
const valueDescription = `${formatValue(value)} out of range ${formatValue(minValue)} to ${formatValue(maxValue)}`;
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.thumbContainer, style: {
|
|
44
|
+
left: `${state.getThumbPercent(index) * 100}%`
|
|
45
|
+
}, role: "presentation", children: [
|
|
46
|
+
/* @__PURE__ */ jsx(SliderThumb, { index, className: styles.thumb, ref: thumbRef, "aria-label": thumbLabel, "aria-valuetext": valueDescription }),
|
|
47
|
+
/* @__PURE__ */ jsx(Tooltip, { label: formatValue(state.values[index]), placement: "top", isDisabled, visible: isTooltipVisible, triggerRef: thumbRef, children: /* @__PURE__ */ jsx("div", { role: "presentation" }) })
|
|
48
|
+
] });
|
|
49
|
+
};
|
|
50
|
+
const Slider = ({
|
|
51
|
+
label,
|
|
52
|
+
description,
|
|
53
|
+
isDisabled = false,
|
|
54
|
+
isRange = false,
|
|
55
|
+
minValue = 0,
|
|
56
|
+
maxValue = 100,
|
|
57
|
+
step,
|
|
58
|
+
formatOptions,
|
|
59
|
+
defaultValue = isRange ? [25, 75] : 50,
|
|
60
|
+
value,
|
|
61
|
+
id: providedId,
|
|
62
|
+
onChange,
|
|
63
|
+
showTooltip = false
|
|
64
|
+
}) => {
|
|
65
|
+
const uniqueId = useId();
|
|
66
|
+
const id = providedId || `slider-${uniqueId}`;
|
|
67
|
+
const calculatedStep = step ?? (typeof formatOptions === "object" && (formatOptions == null ? void 0 : formatOptions.style) === "currency" ? 0.01 : typeof defaultValue === "number" ? defaultValue % 1 !== 0 ? 0.01 : 1 : Array.isArray(defaultValue) && defaultValue.some((v) => v % 1 !== 0) ? 0.01 : 1);
|
|
68
|
+
const formatValue = (val) => {
|
|
69
|
+
if (typeof formatOptions === "function") {
|
|
70
|
+
return formatOptions(val, maxValue);
|
|
71
|
+
}
|
|
72
|
+
if (!formatOptions) {
|
|
73
|
+
const decimalPlaces = calculatedStep < 1 ? 2 : 0;
|
|
74
|
+
return val.toFixed(decimalPlaces);
|
|
75
|
+
}
|
|
76
|
+
return new Intl.NumberFormat(void 0, formatOptions).format(val);
|
|
77
|
+
};
|
|
78
|
+
const sliderProps = {
|
|
79
|
+
id,
|
|
80
|
+
isDisabled,
|
|
81
|
+
minValue,
|
|
82
|
+
maxValue,
|
|
83
|
+
step: calculatedStep,
|
|
84
|
+
defaultValue,
|
|
85
|
+
value,
|
|
86
|
+
onChange,
|
|
87
|
+
className: styles.slider,
|
|
88
|
+
orientation: "horizontal"
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ jsx(Box, { display: "flex", flexDirection: "column", gap: "md", padding: "md", children: /* @__PURE__ */ jsx(Slider$1, { ...sliderProps, children: ({
|
|
91
|
+
state
|
|
92
|
+
}) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: styles.fieldHeaderWrapper, children: [
|
|
94
|
+
/* @__PURE__ */ jsx(FieldHeader, { label, description, labelFor: id, isRequired: true }),
|
|
95
|
+
/* @__PURE__ */ jsx("div", { className: styles.output, "aria-live": "polite", "aria-atomic": "true", children: isRange ? /* @__PURE__ */ jsx("span", { children: `${formatValue(state.values[0])} - ${formatValue(state.values[1])}` }) : /* @__PURE__ */ jsx("span", { children: formatValue(state.values[0]) }) })
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: styles.sliderContainer, role: "presentation", children: /* @__PURE__ */ jsxs(SliderTrack, { className: styles.track, children: [
|
|
98
|
+
/* @__PURE__ */ jsx("div", { className: styles.fill, style: {
|
|
99
|
+
left: isRange ? `${state.getThumbPercent(0) * 100}%` : 0,
|
|
100
|
+
width: isRange ? `${(state.getThumbPercent(1) - state.getThumbPercent(0)) * 100}%` : `${state.getThumbPercent(0) * 100}%`
|
|
101
|
+
}, role: "presentation" }),
|
|
102
|
+
isRange ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
103
|
+
/* @__PURE__ */ jsx(CustomThumb, { index: 0, state, formatValue, isDisabled, showTooltip, label: label || "", minValue, maxValue: state.values[1], isRange: true }),
|
|
104
|
+
/* @__PURE__ */ jsx(CustomThumb, { index: 1, state, formatValue, isDisabled, showTooltip, label: label || "", minValue: state.values[0], maxValue, isRange: true })
|
|
105
|
+
] }) : /* @__PURE__ */ jsx(CustomThumb, { index: 0, state, formatValue, isDisabled, showTooltip, label: label || "", minValue, maxValue, isRange: false })
|
|
106
|
+
] }) })
|
|
107
|
+
] }) }) });
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
Slider,
|
|
111
|
+
Slider as default
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=Slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Slider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
|
-
import {
|
|
3
|
+
import { ForegroundVariants } from '../../utils/foregroundColour/foregroundColor';
|
|
4
4
|
declare const subHeading: (props?: ({
|
|
5
5
|
size?: "sm" | "xs" | null | undefined;
|
|
6
|
-
textAlign?: "
|
|
6
|
+
textAlign?: "end" | "start" | "center" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
type HeadingVariants = VariantProps<typeof subHeading>;
|
|
9
|
-
type FgColorVariants = VariantProps<typeof fgColorVariants>;
|
|
10
9
|
type SubHeadingLevel = 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
10
|
type SubHeadingSize = 'xs' | 'sm';
|
|
12
11
|
export interface HeadingProps extends HeadingVariants {
|
|
12
|
+
/**
|
|
13
|
+
* children
|
|
14
|
+
*/
|
|
13
15
|
children: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The heading element to render
|
|
18
|
+
*/
|
|
14
19
|
as?: SubHeadingLevel;
|
|
20
|
+
/**
|
|
21
|
+
* The size of the heading
|
|
22
|
+
*/
|
|
15
23
|
size?: SubHeadingSize;
|
|
16
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The foreground color of the heading
|
|
26
|
+
* @default "accentPrimary"
|
|
27
|
+
*/
|
|
28
|
+
foregroundColor?: ForegroundVariants['foregroundColor'];
|
|
29
|
+
/**
|
|
30
|
+
* The foreground color of the heading
|
|
31
|
+
* @deprecated Use `foregroundColor` instead
|
|
32
|
+
*/
|
|
33
|
+
fgColor?: ForegroundVariants['foregroundColor'];
|
|
34
|
+
/**
|
|
35
|
+
* The text alignment of the heading
|
|
36
|
+
* @default "start"
|
|
37
|
+
*/
|
|
17
38
|
textAlign?: 'start' | 'center' | 'end';
|
|
18
39
|
}
|
|
19
|
-
export declare const SubHeading: ({ children, as: Component, size, fgColor, textAlign, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare const SubHeading: ({ children, as: Component, size, foregroundColor, fgColor, textAlign, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
41
|
export default SubHeading;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as cva } from "../../index-Bi3v_EjJ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { foregroundColorVariants } from "../../utils/foregroundColour/foregroundColor.js";
|
|
4
4
|
import '../../assets/SubHeading.css';const subHeading$1 = "_subHeading_up5r4_1";
|
|
5
5
|
const xs = "_xs_up5r4_8";
|
|
6
6
|
const sm = "_sm_up5r4_15";
|
|
@@ -36,16 +36,21 @@ const SubHeading = ({
|
|
|
36
36
|
children,
|
|
37
37
|
as: Component = "span",
|
|
38
38
|
size,
|
|
39
|
-
|
|
39
|
+
foregroundColor = "accentPrimary",
|
|
40
|
+
fgColor,
|
|
40
41
|
textAlign = "start",
|
|
41
42
|
...props
|
|
42
43
|
}) => {
|
|
43
44
|
const effectiveSize = size;
|
|
45
|
+
if (fgColor) {
|
|
46
|
+
console.warn("The `fgColor` prop has been deprecated. Please use `foregroundColor` instead.");
|
|
47
|
+
}
|
|
48
|
+
const resolvedFontColor = fgColor ?? foregroundColor ?? "accentPrimary";
|
|
44
49
|
return /* @__PURE__ */ jsx(Component, { className: `${subHeading({
|
|
45
50
|
size: effectiveSize,
|
|
46
51
|
textAlign
|
|
47
|
-
})} ${
|
|
48
|
-
|
|
52
|
+
})} ${foregroundColorVariants({
|
|
53
|
+
foregroundColor: resolvedFontColor
|
|
49
54
|
})}`, ...props, children });
|
|
50
55
|
};
|
|
51
56
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubHeading.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubHeading.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
3
|
+
export interface SwitchProps extends AriaSwitchProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const Switch: (props: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Switch;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Switch as Switch$1 } from "react-aria-components";
|
|
3
|
+
import '../../assets/Switch.css';const indicator = "_indicator_1mhci_18";
|
|
4
|
+
const styles = {
|
|
5
|
+
"switch": "_switch_1mhci_1",
|
|
6
|
+
indicator
|
|
7
|
+
};
|
|
8
|
+
const Switch = (props) => {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Switch$1, { ...props, className: styles.switch, children: [
|
|
10
|
+
/* @__PURE__ */ jsx("div", { className: styles.indicator }),
|
|
11
|
+
(props == null ? void 0 : props.children) && /* @__PURE__ */ jsx("label", { className: styles.label, htmlFor: props == null ? void 0 : props.name, children: props.children })
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
Switch,
|
|
16
|
+
Switch as default
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Switch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -26,7 +26,7 @@ const TagGroup = ({
|
|
|
26
26
|
return /* @__PURE__ */ jsxs(TagGroup$1, { className: styles.tagGroup, selectionMode, ...props, children: [
|
|
27
27
|
/* @__PURE__ */ jsxs("span", { className: styles.spanContainer, children: [
|
|
28
28
|
/* @__PURE__ */ jsx(FieldLabel, { children: label }),
|
|
29
|
-
clearButton && /* @__PURE__ */ jsx(Button, {
|
|
29
|
+
clearButton && /* @__PURE__ */ jsx(Button, { styleVariant: "accent", emphasis: "quaternary", size: "sm", onPress: clearButtonOnClick, children: "Clear" })
|
|
30
30
|
] }),
|
|
31
31
|
description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
|
|
32
32
|
/* @__PURE__ */ jsx(TagList, { className: styles.tagGroupList, items, renderEmptyState, children })
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TextFieldProps } from '../TextField/TextField';
|
|
2
|
-
export declare const TextAreaField: (
|
|
2
|
+
export declare const TextAreaField: (props: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TextAreaField;
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { TextField, TextArea } from "react-aria-components";
|
|
3
|
-
import {
|
|
4
|
-
import '../../assets/TextAreaField.css';const textAreaField = "
|
|
5
|
-
const validationError = "
|
|
3
|
+
import { Field } from "../_base/Field/Field.js";
|
|
4
|
+
import '../../assets/TextAreaField.css';const textAreaField = "_textAreaField_1hjyj_1";
|
|
5
|
+
const validationError = "_validationError_1hjyj_71";
|
|
6
6
|
const styles = {
|
|
7
7
|
textAreaField,
|
|
8
8
|
validationError
|
|
9
9
|
};
|
|
10
|
-
const TextAreaField = ({
|
|
11
|
-
|
|
12
|
-
description,
|
|
13
|
-
defaultValue,
|
|
14
|
-
errorMessage,
|
|
15
|
-
isDisabled,
|
|
16
|
-
isInvalid,
|
|
17
|
-
isRequired = false,
|
|
18
|
-
...props
|
|
19
|
-
}) => {
|
|
20
|
-
return /* @__PURE__ */ jsxs(TextField, { className: styles.textAreaField, defaultValue, isDisabled, isInvalid, ...props, children: [
|
|
21
|
-
/* @__PURE__ */ jsx(FieldHeader, { label, description, errorMessage, isRequired, isInvalid }),
|
|
22
|
-
/* @__PURE__ */ jsx(TextArea, {})
|
|
23
|
-
] });
|
|
10
|
+
const TextAreaField = (props) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(Field, { as: TextField, className: styles.textAreaField, ...props, children: /* @__PURE__ */ jsx(TextArea, {}) });
|
|
24
12
|
};
|
|
25
13
|
export {
|
|
26
14
|
TextAreaField,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaField.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextAreaField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1,34 +1,7 @@
|
|
|
1
|
-
import { TextFieldProps as AriaTextFieldProps
|
|
1
|
+
import { TextFieldProps as AriaTextFieldProps } from 'react-aria-components';
|
|
2
2
|
import { IconProps } from '../Icon/Icon';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The label for the TextField
|
|
6
|
-
*/
|
|
7
|
-
label?: string;
|
|
8
|
-
/**
|
|
9
|
-
* The description for the TextField
|
|
10
|
-
*/
|
|
11
|
-
description?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The error message for the TextField
|
|
14
|
-
*/
|
|
15
|
-
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
16
|
-
/**
|
|
17
|
-
* Whether the TextField is disabled
|
|
18
|
-
*/
|
|
19
|
-
isDisabled?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* The default value for the TextField
|
|
22
|
-
*/
|
|
23
|
-
defaultValue?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Whether the TextField is invalid
|
|
26
|
-
*/
|
|
27
|
-
isInvalid?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Whether the TextField is required
|
|
30
|
-
*/
|
|
31
|
-
isRequired?: boolean;
|
|
3
|
+
import { FieldProps } from '../_base/Field';
|
|
4
|
+
export interface TextFieldProps extends FieldProps<AriaTextFieldProps> {
|
|
32
5
|
/**
|
|
33
6
|
* Whether an icon should display at the start of the TextField
|
|
34
7
|
*/
|
|
@@ -38,5 +11,5 @@ export interface TextFieldProps extends AriaTextFieldProps {
|
|
|
38
11
|
*/
|
|
39
12
|
iconEndProps?: IconProps;
|
|
40
13
|
}
|
|
41
|
-
export declare const TextField: ({
|
|
14
|
+
export declare const TextField: ({ iconStartProps, iconEndProps, ...props }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
15
|
export default TextField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TextField as TextField$1, Input } from "react-aria-components";
|
|
3
|
-
import { FieldHeader } from "../FieldHeader/FieldHeader.js";
|
|
4
3
|
import { Icon } from "../Icon/Icon.js";
|
|
4
|
+
import { Field } from "../_base/Field/Field.js";
|
|
5
5
|
import '../../assets/TextField.css';const textField = "_textField_1kom2_1";
|
|
6
6
|
const inputWrapper = "_inputWrapper_1kom2_45";
|
|
7
7
|
const iconStart = "_iconStart_1kom2_51";
|
|
@@ -13,25 +13,15 @@ const styles = {
|
|
|
13
13
|
iconEnd
|
|
14
14
|
};
|
|
15
15
|
const TextField = ({
|
|
16
|
-
label,
|
|
17
|
-
description,
|
|
18
|
-
defaultValue,
|
|
19
|
-
errorMessage,
|
|
20
|
-
isDisabled,
|
|
21
|
-
isInvalid,
|
|
22
|
-
isRequired = false,
|
|
23
16
|
iconStartProps,
|
|
24
17
|
iconEndProps,
|
|
25
18
|
...props
|
|
26
19
|
}) => {
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */ jsx(
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
iconEndProps && /* @__PURE__ */ jsx(Icon, { ...iconEndProps, className: styles.iconEnd })
|
|
33
|
-
] })
|
|
34
|
-
] });
|
|
20
|
+
return /* @__PURE__ */ jsx(Field, { as: TextField$1, className: styles.textField, ...props, children: /* @__PURE__ */ jsxs("div", { className: styles.inputWrapper, children: [
|
|
21
|
+
iconStartProps && /* @__PURE__ */ jsx(Icon, { ...iconStartProps, className: styles.iconStart }),
|
|
22
|
+
/* @__PURE__ */ jsx(Input, {}),
|
|
23
|
+
iconEndProps && /* @__PURE__ */ jsx(Icon, { ...iconEndProps, className: styles.iconEnd })
|
|
24
|
+
] }) });
|
|
35
25
|
};
|
|
36
26
|
export {
|
|
37
27
|
TextField,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,14 +4,14 @@ import { useRef, useState, useEffect } from "react";
|
|
|
4
4
|
import { ToggleButton as ToggleButton$1 } from "react-aria-components";
|
|
5
5
|
import LoadingSpinner from "../LoadingSpinner/LoadingSpinner.js";
|
|
6
6
|
import { focusStyleVariants } from "../../utils/focus/focusStyles.js";
|
|
7
|
-
import '../../assets/ToggleButton.css';const toggleButton$1 = "
|
|
8
|
-
const sm = "
|
|
9
|
-
const md = "
|
|
10
|
-
const lg = "
|
|
7
|
+
import '../../assets/ToggleButton.css';const toggleButton$1 = "_toggleButton_1q059_1";
|
|
8
|
+
const sm = "_sm_1q059_35";
|
|
9
|
+
const md = "_md_1q059_42";
|
|
10
|
+
const lg = "_lg_1q059_48";
|
|
11
11
|
const styles = {
|
|
12
12
|
toggleButton: toggleButton$1,
|
|
13
|
-
"fa-spinner-third": "_fa-spinner-
|
|
14
|
-
"icon-wrapper": "_icon-
|
|
13
|
+
"fa-spinner-third": "_fa-spinner-third_1q059_21",
|
|
14
|
+
"icon-wrapper": "_icon-wrapper_1q059_26",
|
|
15
15
|
sm,
|
|
16
16
|
md,
|
|
17
17
|
lg
|
|
@@ -14,6 +14,14 @@ export interface ToggleIconButtonProps extends Omit<ToggleButtonProps, 'children
|
|
|
14
14
|
* Handler that is called when the press is released over the target.
|
|
15
15
|
*/
|
|
16
16
|
onClick?: (e: PressEvent) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Tooltip text to display on hover and focus
|
|
19
|
+
*/
|
|
20
|
+
tooltipLabel?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Tooltip placement relative to the button
|
|
23
|
+
*/
|
|
24
|
+
tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';
|
|
17
25
|
}
|
|
18
|
-
declare const ToggleIconButton: ({ iconProps, isLoading, size, focusStyle, isSelected, defaultSelected, isDisabled, autoFocus, type, onClick, ...props }: ToggleIconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare const ToggleIconButton: ({ iconProps, isLoading, size, focusStyle, tooltipLabel, tooltipPlacement, isSelected, defaultSelected, isDisabled, autoFocus, type, onClick, ...props }: ToggleIconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
27
|
export default ToggleIconButton;
|
|
@@ -5,17 +5,18 @@ import { ToggleButton } from "react-aria-components";
|
|
|
5
5
|
import { Icon } from "../Icon/Icon.js";
|
|
6
6
|
import LoadingSpinner from "../LoadingSpinner/LoadingSpinner.js";
|
|
7
7
|
import { focusStyleVariants } from "../../utils/focus/focusStyles.js";
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
8
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import '../../assets/ToggleIconButton.css';const toggleIconButton$1 = "_toggleIconButton_1za7z_1";
|
|
10
|
+
const sm = "_sm_1za7z_26";
|
|
11
|
+
const md = "_md_1za7z_32";
|
|
12
|
+
const lg = "_lg_1za7z_38";
|
|
12
13
|
const styles = {
|
|
13
14
|
toggleIconButton: toggleIconButton$1,
|
|
14
|
-
"icon-wrapper": "_icon-
|
|
15
|
+
"icon-wrapper": "_icon-wrapper_1za7z_17",
|
|
15
16
|
sm,
|
|
16
17
|
md,
|
|
17
18
|
lg,
|
|
18
|
-
"fa-spinner-third": "_fa-spinner-
|
|
19
|
+
"fa-spinner-third": "_fa-spinner-third_1za7z_44"
|
|
19
20
|
};
|
|
20
21
|
const toggleIconButton = cva(styles.toggleIconButton, {
|
|
21
22
|
variants: {
|
|
@@ -36,6 +37,8 @@ const ToggleIconButton = ({
|
|
|
36
37
|
isLoading = false,
|
|
37
38
|
size = "md",
|
|
38
39
|
focusStyle = "default",
|
|
40
|
+
tooltipLabel = "",
|
|
41
|
+
tooltipPlacement = "top",
|
|
39
42
|
// react-aria props
|
|
40
43
|
isSelected,
|
|
41
44
|
defaultSelected,
|
|
@@ -65,16 +68,20 @@ const ToggleIconButton = ({
|
|
|
65
68
|
onClick(e);
|
|
66
69
|
}
|
|
67
70
|
};
|
|
68
|
-
|
|
71
|
+
const buttonContent = /* @__PURE__ */ jsxs(ToggleButton, { className: `${toggleIconButton({
|
|
69
72
|
size
|
|
70
73
|
})} ${focusStyleVariants({
|
|
71
74
|
focusStyle
|
|
72
|
-
})}`, ref: buttonRef, isSelected: selectedState, defaultSelected, isDisabled, autoFocus, type, onPress: handlePress, "aria-label": isLoading ? "Loading Spinner" : "Icon", style: {
|
|
75
|
+
})}`, ref: buttonRef, isSelected: selectedState, defaultSelected, isDisabled, autoFocus, type, onPress: handlePress, "aria-label": tooltipLabel ? void 0 : isLoading ? "Loading Spinner" : "Icon", style: {
|
|
73
76
|
width: isLoading && buttonWidth ? `${buttonWidth}px` : void 0
|
|
74
77
|
}, ...props, children: [
|
|
75
78
|
isLoading && /* @__PURE__ */ jsx(LoadingSpinner, { size: "1x" }),
|
|
76
79
|
!isLoading && /* @__PURE__ */ jsx(Icon, { ...iconProps })
|
|
77
80
|
] });
|
|
81
|
+
if (tooltipLabel) {
|
|
82
|
+
return /* @__PURE__ */ jsx(Tooltip, { label: tooltipLabel, placement: tooltipPlacement, isDisabled, children: buttonContent });
|
|
83
|
+
}
|
|
84
|
+
return buttonContent;
|
|
78
85
|
};
|
|
79
86
|
export {
|
|
80
87
|
ToggleIconButton as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleIconButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToggleIconButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -26,6 +26,10 @@ export interface TooltipProps extends AriaTooltipProps {
|
|
|
26
26
|
By default, opens for both focus and hover. Can be made to open only for focus.
|
|
27
27
|
*/
|
|
28
28
|
trigger?: 'focus';
|
|
29
|
+
/**
|
|
30
|
+
Controls the visibility of the tooltip
|
|
31
|
+
*/
|
|
32
|
+
visible?: boolean;
|
|
29
33
|
}
|
|
30
|
-
export declare const Tooltip: ({ label, placement, isDisabled, delay, closeDelay, children, trigger, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const Tooltip: ({ label, placement, isDisabled, delay, closeDelay, children, trigger, visible, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
35
|
export default Tooltip;
|
|
@@ -14,11 +14,12 @@ const Tooltip = ({
|
|
|
14
14
|
closeDelay,
|
|
15
15
|
children,
|
|
16
16
|
trigger,
|
|
17
|
+
visible,
|
|
17
18
|
...props
|
|
18
19
|
}) => {
|
|
19
|
-
return /* @__PURE__ */ jsxs(TooltipTrigger, { isDisabled, delay, closeDelay, trigger, children: [
|
|
20
|
+
return /* @__PURE__ */ jsxs(TooltipTrigger, { isDisabled, delay, closeDelay, trigger, isOpen: visible, children: [
|
|
20
21
|
children,
|
|
21
|
-
/* @__PURE__ */ jsx(Tooltip$1, { className: styles.tooltip, placement, ...props, children: label })
|
|
22
|
+
/* @__PURE__ */ jsx(Tooltip$1, { className: styles.tooltip, placement, ...props, children: /* @__PURE__ */ jsx("div", { "data-placement": placement, children: label }) })
|
|
22
23
|
] });
|
|
23
24
|
};
|
|
24
25
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldHeaderProps } from '../../FieldHeader';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface FieldCommonProps extends FieldHeaderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the Field is disabled
|
|
6
|
+
*/
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type FieldProps<T extends object = object> = T & FieldCommonProps;
|
|
10
|
+
type FieldBaseProps<T extends object> = FieldProps<T> & {
|
|
11
|
+
as: React.ElementType;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
className?: React.ComponentProps<React.ElementType>['className'];
|
|
14
|
+
};
|
|
15
|
+
export declare function Field<T extends object>({ as, children, className, ...props }: FieldBaseProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default Field;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FieldHeader } from "../../FieldHeader/FieldHeader.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
function PolymorphicField({
|
|
5
|
+
as,
|
|
6
|
+
children,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
if (!as) {
|
|
10
|
+
console.warn("@alto/ui: Field expects an as prop");
|
|
11
|
+
}
|
|
12
|
+
return as ? React.createElement(as, props, children) : /* @__PURE__ */ jsx("div", { children });
|
|
13
|
+
}
|
|
14
|
+
function Field({
|
|
15
|
+
as,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ jsxs(PolymorphicField, { as, isDisabled: props == null ? void 0 : props.isDisabled, className, isRequired: props == null ? void 0 : props.isRequired, ...props, children: [
|
|
21
|
+
(props == null ? void 0 : props.label) ? /* @__PURE__ */ jsx(FieldHeader, { label: props == null ? void 0 : props.label, description: props == null ? void 0 : props.description, errorMessage: props == null ? void 0 : props.errorMessage, isInvalid: props == null ? void 0 : props.isInvalid, isRequired: props == null ? void 0 : props.isRequired, labelFor: props == null ? void 0 : props.labelFor }) : null,
|
|
22
|
+
children
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Field,
|
|
27
|
+
Field as default
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|