@pingux/astro 1.2.0-alpha.2 → 1.2.0-alpha.3
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.
@@ -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;
|
@@ -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;
|
@@ -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;
|
@@ -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
|
};
|