@pingux/astro 1.2.0-alpha.2 → 1.2.0-alpha.6
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/lib/cjs/components/Button/Button.stories.js +43 -2
- package/lib/cjs/components/Button/Button.test.js +26 -0
- package/lib/cjs/components/CopyText/CopyButton.js +9 -2
- package/lib/cjs/components/HelpHint/HelpHint.js +24 -6
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +57 -0
- package/lib/cjs/components/HelpHint/HelpHint.test.js +80 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/cjs/components/NumberField/NumberField.js +3 -1
- package/lib/cjs/components/NumberField/NumberField.test.js +7 -0
- package/lib/cjs/components/TextField/TextField.stories.js +79 -2
- package/lib/cjs/styles/variants/buttons.js +60 -2
- package/lib/cjs/styles/variants/text.js +14 -0
- package/lib/components/Button/Button.stories.js +36 -0
- package/lib/components/Button/Button.test.js +20 -0
- package/lib/components/CopyText/CopyButton.js +7 -2
- package/lib/components/HelpHint/HelpHint.js +25 -5
- package/lib/components/HelpHint/HelpHint.stories.js +34 -0
- package/lib/components/HelpHint/HelpHint.test.js +58 -0
- package/lib/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/components/NumberField/NumberField.js +2 -1
- package/lib/components/NumberField/NumberField.test.js +7 -0
- package/lib/components/TextField/TextField.stories.js +72 -0
- package/lib/styles/variants/buttons.js +60 -2
- package/lib/styles/variants/text.js +14 -0
- package/package.json +1 -1
@@ -8,12 +8,18 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports.InlineButton = exports.TextButton = exports.TextIconButton = exports.Disabled = exports.Default = exports["default"] = void 0;
|
11
|
+
exports.ColorBlockButton = exports.InlineButton = exports.TextButton = exports.TextIconButton = exports.Disabled = exports.Default = exports["default"] = void 0;
|
12
|
+
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
|
+
|
15
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
12
16
|
|
13
17
|
var _react = _interopRequireDefault(require("react"));
|
14
18
|
|
15
19
|
var _AddCircleIcon = _interopRequireDefault(require("mdi-react/AddCircleIcon"));
|
16
20
|
|
21
|
+
var _CreateIcon = _interopRequireDefault(require("mdi-react/CreateIcon"));
|
22
|
+
|
17
23
|
var _Box = _interopRequireDefault(require("../Box"));
|
18
24
|
|
19
25
|
var _ = _interopRequireDefault(require("."));
|
@@ -56,6 +62,13 @@ var _default = {
|
|
56
62
|
type: 'text'
|
57
63
|
}
|
58
64
|
}
|
65
|
+
},
|
66
|
+
parameters: {
|
67
|
+
docs: {
|
68
|
+
source: {
|
69
|
+
type: 'code'
|
70
|
+
}
|
71
|
+
}
|
59
72
|
}
|
60
73
|
};
|
61
74
|
exports["default"] = _default;
|
@@ -110,4 +123,32 @@ var InlineButton = function InlineButton() {
|
|
110
123
|
}, "Inline");
|
111
124
|
};
|
112
125
|
|
113
|
-
exports.InlineButton = InlineButton;
|
126
|
+
exports.InlineButton = InlineButton;
|
127
|
+
|
128
|
+
var ColorBlockButton = function ColorBlockButton(args) {
|
129
|
+
// Change `isConfigured` property in storybook controls
|
130
|
+
var isConfigured = args.isConfigured,
|
131
|
+
props = (0, _objectWithoutProperties2["default"])(args, ["isConfigured"]);
|
132
|
+
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, props, {
|
133
|
+
variant: "colorBlock",
|
134
|
+
className: isConfigured ? 'is-configured' : ''
|
135
|
+
}), (0, _react2.jsx)(_Box["default"], null, (0, _react2.jsx)(_Text["default"], {
|
136
|
+
variant: "buttonTitle"
|
137
|
+
}, "Title"), (0, _react2.jsx)(_Text["default"], {
|
138
|
+
variant: "buttonSubtitle"
|
139
|
+
}, "Info")), (0, _react2.jsx)(_Icon["default"], {
|
140
|
+
icon: _CreateIcon["default"]
|
141
|
+
}));
|
142
|
+
};
|
143
|
+
|
144
|
+
exports.ColorBlockButton = ColorBlockButton;
|
145
|
+
ColorBlockButton.story = {
|
146
|
+
argTypes: {
|
147
|
+
isConfigured: {
|
148
|
+
control: {
|
149
|
+
type: 'boolean'
|
150
|
+
},
|
151
|
+
defaultValue: false
|
152
|
+
}
|
153
|
+
}
|
154
|
+
};
|
@@ -122,4 +122,30 @@ test('button renders children when not loading', function () {
|
|
122
122
|
expect(childWrapper).toBeInTheDocument();
|
123
123
|
expect(childWrapper).toBeVisible();
|
124
124
|
expect(_testWrapper.screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
125
|
+
});
|
126
|
+
test('color block button renders in default state', function () {
|
127
|
+
getComponent({
|
128
|
+
variant: 'colorBlock'
|
129
|
+
});
|
130
|
+
|
131
|
+
var button = _testWrapper.screen.getByRole('button');
|
132
|
+
|
133
|
+
expect(button).toBeInTheDocument();
|
134
|
+
expect(button).not.toHaveClass('is-configured');
|
135
|
+
|
136
|
+
_userEvent["default"].tab();
|
137
|
+
|
138
|
+
expect(button).toHaveClass('is-focused');
|
139
|
+
expect(button).toHaveFocus();
|
140
|
+
});
|
141
|
+
test('color block button renders in configured state', function () {
|
142
|
+
getComponent({
|
143
|
+
variant: 'colorBlock',
|
144
|
+
className: 'is-configured'
|
145
|
+
});
|
146
|
+
|
147
|
+
var button = _testWrapper.screen.getByRole('button');
|
148
|
+
|
149
|
+
expect(button).toBeInTheDocument();
|
150
|
+
expect(button).toHaveClass('is-configured');
|
125
151
|
});
|
@@ -18,6 +18,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
18
18
|
|
19
19
|
var _ContentCopyIcon = _interopRequireDefault(require("mdi-react/ContentCopyIcon"));
|
20
20
|
|
21
|
+
var _lodash = require("lodash");
|
22
|
+
|
23
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
24
|
+
|
21
25
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
22
26
|
|
23
27
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
@@ -29,10 +33,13 @@ var CopyButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
29
33
|
ref: ref,
|
30
34
|
"aria-label": "copy",
|
31
35
|
variant: "buttons.copy"
|
32
|
-
}, props), (0, _react2.jsx)(_Icon["default"], {
|
36
|
+
}, (0, _lodash.omit)(props, 'iconProps')), (0, _react2.jsx)(_Icon["default"], (0, _extends2["default"])({
|
33
37
|
icon: _ContentCopyIcon["default"],
|
34
38
|
size: 15
|
35
|
-
}));
|
39
|
+
}, props === null || props === void 0 ? void 0 : props.iconProps)));
|
36
40
|
});
|
41
|
+
CopyButton.propTypes = {
|
42
|
+
iconProps: _propTypes["default"].shape({})
|
43
|
+
};
|
37
44
|
var _default = CopyButton;
|
38
45
|
exports["default"] = _default;
|
@@ -18,8 +18,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-c
|
|
18
18
|
|
19
19
|
var _react = _interopRequireWildcard(require("react"));
|
20
20
|
|
21
|
-
var _HelpIcon = _interopRequireDefault(require("mdi-react/HelpIcon"));
|
22
|
-
|
23
21
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
24
22
|
|
25
23
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
@@ -30,20 +28,40 @@ var _Icon = _interopRequireDefault(require("../Icon"));
|
|
30
28
|
|
31
29
|
var _react2 = require("@emotion/react");
|
32
30
|
|
31
|
+
var HelpIcon = function HelpIcon() {
|
32
|
+
return (0, _react2.jsx)("svg", {
|
33
|
+
width: "7",
|
34
|
+
height: "9",
|
35
|
+
viewBox: "0 0 7 9",
|
36
|
+
fill: "none",
|
37
|
+
xmlns: "http://www.w3.org/2000/svg"
|
38
|
+
}, (0, _react2.jsx)("path", {
|
39
|
+
d: "M2.56685 7.306V9H4.29385V7.306H2.56685ZM0.795848 3.676H2.41285C2.41285 3.478 2.43485 3.29467 2.47885 3.126C2.52285 2.95 2.58885 2.79967 2.67685 2.675C2.77218 2.543 2.88951 2.44033 3.02885 2.367C3.17551 2.28633 3.34785 2.246 3.54585 2.246C3.83918 2.246 4.06651 2.32667 4.22785 2.488C4.39651 2.64933 4.48085 2.89867 4.48085 3.236C4.48818 3.434 4.45151 3.599 4.37085 3.731C4.29751 3.863 4.19851 3.984 4.07385 4.094C3.94918 4.204 3.81351 4.314 3.66685 4.424C3.52018 4.534 3.38085 4.666 3.24885 4.82C3.11685 4.96667 2.99951 5.14633 2.89685 5.359C2.80151 5.57167 2.74285 5.83567 2.72085 6.151V6.646H4.20585V6.228C4.23518 6.008 4.30485 5.82467 4.41485 5.678C4.53218 5.53133 4.66418 5.403 4.81085 5.293C4.95751 5.17567 5.11151 5.062 5.27285 4.952C5.44151 4.83467 5.59185 4.69533 5.72385 4.534C5.86318 4.37267 5.97685 4.17833 6.06485 3.951C6.16018 3.72367 6.20785 3.434 6.20785 3.082C6.20785 2.86933 6.16018 2.642 6.06485 2.4C5.97685 2.15067 5.82651 1.91967 5.61385 1.707C5.40118 1.49433 5.11885 1.31833 4.76685 1.179C4.42218 1.03233 3.98951 0.959 3.46885 0.959C3.06551 0.959 2.69885 1.02867 2.36885 1.168C2.04618 1.3 1.76751 1.487 1.53285 1.729C1.30551 1.971 1.12585 2.257 0.993848 2.587C0.869181 2.917 0.803181 3.28 0.795848 3.676Z",
|
40
|
+
fill: "#3B4A58"
|
41
|
+
}));
|
42
|
+
};
|
43
|
+
/**
|
44
|
+
* A `HelpHint` is a composed component using tooltip trigger and icon button.
|
45
|
+
*
|
46
|
+
* For customization the trigger icon,
|
47
|
+
* please see the [TooltipTrigger](./?path=/docs/tooltiptrigger--default) docs.
|
48
|
+
*/
|
49
|
+
|
50
|
+
|
33
51
|
var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
34
52
|
var children = props.children,
|
35
53
|
tooltipProps = props.tooltipProps,
|
36
54
|
iconButtonProps = props.iconButtonProps,
|
37
55
|
others = (0, _objectWithoutProperties2["default"])(props, ["children", "tooltipProps", "iconButtonProps"]);
|
38
56
|
return (0, _react2.jsx)(_TooltipTrigger["default"], (0, _extends2["default"])({
|
39
|
-
ref: ref
|
40
|
-
|
57
|
+
ref: ref,
|
58
|
+
direction: "top"
|
59
|
+
}, others, tooltipProps), (0, _react2.jsx)(_IconButton["default"], (0, _extends2["default"])({
|
41
60
|
variant: "helpHint",
|
42
61
|
"aria-label": "label help hint",
|
43
62
|
"data-testid": "help-hint__button"
|
44
63
|
}, iconButtonProps), (0, _react2.jsx)(_Icon["default"], {
|
45
|
-
icon:
|
46
|
-
size: "11px"
|
64
|
+
icon: HelpIcon
|
47
65
|
})), (0, _react2.jsx)(_TooltipTrigger.Tooltip, tooltipProps, children));
|
48
66
|
});
|
49
67
|
HelpHint.propTypes = {
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
|
11
|
+
exports.WithTooltipAndIconButtonProps = exports.Default = exports["default"] = void 0;
|
12
|
+
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
14
|
+
|
15
|
+
var _ = _interopRequireDefault(require("."));
|
16
|
+
|
17
|
+
var _Box = _interopRequireDefault(require("../Box"));
|
18
|
+
|
19
|
+
var _react2 = require("@emotion/react");
|
20
|
+
|
21
|
+
var _default = {
|
22
|
+
title: 'HelpHint',
|
23
|
+
component: _["default"],
|
24
|
+
argTypes: {
|
25
|
+
children: {
|
26
|
+
description: 'Tooltip content',
|
27
|
+
defaultValue: 'Text of the tooltip right here...',
|
28
|
+
control: {
|
29
|
+
type: 'text'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
};
|
34
|
+
exports["default"] = _default;
|
35
|
+
|
36
|
+
var Default = function Default(args) {
|
37
|
+
return (0, _react2.jsx)(_Box["default"], {
|
38
|
+
p: 50
|
39
|
+
}, (0, _react2.jsx)(_["default"], args));
|
40
|
+
};
|
41
|
+
|
42
|
+
exports.Default = Default;
|
43
|
+
|
44
|
+
var WithTooltipAndIconButtonProps = function WithTooltipAndIconButtonProps() {
|
45
|
+
return (0, _react2.jsx)(_Box["default"], {
|
46
|
+
p: 50
|
47
|
+
}, (0, _react2.jsx)(_["default"], {
|
48
|
+
tooltipProps: {
|
49
|
+
direction: 'bottom'
|
50
|
+
},
|
51
|
+
iconButtonProps: {
|
52
|
+
'aria-label': 'Help hint'
|
53
|
+
}
|
54
|
+
}, "Text of the tooltip right here..."));
|
55
|
+
};
|
56
|
+
|
57
|
+
exports.WithTooltipAndIconButtonProps = WithTooltipAndIconButtonProps;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
6
|
+
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
8
|
+
|
9
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
10
|
+
|
11
|
+
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
12
|
+
|
13
|
+
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
14
|
+
|
15
|
+
var _HelpHint = _interopRequireDefault(require("./HelpHint"));
|
16
|
+
|
17
|
+
var _react2 = require("@emotion/react");
|
18
|
+
|
19
|
+
var testId = 'help-hint__button';
|
20
|
+
var tooltipValue = 'Some text';
|
21
|
+
var defaultProps = {
|
22
|
+
children: tooltipValue
|
23
|
+
};
|
24
|
+
|
25
|
+
var getComponent = function getComponent() {
|
26
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
27
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_HelpHint["default"], (0, _extends2["default"])({}, defaultProps, props)));
|
28
|
+
}; // Need to be added to each test file to test accessibility using axe.
|
29
|
+
|
30
|
+
|
31
|
+
(0, _testAxe["default"])(getComponent);
|
32
|
+
test('renders HelpHint component', function () {
|
33
|
+
getComponent();
|
34
|
+
|
35
|
+
var helpHintButton = _testWrapper.screen.getByTestId(testId);
|
36
|
+
|
37
|
+
expect(helpHintButton).toBeInTheDocument();
|
38
|
+
});
|
39
|
+
test('shows tooltip on hover', function () {
|
40
|
+
getComponent();
|
41
|
+
|
42
|
+
var helpHintButton = _testWrapper.screen.getByTestId(testId);
|
43
|
+
|
44
|
+
expect(_testWrapper.screen.queryByText(tooltipValue)).not.toBeInTheDocument();
|
45
|
+
|
46
|
+
_testWrapper.fireEvent.mouseMove(helpHintButton);
|
47
|
+
|
48
|
+
_testWrapper.fireEvent.mouseEnter(helpHintButton);
|
49
|
+
|
50
|
+
expect(_testWrapper.screen.getByText(tooltipValue)).toBeInTheDocument();
|
51
|
+
});
|
52
|
+
test('shows tooltip on focus', function () {
|
53
|
+
getComponent();
|
54
|
+
|
55
|
+
var helpHintButton = _testWrapper.screen.getByTestId(testId);
|
56
|
+
|
57
|
+
expect(_testWrapper.screen.queryByText(tooltipValue)).not.toBeInTheDocument();
|
58
|
+
|
59
|
+
_userEvent["default"].tab();
|
60
|
+
|
61
|
+
expect(helpHintButton).toHaveFocus();
|
62
|
+
expect(_testWrapper.screen.queryByText(tooltipValue)).toBeInTheDocument();
|
63
|
+
});
|
64
|
+
test('applies tooltipProps', function () {
|
65
|
+
getComponent({
|
66
|
+
tooltipProps: {
|
67
|
+
isOpen: true
|
68
|
+
}
|
69
|
+
});
|
70
|
+
expect(_testWrapper.screen.getByText(tooltipValue)).toBeInTheDocument();
|
71
|
+
});
|
72
|
+
test('applies iconButtonProps', function () {
|
73
|
+
var newLabel = 'New label';
|
74
|
+
getComponent({
|
75
|
+
iconButtonProps: {
|
76
|
+
'aria-label': newLabel
|
77
|
+
}
|
78
|
+
});
|
79
|
+
expect(_testWrapper.screen.getByLabelText(newLabel)).toBeInTheDocument();
|
80
|
+
});
|
@@ -50,6 +50,8 @@ var _i18n = require("@react-aria/i18n");
|
|
50
50
|
|
51
51
|
var _utils = require("@react-aria/utils");
|
52
52
|
|
53
|
+
var _omit = _interopRequireDefault(require("lodash/omit"));
|
54
|
+
|
53
55
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
54
56
|
|
55
57
|
var _index = require("../../index");
|
@@ -130,7 +132,7 @@ var NumberField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
130
132
|
ref: inputRef // we don't want to merge this props, we want to
|
131
133
|
// overwrite them like defaultValue, value, ect.
|
132
134
|
|
133
|
-
}, fieldControlProps, inputProps)), ControlArrows), helperText && (0, _react2.jsx)(_index.FieldHelperText, {
|
135
|
+
}, fieldControlProps, (0, _omit["default"])(inputProps, 'name'))), ControlArrows), helperText && (0, _react2.jsx)(_index.FieldHelperText, {
|
134
136
|
status: status
|
135
137
|
}, helperText)));
|
136
138
|
});
|
@@ -169,4 +169,11 @@ test('increment and decrement buttons shouldn\'t be able to be focused via keybo
|
|
169
169
|
_userEvent["default"].tab();
|
170
170
|
|
171
171
|
expect(_testWrapper.screen.getByLabelText('arrow-down')).not.toHaveFocus();
|
172
|
+
});
|
173
|
+
test('number field input receiving name attribute', function () {
|
174
|
+
var testName = 'testName';
|
175
|
+
getComponent({
|
176
|
+
name: testName
|
177
|
+
});
|
178
|
+
expect(_testWrapper.screen.getByLabelText(testLabel)).toHaveAttribute('name', testName);
|
172
179
|
});
|
@@ -10,7 +10,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
11
11
|
});
|
12
12
|
|
13
|
-
exports.MaxLength = exports.WithoutStatusIndicator = exports.WithHelpHint = exports.Warning = exports.Success = exports.Error = exports.DynamicRequired = exports.Required = exports.ReadOnly = exports.Disabled = exports.Password = exports.Controlled = exports.LeftLabel = exports.FloatLabel = exports.SmallVariant = exports.Default = exports["default"] = void 0;
|
13
|
+
exports.WithSlots = exports.MaxLength = exports.WithoutStatusIndicator = exports.WithHelpHint = exports.Warning = exports.Success = exports.Error = exports.DynamicRequired = exports.Required = exports.ReadOnly = exports.Disabled = exports.Password = exports.Controlled = exports.LeftLabel = exports.FloatLabel = exports.SmallVariant = exports.Default = exports["default"] = void 0;
|
14
14
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
16
16
|
|
@@ -32,6 +32,10 @@ var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/s
|
|
32
32
|
|
33
33
|
var _Box = _interopRequireDefault(require("../Box"));
|
34
34
|
|
35
|
+
var _useCopyToClipboard = _interopRequireDefault(require("../../hooks/useCopyToClipboard"));
|
36
|
+
|
37
|
+
var _CopyButton = _interopRequireDefault(require("../CopyText/CopyButton"));
|
38
|
+
|
35
39
|
var _react2 = require("@emotion/react");
|
36
40
|
|
37
41
|
var _default = {
|
@@ -259,4 +263,77 @@ var MaxLength = function MaxLength() {
|
|
259
263
|
});
|
260
264
|
};
|
261
265
|
|
262
|
-
exports.MaxLength = MaxLength;
|
266
|
+
exports.MaxLength = MaxLength;
|
267
|
+
|
268
|
+
var WithSlots = function WithSlots() {
|
269
|
+
var _useState5 = (0, _react.useState)("[{ 'type': 'work', 'streetAddress': 'San Antonio MI 47096' },{ 'type': 'home', 'streetAddress': 'Santa Rosa MN 98804' }]"),
|
270
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
271
|
+
addressesValue = _useState6[0],
|
272
|
+
setAddressesValue = _useState6[1];
|
273
|
+
|
274
|
+
var _useState7 = (0, _react.useState)("[{ 'status': 'inactive', 'subject': 'example@pingidentity.com' },{ 'status': 'active', 'subject': 'john@pingidentity.com' }]"),
|
275
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
276
|
+
jsonValue = _useState8[0],
|
277
|
+
setJsonValue = _useState8[1];
|
278
|
+
|
279
|
+
var copyAddressesToClipboard = (0, _useCopyToClipboard["default"])(addressesValue);
|
280
|
+
var copyJsonToClipboard = (0, _useCopyToClipboard["default"])(jsonValue);
|
281
|
+
var buttonSx = {
|
282
|
+
position: 'absolute',
|
283
|
+
right: 0,
|
284
|
+
top: '5px'
|
285
|
+
};
|
286
|
+
var containerSx = {
|
287
|
+
sx: {
|
288
|
+
'& input': {
|
289
|
+
paddingRight: '40px'
|
290
|
+
}
|
291
|
+
}
|
292
|
+
};
|
293
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_["default"], {
|
294
|
+
label: "Multiple Addresses",
|
295
|
+
labelMode: "float",
|
296
|
+
onChange: function onChange(e) {
|
297
|
+
return setAddressesValue(e.target.value);
|
298
|
+
},
|
299
|
+
value: addressesValue,
|
300
|
+
containerProps: containerSx,
|
301
|
+
slots: {
|
302
|
+
inContainer: (0, _react2.jsx)(_CopyButton["default"], {
|
303
|
+
onPress: copyAddressesToClipboard,
|
304
|
+
sx: buttonSx,
|
305
|
+
iconProps: {
|
306
|
+
sx: {
|
307
|
+
path: {
|
308
|
+
fill: 'active'
|
309
|
+
}
|
310
|
+
}
|
311
|
+
}
|
312
|
+
})
|
313
|
+
},
|
314
|
+
mb: 30
|
315
|
+
}), (0, _react2.jsx)(_["default"], {
|
316
|
+
label: "Example JSON",
|
317
|
+
labelMode: "float",
|
318
|
+
onChange: function onChange(e) {
|
319
|
+
return setJsonValue(e.target.value);
|
320
|
+
},
|
321
|
+
value: jsonValue,
|
322
|
+
containerProps: containerSx,
|
323
|
+
slots: {
|
324
|
+
inContainer: (0, _react2.jsx)(_CopyButton["default"], {
|
325
|
+
onPress: copyJsonToClipboard,
|
326
|
+
sx: buttonSx,
|
327
|
+
iconProps: {
|
328
|
+
sx: {
|
329
|
+
path: {
|
330
|
+
fill: 'active'
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
334
|
+
})
|
335
|
+
}
|
336
|
+
}));
|
337
|
+
};
|
338
|
+
|
339
|
+
exports.WithSlots = WithSlots;
|
@@ -317,6 +317,11 @@ var helpHint = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
317
317
|
ml: '5px',
|
318
318
|
maxWidth: '13px',
|
319
319
|
maxHeight: '14px',
|
320
|
+
borderRadius: '5.5px',
|
321
|
+
'svg': {
|
322
|
+
'height': '100%',
|
323
|
+
mb: 0.75
|
324
|
+
},
|
320
325
|
'path': {
|
321
326
|
fill: 'neutral.20'
|
322
327
|
},
|
@@ -376,7 +381,7 @@ var chipDeleteButton = {
|
|
376
381
|
borderRadius: '50%',
|
377
382
|
cursor: 'pointer',
|
378
383
|
height: 14,
|
379
|
-
|
384
|
+
mx: '3px !important',
|
380
385
|
p: 0,
|
381
386
|
width: 14,
|
382
387
|
'&.is-focused, &.is-hovered': {
|
@@ -556,6 +561,58 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
|
556
561
|
}
|
557
562
|
});
|
558
563
|
|
564
|
+
var colorBlock = {
|
565
|
+
bg: 'neutral.95',
|
566
|
+
border: '1px solid',
|
567
|
+
borderColor: 'neutral.90',
|
568
|
+
borderRadius: 10,
|
569
|
+
outline: 'none',
|
570
|
+
cursor: 'pointer',
|
571
|
+
width: 150,
|
572
|
+
minHeight: 40,
|
573
|
+
p: '5px 15px',
|
574
|
+
display: 'flex',
|
575
|
+
justifyContent: 'space-between',
|
576
|
+
alignItems: 'center',
|
577
|
+
'&.is-hovered': {
|
578
|
+
bg: 'neutral.80'
|
579
|
+
},
|
580
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
581
|
+
'&.is-pressed': {
|
582
|
+
bg: 'neutral.60',
|
583
|
+
borderColor: 'neutral.60'
|
584
|
+
},
|
585
|
+
'& span': {
|
586
|
+
color: 'text.primary',
|
587
|
+
textAlign: 'left'
|
588
|
+
},
|
589
|
+
'&>div': {
|
590
|
+
alignItems: 'baseline'
|
591
|
+
},
|
592
|
+
'&>svg': {
|
593
|
+
color: 'text.secondary',
|
594
|
+
fill: 'text.secondary'
|
595
|
+
},
|
596
|
+
'&.is-configured': {
|
597
|
+
bg: 'active',
|
598
|
+
borderColor: 'active',
|
599
|
+
'& span': {
|
600
|
+
color: 'white'
|
601
|
+
},
|
602
|
+
'&>svg': {
|
603
|
+
color: 'white',
|
604
|
+
fill: 'white'
|
605
|
+
}
|
606
|
+
},
|
607
|
+
'&.is-configured.is-hovered': {
|
608
|
+
bg: 'accent.40',
|
609
|
+
borderColor: 'accent.40'
|
610
|
+
},
|
611
|
+
'&.is-configured.is-pressed': {
|
612
|
+
bg: 'accent.20',
|
613
|
+
borderColor: 'accent.20'
|
614
|
+
}
|
615
|
+
};
|
559
616
|
var _default = {
|
560
617
|
accordionHeader: accordionHeader,
|
561
618
|
chipDeleteButton: chipDeleteButton,
|
@@ -595,6 +652,7 @@ var _default = {
|
|
595
652
|
invertedSquare: invertedSquare,
|
596
653
|
tooltipChip: tooltipChip,
|
597
654
|
tooltipIconButton: tooltipIconButton,
|
598
|
-
tooltipInline: tooltipInline
|
655
|
+
tooltipInline: tooltipInline,
|
656
|
+
colorBlock: colorBlock
|
599
657
|
};
|
600
658
|
exports["default"] = _default;
|
@@ -178,6 +178,20 @@ var text = {
|
|
178
178
|
color: 'accent.30',
|
179
179
|
fontFamily: 'standard'
|
180
180
|
}),
|
181
|
+
buttonTitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
182
|
+
fontSize: 'xs',
|
183
|
+
fontWeight: 0,
|
184
|
+
color: 'text.primary',
|
185
|
+
fontFamily: 'standard',
|
186
|
+
lineHeight: '13px'
|
187
|
+
}),
|
188
|
+
buttonSubtitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
189
|
+
fontSize: 'sm',
|
190
|
+
fontWeight: 3,
|
191
|
+
color: 'text.primary',
|
192
|
+
fontFamily: 'standard',
|
193
|
+
lineHeight: '16px'
|
194
|
+
}),
|
181
195
|
capsLabel: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
182
196
|
color: 'text.secondary',
|
183
197
|
textTransform: 'uppercase',
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
1
3
|
import React from 'react';
|
2
4
|
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
5
|
+
import CreateIcon from 'mdi-react/CreateIcon';
|
3
6
|
import Box from '../Box';
|
4
7
|
import Button from '.';
|
5
8
|
import Icon from '../Icon';
|
@@ -36,6 +39,13 @@ export default {
|
|
36
39
|
type: 'text'
|
37
40
|
}
|
38
41
|
}
|
42
|
+
},
|
43
|
+
parameters: {
|
44
|
+
docs: {
|
45
|
+
source: {
|
46
|
+
type: 'code'
|
47
|
+
}
|
48
|
+
}
|
39
49
|
}
|
40
50
|
};
|
41
51
|
export var Default = function Default(args) {
|
@@ -74,4 +84,30 @@ export var InlineButton = function InlineButton() {
|
|
74
84
|
mb: "sm",
|
75
85
|
variant: "inline"
|
76
86
|
}, "Inline");
|
87
|
+
};
|
88
|
+
export var ColorBlockButton = function ColorBlockButton(args) {
|
89
|
+
// Change `isConfigured` property in storybook controls
|
90
|
+
var isConfigured = args.isConfigured,
|
91
|
+
props = _objectWithoutProperties(args, ["isConfigured"]);
|
92
|
+
|
93
|
+
return ___EmotionJSX(Button, _extends({}, props, {
|
94
|
+
variant: "colorBlock",
|
95
|
+
className: isConfigured ? 'is-configured' : ''
|
96
|
+
}), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
|
97
|
+
variant: "buttonTitle"
|
98
|
+
}, "Title"), ___EmotionJSX(Text, {
|
99
|
+
variant: "buttonSubtitle"
|
100
|
+
}, "Info")), ___EmotionJSX(Icon, {
|
101
|
+
icon: CreateIcon
|
102
|
+
}));
|
103
|
+
};
|
104
|
+
ColorBlockButton.story = {
|
105
|
+
argTypes: {
|
106
|
+
isConfigured: {
|
107
|
+
control: {
|
108
|
+
type: 'boolean'
|
109
|
+
},
|
110
|
+
defaultValue: false
|
111
|
+
}
|
112
|
+
}
|
77
113
|
};
|
@@ -89,4 +89,24 @@ test('button renders children when not loading', function () {
|
|
89
89
|
expect(childWrapper).toBeInTheDocument();
|
90
90
|
expect(childWrapper).toBeVisible();
|
91
91
|
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
92
|
+
});
|
93
|
+
test('color block button renders in default state', function () {
|
94
|
+
getComponent({
|
95
|
+
variant: 'colorBlock'
|
96
|
+
});
|
97
|
+
var button = screen.getByRole('button');
|
98
|
+
expect(button).toBeInTheDocument();
|
99
|
+
expect(button).not.toHaveClass('is-configured');
|
100
|
+
userEvent.tab();
|
101
|
+
expect(button).toHaveClass('is-focused');
|
102
|
+
expect(button).toHaveFocus();
|
103
|
+
});
|
104
|
+
test('color block button renders in configured state', function () {
|
105
|
+
getComponent({
|
106
|
+
variant: 'colorBlock',
|
107
|
+
className: 'is-configured'
|
108
|
+
});
|
109
|
+
var button = screen.getByRole('button');
|
110
|
+
expect(button).toBeInTheDocument();
|
111
|
+
expect(button).toHaveClass('is-configured');
|
92
112
|
});
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React, { forwardRef } from 'react';
|
3
3
|
import ContentCopy from 'mdi-react/ContentCopyIcon';
|
4
|
+
import { omit } from 'lodash';
|
5
|
+
import PropTypes from 'prop-types';
|
4
6
|
import Icon from '../Icon';
|
5
7
|
import IconButton from '../IconButton';
|
6
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -9,9 +11,12 @@ var CopyButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
9
11
|
ref: ref,
|
10
12
|
"aria-label": "copy",
|
11
13
|
variant: "buttons.copy"
|
12
|
-
}, props), ___EmotionJSX(Icon, {
|
14
|
+
}, omit(props, 'iconProps')), ___EmotionJSX(Icon, _extends({
|
13
15
|
icon: ContentCopy,
|
14
16
|
size: 15
|
15
|
-
}));
|
17
|
+
}, props === null || props === void 0 ? void 0 : props.iconProps)));
|
16
18
|
});
|
19
|
+
CopyButton.propTypes = {
|
20
|
+
iconProps: PropTypes.shape({})
|
21
|
+
};
|
17
22
|
export default CopyButton;
|
@@ -1,12 +1,32 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
3
|
import React, { forwardRef } from 'react';
|
4
|
-
import HelpIcon from 'mdi-react/HelpIcon';
|
5
4
|
import PropTypes from 'prop-types';
|
6
5
|
import IconButton from '../IconButton';
|
7
6
|
import TooltipTrigger, { Tooltip } from '../TooltipTrigger';
|
8
7
|
import Icon from '../Icon';
|
9
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
+
|
10
|
+
var HelpIcon = function HelpIcon() {
|
11
|
+
return ___EmotionJSX("svg", {
|
12
|
+
width: "7",
|
13
|
+
height: "9",
|
14
|
+
viewBox: "0 0 7 9",
|
15
|
+
fill: "none",
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
17
|
+
}, ___EmotionJSX("path", {
|
18
|
+
d: "M2.56685 7.306V9H4.29385V7.306H2.56685ZM0.795848 3.676H2.41285C2.41285 3.478 2.43485 3.29467 2.47885 3.126C2.52285 2.95 2.58885 2.79967 2.67685 2.675C2.77218 2.543 2.88951 2.44033 3.02885 2.367C3.17551 2.28633 3.34785 2.246 3.54585 2.246C3.83918 2.246 4.06651 2.32667 4.22785 2.488C4.39651 2.64933 4.48085 2.89867 4.48085 3.236C4.48818 3.434 4.45151 3.599 4.37085 3.731C4.29751 3.863 4.19851 3.984 4.07385 4.094C3.94918 4.204 3.81351 4.314 3.66685 4.424C3.52018 4.534 3.38085 4.666 3.24885 4.82C3.11685 4.96667 2.99951 5.14633 2.89685 5.359C2.80151 5.57167 2.74285 5.83567 2.72085 6.151V6.646H4.20585V6.228C4.23518 6.008 4.30485 5.82467 4.41485 5.678C4.53218 5.53133 4.66418 5.403 4.81085 5.293C4.95751 5.17567 5.11151 5.062 5.27285 4.952C5.44151 4.83467 5.59185 4.69533 5.72385 4.534C5.86318 4.37267 5.97685 4.17833 6.06485 3.951C6.16018 3.72367 6.20785 3.434 6.20785 3.082C6.20785 2.86933 6.16018 2.642 6.06485 2.4C5.97685 2.15067 5.82651 1.91967 5.61385 1.707C5.40118 1.49433 5.11885 1.31833 4.76685 1.179C4.42218 1.03233 3.98951 0.959 3.46885 0.959C3.06551 0.959 2.69885 1.02867 2.36885 1.168C2.04618 1.3 1.76751 1.487 1.53285 1.729C1.30551 1.971 1.12585 2.257 0.993848 2.587C0.869181 2.917 0.803181 3.28 0.795848 3.676Z",
|
19
|
+
fill: "#3B4A58"
|
20
|
+
}));
|
21
|
+
};
|
22
|
+
/**
|
23
|
+
* A `HelpHint` is a composed component using tooltip trigger and icon button.
|
24
|
+
*
|
25
|
+
* For customization the trigger icon,
|
26
|
+
* please see the [TooltipTrigger](./?path=/docs/tooltiptrigger--default) docs.
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
10
30
|
var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
11
31
|
var children = props.children,
|
12
32
|
tooltipProps = props.tooltipProps,
|
@@ -14,14 +34,14 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
14
34
|
others = _objectWithoutProperties(props, ["children", "tooltipProps", "iconButtonProps"]);
|
15
35
|
|
16
36
|
return ___EmotionJSX(TooltipTrigger, _extends({
|
17
|
-
ref: ref
|
18
|
-
|
37
|
+
ref: ref,
|
38
|
+
direction: "top"
|
39
|
+
}, others, tooltipProps), ___EmotionJSX(IconButton, _extends({
|
19
40
|
variant: "helpHint",
|
20
41
|
"aria-label": "label help hint",
|
21
42
|
"data-testid": "help-hint__button"
|
22
43
|
}, iconButtonProps), ___EmotionJSX(Icon, {
|
23
|
-
icon: HelpIcon
|
24
|
-
size: "11px"
|
44
|
+
icon: HelpIcon
|
25
45
|
})), ___EmotionJSX(Tooltip, tooltipProps, children));
|
26
46
|
});
|
27
47
|
HelpHint.propTypes = {
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import HelpHint from '.';
|
3
|
+
import Box from '../Box';
|
4
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
|
+
export default {
|
6
|
+
title: 'HelpHint',
|
7
|
+
component: HelpHint,
|
8
|
+
argTypes: {
|
9
|
+
children: {
|
10
|
+
description: 'Tooltip content',
|
11
|
+
defaultValue: 'Text of the tooltip right here...',
|
12
|
+
control: {
|
13
|
+
type: 'text'
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
};
|
18
|
+
export var Default = function Default(args) {
|
19
|
+
return ___EmotionJSX(Box, {
|
20
|
+
p: 50
|
21
|
+
}, ___EmotionJSX(HelpHint, args));
|
22
|
+
};
|
23
|
+
export var WithTooltipAndIconButtonProps = function WithTooltipAndIconButtonProps() {
|
24
|
+
return ___EmotionJSX(Box, {
|
25
|
+
p: 50
|
26
|
+
}, ___EmotionJSX(HelpHint, {
|
27
|
+
tooltipProps: {
|
28
|
+
direction: 'bottom'
|
29
|
+
},
|
30
|
+
iconButtonProps: {
|
31
|
+
'aria-label': 'Help hint'
|
32
|
+
}
|
33
|
+
}, "Text of the tooltip right here..."));
|
34
|
+
};
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import React from 'react';
|
3
|
+
import userEvent from '@testing-library/user-event';
|
4
|
+
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
5
|
+
import axeTest from '../../utils/testUtils/testAxe';
|
6
|
+
import HelpHint from './HelpHint';
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
+
var testId = 'help-hint__button';
|
9
|
+
var tooltipValue = 'Some text';
|
10
|
+
var defaultProps = {
|
11
|
+
children: tooltipValue
|
12
|
+
};
|
13
|
+
|
14
|
+
var getComponent = function getComponent() {
|
15
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
16
|
+
return render(___EmotionJSX(HelpHint, _extends({}, defaultProps, props)));
|
17
|
+
}; // Need to be added to each test file to test accessibility using axe.
|
18
|
+
|
19
|
+
|
20
|
+
axeTest(getComponent);
|
21
|
+
test('renders HelpHint component', function () {
|
22
|
+
getComponent();
|
23
|
+
var helpHintButton = screen.getByTestId(testId);
|
24
|
+
expect(helpHintButton).toBeInTheDocument();
|
25
|
+
});
|
26
|
+
test('shows tooltip on hover', function () {
|
27
|
+
getComponent();
|
28
|
+
var helpHintButton = screen.getByTestId(testId);
|
29
|
+
expect(screen.queryByText(tooltipValue)).not.toBeInTheDocument();
|
30
|
+
fireEvent.mouseMove(helpHintButton);
|
31
|
+
fireEvent.mouseEnter(helpHintButton);
|
32
|
+
expect(screen.getByText(tooltipValue)).toBeInTheDocument();
|
33
|
+
});
|
34
|
+
test('shows tooltip on focus', function () {
|
35
|
+
getComponent();
|
36
|
+
var helpHintButton = screen.getByTestId(testId);
|
37
|
+
expect(screen.queryByText(tooltipValue)).not.toBeInTheDocument();
|
38
|
+
userEvent.tab();
|
39
|
+
expect(helpHintButton).toHaveFocus();
|
40
|
+
expect(screen.queryByText(tooltipValue)).toBeInTheDocument();
|
41
|
+
});
|
42
|
+
test('applies tooltipProps', function () {
|
43
|
+
getComponent({
|
44
|
+
tooltipProps: {
|
45
|
+
isOpen: true
|
46
|
+
}
|
47
|
+
});
|
48
|
+
expect(screen.getByText(tooltipValue)).toBeInTheDocument();
|
49
|
+
});
|
50
|
+
test('applies iconButtonProps', function () {
|
51
|
+
var newLabel = 'New label';
|
52
|
+
getComponent({
|
53
|
+
iconButtonProps: {
|
54
|
+
'aria-label': newLabel
|
55
|
+
}
|
56
|
+
});
|
57
|
+
expect(screen.getByLabelText(newLabel)).toBeInTheDocument();
|
58
|
+
});
|
@@ -22,6 +22,7 @@ import { useNumberField } from '@react-aria/numberfield';
|
|
22
22
|
import { useNumberFieldState } from '@react-stately/numberfield';
|
23
23
|
import { useLocale } from '@react-aria/i18n';
|
24
24
|
import { mergeProps } from '@react-aria/utils';
|
25
|
+
import omit from 'lodash/omit';
|
25
26
|
import statuses from '../../utils/devUtils/constants/statuses';
|
26
27
|
import { Box, FieldHelperText, Icon, IconButton, Input, Label } from '../../index';
|
27
28
|
import { useField, usePropWarning } from '../../hooks';
|
@@ -94,7 +95,7 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
95
|
ref: inputRef // we don't want to merge this props, we want to
|
95
96
|
// overwrite them like defaultValue, value, ect.
|
96
97
|
|
97
|
-
}, fieldControlProps, inputProps)), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
|
98
|
+
}, fieldControlProps, omit(inputProps, 'name'))), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
|
98
99
|
status: status
|
99
100
|
}, helperText)));
|
100
101
|
});
|
@@ -128,4 +128,11 @@ test('increment and decrement buttons shouldn\'t be able to be focused via keybo
|
|
128
128
|
expect(screen.getByLabelText('arrow-up')).not.toHaveFocus();
|
129
129
|
userEvent.tab();
|
130
130
|
expect(screen.getByLabelText('arrow-down')).not.toHaveFocus();
|
131
|
+
});
|
132
|
+
test('number field input receiving name attribute', function () {
|
133
|
+
var testName = 'testName';
|
134
|
+
getComponent({
|
135
|
+
name: testName
|
136
|
+
});
|
137
|
+
expect(screen.getByLabelText(testLabel)).toHaveAttribute('name', testName);
|
131
138
|
});
|
@@ -8,6 +8,8 @@ import TextField from '.';
|
|
8
8
|
import { modes as labelModes } from '../Label/constants';
|
9
9
|
import statuses from '../../utils/devUtils/constants/statuses.js';
|
10
10
|
import Box from '../Box';
|
11
|
+
import useCopyToClipboard from '../../hooks/useCopyToClipboard';
|
12
|
+
import CopyButton from '../CopyText/CopyButton';
|
11
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
14
|
export default {
|
13
15
|
title: 'Form/TextField',
|
@@ -186,4 +188,74 @@ export var MaxLength = function MaxLength() {
|
|
186
188
|
label: "Example label",
|
187
189
|
maxLength: 9
|
188
190
|
});
|
191
|
+
};
|
192
|
+
export var WithSlots = function WithSlots() {
|
193
|
+
var _useState5 = useState("[{ 'type': 'work', 'streetAddress': 'San Antonio MI 47096' },{ 'type': 'home', 'streetAddress': 'Santa Rosa MN 98804' }]"),
|
194
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
195
|
+
addressesValue = _useState6[0],
|
196
|
+
setAddressesValue = _useState6[1];
|
197
|
+
|
198
|
+
var _useState7 = useState("[{ 'status': 'inactive', 'subject': 'example@pingidentity.com' },{ 'status': 'active', 'subject': 'john@pingidentity.com' }]"),
|
199
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
200
|
+
jsonValue = _useState8[0],
|
201
|
+
setJsonValue = _useState8[1];
|
202
|
+
|
203
|
+
var copyAddressesToClipboard = useCopyToClipboard(addressesValue);
|
204
|
+
var copyJsonToClipboard = useCopyToClipboard(jsonValue);
|
205
|
+
var buttonSx = {
|
206
|
+
position: 'absolute',
|
207
|
+
right: 0,
|
208
|
+
top: '5px'
|
209
|
+
};
|
210
|
+
var containerSx = {
|
211
|
+
sx: {
|
212
|
+
'& input': {
|
213
|
+
paddingRight: '40px'
|
214
|
+
}
|
215
|
+
}
|
216
|
+
};
|
217
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(TextField, {
|
218
|
+
label: "Multiple Addresses",
|
219
|
+
labelMode: "float",
|
220
|
+
onChange: function onChange(e) {
|
221
|
+
return setAddressesValue(e.target.value);
|
222
|
+
},
|
223
|
+
value: addressesValue,
|
224
|
+
containerProps: containerSx,
|
225
|
+
slots: {
|
226
|
+
inContainer: ___EmotionJSX(CopyButton, {
|
227
|
+
onPress: copyAddressesToClipboard,
|
228
|
+
sx: buttonSx,
|
229
|
+
iconProps: {
|
230
|
+
sx: {
|
231
|
+
path: {
|
232
|
+
fill: 'active'
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
})
|
237
|
+
},
|
238
|
+
mb: 30
|
239
|
+
}), ___EmotionJSX(TextField, {
|
240
|
+
label: "Example JSON",
|
241
|
+
labelMode: "float",
|
242
|
+
onChange: function onChange(e) {
|
243
|
+
return setJsonValue(e.target.value);
|
244
|
+
},
|
245
|
+
value: jsonValue,
|
246
|
+
containerProps: containerSx,
|
247
|
+
slots: {
|
248
|
+
inContainer: ___EmotionJSX(CopyButton, {
|
249
|
+
onPress: copyJsonToClipboard,
|
250
|
+
sx: buttonSx,
|
251
|
+
iconProps: {
|
252
|
+
sx: {
|
253
|
+
path: {
|
254
|
+
fill: 'active'
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
})
|
259
|
+
}
|
260
|
+
}));
|
189
261
|
};
|
@@ -295,6 +295,11 @@ var helpHint = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
295
295
|
ml: '5px',
|
296
296
|
maxWidth: '13px',
|
297
297
|
maxHeight: '14px',
|
298
|
+
borderRadius: '5.5px',
|
299
|
+
'svg': {
|
300
|
+
'height': '100%',
|
301
|
+
mb: 0.75
|
302
|
+
},
|
298
303
|
'path': {
|
299
304
|
fill: 'neutral.20'
|
300
305
|
},
|
@@ -354,7 +359,7 @@ var chipDeleteButton = {
|
|
354
359
|
borderRadius: '50%',
|
355
360
|
cursor: 'pointer',
|
356
361
|
height: 14,
|
357
|
-
|
362
|
+
mx: '3px !important',
|
358
363
|
p: 0,
|
359
364
|
width: 14,
|
360
365
|
'&.is-focused, &.is-hovered': {
|
@@ -534,6 +539,58 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
|
534
539
|
}
|
535
540
|
});
|
536
541
|
|
542
|
+
var colorBlock = {
|
543
|
+
bg: 'neutral.95',
|
544
|
+
border: '1px solid',
|
545
|
+
borderColor: 'neutral.90',
|
546
|
+
borderRadius: 10,
|
547
|
+
outline: 'none',
|
548
|
+
cursor: 'pointer',
|
549
|
+
width: 150,
|
550
|
+
minHeight: 40,
|
551
|
+
p: '5px 15px',
|
552
|
+
display: 'flex',
|
553
|
+
justifyContent: 'space-between',
|
554
|
+
alignItems: 'center',
|
555
|
+
'&.is-hovered': {
|
556
|
+
bg: 'neutral.80'
|
557
|
+
},
|
558
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
559
|
+
'&.is-pressed': {
|
560
|
+
bg: 'neutral.60',
|
561
|
+
borderColor: 'neutral.60'
|
562
|
+
},
|
563
|
+
'& span': {
|
564
|
+
color: 'text.primary',
|
565
|
+
textAlign: 'left'
|
566
|
+
},
|
567
|
+
'&>div': {
|
568
|
+
alignItems: 'baseline'
|
569
|
+
},
|
570
|
+
'&>svg': {
|
571
|
+
color: 'text.secondary',
|
572
|
+
fill: 'text.secondary'
|
573
|
+
},
|
574
|
+
'&.is-configured': {
|
575
|
+
bg: 'active',
|
576
|
+
borderColor: 'active',
|
577
|
+
'& span': {
|
578
|
+
color: 'white'
|
579
|
+
},
|
580
|
+
'&>svg': {
|
581
|
+
color: 'white',
|
582
|
+
fill: 'white'
|
583
|
+
}
|
584
|
+
},
|
585
|
+
'&.is-configured.is-hovered': {
|
586
|
+
bg: 'accent.40',
|
587
|
+
borderColor: 'accent.40'
|
588
|
+
},
|
589
|
+
'&.is-configured.is-pressed': {
|
590
|
+
bg: 'accent.20',
|
591
|
+
borderColor: 'accent.20'
|
592
|
+
}
|
593
|
+
};
|
537
594
|
export default {
|
538
595
|
accordionHeader: accordionHeader,
|
539
596
|
chipDeleteButton: chipDeleteButton,
|
@@ -573,5 +630,6 @@ export default {
|
|
573
630
|
invertedSquare: invertedSquare,
|
574
631
|
tooltipChip: tooltipChip,
|
575
632
|
tooltipIconButton: tooltipIconButton,
|
576
|
-
tooltipInline: tooltipInline
|
633
|
+
tooltipInline: tooltipInline,
|
634
|
+
colorBlock: colorBlock
|
577
635
|
};
|
@@ -158,6 +158,20 @@ export var text = {
|
|
158
158
|
color: 'accent.30',
|
159
159
|
fontFamily: 'standard'
|
160
160
|
}),
|
161
|
+
buttonTitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
162
|
+
fontSize: 'xs',
|
163
|
+
fontWeight: 0,
|
164
|
+
color: 'text.primary',
|
165
|
+
fontFamily: 'standard',
|
166
|
+
lineHeight: '13px'
|
167
|
+
}),
|
168
|
+
buttonSubtitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
169
|
+
fontSize: 'sm',
|
170
|
+
fontWeight: 3,
|
171
|
+
color: 'text.primary',
|
172
|
+
fontFamily: 'standard',
|
173
|
+
lineHeight: '16px'
|
174
|
+
}),
|
161
175
|
capsLabel: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
162
176
|
color: 'text.secondary',
|
163
177
|
textTransform: 'uppercase',
|