@dhis2-ui/button 9.11.0 → 9.11.1-beta.2
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/build/cjs/button/__tests__/Button.test.js +1 -8
- package/build/cjs/button/button.e2e.stories.js +34 -0
- package/build/cjs/button/button.js +8 -47
- package/build/cjs/button/{button.stories.js → button.prod.stories.js} +36 -59
- package/build/cjs/button/button.styles.js +2 -5
- package/build/cjs/button/features/can_be_blurred/index.js +1 -2
- package/build/cjs/button/features/can_be_clicked/index.js +1 -2
- package/build/cjs/button/features/can_be_focused/index.js +1 -2
- package/build/cjs/button/index.js +0 -1
- package/build/cjs/button-strip/button-strip.e2e.stories.js +15 -0
- package/build/cjs/button-strip/button-strip.js +4 -17
- package/build/cjs/button-strip/{button-strip.stories.js → button-strip.prod.stories.js} +13 -21
- package/build/cjs/button-strip/features/accepts_children/index.js +0 -1
- package/build/cjs/button-strip/index.js +0 -1
- package/build/cjs/dropdown-button/__tests__/dropdown-button.test.js +1 -23
- package/build/cjs/dropdown-button/dropdown-button.e2e.stories.js +60 -0
- package/build/cjs/dropdown-button/dropdown-button.js +11 -48
- package/build/cjs/dropdown-button/{dropdown-button.stories.js → dropdown-button.prod.stories.js} +36 -60
- package/build/cjs/dropdown-button/features/accepts_children/index.js +0 -1
- package/build/cjs/dropdown-button/features/accepts_component/index.js +0 -1
- package/build/cjs/dropdown-button/features/accepts_icon/index.js +0 -1
- package/build/cjs/dropdown-button/features/accepts_initial_focus/index.js +1 -2
- package/build/cjs/dropdown-button/features/button_is_clickable/index.js +1 -2
- package/build/cjs/dropdown-button/features/can_be_disabled/index.js +1 -2
- package/build/cjs/dropdown-button/features/common/index.js +0 -1
- package/build/cjs/dropdown-button/features/opens_a_dropdown/index.js +0 -1
- package/build/cjs/dropdown-button/index.js +0 -1
- package/build/cjs/index.js +0 -4
- package/build/cjs/locales/index.js +3 -9
- package/build/cjs/split-button/features/accepts_children/index.js +0 -1
- package/build/cjs/split-button/features/accepts_icon/index.js +0 -1
- package/build/cjs/split-button/features/accepts_initial_focus/index.js +1 -2
- package/build/cjs/split-button/features/arrow_opens_menu/index.js +0 -1
- package/build/cjs/split-button/features/button_is_clickable/index.js +1 -2
- package/build/cjs/split-button/features/can_be_disabled/index.js +0 -1
- package/build/cjs/split-button/features/common/index.js +0 -1
- package/build/cjs/split-button/index.js +0 -1
- package/build/cjs/split-button/split-button.e2e.stories.js +53 -0
- package/build/cjs/split-button/split-button.js +13 -48
- package/build/cjs/split-button/{split-button.stories.js → split-button.prod.stories.js} +30 -42
- package/build/cjs/split-button/split-button.test.js +5 -22
- package/build/es/button/{button.stories.e2e.js → button.e2e.stories.js} +9 -5
- package/build/es/button/button.js +5 -33
- package/build/es/button/{button.stories.js → button.prod.stories.js} +23 -16
- package/build/es/button/button.styles.js +1 -1
- package/build/es/button/features/can_be_blurred/index.js +1 -1
- package/build/es/button/features/can_be_clicked/index.js +1 -1
- package/build/es/button/features/can_be_focused/index.js +1 -1
- package/build/es/button-strip/button-strip.e2e.stories.js +7 -0
- package/build/es/button-strip/button-strip.js +1 -5
- package/build/es/button-strip/{button-strip.stories.js → button-strip.prod.stories.js} +10 -4
- package/build/es/dropdown-button/{dropdown-button.stories.e2e.js → dropdown-button.e2e.stories.js} +17 -9
- package/build/es/dropdown-button/dropdown-button.js +8 -35
- package/build/es/dropdown-button/{dropdown-button.stories.js → dropdown-button.prod.stories.js} +21 -20
- package/build/es/dropdown-button/features/accepts_initial_focus/index.js +1 -1
- package/build/es/dropdown-button/features/button_is_clickable/index.js +1 -1
- package/build/es/dropdown-button/features/can_be_disabled/index.js +1 -1
- package/build/es/split-button/features/accepts_initial_focus/index.js +1 -1
- package/build/es/split-button/features/button_is_clickable/index.js +1 -1
- package/build/es/split-button/{split-button.stories.e2e.js → split-button.e2e.stories.js} +15 -8
- package/build/es/split-button/split-button.js +10 -32
- package/build/es/split-button/{split-button.stories.js → split-button.prod.stories.js} +19 -13
- package/build/es/split-button/split-button.test.js +4 -2
- package/package.json +9 -9
- package/build/cjs/button/button.stories.e2e.js +0 -27
- package/build/cjs/button-strip/button-strip.stories.e2e.js +0 -13
- package/build/cjs/dropdown-button/dropdown-button.stories.e2e.js +0 -45
- package/build/cjs/split-button/split-button.stories.e2e.js +0 -40
- package/build/es/button-strip/button-strip.stories.e2e.js +0 -5
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
|
-
|
|
5
4
|
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
5
|
var _react2 = _interopRequireDefault(require("react"));
|
|
8
|
-
|
|
9
6
|
var _button = require("../button.js");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
8
|
describe('<Button>', () => {
|
|
14
9
|
let consoleSpy;
|
|
15
10
|
beforeEach(() => {
|
|
@@ -94,13 +89,11 @@ describe('<Button>', () => {
|
|
|
94
89
|
value: "button-value",
|
|
95
90
|
onKeyDown: onKeyDown
|
|
96
91
|
}, "btn"));
|
|
97
|
-
|
|
98
92
|
_react.fireEvent.keyDown(_react.screen.getByRole('button'), {
|
|
99
93
|
key: 'Enter',
|
|
100
94
|
code: 'Enter',
|
|
101
95
|
charCode: 13
|
|
102
96
|
});
|
|
103
|
-
|
|
104
97
|
expect(onKeyDown).toHaveBeenCalledWith({
|
|
105
98
|
name: 'button-name',
|
|
106
99
|
value: 'button-value'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithOnFocus = exports.WithOnClick = exports.WithInitialFocusAndOnBlur = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _button = require("./button.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
window.onClick = window.Cypress && window.Cypress.cy.stub();
|
|
11
|
+
window.onBlur = window.Cypress && window.Cypress.cy.stub();
|
|
12
|
+
window.onFocus = window.Cypress && window.Cypress.cy.stub();
|
|
13
|
+
var _default = exports.default = {
|
|
14
|
+
title: 'Button'
|
|
15
|
+
};
|
|
16
|
+
const WithOnClick = () => /*#__PURE__*/_react.default.createElement(_button.Button, {
|
|
17
|
+
name: "Button",
|
|
18
|
+
value: "default",
|
|
19
|
+
onClick: window.onClick
|
|
20
|
+
}, "Label me!");
|
|
21
|
+
exports.WithOnClick = WithOnClick;
|
|
22
|
+
const WithInitialFocusAndOnBlur = () => /*#__PURE__*/_react.default.createElement(_button.Button, {
|
|
23
|
+
name: "Button",
|
|
24
|
+
value: "default",
|
|
25
|
+
initialFocus: true,
|
|
26
|
+
onBlur: window.onBlur
|
|
27
|
+
}, "Label me!");
|
|
28
|
+
exports.WithInitialFocusAndOnBlur = WithInitialFocusAndOnBlur;
|
|
29
|
+
const WithOnFocus = () => /*#__PURE__*/_react.default.createElement(_button.Button, {
|
|
30
|
+
name: "Button",
|
|
31
|
+
value: "default",
|
|
32
|
+
onFocus: window.onFocus
|
|
33
|
+
}, "Label me!");
|
|
34
|
+
exports.WithOnFocus = WithOnFocus;
|
|
@@ -4,29 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Button = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
|
-
var _loader = require("@dhis2-ui/loader");
|
|
11
|
-
|
|
12
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
13
|
-
|
|
9
|
+
var _loader = require("@dhis2-ui/loader");
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _buttonStyles = _interopRequireDefault(require("./button.styles.js"));
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
|
-
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
30
18
|
const Button = _ref => {
|
|
31
19
|
let {
|
|
32
20
|
children,
|
|
@@ -62,31 +50,25 @@ const Button = _ref => {
|
|
|
62
50
|
'aria-label': ariaLabel,
|
|
63
51
|
title
|
|
64
52
|
} = otherProps;
|
|
65
|
-
|
|
66
53
|
if (!children && !title && !ariaLabel) {
|
|
67
54
|
console.debug('Button component has no children but is missing title and ariaLabel attribute.');
|
|
68
55
|
}
|
|
69
|
-
|
|
70
56
|
const handleClick = event => onClick && onClick({
|
|
71
57
|
value,
|
|
72
58
|
name
|
|
73
59
|
}, event);
|
|
74
|
-
|
|
75
60
|
const handleBlur = event => onBlur && onBlur({
|
|
76
61
|
value,
|
|
77
62
|
name
|
|
78
63
|
}, event);
|
|
79
|
-
|
|
80
64
|
const handleFocus = event => onFocus && onFocus({
|
|
81
65
|
value,
|
|
82
66
|
name
|
|
83
67
|
}, event);
|
|
84
|
-
|
|
85
68
|
const handleKeyDown = event => onKeyDown && onKeyDown({
|
|
86
69
|
value,
|
|
87
70
|
name
|
|
88
71
|
}, event);
|
|
89
|
-
|
|
90
72
|
const iconOnly = icon && !children;
|
|
91
73
|
const buttonClassName = (0, _classnames.default)(className, {
|
|
92
74
|
primary,
|
|
@@ -110,21 +92,20 @@ const Button = _ref => {
|
|
|
110
92
|
onFocus: handleFocus,
|
|
111
93
|
onKeyDown: handleKeyDown
|
|
112
94
|
}, otherProps, {
|
|
113
|
-
className:
|
|
95
|
+
className: `jsx-${_buttonStyles.default.__hash}` + " " + (otherProps && otherProps.className != null && otherProps.className || buttonClassName || "")
|
|
114
96
|
}), loading && /*#__PURE__*/_react.default.createElement("span", {
|
|
115
|
-
className:
|
|
97
|
+
className: `jsx-${_buttonStyles.default.__hash}` + " " + "loader"
|
|
116
98
|
}, destructive || primary ? /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, {
|
|
117
99
|
extrasmall: true,
|
|
118
100
|
invert: true
|
|
119
101
|
}) : /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, {
|
|
120
102
|
extrasmall: true
|
|
121
103
|
})), icon && /*#__PURE__*/_react.default.createElement("span", {
|
|
122
|
-
className:
|
|
104
|
+
className: `jsx-${_buttonStyles.default.__hash}` + " " + "button-icon"
|
|
123
105
|
}, icon), children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
124
106
|
id: _buttonStyles.default.__hash
|
|
125
107
|
}, _buttonStyles.default));
|
|
126
108
|
};
|
|
127
|
-
|
|
128
109
|
exports.Button = Button;
|
|
129
110
|
Button.defaultProps = {
|
|
130
111
|
type: 'button',
|
|
@@ -133,85 +114,65 @@ Button.defaultProps = {
|
|
|
133
114
|
Button.propTypes = {
|
|
134
115
|
/** Component to render inside the button */
|
|
135
116
|
children: _propTypes.default.node,
|
|
136
|
-
|
|
137
117
|
/** A className that will be passed to the `<button>` element */
|
|
138
118
|
className: _propTypes.default.string,
|
|
139
|
-
|
|
140
119
|
/**
|
|
141
120
|
* A string that will be applied as a `data-test` attribute on the button element
|
|
142
121
|
* for identification during testing
|
|
143
122
|
*/
|
|
144
123
|
dataTest: _propTypes.default.string,
|
|
145
|
-
|
|
146
124
|
/**
|
|
147
125
|
* Applies 'destructive' button appearance, implying a dangerous action.
|
|
148
126
|
*/
|
|
149
127
|
destructive: _propTypes.default.bool,
|
|
150
|
-
|
|
151
128
|
/** Applies a greyed-out appearance and makes the button non-interactive */
|
|
152
129
|
disabled: _propTypes.default.bool,
|
|
153
|
-
|
|
154
130
|
/** An icon element to display inside the button */
|
|
155
131
|
icon: _propTypes.default.element,
|
|
156
|
-
|
|
157
132
|
/** Use this variant to capture the initial focus on the page. */
|
|
158
133
|
initialFocus: _propTypes.default.bool,
|
|
159
|
-
|
|
160
134
|
/** Makes the button large. Mutually exclusive with `small` */
|
|
161
135
|
large: _uiConstants.sharedPropTypes.sizePropType,
|
|
162
|
-
|
|
163
136
|
/** Sets the button into a loading state */
|
|
164
137
|
loading: _propTypes.default.bool,
|
|
165
|
-
|
|
166
138
|
/**
|
|
167
139
|
* Sets `name` attribute on button element.
|
|
168
140
|
* Gets passed as part of the first argument to callbacks (see `onClick`).
|
|
169
141
|
*/
|
|
170
142
|
name: _propTypes.default.string,
|
|
171
|
-
|
|
172
143
|
/**
|
|
173
144
|
* Applies 'primary' button appearance, implying the most important action.
|
|
174
145
|
*/
|
|
175
146
|
primary: _propTypes.default.bool,
|
|
176
|
-
|
|
177
147
|
/**
|
|
178
148
|
* Applies 'secondary' button appearance.
|
|
179
149
|
*/
|
|
180
150
|
secondary: _propTypes.default.bool,
|
|
181
|
-
|
|
182
151
|
/** Makes the button small. Mutually exclusive with `large` prop */
|
|
183
152
|
small: _uiConstants.sharedPropTypes.sizePropType,
|
|
184
|
-
|
|
185
153
|
/** Tab index for focusing the button with a keyboard */
|
|
186
154
|
tabIndex: _propTypes.default.string,
|
|
187
|
-
|
|
188
155
|
/** Changes appearance of button to an on/off state */
|
|
189
156
|
toggled: _propTypes.default.bool,
|
|
190
|
-
|
|
191
157
|
/** Sets `type` attribute on `<button>` element */
|
|
192
158
|
type: _propTypes.default.oneOf(['submit', 'reset', 'button']),
|
|
193
|
-
|
|
194
159
|
/**
|
|
195
160
|
* Value associated with the button.
|
|
196
161
|
* Gets passed as part of the first argument to callbacks (see `onClick`).
|
|
197
162
|
*/
|
|
198
163
|
value: _propTypes.default.string,
|
|
199
|
-
|
|
200
164
|
/**
|
|
201
165
|
* Callback to trigger on de-focus (blur).
|
|
202
166
|
* Called with same args as `onClick`
|
|
203
167
|
* */
|
|
204
168
|
onBlur: _propTypes.default.func,
|
|
205
|
-
|
|
206
169
|
/**
|
|
207
170
|
* Callback to trigger on click.
|
|
208
171
|
* Called with args `({ value, name }, event)`
|
|
209
172
|
* */
|
|
210
173
|
onClick: _propTypes.default.func,
|
|
211
|
-
|
|
212
174
|
/** Callback to trigger on focus. Called with same args as `onClick` */
|
|
213
175
|
onFocus: _propTypes.default.func,
|
|
214
|
-
|
|
215
176
|
/** Callback to trigger on key-down. Called with same args as `onClick` */
|
|
216
177
|
onKeyDown: _propTypes.default.func
|
|
217
178
|
};
|
|
@@ -4,33 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.ToggledDisabled = exports.Toggled = exports.Small = exports.Secondary = exports.Primary = exports.Loading = exports.Large = exports.InitialFocus = exports.IconSmall = exports.IconRTL = exports.IconOnlySmall = exports.IconOnly = exports.Icon = exports.Disabled = exports.DestructiveSecondary = exports.Destructive = exports.Basic = void 0;
|
|
7
|
-
|
|
8
7
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _button = require("./button.js");
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
12
|
// Note: make sure 'fenced code blocks' are not indentend in this template string
|
|
19
|
-
const description =
|
|
13
|
+
const description = `Buttons are used for triggering actions.
|
|
14
|
+
There are different types of buttons in the design system which are intended
|
|
15
|
+
for different types of actions.
|
|
16
|
+
|
|
17
|
+
\`\`\`js
|
|
18
|
+
import { Button } from '@dhis2/ui'
|
|
19
|
+
\`\`\``;
|
|
20
20
|
const {
|
|
21
21
|
buttonVariantArgType,
|
|
22
22
|
sizeArgType
|
|
23
23
|
} = _uiConstants.sharedPropTypes;
|
|
24
|
-
|
|
25
24
|
const logger = _ref => {
|
|
26
25
|
let {
|
|
27
26
|
name,
|
|
28
27
|
value
|
|
29
28
|
} = _ref;
|
|
30
|
-
return console.log(
|
|
29
|
+
return console.log(`${name}: ${value}`);
|
|
31
30
|
};
|
|
32
|
-
|
|
33
|
-
var _default = {
|
|
31
|
+
var _default = exports.default = {
|
|
34
32
|
title: 'Button',
|
|
35
33
|
component: _button.Button,
|
|
36
34
|
parameters: {
|
|
@@ -49,20 +47,23 @@ var _default = {
|
|
|
49
47
|
ariaLabel: 'Button'
|
|
50
48
|
},
|
|
51
49
|
argTypes: {
|
|
52
|
-
primary: {
|
|
50
|
+
primary: {
|
|
51
|
+
...buttonVariantArgType
|
|
53
52
|
},
|
|
54
|
-
secondary: {
|
|
53
|
+
secondary: {
|
|
54
|
+
...buttonVariantArgType
|
|
55
55
|
},
|
|
56
|
-
destructive: {
|
|
56
|
+
destructive: {
|
|
57
|
+
...buttonVariantArgType
|
|
57
58
|
},
|
|
58
|
-
small: {
|
|
59
|
+
small: {
|
|
60
|
+
...sizeArgType
|
|
59
61
|
},
|
|
60
|
-
large: {
|
|
62
|
+
large: {
|
|
63
|
+
...sizeArgType
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
|
-
exports.default = _default;
|
|
65
|
-
|
|
66
67
|
const DemoIcon24 = /*#__PURE__*/_react.default.createElement("svg", {
|
|
67
68
|
height: "24",
|
|
68
69
|
viewBox: "0 0 24 24",
|
|
@@ -72,7 +73,6 @@ const DemoIcon24 = /*#__PURE__*/_react.default.createElement("svg", {
|
|
|
72
73
|
d: "m10.7071068 13.2928932c.3604839.360484.3882135.927715.0831886 1.3200062l-.0831886.0942074-5.2921068 5.2918932 2.585.001c.51283584 0 .93550716.3860402.99327227.8833789l.00672773.1166211c0 .5128358-.38604019.9355072-.88337887.9932723l-.11662113.0067277h-5l-.0193545-.0001861c-.02332655-.0004488-.04664039-.0017089-.06989557-.0037803l.08925007.0039664c-.05062028 0-.10036209-.0037612-.14896122-.0110193-.01698779-.0026088-.03441404-.0056829-.05176454-.0092208-.02202032-.0043997-.04371072-.0095935-.06511385-.0154809-.01562367-.0043767-.03101173-.0090077-.04630291-.0140171-.01965516-.0063844-.03943668-.0135776-.058916-.0213659-.01773713-.0070924-.03503998-.014575-.05216303-.0225694-.02066985-.0097032-.0410724-.0201205-.0610554-.0312024-.01211749-.006623-.02433616-.0137311-.0364318-.0211197-.0255662-.0157232-.05042194-.0324946-.07445055-.050318-.00744374-.0054399-.01468311-.010971-.02186305-.0166142-.0631594-.049624-.12042594-.1068905-.17019169-.1703222l.08010726.0903567c-.03539405-.0353941-.06758027-.0727812-.09655864-.1118002-.01784449-.0241759-.03461588-.0490316-.05026715-.0746464-.00746051-.0120471-.0145686-.0242658-.02139626-.0365981-.01087725-.0197682-.02129453-.0401707-.03101739-.060963-.00797473-.0170006-.01545736-.0343035-.02242829-.0517631-.00790975-.0197568-.015103-.0395383-.02167881-.0595996-.00481796-.0148851-.00944895-.0302731-.01370154-.0457434-.00601151-.0215565-.01120534-.0432469-.01567999-.0651989-.00346298-.0174188-.00653707-.0348451-.00914735-.0523272-.00160026-.010231-.00303174-.021012-.00429007-.0318458l-.00276132-.027371c-.00207143-.0232552-.00333152-.0465691-.00378026-.0698956l-.00018615-.0193545v-5c0-.5522847.44771525-1 1-1 .51283584 0 .93550716.3860402.99327227.8833789l.00672773.1166211v2.584l5.29289322-5.2911068c.39052429-.3905243 1.02368928-.3905243 1.41421358 0zm9.2928932-3.2928932v10h-10v-2h8v-8zm-6-6v2h-8v7h-2v-9zm7-2 .0193545.00018615c.0233265.00044874.0466404.00170883.0698956.00378026l-.0892501-.00396641c.0506203 0 .1003621.00376119.1489612.01101934.0169878.00260874.0344141.00568283.0517646.00922073.0220203.00439973.0437107.00959356.0651138.0154809.0156237.00437676.0310117.00900775.0463029.01401712.0196552.0063844.0394367.01357765.058916.02136587.0177371.00709246.03504.01457509.052163.0225694.0206699.00970328.0410724.02012056.0610555.03120241.0121174.00662306.0243361.01373115.0364318.02111968.0255662.01572325.0504219.03249464.0744505.05031806.0074437.00543993.0146831.01097097.021863.01661418.0631595.04962402.120426.10689056.1701917.17032223l-.0801072-.0903567c.035394.03539405.0675802.0727812.0965586.11180017.0178445.02417592.0346159.04903166.0502672.07464642.0074605.01204708.0145686.02426575.0213962.03659809.0108773.01976815.0212946.0401707.0310174.06096295.0079748.01700065.0154574.0343035.0224283.05176313.0079098.01975682.015103.03953834.0216788.05959961.004818.01488507.009449.03027313.0137016.04574344.0060115.02155649.0112053.04324689.0156799.06519887.003463.01741884.0065371.03484509.0091474.05232723.0016003.01023098.0030317.02101195.0042901.03184574l.0030256.03039033c.0015457.01796531.0026074.03596443.003185.05397618l.0005171.03225462v5c0 .55228475-.4477153 1-1 1-.5128358 0-.9355072-.38604019-.9932723-.88337887l-.0067277-.11662113v-2.586l-5.2928932 5.2931068c-.3905243.3905243-1.0236893.3905243-1.4142136 0-.3604839-.360484-.3882135-.92771504-.0831886-1.32000624l.0831886-.09420734 5.2911068-5.29289322h-2.584c-.5128358 0-.9355072-.38604019-.9932723-.88337887l-.0067277-.11662113c0-.51283584.3860402-.93550716.8833789-.99327227l.1166211-.00672773z",
|
|
73
74
|
fill: "inherit"
|
|
74
75
|
}));
|
|
75
|
-
|
|
76
76
|
const DemoIcon16 = /*#__PURE__*/_react.default.createElement("svg", {
|
|
77
77
|
height: "16",
|
|
78
78
|
viewBox: "0 0 16 16",
|
|
@@ -82,16 +82,12 @@ const DemoIcon16 = /*#__PURE__*/_react.default.createElement("svg", {
|
|
|
82
82
|
d: "m6.85355339 9.14644661c.17356635.17356635.1928515.44299075.05785545.63785889l-.05785545.06924789-4.14755339 4.14644661h2.794c.24545989 0 .44960837.1768752.49194433.4101244l.00805567.0898756c0 .2454599-.17687516.4496084-.41012437.4919443l-.08987563.0080557h-4c-.24545989 0-.44960837-.1768752-.49194433-.4101244l-.00805567-.0898756v-4c0-.2761424.22385763-.5.5-.5.24545989 0 .44960837.1768752.49194433.4101244l.00805567.0898756v2.792l4.14644661-4.14555339c.19526215-.19526215.51184463-.19526215.70710678 0zm6.14644661-2.14644661v6h-6v-1h5v-5zm-4-4v1h-5v5h-1v-6zm5.5-2c.2454599 0 .4496084.17687516.4919443.41012437l.0080557.08987563v4c0 .27614237-.2238576.5-.5.5-.2454599 0-.4496084-.17687516-.4919443-.41012437l-.0080557-.08987563v-2.794l-4.14644661 4.14755339c-.19526215.19526215-.51184463.19526215-.70710678 0-.17356635-.17356635-.1928515-.44299075-.05785545-.63785889l.05785545-.06924789 4.14655339-4.14744661-2.793.001c-.2454599 0-.4496084-.17687516-.4919443-.41012437l-.0080557-.08987563c0-.24545989.1768752-.44960837.4101244-.49194433l.0898756-.00805567z",
|
|
83
83
|
fill: "inherit"
|
|
84
84
|
}));
|
|
85
|
-
|
|
86
85
|
const Template = args => /*#__PURE__*/_react.default.createElement(_button.Button, args);
|
|
87
|
-
|
|
88
|
-
const Basic = Template.bind({});
|
|
89
|
-
exports.Basic = Basic;
|
|
86
|
+
const Basic = exports.Basic = Template.bind({});
|
|
90
87
|
Basic.args = {
|
|
91
88
|
name: 'Basic button'
|
|
92
89
|
};
|
|
93
|
-
const Primary = Template.bind({});
|
|
94
|
-
exports.Primary = Primary;
|
|
90
|
+
const Primary = exports.Primary = Template.bind({});
|
|
95
91
|
Primary.args = {
|
|
96
92
|
primary: true,
|
|
97
93
|
name: 'Primary button'
|
|
@@ -106,8 +102,7 @@ Primary.parameters = {
|
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
};
|
|
109
|
-
const Secondary = Template.bind({});
|
|
110
|
-
exports.Secondary = Secondary;
|
|
105
|
+
const Secondary = exports.Secondary = Template.bind({});
|
|
111
106
|
Secondary.args = {
|
|
112
107
|
secondary: true,
|
|
113
108
|
name: 'Secondary button'
|
|
@@ -122,8 +117,7 @@ Secondary.parameters = {
|
|
|
122
117
|
}
|
|
123
118
|
}
|
|
124
119
|
};
|
|
125
|
-
const Destructive = Template.bind({});
|
|
126
|
-
exports.Destructive = Destructive;
|
|
120
|
+
const Destructive = exports.Destructive = Template.bind({});
|
|
127
121
|
Destructive.args = {
|
|
128
122
|
destructive: true,
|
|
129
123
|
name: 'Destructive button'
|
|
@@ -138,14 +132,12 @@ Destructive.parameters = {
|
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
134
|
};
|
|
141
|
-
const DestructiveSecondary = Template.bind({});
|
|
142
|
-
exports.DestructiveSecondary = DestructiveSecondary;
|
|
135
|
+
const DestructiveSecondary = exports.DestructiveSecondary = Template.bind({});
|
|
143
136
|
DestructiveSecondary.args = {
|
|
144
137
|
destructive: true,
|
|
145
138
|
secondary: true,
|
|
146
139
|
name: 'Destructive secondary button'
|
|
147
140
|
};
|
|
148
|
-
|
|
149
141
|
const Disabled = args => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
150
142
|
name: "Disabled button"
|
|
151
143
|
}, args)), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
@@ -158,7 +150,6 @@ const Disabled = args => /*#__PURE__*/_react.default.createElement(_react.defaul
|
|
|
158
150
|
destructive: true,
|
|
159
151
|
name: "Disabled button"
|
|
160
152
|
}, args)));
|
|
161
|
-
|
|
162
153
|
exports.Disabled = Disabled;
|
|
163
154
|
Disabled.args = {
|
|
164
155
|
disabled: true
|
|
@@ -173,8 +164,7 @@ Disabled.parameters = {
|
|
|
173
164
|
}
|
|
174
165
|
}
|
|
175
166
|
};
|
|
176
|
-
const Small = Template.bind({});
|
|
177
|
-
exports.Small = Small;
|
|
167
|
+
const Small = exports.Small = Template.bind({});
|
|
178
168
|
Small.args = {
|
|
179
169
|
small: true,
|
|
180
170
|
name: 'Small button'
|
|
@@ -188,8 +178,7 @@ Small.parameters = {
|
|
|
188
178
|
}
|
|
189
179
|
}
|
|
190
180
|
};
|
|
191
|
-
const Large = Template.bind({});
|
|
192
|
-
exports.Large = Large;
|
|
181
|
+
const Large = exports.Large = Template.bind({});
|
|
193
182
|
Large.args = {
|
|
194
183
|
large: true,
|
|
195
184
|
name: 'Large button'
|
|
@@ -203,20 +192,18 @@ Large.parameters = {
|
|
|
203
192
|
}
|
|
204
193
|
}
|
|
205
194
|
};
|
|
206
|
-
const InitialFocus = Template.bind({});
|
|
207
|
-
exports.InitialFocus = InitialFocus;
|
|
195
|
+
const InitialFocus = exports.InitialFocus = Template.bind({});
|
|
208
196
|
InitialFocus.args = {
|
|
209
197
|
initialFocus: true,
|
|
210
198
|
name: 'Focused button'
|
|
211
|
-
};
|
|
199
|
+
};
|
|
200
|
+
// When enabled, this story grabs focus every time a control is changed
|
|
212
201
|
// in the docs page. Disabled for better UX
|
|
213
|
-
|
|
214
202
|
InitialFocus.parameters = {
|
|
215
203
|
docs: {
|
|
216
204
|
disable: true
|
|
217
205
|
}
|
|
218
206
|
};
|
|
219
|
-
|
|
220
207
|
const Icon = args => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.Button, args), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
221
208
|
primary: true
|
|
222
209
|
}, args)), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
@@ -224,7 +211,6 @@ const Icon = args => /*#__PURE__*/_react.default.createElement(_react.default.Fr
|
|
|
224
211
|
}, args)), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
225
212
|
destructive: true
|
|
226
213
|
}, args)));
|
|
227
|
-
|
|
228
214
|
exports.Icon = Icon;
|
|
229
215
|
Icon.args = {
|
|
230
216
|
icon: DemoIcon24,
|
|
@@ -241,19 +227,16 @@ Icon.parameters = {
|
|
|
241
227
|
}
|
|
242
228
|
}
|
|
243
229
|
};
|
|
244
|
-
|
|
245
230
|
const IconRTL = args => /*#__PURE__*/_react.default.createElement("div", {
|
|
246
231
|
dir: "rtl"
|
|
247
232
|
}, /*#__PURE__*/_react.default.createElement(_button.Button, args));
|
|
248
|
-
|
|
249
233
|
exports.IconRTL = IconRTL;
|
|
250
234
|
IconRTL.args = {
|
|
251
235
|
icon: DemoIcon24,
|
|
252
236
|
name: 'RTL icon button',
|
|
253
237
|
children: 'RTL text'
|
|
254
238
|
};
|
|
255
|
-
const IconOnly = Template.bind({});
|
|
256
|
-
exports.IconOnly = IconOnly;
|
|
239
|
+
const IconOnly = exports.IconOnly = Template.bind({});
|
|
257
240
|
IconOnly.args = {
|
|
258
241
|
icon: DemoIcon24,
|
|
259
242
|
name: 'Icon only button',
|
|
@@ -261,24 +244,21 @@ IconOnly.args = {
|
|
|
261
244
|
title: 'Icon Button',
|
|
262
245
|
ariaLabel: 'Icon Button'
|
|
263
246
|
};
|
|
264
|
-
const IconSmall = Template.bind({});
|
|
265
|
-
exports.IconSmall = IconSmall;
|
|
247
|
+
const IconSmall = exports.IconSmall = Template.bind({});
|
|
266
248
|
IconSmall.args = {
|
|
267
249
|
icon: DemoIcon16,
|
|
268
250
|
small: true,
|
|
269
251
|
name: 'Icon small button',
|
|
270
252
|
children: 'Label me!'
|
|
271
253
|
};
|
|
272
|
-
const IconOnlySmall = Template.bind({});
|
|
273
|
-
exports.IconOnlySmall = IconOnlySmall;
|
|
254
|
+
const IconOnlySmall = exports.IconOnlySmall = Template.bind({});
|
|
274
255
|
IconOnlySmall.args = {
|
|
275
256
|
icon: DemoIcon16,
|
|
276
257
|
small: true,
|
|
277
258
|
name: 'Icon only small button',
|
|
278
259
|
children: null
|
|
279
260
|
};
|
|
280
|
-
const Toggled = Template.bind({});
|
|
281
|
-
exports.Toggled = Toggled;
|
|
261
|
+
const Toggled = exports.Toggled = Template.bind({});
|
|
282
262
|
Toggled.args = {
|
|
283
263
|
toggled: true,
|
|
284
264
|
icon: DemoIcon24,
|
|
@@ -298,8 +278,7 @@ Toggled.parameters = {
|
|
|
298
278
|
}
|
|
299
279
|
}
|
|
300
280
|
};
|
|
301
|
-
const ToggledDisabled = Template.bind({});
|
|
302
|
-
exports.ToggledDisabled = ToggledDisabled;
|
|
281
|
+
const ToggledDisabled = exports.ToggledDisabled = Template.bind({});
|
|
303
282
|
ToggledDisabled.args = {
|
|
304
283
|
toggled: true,
|
|
305
284
|
disabled: true,
|
|
@@ -307,7 +286,6 @@ ToggledDisabled.args = {
|
|
|
307
286
|
name: 'Toggled button',
|
|
308
287
|
children: null
|
|
309
288
|
};
|
|
310
|
-
|
|
311
289
|
const Loading = args => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.Button, args), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
312
290
|
primary: true
|
|
313
291
|
}, args)), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
@@ -315,7 +293,6 @@ const Loading = args => /*#__PURE__*/_react.default.createElement(_react.default
|
|
|
315
293
|
}, args)), /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
316
294
|
destructive: true
|
|
317
295
|
}, args)));
|
|
318
|
-
|
|
319
296
|
exports.Loading = Loading;
|
|
320
297
|
Loading.args = {
|
|
321
298
|
name: 'Loading button',
|
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
9
|
-
|
|
10
|
-
const _defaultExport = ["button.jsx-1796590446{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border-radius:4px;font-weight:400;-webkit-letter-spacing:0.5px;-moz-letter-spacing:0.5px;-ms-letter-spacing:0.5px;letter-spacing:0.5px;-webkit-text-decoration:none;text-decoration:none;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:".concat(_uiConstants.colors.grey900, ";height:36px;padding:0 ").concat(_uiConstants.spacers.dp12, ";font-size:14px;line-height:16px;border:1px solid ").concat(_uiConstants.colors.grey500, ";background-color:#f9fafb;}"), "button.jsx-1796590446:disabled{cursor:not-allowed;}", "button.jsx-1796590446:focus{outline:3px solid ".concat(_uiConstants.theme.focus, ";outline-offset:-3px;-webkit-text-decoration:underline;text-decoration:underline;}"), "button.jsx-1796590446:focus.jsx-1796590446:not(:focus-visible){outline:none;-webkit-text-decoration:none;text-decoration:none;}", "button.jsx-1796590446:active.jsx-1796590446:focus,button.jsx-1796590446:disabled.jsx-1796590446:focus{outline:none;-webkit-text-decoration:none;text-decoration:none;}", "button.jsx-1796590446:hover{border-color:".concat(_uiConstants.colors.grey500, ";background-color:").concat(_uiConstants.colors.grey200, ";}"), "button.jsx-1796590446:active,button.jsx-1796590446:active.jsx-1796590446:focus{border-color:".concat(_uiConstants.colors.grey500, ";background-color:").concat(_uiConstants.colors.grey200, ";box-shadow:0 0 0 1px rgb(0,0,0,0.1) inset;}"), "button.jsx-1796590446:focus{background-color:#f9fafb;}", "button.jsx-1796590446:disabled{border-color:".concat(_uiConstants.colors.grey400, ";background-color:#f9fafb;box-shadow:none;color:").concat(_uiConstants.theme.disabled, ";fill:").concat(_uiConstants.theme.disabled, ";}"), ".small.jsx-1796590446{height:28px;padding:0 6px;font-size:14px;line-height:16px;}", ".large.jsx-1796590446{height:43px;padding:0 ".concat(_uiConstants.spacers.dp24, ";font-size:16px;-webkit-letter-spacing:0.57px;-moz-letter-spacing:0.57px;-ms-letter-spacing:0.57px;letter-spacing:0.57px;line-height:19px;}"), ".primary.jsx-1796590446{border-color:".concat(_uiConstants.theme.primary800, ";background:linear-gradient(180deg,#1565c0 0%,#0650a3 100%);background-color:#2b61b3;color:").concat(_uiConstants.colors.white, ";fill:").concat(_uiConstants.colors.white, ";font-weight:500;}"), ".primary.jsx-1796590446:hover{border-color:".concat(_uiConstants.theme.primary800, ";background:linear-gradient(180deg,#054fa3 0%,#034793 100%);background-color:#21539f;}"), ".primary.jsx-1796590446:active,.primary.jsx-1796590446:active.jsx-1796590446:focus{background:linear-gradient(180deg,#054fa3 0%,#034793 100%);background-color:#1c4a90;box-shadow:0 0 0 1px rgba(0,0,0,0.18) inset;}", ".primary.jsx-1796590446:focus{background:".concat(_uiConstants.colors.blue800, ";border-color:").concat(_uiConstants.colors.blue900, ";outline-offset:-5px;}"), ".primary.jsx-1796590446:disabled{border-color:#93a6bd;background:#b3c6de;box-shadow:none;color:".concat(_uiConstants.colors.white, ";fill:").concat(_uiConstants.colors.white, ";}"), ".secondary.jsx-1796590446{border-color:rgba(74,87,104,0.25);background-color:transparent;}", ".secondary.jsx-1796590446:hover{border-color:rgba(74,87,104,0.5);background-color:rgba(160,173,186,0.05);}", ".secondary.jsx-1796590446:active,.secondary.jsx-1796590446:active.jsx-1796590446:focus{background-color:rgba(160,173,186,0.2);box-shadow:none;}", ".secondary.jsx-1796590446:focus{background-color:transparent;}", ".secondary.jsx-1796590446:disabled{border-color:rgba(74,87,104,0.25);background-color:transparent;box-shadow:none;color:".concat(_uiConstants.theme.disabled, ";fill:").concat(_uiConstants.theme.disabled, ";}"), ".destructive.jsx-1796590446{border-color:#a10b0b;background:linear-gradient(180deg,#d32f2f 0%,#b71c1c 100%);background-color:#b9242b;color:".concat(_uiConstants.colors.white, ";fill:").concat(_uiConstants.colors.white, ";font-weight:500;}"), ".destructive.jsx-1796590446:hover{border-color:#a10b0b;background:linear-gradient(180deg,#b81c1c 0%,#b80c0b 100%);background-color:#ac0f1a;}", ".destructive.jsx-1796590446:active,.destructive.jsx-1796590446:active.jsx-1796590446:focus{background:linear-gradient(180deg,#b81c1c 0%,#b80c0b 100%);background-color:#ac101b;box-shadow:0 0 0 1px rgba(0,0,0,0.18) inset;}", ".destructive.jsx-1796590446:focus{background:linear-gradient(180deg,#d32f2f 0%,#b71c1c 100%);background-color:#b72229;}", ".destructive.jsx-1796590446:disabled{border-color:#c59898;background:#d6a8a8;box-shadow:none;color:".concat(_uiConstants.colors.white, ";fill:").concat(_uiConstants.colors.white, ";}"), ".destructive.secondary.jsx-1796590446{border-color:rgba(74,87,104,0.25);background:transparent;color:".concat(_uiConstants.colors.red700, ";fill:").concat(_uiConstants.colors.red700, ";font-weight:400;}"), ".destructive.secondary.jsx-1796590446:hover{border-color:".concat(_uiConstants.colors.red600, ";background:").concat(_uiConstants.colors.red050, ";color:").concat(_uiConstants.colors.red800, ";fill:").concat(_uiConstants.colors.red800, ";}"), ".destructive.secondary.jsx-1796590446:active,.destructive.secondary.jsx-1796590446:active.jsx-1796590446:focus{background:".concat(_uiConstants.colors.red100, ";border-color:").concat(_uiConstants.colors.red700, ";box-shadow:none;}"), ".destructive.secondary.jsx-1796590446:disabled{background:transparent;border-color:rgba(74,87,104,0.25);color:rgba(183,28,28,0.6);fill:rgba(183,28,28,0.6);}", ".icon-only.jsx-1796590446{padding:0 0 0 5px;}", ".button-icon.jsx-1796590446{margin-inline-end:6px;color:inherit;fill:inherit;font-size:26px;vertical-align:middle;pointer-events:none;}", ".icon-only.jsx-1796590446 .button-icon.jsx-1796590446{margin-inline-end:5px;}", ".small.icon-only.jsx-1796590446{padding-block:0;padding-inline-start:5px;padding-inline-end:4px;}", ".small.jsx-1796590446 .button-icon.jsx-1796590446{margin-inline-end:2px;}", ".small.icon-only.jsx-1796590446 .button-icon.jsx-1796590446{margin-inline-end:1px;}", ".toggled.jsx-1796590446{background:".concat(_uiConstants.colors.grey700, ";border:1px solid ").concat(_uiConstants.colors.grey900, ";color:").concat(_uiConstants.colors.grey050, ";fill:").concat(_uiConstants.colors.grey050, ";}"), ".toggled.jsx-1796590446:focus{background:".concat(_uiConstants.colors.grey800, ";}"), ".toggled.jsx-1796590446:hover{background:".concat(_uiConstants.colors.grey800, ";border-color:").concat(_uiConstants.colors.grey900, ";}"), ".toggled.jsx-1796590446:active,.toggled.jsx-1796590446:active.jsx-1796590446:focus{background:".concat(_uiConstants.colors.grey900, ";border-color:").concat(_uiConstants.colors.grey900, ";}"), ".toggled.jsx-1796590446:disabled{background:".concat(_uiConstants.colors.grey500, ";border-color:").concat(_uiConstants.colors.grey600, ";color:").concat(_uiConstants.colors.grey050, ";fill:").concat(_uiConstants.colors.grey050, ";}"), ".loader.jsx-1796590446{width:16px;height:16px;margin-inline-end:8px;}", ".loader.jsx-1796590446+.button-icon.jsx-1796590446{display:none;}", ".icon-only.jsx-1796590446 .loader.jsx-1796590446{margin:0 8px 0 4px;margin-inline-start:4px;margin-inline-end:8px;}", ".small.icon-only.jsx-1796590446 .loader.jsx-1796590446{margin:0 4px;}"];
|
|
8
|
+
const _defaultExport = [`button.jsx-1796590446{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border-radius:4px;font-weight:400;-webkit-letter-spacing:0.5px;-moz-letter-spacing:0.5px;-ms-letter-spacing:0.5px;letter-spacing:0.5px;-webkit-text-decoration:none;text-decoration:none;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:${_uiConstants.colors.grey900};height:36px;padding:0 ${_uiConstants.spacers.dp12};font-size:14px;line-height:16px;border:1px solid ${_uiConstants.colors.grey500};background-color:#f9fafb;}`, "button.jsx-1796590446:disabled{cursor:not-allowed;}", `button.jsx-1796590446:focus{outline:3px solid ${_uiConstants.theme.focus};outline-offset:-3px;-webkit-text-decoration:underline;text-decoration:underline;}`, "button.jsx-1796590446:focus.jsx-1796590446:not(:focus-visible){outline:none;-webkit-text-decoration:none;text-decoration:none;}", "button.jsx-1796590446:active.jsx-1796590446:focus,button.jsx-1796590446:disabled.jsx-1796590446:focus{outline:none;-webkit-text-decoration:none;text-decoration:none;}", `button.jsx-1796590446:hover{border-color:${_uiConstants.colors.grey500};background-color:${_uiConstants.colors.grey200};}`, `button.jsx-1796590446:active,button.jsx-1796590446:active.jsx-1796590446:focus{border-color:${_uiConstants.colors.grey500};background-color:${_uiConstants.colors.grey200};box-shadow:0 0 0 1px rgb(0,0,0,0.1) inset;}`, "button.jsx-1796590446:focus{background-color:#f9fafb;}", `button.jsx-1796590446:disabled{border-color:${_uiConstants.colors.grey400};background-color:#f9fafb;box-shadow:none;color:${_uiConstants.theme.disabled};fill:${_uiConstants.theme.disabled};}`, ".small.jsx-1796590446{height:28px;padding:0 6px;font-size:14px;line-height:16px;}", `.large.jsx-1796590446{height:43px;padding:0 ${_uiConstants.spacers.dp24};font-size:16px;-webkit-letter-spacing:0.57px;-moz-letter-spacing:0.57px;-ms-letter-spacing:0.57px;letter-spacing:0.57px;line-height:19px;}`, `.primary.jsx-1796590446{border-color:${_uiConstants.theme.primary800};background:linear-gradient(180deg,#1565c0 0%,#0650a3 100%);background-color:#2b61b3;color:${_uiConstants.colors.white};fill:${_uiConstants.colors.white};font-weight:500;}`, `.primary.jsx-1796590446:hover{border-color:${_uiConstants.theme.primary800};background:linear-gradient(180deg,#054fa3 0%,#034793 100%);background-color:#21539f;}`, ".primary.jsx-1796590446:active,.primary.jsx-1796590446:active.jsx-1796590446:focus{background:linear-gradient(180deg,#054fa3 0%,#034793 100%);background-color:#1c4a90;box-shadow:0 0 0 1px rgba(0,0,0,0.18) inset;}", `.primary.jsx-1796590446:focus{background:${_uiConstants.colors.blue800};border-color:${_uiConstants.colors.blue900};outline-offset:-5px;}`, `.primary.jsx-1796590446:disabled{border-color:#93a6bd;background:#b3c6de;box-shadow:none;color:${_uiConstants.colors.white};fill:${_uiConstants.colors.white};}`, ".secondary.jsx-1796590446{border-color:rgba(74,87,104,0.25);background-color:transparent;}", ".secondary.jsx-1796590446:hover{border-color:rgba(74,87,104,0.5);background-color:rgba(160,173,186,0.05);}", ".secondary.jsx-1796590446:active,.secondary.jsx-1796590446:active.jsx-1796590446:focus{background-color:rgba(160,173,186,0.2);box-shadow:none;}", ".secondary.jsx-1796590446:focus{background-color:transparent;}", `.secondary.jsx-1796590446:disabled{border-color:rgba(74,87,104,0.25);background-color:transparent;box-shadow:none;color:${_uiConstants.theme.disabled};fill:${_uiConstants.theme.disabled};}`, `.destructive.jsx-1796590446{border-color:#a10b0b;background:linear-gradient(180deg,#d32f2f 0%,#b71c1c 100%);background-color:#b9242b;color:${_uiConstants.colors.white};fill:${_uiConstants.colors.white};font-weight:500;}`, ".destructive.jsx-1796590446:hover{border-color:#a10b0b;background:linear-gradient(180deg,#b81c1c 0%,#b80c0b 100%);background-color:#ac0f1a;}", ".destructive.jsx-1796590446:active,.destructive.jsx-1796590446:active.jsx-1796590446:focus{background:linear-gradient(180deg,#b81c1c 0%,#b80c0b 100%);background-color:#ac101b;box-shadow:0 0 0 1px rgba(0,0,0,0.18) inset;}", ".destructive.jsx-1796590446:focus{background:linear-gradient(180deg,#d32f2f 0%,#b71c1c 100%);background-color:#b72229;}", `.destructive.jsx-1796590446:disabled{border-color:#c59898;background:#d6a8a8;box-shadow:none;color:${_uiConstants.colors.white};fill:${_uiConstants.colors.white};}`, `.destructive.secondary.jsx-1796590446{border-color:rgba(74,87,104,0.25);background:transparent;color:${_uiConstants.colors.red700};fill:${_uiConstants.colors.red700};font-weight:400;}`, `.destructive.secondary.jsx-1796590446:hover{border-color:${_uiConstants.colors.red600};background:${_uiConstants.colors.red050};color:${_uiConstants.colors.red800};fill:${_uiConstants.colors.red800};}`, `.destructive.secondary.jsx-1796590446:active,.destructive.secondary.jsx-1796590446:active.jsx-1796590446:focus{background:${_uiConstants.colors.red100};border-color:${_uiConstants.colors.red700};box-shadow:none;}`, ".destructive.secondary.jsx-1796590446:disabled{background:transparent;border-color:rgba(74,87,104,0.25);color:rgba(183,28,28,0.6);fill:rgba(183,28,28,0.6);}", ".icon-only.jsx-1796590446{padding:0 0 0 5px;}", ".button-icon.jsx-1796590446{margin-inline-end:6px;color:inherit;fill:inherit;font-size:26px;vertical-align:middle;pointer-events:none;}", ".icon-only.jsx-1796590446 .button-icon.jsx-1796590446{margin-inline-end:5px;}", ".small.icon-only.jsx-1796590446{padding-block:0;padding-inline-start:5px;padding-inline-end:4px;}", ".small.jsx-1796590446 .button-icon.jsx-1796590446{margin-inline-end:2px;}", ".small.icon-only.jsx-1796590446 .button-icon.jsx-1796590446{margin-inline-end:1px;}", `.toggled.jsx-1796590446{background:${_uiConstants.colors.grey700};border:1px solid ${_uiConstants.colors.grey900};color:${_uiConstants.colors.grey050};fill:${_uiConstants.colors.grey050};}`, `.toggled.jsx-1796590446:focus{background:${_uiConstants.colors.grey800};}`, `.toggled.jsx-1796590446:hover{background:${_uiConstants.colors.grey800};border-color:${_uiConstants.colors.grey900};}`, `.toggled.jsx-1796590446:active,.toggled.jsx-1796590446:active.jsx-1796590446:focus{background:${_uiConstants.colors.grey900};border-color:${_uiConstants.colors.grey900};}`, `.toggled.jsx-1796590446:disabled{background:${_uiConstants.colors.grey500};border-color:${_uiConstants.colors.grey600};color:${_uiConstants.colors.grey050};fill:${_uiConstants.colors.grey050};}`, ".loader.jsx-1796590446{width:16px;height:16px;margin-inline-end:8px;}", ".loader.jsx-1796590446+.button-icon.jsx-1796590446{display:none;}", ".icon-only.jsx-1796590446 .loader.jsx-1796590446{margin:0 8px 0 4px;margin-inline-start:4px;margin-inline-end:8px;}", ".small.icon-only.jsx-1796590446 .loader.jsx-1796590446{margin:0 4px;}"];
|
|
11
9
|
_defaultExport.__hash = "1796590446";
|
|
12
|
-
var _default = _defaultExport;
|
|
13
|
-
exports.default = _default;
|
|
10
|
+
var _default = exports.default = _defaultExport;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('an Button with initialFocus and onBlur handler is rendered', () => {
|
|
6
|
-
cy.visitStory('Button', 'With
|
|
5
|
+
cy.visitStory('Button', 'With initial focus and on blur');
|
|
7
6
|
cy.focused().should('exist');
|
|
8
7
|
});
|
|
9
8
|
(0, _cypressCucumberPreprocessor.When)('the Button is blurred', () => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a Button with onClick handler is rendered', () => {
|
|
6
|
-
cy.visitStory('Button', 'With
|
|
5
|
+
cy.visitStory('Button', 'With on click');
|
|
7
6
|
});
|
|
8
7
|
(0, _cypressCucumberPreprocessor.When)('the Button is clicked', () => {
|
|
9
8
|
cy.get('[data-test="dhis2-uicore-button"]').click();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a Button with onFocus handler is rendered', () => {
|
|
6
|
-
cy.visitStory('Button', 'With
|
|
5
|
+
cy.visitStory('Button', 'With on focus');
|
|
7
6
|
});
|
|
8
7
|
(0, _cypressCucumberPreprocessor.When)('the Button is focused', () => {
|
|
9
8
|
cy.get('[data-test="dhis2-uicore-button"]').focus();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithChildren = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _index = require("../index.js");
|
|
9
|
+
var _index2 = require("./index.js");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var _default = exports.default = {
|
|
12
|
+
title: 'ButtonStrip'
|
|
13
|
+
};
|
|
14
|
+
const WithChildren = () => /*#__PURE__*/_react.default.createElement(_index2.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_index.Button, null, "I am a child"), /*#__PURE__*/_react.default.createElement(_index.Button, null, "I am a child"), /*#__PURE__*/_react.default.createElement(_index.Button, null, "I am a child"));
|
|
15
|
+
exports.WithChildren = WithChildren;
|