@auth0/quantum-product 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/color-text-field/color-text-field.js +47 -2
- package/copy-button/copy-button.js +25 -3
- package/data-table/data-table-row.js +1 -1
- package/esm/color-text-field/color-text-field.js +47 -2
- package/esm/copy-button/copy-button.js +25 -3
- package/esm/data-table/data-table-row.js +1 -1
- package/esm/icon-button/icon-button.js +4 -2
- package/icon-button/icon-button.js +4 -2
- package/package.json +1 -1
|
@@ -44,6 +44,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
46
|
};
|
|
47
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
48
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
49
|
+
if (!m) return o;
|
|
50
|
+
var i = m.call(o), r, ar = [], e;
|
|
51
|
+
try {
|
|
52
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
53
|
+
}
|
|
54
|
+
catch (error) { e = { error: error }; }
|
|
55
|
+
finally {
|
|
56
|
+
try {
|
|
57
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
58
|
+
}
|
|
59
|
+
finally { if (e) throw e.error; }
|
|
60
|
+
}
|
|
61
|
+
return ar;
|
|
62
|
+
};
|
|
47
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
64
|
exports.ColorTextField = void 0;
|
|
49
65
|
var React = __importStar(require("react"));
|
|
@@ -65,10 +81,39 @@ var ColorPicker = (0, styled_1.styled)('input', { name: colorTextFieldComponentN
|
|
|
65
81
|
'&:focus': __assign({ outline: 'none' }, theme.mixins.focusRing()),
|
|
66
82
|
});
|
|
67
83
|
});
|
|
84
|
+
var normalizeHex = function (hex) {
|
|
85
|
+
if (hex.length === 4 && /^#[0-9A-F]{3}$/i.test(hex)) {
|
|
86
|
+
return "#".concat(hex[1]).concat(hex[1]).concat(hex[2]).concat(hex[2]).concat(hex[3]).concat(hex[3]);
|
|
87
|
+
}
|
|
88
|
+
return hex;
|
|
89
|
+
};
|
|
68
90
|
exports.ColorTextField = React.forwardRef(function (props, ref) {
|
|
69
|
-
var inputAdornmentProps = props.inputAdornmentProps, rootProps = __rest(props, ["inputAdornmentProps"]);
|
|
91
|
+
var inputAdornmentProps = props.inputAdornmentProps, value = props.value, defaultValue = props.defaultValue, placeholder = props.placeholder, rootProps = __rest(props, ["inputAdornmentProps", "value", "defaultValue", "placeholder"]);
|
|
92
|
+
var _a = __read(React.useState(normalizeHex(value || placeholder || defaultValue || '#000000')), 2), color = _a[0], setColor = _a[1];
|
|
93
|
+
var handleColorChange = function (event) {
|
|
94
|
+
var value = event.target.value;
|
|
95
|
+
if (value.length === 4 && /^#[0-9A-F]{3}$/i.test(value)) {
|
|
96
|
+
var normalizedValue = normalizeHex(value);
|
|
97
|
+
if (props.onChange) {
|
|
98
|
+
props.onChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), { value: normalizedValue }) }));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (props.onChange) {
|
|
103
|
+
props.onChange(event);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
React.useEffect(function () {
|
|
108
|
+
var newColor = value || placeholder || defaultValue || '#000000';
|
|
109
|
+
if (newColor) {
|
|
110
|
+
setColor(normalizeHex(newColor));
|
|
111
|
+
}
|
|
112
|
+
}, [value, defaultValue, placeholder]);
|
|
70
113
|
return (React.createElement(Root, __assign({ ref: ref }, rootProps, { InputProps: {
|
|
71
114
|
startAdornment: (React.createElement(input_1.InputAdornment, __assign({ position: "start" }, inputAdornmentProps),
|
|
72
|
-
React.createElement(ColorPicker, { id: props.id ? "".concat(props.id, "-color-input") : undefined, name: props.name, type: "color", disabled: props.disabled || props.readOnly, value:
|
|
115
|
+
React.createElement(ColorPicker, { id: props.id ? "".concat(props.id, "-color-input") : undefined, name: props.name, type: "color", disabled: props.disabled || props.readOnly, value: color, onChange: handleColorChange }))),
|
|
116
|
+
value: value,
|
|
117
|
+
placeholder: placeholder,
|
|
73
118
|
} })));
|
|
74
119
|
});
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,6 +33,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
33
|
__setModuleDefault(result, mod);
|
|
23
34
|
return result;
|
|
24
35
|
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
25
47
|
var __read = (this && this.__read) || function (o, n) {
|
|
26
48
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
49
|
if (!m) return o;
|
|
@@ -44,7 +66,7 @@ var React = __importStar(require("react"));
|
|
|
44
66
|
var icon_1 = require("../icon");
|
|
45
67
|
var icon_button_1 = require("../icon-button");
|
|
46
68
|
exports.CopyButton = React.forwardRef(function (_a, ref) {
|
|
47
|
-
var onClick = _a.onClick;
|
|
69
|
+
var onClick = _a.onClick, label = _a.label, rootProps = __rest(_a, ["onClick", "label"]);
|
|
48
70
|
var _b = __read(React.useState(false), 2), pressed = _b[0], setPressed = _b[1];
|
|
49
71
|
React.useEffect(function () {
|
|
50
72
|
if (!pressed) {
|
|
@@ -63,7 +85,7 @@ exports.CopyButton = React.forwardRef(function (_a, ref) {
|
|
|
63
85
|
};
|
|
64
86
|
var handleClose = function () { return setPressed(false); };
|
|
65
87
|
// use title as the key to force a mount/unmount of the tooltip. This drives the feedback transition.
|
|
66
|
-
var title = pressed ? 'Copied!' :
|
|
67
|
-
return (React.createElement(icon_button_1.IconButton, { key: title, label: title, onTooltipClose: handleClose, ref: ref, tooltipPlacement: "top", onClick: handleClick },
|
|
88
|
+
var title = pressed ? 'Copied!' : label;
|
|
89
|
+
return (React.createElement(icon_button_1.IconButton, __assign({}, rootProps, { key: title, label: title, onTooltipClose: handleClose, ref: ref, tooltipPlacement: "top", onClick: handleClick }),
|
|
68
90
|
React.createElement(icon_1.CopyIcon, null)));
|
|
69
91
|
});
|
|
@@ -106,7 +106,7 @@ function DataTableRow(props) {
|
|
|
106
106
|
}
|
|
107
107
|
return hideHeader ? (React.createElement(table_1.TableCell, { width: column.width, key: colIndex, align: column.align, padding: column.padding }, content)) : (React.createElement(table_1.TableCell, { key: colIndex, align: column.align, padding: column.padding }, content));
|
|
108
108
|
}),
|
|
109
|
-
!!renderItemDetails && (React.createElement(table_1.TableCell, { padding: "checkbox", align: "right" }, !!detailsContent && (React.createElement(icon_button_1.IconButton, { onClick: function () { return setIsExpanded(!isExpanded); }, variant: "link", label: isExpanded ? '
|
|
109
|
+
!!renderItemDetails && (React.createElement(table_1.TableCell, { padding: "checkbox", align: "right" }, !!detailsContent && (React.createElement(icon_button_1.IconButton, { onClick: function () { return setIsExpanded(!isExpanded); }, variant: "link", label: isExpanded ? 'Collapse' : 'Expand' }, isExpanded ? React.createElement(icon_1.ChevronUpIcon, null) : React.createElement(icon_1.ChevronDownIcon, null)))))),
|
|
110
110
|
!!detailsContent && (React.createElement(Row, { ownerState: { expanded: true } },
|
|
111
111
|
React.createElement(table_1.TableCell, { padding: "none", colSpan: columns.length + 1 },
|
|
112
112
|
React.createElement(collapse_1.Collapse, { in: isExpanded, timeout: "auto", unmountOnExit: true },
|
|
@@ -20,6 +20,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
23
39
|
import * as React from 'react';
|
|
24
40
|
import { InputAdornment } from '../input';
|
|
25
41
|
import { styled } from '../styled';
|
|
@@ -39,10 +55,39 @@ var ColorPicker = styled('input', { name: colorTextFieldComponentName, slot: 'Co
|
|
|
39
55
|
'&:focus': __assign({ outline: 'none' }, theme.mixins.focusRing()),
|
|
40
56
|
});
|
|
41
57
|
});
|
|
58
|
+
var normalizeHex = function (hex) {
|
|
59
|
+
if (hex.length === 4 && /^#[0-9A-F]{3}$/i.test(hex)) {
|
|
60
|
+
return "#".concat(hex[1]).concat(hex[1]).concat(hex[2]).concat(hex[2]).concat(hex[3]).concat(hex[3]);
|
|
61
|
+
}
|
|
62
|
+
return hex;
|
|
63
|
+
};
|
|
42
64
|
export var ColorTextField = React.forwardRef(function (props, ref) {
|
|
43
|
-
var inputAdornmentProps = props.inputAdornmentProps, rootProps = __rest(props, ["inputAdornmentProps"]);
|
|
65
|
+
var inputAdornmentProps = props.inputAdornmentProps, value = props.value, defaultValue = props.defaultValue, placeholder = props.placeholder, rootProps = __rest(props, ["inputAdornmentProps", "value", "defaultValue", "placeholder"]);
|
|
66
|
+
var _a = __read(React.useState(normalizeHex(value || placeholder || defaultValue || '#000000')), 2), color = _a[0], setColor = _a[1];
|
|
67
|
+
var handleColorChange = function (event) {
|
|
68
|
+
var value = event.target.value;
|
|
69
|
+
if (value.length === 4 && /^#[0-9A-F]{3}$/i.test(value)) {
|
|
70
|
+
var normalizedValue = normalizeHex(value);
|
|
71
|
+
if (props.onChange) {
|
|
72
|
+
props.onChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), { value: normalizedValue }) }));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
if (props.onChange) {
|
|
77
|
+
props.onChange(event);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
React.useEffect(function () {
|
|
82
|
+
var newColor = value || placeholder || defaultValue || '#000000';
|
|
83
|
+
if (newColor) {
|
|
84
|
+
setColor(normalizeHex(newColor));
|
|
85
|
+
}
|
|
86
|
+
}, [value, defaultValue, placeholder]);
|
|
44
87
|
return (React.createElement(Root, __assign({ ref: ref }, rootProps, { InputProps: {
|
|
45
88
|
startAdornment: (React.createElement(InputAdornment, __assign({ position: "start" }, inputAdornmentProps),
|
|
46
|
-
React.createElement(ColorPicker, { id: props.id ? "".concat(props.id, "-color-input") : undefined, name: props.name, type: "color", disabled: props.disabled || props.readOnly, value:
|
|
89
|
+
React.createElement(ColorPicker, { id: props.id ? "".concat(props.id, "-color-input") : undefined, name: props.name, type: "color", disabled: props.disabled || props.readOnly, value: color, onChange: handleColorChange }))),
|
|
90
|
+
value: value,
|
|
91
|
+
placeholder: placeholder,
|
|
47
92
|
} })));
|
|
48
93
|
});
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
1
23
|
var __read = (this && this.__read) || function (o, n) {
|
|
2
24
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
25
|
if (!m) return o;
|
|
@@ -18,7 +40,7 @@ import * as React from 'react';
|
|
|
18
40
|
import { CopyIcon } from '../icon';
|
|
19
41
|
import { IconButton } from '../icon-button';
|
|
20
42
|
export var CopyButton = React.forwardRef(function (_a, ref) {
|
|
21
|
-
var onClick = _a.onClick;
|
|
43
|
+
var onClick = _a.onClick, label = _a.label, rootProps = __rest(_a, ["onClick", "label"]);
|
|
22
44
|
var _b = __read(React.useState(false), 2), pressed = _b[0], setPressed = _b[1];
|
|
23
45
|
React.useEffect(function () {
|
|
24
46
|
if (!pressed) {
|
|
@@ -37,7 +59,7 @@ export var CopyButton = React.forwardRef(function (_a, ref) {
|
|
|
37
59
|
};
|
|
38
60
|
var handleClose = function () { return setPressed(false); };
|
|
39
61
|
// use title as the key to force a mount/unmount of the tooltip. This drives the feedback transition.
|
|
40
|
-
var title = pressed ? 'Copied!' :
|
|
41
|
-
return (React.createElement(IconButton, { key: title, label: title, onTooltipClose: handleClose, ref: ref, tooltipPlacement: "top", onClick: handleClick },
|
|
62
|
+
var title = pressed ? 'Copied!' : label;
|
|
63
|
+
return (React.createElement(IconButton, __assign({}, rootProps, { key: title, label: title, onTooltipClose: handleClose, ref: ref, tooltipPlacement: "top", onClick: handleClick }),
|
|
42
64
|
React.createElement(CopyIcon, null)));
|
|
43
65
|
});
|
|
@@ -79,7 +79,7 @@ export function DataTableRow(props) {
|
|
|
79
79
|
}
|
|
80
80
|
return hideHeader ? (React.createElement(TableCell, { width: column.width, key: colIndex, align: column.align, padding: column.padding }, content)) : (React.createElement(TableCell, { key: colIndex, align: column.align, padding: column.padding }, content));
|
|
81
81
|
}),
|
|
82
|
-
!!renderItemDetails && (React.createElement(TableCell, { padding: "checkbox", align: "right" }, !!detailsContent && (React.createElement(IconButton, { onClick: function () { return setIsExpanded(!isExpanded); }, variant: "link", label: isExpanded ? '
|
|
82
|
+
!!renderItemDetails && (React.createElement(TableCell, { padding: "checkbox", align: "right" }, !!detailsContent && (React.createElement(IconButton, { onClick: function () { return setIsExpanded(!isExpanded); }, variant: "link", label: isExpanded ? 'Collapse' : 'Expand' }, isExpanded ? React.createElement(ChevronUpIcon, null) : React.createElement(ChevronDownIcon, null)))))),
|
|
83
83
|
!!detailsContent && (React.createElement(Row, { ownerState: { expanded: true } },
|
|
84
84
|
React.createElement(TableCell, { padding: "none", colSpan: columns.length + 1 },
|
|
85
85
|
React.createElement(Collapse, { in: isExpanded, timeout: "auto", unmountOnExit: true },
|
|
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
|
+
import { capitalize } from '@mui/material';
|
|
24
25
|
import MuiIconButton, { iconButtonClasses } from '@mui/material/IconButton';
|
|
25
26
|
import { styled } from '../styled';
|
|
26
27
|
import { useIconButtonContext } from './icon-button-context';
|
|
@@ -63,6 +64,7 @@ export var IconButton = React.forwardRef(function (props, ref) {
|
|
|
63
64
|
var iconButtonContext = useIconButtonContext();
|
|
64
65
|
var children = props.children, label = props.label, _a = props.color, color = _a === void 0 ? 'default' : _a, _b = props.variant, variant = _b === void 0 ? 'link' : _b, _c = props.size, size = _c === void 0 ? 'medium' : _c, disabled = props.disabled, edgeProp = props.edge, _d = props.shape, shape = _d === void 0 ? 'default' : _d, tooltipPlacement = props.tooltipPlacement, onTooltipClose = props.onTooltipClose, iconButtonProps = __rest(props, ["children", "label", "color", "variant", "size", "disabled", "edge", "shape", "tooltipPlacement", "onTooltipClose"]);
|
|
65
66
|
var edge = edgeProp != null ? edgeProp : iconButtonContext.edge;
|
|
66
|
-
var
|
|
67
|
-
|
|
67
|
+
var captizedLable = label ? capitalize(label) : null;
|
|
68
|
+
var button = (React.createElement(StyledIconButton, __assign({ color: color, ref: ref, edge: edge, disabled: disabled, size: size, variant: variant, ownerState: { shape: shape }, "aria-label": captizedLable }, iconButtonProps), children));
|
|
69
|
+
return (React.createElement(Root, { title: captizedLable, placement: tooltipPlacement, onClose: onTooltipClose }, disabled ? React.createElement(DisabledWrapper, null, button) : button));
|
|
68
70
|
});
|
|
@@ -47,6 +47,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.IconButton = exports.iconButtonClasses = exports.IconButtonComponentName = void 0;
|
|
49
49
|
var React = __importStar(require("react"));
|
|
50
|
+
var material_1 = require("@mui/material");
|
|
50
51
|
var IconButton_1 = __importStar(require("@mui/material/IconButton"));
|
|
51
52
|
Object.defineProperty(exports, "iconButtonClasses", { enumerable: true, get: function () { return IconButton_1.iconButtonClasses; } });
|
|
52
53
|
var styled_1 = require("../styled");
|
|
@@ -89,6 +90,7 @@ exports.IconButton = React.forwardRef(function (props, ref) {
|
|
|
89
90
|
var iconButtonContext = (0, icon_button_context_1.useIconButtonContext)();
|
|
90
91
|
var children = props.children, label = props.label, _a = props.color, color = _a === void 0 ? 'default' : _a, _b = props.variant, variant = _b === void 0 ? 'link' : _b, _c = props.size, size = _c === void 0 ? 'medium' : _c, disabled = props.disabled, edgeProp = props.edge, _d = props.shape, shape = _d === void 0 ? 'default' : _d, tooltipPlacement = props.tooltipPlacement, onTooltipClose = props.onTooltipClose, iconButtonProps = __rest(props, ["children", "label", "color", "variant", "size", "disabled", "edge", "shape", "tooltipPlacement", "onTooltipClose"]);
|
|
91
92
|
var edge = edgeProp != null ? edgeProp : iconButtonContext.edge;
|
|
92
|
-
var
|
|
93
|
-
|
|
93
|
+
var captizedLable = label ? (0, material_1.capitalize)(label) : null;
|
|
94
|
+
var button = (React.createElement(StyledIconButton, __assign({ color: color, ref: ref, edge: edge, disabled: disabled, size: size, variant: variant, ownerState: { shape: shape }, "aria-label": captizedLable }, iconButtonProps), children));
|
|
95
|
+
return (React.createElement(Root, { title: captizedLable, placement: tooltipPlacement, onClose: onTooltipClose }, disabled ? React.createElement(DisabledWrapper, null, button) : button));
|
|
94
96
|
});
|