@vertigis/react-ui 9.14.0 → 10.2.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.
Files changed (105) hide show
  1. package/AdapterDateFns/index.d.ts +3 -0
  2. package/AdapterDateFns/index.js +3 -0
  3. package/AdapterLuxon/index.d.ts +3 -0
  4. package/AdapterLuxon/index.js +3 -0
  5. package/AdapterMoment/index.d.ts +3 -0
  6. package/AdapterMoment/index.js +3 -0
  7. package/Checkbox/Checkbox.d.ts +3 -2
  8. package/ColorInput/ColorInput.d.ts +57 -0
  9. package/ColorInput/ColorInput.js +122 -0
  10. package/ColorInput/index.d.ts +2 -0
  11. package/ColorInput/index.js +2 -0
  12. package/CopyableText/CopyableText.d.ts +35 -0
  13. package/CopyableText/CopyableText.js +80 -0
  14. package/CopyableText/index.d.ts +2 -0
  15. package/CopyableText/index.js +2 -0
  16. package/DataGrid/index.d.ts +1 -0
  17. package/DataGrid/index.js +1 -0
  18. package/DatePicker/index.d.ts +3 -0
  19. package/DatePicker/index.js +3 -0
  20. package/DateRangePicker/index.d.ts +3 -0
  21. package/DateRangePicker/index.js +3 -0
  22. package/DateTimePicker/index.d.ts +3 -0
  23. package/DateTimePicker/index.js +3 -0
  24. package/FormControl/FormControl.d.ts +42 -0
  25. package/FormControl/FormControl.js +30 -0
  26. package/FormControl/index.d.ts +2 -2
  27. package/FormControl/index.js +2 -2
  28. package/FormLabel/FormLabel.d.ts +1 -1
  29. package/FormLabel/FormLabel.js +2 -2
  30. package/FormLabelTextField/FormLabelTextField.d.ts +15 -0
  31. package/FormLabelTextField/FormLabelTextField.js +34 -0
  32. package/FormLabelTextField/index.d.ts +2 -0
  33. package/FormLabelTextField/index.js +2 -0
  34. package/IconButton/IconButton.d.ts +1 -1
  35. package/IconMenu/IconMenu.d.ts +37 -0
  36. package/IconMenu/IconMenu.js +21 -0
  37. package/IconMenu/index.d.ts +2 -0
  38. package/IconMenu/index.js +2 -0
  39. package/InlineFormControl/InlineFormControl.d.ts +38 -0
  40. package/InlineFormControl/InlineFormControl.js +44 -0
  41. package/InlineFormControl/index.d.ts +2 -0
  42. package/InlineFormControl/index.js +2 -0
  43. package/InlineHelp/InlineHelp.d.ts +48 -0
  44. package/InlineHelp/InlineHelp.js +41 -0
  45. package/InlineHelp/index.d.ts +2 -0
  46. package/InlineHelp/index.js +2 -0
  47. package/LicenseInfo/index.d.ts +1 -0
  48. package/LicenseInfo/index.js +1 -0
  49. package/LicenseInfo/index.ts +1 -0
  50. package/Link/Link.d.ts +4 -7
  51. package/Link/Link.js +2 -3
  52. package/Loader/Loader.d.ts +33 -0
  53. package/Loader/Loader.js +75 -0
  54. package/Loader/index.d.ts +2 -0
  55. package/Loader/index.js +2 -0
  56. package/LocalizationProvider/index.d.ts +3 -0
  57. package/LocalizationProvider/index.js +3 -0
  58. package/Markdown/Markdown.d.ts +9 -10
  59. package/Markdown/Markdown.js +2 -1
  60. package/MenuItemSecondaryAction/MenuItemSecondaryAction.d.ts +2 -2
  61. package/MenuItemSecondaryAction/MenuItemSecondaryAction.js +4 -5
  62. package/Radio/Radio.d.ts +3 -2
  63. package/Switch/Switch.d.ts +1 -1
  64. package/Tab/Tab.d.ts +3 -3
  65. package/Tab/Tab.js +1 -1
  66. package/TableCell/TableCell.d.ts +1 -1
  67. package/Tabs/Tabs.d.ts +1 -1
  68. package/Tabs/Tabs.js +1 -1
  69. package/TimePicker/index.d.ts +3 -0
  70. package/TimePicker/index.js +3 -0
  71. package/ToggleButton/ToggleButton.d.ts +1 -1
  72. package/colors/blue.d.ts +1 -1
  73. package/colors/burntOrange.d.ts +1 -1
  74. package/colors/darkBurntOrange.d.ts +1 -1
  75. package/colors/darkRed.d.ts +1 -1
  76. package/colors/green.d.ts +1 -1
  77. package/colors/grey.d.ts +1 -1
  78. package/colors/orange.d.ts +1 -1
  79. package/colors/purple.d.ts +1 -1
  80. package/colors/red.d.ts +1 -1
  81. package/colors/teal.d.ts +1 -1
  82. package/colors/woodlandGreen.d.ts +1 -1
  83. package/icons/utils/createSvgIcon.d.ts +5 -4
  84. package/icons/utils/createSvgIcon.js +4 -3
  85. package/package.json +13 -4
  86. package/styles/CacheProvider.d.ts +1 -1
  87. package/styles/createTheme.js +27 -3
  88. package/styles/index.js +1 -1
  89. package/styles/themeAugmentation.d.ts +22 -0
  90. package/utils/color.d.ts +11 -0
  91. package/utils/color.js +39 -0
  92. package/utils/generateId.d.ts +1 -0
  93. package/utils/generateId.js +1 -0
  94. package/utils/html.d.ts +16 -0
  95. package/utils/html.js +105 -0
  96. package/utils/intl.d.ts +9 -6
  97. package/utils/intl.js +9 -6
  98. package/utils/markdown.d.ts +11 -3
  99. package/utils/markdown.js +11 -1
  100. package/utils/react.d.ts +15 -0
  101. package/utils/react.js +42 -0
  102. package/utils/url.d.ts +19 -0
  103. package/utils/url.js +74 -0
  104. package/CircularProgress/CircularProgress.d.ts +0 -2
  105. package/CircularProgress/CircularProgress.js +0 -2
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/AdapterDateFns";
2
+ import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
3
+ export default AdapterDateFns;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/AdapterDateFns";
2
+ import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
3
+ export default AdapterDateFns;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/AdapterLuxon";
2
+ import { AdapterLuxon } from "@mui/x-date-pickers/AdapterLuxon";
3
+ export default AdapterLuxon;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/AdapterLuxon";
2
+ import { AdapterLuxon } from "@mui/x-date-pickers/AdapterLuxon";
3
+ export default AdapterLuxon;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/AdapterMoment";
2
+ import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
3
+ export default AdapterMoment;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/AdapterMoment";
2
+ import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
3
+ export default AdapterMoment;
@@ -1,5 +1,6 @@
1
- import { ButtonBaseClasses } from "@mui/material/ButtonBase";
2
- import Checkbox, { CheckboxProps as MUICheckboxProps, CheckboxClasses as MUICheckboxClasses } from "@mui/material/Checkbox";
1
+ import type { ButtonBaseClasses } from "@mui/material/ButtonBase";
2
+ import type { CheckboxProps as MUICheckboxProps, CheckboxClasses as MUICheckboxClasses } from "@mui/material/Checkbox";
3
+ import Checkbox from "@mui/material/Checkbox";
3
4
  export * from "@mui/material/Checkbox";
4
5
  export interface CheckboxClasses extends MUICheckboxClasses, ButtonBaseClasses {
5
6
  }
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" />
2
+ import type { BoxProps } from "@mui/material/Box";
3
+ import type { SketchPickerStylesProps } from "react-color/lib/components/sketch/Sketch";
4
+ import type { ButtonProps } from "../Button/index.js";
5
+ export declare const colorInputClasses: {
6
+ root: string;
7
+ pickerButton: string;
8
+ pickerButtonBackground: string;
9
+ pickerButtonColor: string;
10
+ popoverPaper: string;
11
+ };
12
+ export interface SketchColorPreset {
13
+ /**
14
+ * A valid hex string color.
15
+ */
16
+ color: string;
17
+ /**
18
+ * A title representing the color preset.
19
+ */
20
+ title: string;
21
+ }
22
+ export declare type ColorInputClassKey = keyof typeof colorInputClasses;
23
+ export declare type ColorInputClasses = Record<ColorInputClassKey, string>;
24
+ export interface ColorInputProps extends Omit<BoxProps, "onChange"> {
25
+ /**
26
+ * Optional button props
27
+ */
28
+ ButtonProps?: ButtonProps;
29
+ /**
30
+ * Additional CSS classes to be applied to the component.
31
+ */
32
+ classes?: Partial<ColorInputClasses>;
33
+ /**
34
+ * If `true`, the input will be disabled.
35
+ */
36
+ disabled?: boolean;
37
+ /**
38
+ * Will be called every time the value changes.
39
+ */
40
+ onChange?: (value: string) => void;
41
+ /**
42
+ * Array of hex strings or color preset objects or a combination of both to
43
+ * be shown in the color swatch area.
44
+ */
45
+ presetColors?: (string | SketchColorPreset)[];
46
+ /**
47
+ * Style overrides for the react-color SketchPicker.
48
+ */
49
+ sketchPickerStyle?: Partial<SketchPickerStylesProps>;
50
+ /**
51
+ * The color value. This can be any valid CSS color value such as: `blue`,
52
+ * `#0000FF`, `rgb(0, 0, 255)`, `rgba(0, 0, 255, 0.5)`
53
+ */
54
+ value?: string;
55
+ }
56
+ export declare const ColorInput: import("react").ForwardRefExoticComponent<Pick<ColorInputProps, "id" | "dir" | "p" | "slot" | "style" | "title" | "resource" | "results" | "role" | "key" | "value" | "classes" | "color" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "zIndex" | "typography" | "fontFamily" | "fontSize" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "component" | "ButtonProps" | "presetColors" | "sketchPickerStyle"> & import("react").RefAttributes<HTMLDivElement>>;
57
+ export default ColorInput;
@@ -0,0 +1,122 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Box from "@mui/material/Box";
3
+ import { useFormControl } from "@mui/material/FormControl";
4
+ import clsx from "clsx";
5
+ import { forwardRef, useState } from "react";
6
+ import { SketchPicker } from "react-color";
7
+ import Button from "../Button/index.js";
8
+ import Popover from "../Popover/index.js";
9
+ import { mergeStyles, styled, useTheme } from "../styles/index.js";
10
+ import { parse as parseColor } from "../utils/color.js";
11
+ const PREFIX = "GcxColorInput";
12
+ export const colorInputClasses = {
13
+ root: `${PREFIX}-root`,
14
+ pickerButton: `${PREFIX}-pickerButton`,
15
+ pickerButtonBackground: `${PREFIX}-pickerButtonBackground`,
16
+ pickerButtonColor: `${PREFIX}-pickerButtonColor`,
17
+ popoverPaper: `${PREFIX}-popoverPaper`,
18
+ };
19
+ const defaultRgbColor = {
20
+ r: 255,
21
+ g: 255,
22
+ b: 255,
23
+ alpha: 1,
24
+ };
25
+ const defaultColors = [
26
+ "#1479CB",
27
+ "#008A00",
28
+ "#5B7F39",
29
+ "#D43900",
30
+ "#8667AD",
31
+ "#C9493C",
32
+ "#0D8387",
33
+ "#D025B9",
34
+ ];
35
+ const Root = styled(Box)(({ theme: { palette, shape, typography } }) => ({
36
+ [`& .${colorInputClasses.pickerButton}`]: {
37
+ border: "none",
38
+ margin: 0,
39
+ // Reset button's min-width.
40
+ minWidth: "unset",
41
+ padding: typography.pxToRem(8),
42
+ },
43
+ [`& .${colorInputClasses.pickerButtonBackground}`]: {
44
+ // Background: https://css-tricks.com/stripes-css/
45
+ background: `repeating-linear-gradient(
46
+ 135deg,
47
+ ${palette.grey[600]},
48
+ ${palette.grey[600]} 10px,
49
+ ${palette.common.white} 10px,
50
+ ${palette.common.white} 20px
51
+ )`,
52
+ },
53
+ [`& .${colorInputClasses.pickerButtonColor}`]: {
54
+ height: typography.pxToRem(20),
55
+ width: typography.pxToRem(76),
56
+ },
57
+ [`& .${colorInputClasses.popoverPaper}`]: {
58
+ padding: 0,
59
+ "& .sketch-picker input": {
60
+ backgroundColor: "transparent",
61
+ borderRadius: shape.borderRadius,
62
+ color: palette.text.primary,
63
+ textAlign: "center",
64
+ },
65
+ "& .sketch-picker span": {
66
+ color: `${palette.text.primary} !important`,
67
+ },
68
+ },
69
+ }));
70
+ export const ColorInput = forwardRef(function ColorInput({ ButtonProps, className, classes: classesProp, disabled, presetColors, onChange, value: unsanitizedValue, sketchPickerStyle = {}, ...others }, ref) {
71
+ const theme = useTheme();
72
+ const [buttonEl, setButtonEl] = useState();
73
+ const handleColorPopoverOpen = (event) => setButtonEl(event.currentTarget);
74
+ const handleColorPopoverClose = () => setButtonEl(undefined);
75
+ const handleColorPickerChangeComplete = (newColor) => {
76
+ const validatedColor = parseColor(newColor.rgb);
77
+ if (validatedColor) {
78
+ onChange?.(validatedColor.rgb().string());
79
+ }
80
+ };
81
+ // Careful. `useFormControl` can return undefined.
82
+ // See https://github.com/mui-org/material-ui/pull/20278.
83
+ const muiFormControl = useFormControl();
84
+ // `RGB(0,0,0)` will fail, we should instead convert to `rgb(0,0,0)`
85
+ const value = unsanitizedValue && unsanitizedValue.toLowerCase();
86
+ // Color allows us to easily convert between different color types
87
+ const color = parseColor(value);
88
+ // The rgb object will be used for passing values to the color picker component
89
+ const rgb = color ? color.rgb().object() : defaultRgbColor;
90
+ const classes = mergeStyles(colorInputClasses, classesProp);
91
+ return (_jsxs(Root, Object.assign({ className: clsx(classes.root, className) }, others, { ref: ref }, { children: [_jsx(Button, Object.assign({}, ButtonProps, { disabled: disabled ?? muiFormControl?.disabled, className: classes.pickerButton, "data-test": "ColorInput-picker-button", onClick: handleColorPopoverOpen }, { children: _jsx("div", Object.assign({ className: classes.pickerButtonBackground }, { children: _jsx("div", { className: classes.pickerButtonColor, "data-test": "ColorInput-picker-button-color", style: {
92
+ // The rgb CSS string will be used for styling the color picker button
93
+ background: color ? color.rgb().string() : "transparent",
94
+ } }, void 0) }), void 0) }), void 0), _jsx(Popover, Object.assign({ anchorEl: buttonEl, open: !!buttonEl, anchorOrigin: {
95
+ vertical: "bottom",
96
+ horizontal: "left",
97
+ }, transformOrigin: {
98
+ vertical: "top",
99
+ horizontal: "left",
100
+ }, onClose: handleColorPopoverClose, PaperProps: {
101
+ classes: { root: classes.popoverPaper },
102
+ // Workaround for type error. This is valid and gets passed through.
103
+ [`${"data-test"}`]: "ColorInput-color-picker",
104
+ } }, { children: _jsx(SketchPicker
105
+ // The color object that the picker expects uses key `a` instead of `alpha`
106
+ , {
107
+ // The color object that the picker expects uses key `a` instead of `alpha`
108
+ color: {
109
+ r: rgb.r,
110
+ g: rgb.g,
111
+ b: rgb.b,
112
+ a: rgb.alpha,
113
+ }, onChangeComplete: handleColorPickerChangeComplete, presetColors: presetColors || defaultColors, styles: {
114
+ default: {
115
+ picker: {
116
+ background: theme.palette.background.paper,
117
+ },
118
+ ...sketchPickerStyle,
119
+ },
120
+ } }, void 0) }), void 0)] }), void 0));
121
+ });
122
+ export default ColorInput;
@@ -0,0 +1,2 @@
1
+ export { default } from "./ColorInput.js";
2
+ export * from "./ColorInput.js";
@@ -0,0 +1,2 @@
1
+ export { default } from "./ColorInput.js";
2
+ export * from "./ColorInput.js";
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import type { InputProps as InputPropsType } from "../Input/index.js";
3
+ import type { StackProps } from "../Stack/index.js";
4
+ export declare const copyableTextClasses: {
5
+ root: string;
6
+ input: string;
7
+ inputRoot: string;
8
+ iconButton: string;
9
+ };
10
+ export declare type CopyableTextClassKey = keyof typeof copyableTextClasses;
11
+ export declare type CopyableTextClasses = Record<CopyableTextClassKey, string>;
12
+ export interface CopyableTextProps extends StackProps {
13
+ /**
14
+ * Additional CSS classes to be applied to the component.
15
+ */
16
+ classes?: Partial<CopyableTextClasses>;
17
+ /**
18
+ * Props for the input component.
19
+ */
20
+ InputProps?: Partial<InputPropsType>;
21
+ /**
22
+ * The text displayed when the text is copied.
23
+ */
24
+ tooltipCopiedText: string;
25
+ /**
26
+ * The text displayed when hovering over the copy button.
27
+ */
28
+ tooltipCopyText: string;
29
+ /**
30
+ * The text displayed in the input.
31
+ */
32
+ value: string | undefined;
33
+ }
34
+ declare const CopyableText: import("react").ForwardRefExoticComponent<Pick<CopyableTextProps, "id" | "dir" | "p" | "slot" | "style" | "title" | "resource" | "results" | "role" | "key" | "value" | "classes" | "color" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "zIndex" | "direction" | "spacing" | "typography" | "fontFamily" | "fontSize" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "divider" | "InputProps" | "tooltipCopiedText" | "tooltipCopyText"> & import("react").RefAttributes<unknown>>;
35
+ export default CopyableText;
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { forwardRef, useRef, useState } from "react";
4
+ import Button from "../Button/index.js";
5
+ import Input from "../Input/index.js";
6
+ import Stack from "../Stack/index.js";
7
+ import Tooltip from "../Tooltip/index.js";
8
+ import CopyIcon from "../icons/Copy.js";
9
+ import { mergeStyles, styled } from "../styles/index.js";
10
+ import { mergeRefs } from "../utils/react.js";
11
+ const PREFIX = "GcxCopyableText";
12
+ export const copyableTextClasses = {
13
+ root: `${PREFIX}-root`,
14
+ input: `${PREFIX}-input`,
15
+ inputRoot: `${PREFIX}-inputRoot`,
16
+ iconButton: `${PREFIX}-iconButton`,
17
+ };
18
+ const StyledStack = styled(Stack)(({ theme: { typography } }) => ({
19
+ [`& .${copyableTextClasses.input}`]: {
20
+ width: "100%",
21
+ },
22
+ [`& .${copyableTextClasses.inputRoot}`]: {
23
+ flex: 1,
24
+ borderTopRightRadius: 0,
25
+ borderBottomRightRadius: 0,
26
+ },
27
+ [`& .${copyableTextClasses.iconButton}`]: {
28
+ minWidth: "unset",
29
+ width: typography.pxToRem(16),
30
+ borderLeft: "none",
31
+ margin: 0,
32
+ borderTopLeftRadius: 0,
33
+ borderBottomLeftRadius: 0,
34
+ },
35
+ }));
36
+ const CopyableText = forwardRef((props, ref) => {
37
+ const localRef = useRef();
38
+ const [open, setOpen] = useState(false);
39
+ const [showClickedMessage, setShowClickedMessage] = useState(false);
40
+ const handleTooltipClose = () => setOpen(false);
41
+ const handleTooltipOpen = () => {
42
+ // Because this is hooked up internally to a mouseEnter event in
43
+ // Tooltip, this can get fired multiple times when the user is moving
44
+ // their mouse within the button. showClickedMessage should get set to
45
+ // false when the user is re-entering the button, otherwise it should
46
+ // keep its value.
47
+ setOpen(true);
48
+ setShowClickedMessage(open && showClickedMessage);
49
+ };
50
+ const handleMouseDown = (e) => {
51
+ // We need to call preventDefault() because otherwise the mousedown will
52
+ // fire a Blur event which triggers Tooltip's onClose which will close
53
+ // the tooltip (as per the logic in handleTooltipClose()). As we dont
54
+ // want the tooltip to close when the button is clicked, we need to stop
55
+ // the propagation of this event.
56
+ e.preventDefault();
57
+ };
58
+ const handleCopyUrl = async (e) => {
59
+ if (!localRef.current) {
60
+ return;
61
+ }
62
+ await navigator.clipboard.writeText(value ?? "");
63
+ setShowClickedMessage(true);
64
+ };
65
+ const { classes: classesProp, className, InputProps = {}, tooltipCopiedText, tooltipCopyText, value, ...other } = props;
66
+ const { classes: inputPropsClasses = {}, inputProps, ...otherInputProps } = InputProps;
67
+ const { root, input, ...otherClasses } = inputPropsClasses;
68
+ const classes = mergeStyles(copyableTextClasses, classesProp);
69
+ return (_jsxs(StyledStack, Object.assign({ direction: "row", className: clsx(classes.root, className) }, other, { children: [_jsx(Input, Object.assign({ classes: {
70
+ root: clsx(classes.inputRoot, root),
71
+ input: clsx(classes.input, input),
72
+ ...otherClasses,
73
+ }, inputProps: {
74
+ readOnly: true,
75
+ "data-test": "CopyableText-Input",
76
+ ...inputProps,
77
+ }, inputRef: mergeRefs(ref, localRef), value: value || "", "data-test": "CopyableText-Input-Wrapper" }, otherInputProps), void 0), _jsx(Tooltip, Object.assign({ "data-test": "CopyableText-Tooltip", open: open, onOpen: handleTooltipOpen, onClose: handleTooltipClose, title: showClickedMessage ? tooltipCopiedText : tooltipCopyText, placement: "bottom" }, { children: _jsx(Button, Object.assign({ className: classes.iconButton, "data-test": "CopyableText-IconButton", disabled: !value, onClick: handleCopyUrl, onMouseDown: handleMouseDown }, { children: _jsx(CopyIcon, {}, void 0) }), void 0) }), void 0)] }), void 0));
78
+ });
79
+ CopyableText.displayName = "CopyableText";
80
+ export default CopyableText;
@@ -0,0 +1,2 @@
1
+ export { default } from "./CopyableText.js";
2
+ export * from "./CopyableText.js";
@@ -0,0 +1,2 @@
1
+ export { default } from "./CopyableText.js";
2
+ export * from "./CopyableText.js";
@@ -0,0 +1 @@
1
+ export * from "@mui/x-data-grid-pro";
@@ -0,0 +1 @@
1
+ export * from "@mui/x-data-grid-pro";
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/DatePicker";
2
+ import { DatePicker } from "@mui/x-date-pickers-pro";
3
+ export default DatePicker;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/DatePicker";
2
+ import { DatePicker } from "@mui/x-date-pickers-pro";
3
+ export default DatePicker;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers-pro/DateRangePicker";
2
+ import { DateRangePicker } from "@mui/x-date-pickers-pro";
3
+ export default DateRangePicker;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers-pro/DateRangePicker";
2
+ import { DateRangePicker } from "@mui/x-date-pickers-pro";
3
+ export default DateRangePicker;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/DateTimePicker";
2
+ import { DateTimePicker } from "@mui/x-date-pickers-pro";
3
+ export default DateTimePicker;
@@ -0,0 +1,3 @@
1
+ export * from "@mui/x-date-pickers/DateTimePicker";
2
+ import { DateTimePicker } from "@mui/x-date-pickers-pro";
3
+ export default DateTimePicker;
@@ -0,0 +1,42 @@
1
+ import type { FormControlClasses as MUIFormControlClasses, FormControlProps as MUIFormControlProps } from "@mui/material/FormControl";
2
+ import type { ReactNode } from "react";
3
+ export * from "@mui/material/FormControl";
4
+ declare const gcxFormControlClasses: {
5
+ inlineHelp: string;
6
+ };
7
+ export declare const formControlClasses: {
8
+ inlineHelp: string;
9
+ root: string;
10
+ marginNormal: string;
11
+ marginDense: string;
12
+ fullWidth: string;
13
+ };
14
+ export declare type FormControlClasses = MUIFormControlClasses & Record<keyof typeof gcxFormControlClasses, string>;
15
+ export declare type FormControlClassKey = keyof FormControlClasses;
16
+ export interface FormControlProps extends Omit<MUIFormControlProps, "classes"> {
17
+ /**
18
+ * Additional CSS classes to be applied to the component.
19
+ */
20
+ classes?: Partial<FormControlClasses>;
21
+ /**
22
+ * The content of the inline help to display for the field. If the content
23
+ * is not provided, an inline help component will not be shown.
24
+ */
25
+ inlineHelpContent?: ReactNode;
26
+ /**
27
+ * The title to display on hover of the InlineHelp
28
+ */
29
+ inlineHelpTitle?: string;
30
+ /**
31
+ * The link displayed in the inline help.
32
+ */
33
+ inlineHelpUrl?: {
34
+ label: string;
35
+ href: string;
36
+ };
37
+ }
38
+ /**
39
+ * A simple extension for a Form Control that includes inline help.
40
+ */
41
+ declare const FormControl: import("react").ForwardRefExoticComponent<Pick<FormControlProps, "error" | "id" | "dir" | "slot" | "style" | "title" | "resource" | "results" | "role" | "key" | "classes" | "color" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "required" | "size" | "margin" | "fullWidth" | "variant" | "hiddenLabel" | "focused" | "inlineHelpContent" | "inlineHelpTitle" | "inlineHelpUrl"> & import("react").RefAttributes<HTMLDivElement>>;
42
+ export default FormControl;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import MUIFormControl, { formControlClasses as muiFormControlClasses, } from "@mui/material/FormControl";
3
+ import InlineHelp from "@vertigis/react-ui/InlineHelp/index.js";
4
+ import { styled, mergeStyles } from "@vertigis/react-ui/styles";
5
+ import { forwardRef } from "react";
6
+ // MUST be the first export, since some of the exports are overridden below.
7
+ export * from "@mui/material/FormControl";
8
+ const PREFIX = "GcxFormControl";
9
+ const gcxFormControlClasses = {
10
+ inlineHelp: `${PREFIX}-inlineHelp`,
11
+ };
12
+ export const formControlClasses = {
13
+ ...muiFormControlClasses,
14
+ ...gcxFormControlClasses,
15
+ };
16
+ const StyledMUIFormControl = styled(MUIFormControl)({
17
+ [`& .${gcxFormControlClasses.inlineHelp}`]: {
18
+ position: "absolute",
19
+ right: 0,
20
+ },
21
+ });
22
+ /**
23
+ * A simple extension for a Form Control that includes inline help.
24
+ */
25
+ const FormControl = forwardRef(function FormControl(props, ref) {
26
+ const { children, classes, inlineHelpContent, inlineHelpUrl, inlineHelpTitle, ...other } = props;
27
+ const { inlineHelp: inlineHelpClass, ...otherClasses } = mergeStyles(gcxFormControlClasses, classes);
28
+ return (_jsxs(StyledMUIFormControl, Object.assign({}, other, { classes: otherClasses, ref: ref }, { children: [children, inlineHelpContent && (_jsx(InlineHelp, Object.assign({ title: inlineHelpTitle, className: inlineHelpClass, url: inlineHelpUrl }, { children: inlineHelpContent }), void 0))] }), void 0));
29
+ });
30
+ export default FormControl;
@@ -1,2 +1,2 @@
1
- export { default } from "@mui/material/FormControl";
2
- export * from "@mui/material/FormControl";
1
+ export { default } from "./FormControl.js";
2
+ export * from "./FormControl.js";
@@ -1,2 +1,2 @@
1
- export { default } from "@mui/material/FormControl";
2
- export * from "@mui/material/FormControl";
1
+ export { default } from "./FormControl.js";
2
+ export * from "./FormControl.js";
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { FormLabelClasses as MUIFormLabelClasses, FormLabelProps as MUIFormLabelProps } from "@mui/material/FormLabel";
2
+ import type { FormLabelClasses as MUIFormLabelClasses, FormLabelProps as MUIFormLabelProps } from "@mui/material/FormLabel";
3
3
  import type { OverridableComponent } from "@mui/material/OverridableComponent";
4
4
  declare const gcxFormLabelClasses: {
5
5
  errorIcon: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import MUIFormLabel, { formLabelClasses as muiFormLabelClasses, } from "@mui/material/FormLabel";
2
+ import MUIFormLabel, { formLabelClasses as muiFormLabelClasses } from "@mui/material/FormLabel";
3
3
  import clsx from "clsx";
4
4
  import { forwardRef } from "react";
5
5
  import { useFormControl } from "../FormControl/index.js";
@@ -27,7 +27,7 @@ export const FormLabel = forwardRef(function FormLabel(props, ref) {
27
27
  // Careful. `useFormControl` can return undefined.
28
28
  // See https://github.com/mui-org/material-ui/pull/20278.
29
29
  const muiFormControl = useFormControl();
30
- const error = errorProp !== null && errorProp !== void 0 ? errorProp : muiFormControl === null || muiFormControl === void 0 ? void 0 : muiFormControl.error;
30
+ const error = errorProp ?? muiFormControl?.error;
31
31
  const { errorIcon: errorIconClass, ...otherClasses } = mergeStyles(gcxFormLabelClasses, classes);
32
32
  return (_jsxs(StyledMUIFormLabel, Object.assign({ error: error, className: clsx("GcxFormLabel", className) }, other, { classes: otherClasses, ref: ref }, { children: [error && _jsx(ErrorIcon, { className: errorIconClass, "data-test": "FormLabel-ErrorIcon" }, void 0), children] }), void 0));
33
33
  });
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import type { TextFieldProps } from "@mui/material/TextField";
3
+ import type { FormControlProps } from "../FormControl/index.js";
4
+ export declare type FormLabelTextFieldProps = Omit<TextFieldProps, "variant"> & Pick<FormControlProps, "inlineHelpContent" | "inlineHelpUrl"> & {
5
+ /**
6
+ * Shortcut for setting both `select` and `native` within SelectProps.
7
+ */
8
+ nativeSelect?: boolean;
9
+ };
10
+ /**
11
+ * Like TextField, but uses a FormLabel instead of an InputLabel. Also allows
12
+ * for inline help.
13
+ */
14
+ declare const FormLabelTextField: import("react").ForwardRefExoticComponent<Pick<FormLabelTextFieldProps, "error" | "select" | "id" | "dir" | "label" | "slot" | "style" | "title" | "type" | "resource" | "results" | "role" | "key" | "value" | "classes" | "color" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "autoFocus" | "name" | "inputProps" | "inputRef" | "required" | "size" | "margin" | "fullWidth" | "autoComplete" | "multiline" | "rows" | "maxRows" | "minRows" | "hiddenLabel" | "focused" | "InputProps" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "SelectProps" | "inlineHelpContent" | "inlineHelpUrl" | "nativeSelect"> & import("react").RefAttributes<HTMLDivElement>>;
15
+ export default FormLabelTextField;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import FormControl from "../FormControl/index.js";
4
+ import FormHelperText from "../FormHelperText/index.js";
5
+ import FormLabel from "../FormLabel/index.js";
6
+ import Input from "../Input/index.js";
7
+ import Select from "../Select/index.js";
8
+ import { useId } from "../utils/react.js";
9
+ /**
10
+ * Like TextField, but uses a FormLabel instead of an InputLabel. Also allows
11
+ * for inline help.
12
+ */
13
+ const FormLabelTextField = forwardRef(function FormLabelTextField(props, ref) {
14
+ const { autoComplete, autoFocus = false, children, defaultValue, FormHelperTextProps, fullWidth = false, helperText, id: idProp, InputLabelProps, inputProps, InputProps, inputRef, label, maxRows, minRows, multiline = false, name, nativeSelect = false, onBlur, onChange, onFocus, placeholder, rows, select = false, SelectProps, type, value, ...other } = props;
15
+ const id = useId(idProp);
16
+ const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
17
+ const inputLabelId = label && id ? `${id}-label` : undefined;
18
+ const inputMoreProps = {};
19
+ if (select || nativeSelect) {
20
+ // Unset defaults from textbox inputs.
21
+ if (!SelectProps || (!SelectProps.native && !nativeSelect)) {
22
+ inputMoreProps.id = undefined;
23
+ }
24
+ inputMoreProps["aria-describedby"] = undefined;
25
+ }
26
+ const InputElement = (_jsx(Input, Object.assign({ "aria-describedby": helperTextId, autoComplete: autoComplete,
27
+ // Disabling this linting rule since the intent is to forward it
28
+ // if it exists rather than set it.
29
+ //
30
+ // eslint-disable-next-line jsx-a11y/no-autofocus
31
+ autoFocus: autoFocus, defaultValue: defaultValue, fullWidth: fullWidth, id: id, inputProps: inputProps, inputRef: inputRef, maxRows: maxRows, minRows: minRows, multiline: multiline, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, placeholder: placeholder, rows: rows, type: type, value: value }, inputMoreProps, InputProps), void 0));
32
+ return (_jsxs(FormControl, Object.assign({ fullWidth: fullWidth, ref: ref }, other, { children: [label && (_jsx(FormLabel, Object.assign({ htmlFor: id, id: inputLabelId }, { children: label }), void 0)), helperText && (_jsx(FormHelperText, Object.assign({ id: helperTextId }, FormHelperTextProps, { children: helperText }), void 0)), select || nativeSelect ? (_jsx(Select, Object.assign({ "aria-describedby": helperTextId, id: id, labelId: inputLabelId, value: value, input: InputElement }, { ...SelectProps, ...(nativeSelect && { native: true }) }, { children: children }), void 0)) : (InputElement)] }), void 0));
33
+ });
34
+ export default FormLabelTextField;