@pingux/astro 1.28.0 → 1.28.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/cjs/components/DataTable/DataTable.js +30 -26
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/recipes/Slider.stories.js +73 -70
- package/lib/cjs/styles/forms/index.js +1 -1
- package/lib/cjs/styles/forms/label.js +1 -1
- package/lib/cjs/styles/forms/select.js +1 -1
- package/lib/components/DataTable/DataTable.js +30 -25
- package/lib/index.js +1 -1
- package/lib/recipes/Slider.stories.js +72 -68
- package/lib/styles/forms/index.js +1 -1
- package/lib/styles/forms/label.js +1 -1
- package/lib/styles/forms/select.js +1 -1
- package/package.json +1 -9
- package/NOTICE.html +0 -5016
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.28.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.28.0...@pingux/astro@1.28.1) (2022-09-22)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* Change DataTable prop type definitions for width and height ([e295973](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e29597388e30eec017532a262bf79a37e147f87d))
|
12
|
+
* Hotfix to address React Spectrum build error happening for some users ([9dccf35](https://gitlab.corp.pingidentity.com/ux/pingux/commit/9dccf35dd2a91e2517c975812649592bef51ef43))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
6
18
|
# [1.28.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.27.0...@pingux/astro@1.28.0) (2022-09-22)
|
7
19
|
|
8
20
|
|
@@ -46,8 +46,6 @@ var _virtualizer = require("@react-aria/virtualizer");
|
|
46
46
|
|
47
47
|
var _table = require("@react-stately/table");
|
48
48
|
|
49
|
-
var _utils2 = require("@react-spectrum/utils");
|
50
|
-
|
51
49
|
var _layout = require("@react-stately/layout");
|
52
50
|
|
53
51
|
var _table2 = require("@react-aria/table");
|
@@ -106,11 +104,9 @@ var ROW_HEIGHTS = {
|
|
106
104
|
*/
|
107
105
|
|
108
106
|
var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
109
|
-
var
|
110
|
-
|
111
|
-
|
112
|
-
styleProps = _useStyleProps.styleProps;
|
113
|
-
|
107
|
+
var width = props.width,
|
108
|
+
height = props.height,
|
109
|
+
onAction = props.onAction;
|
114
110
|
var direction = 'ltr'; // useLocale override
|
115
111
|
|
116
112
|
var scale = 'large'; // useProvider override
|
@@ -243,7 +239,9 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
243
239
|
style: {
|
244
240
|
whiteSpace: props.overflowMode === 'wrap' ? 'normal' : 'initial'
|
245
241
|
}
|
246
|
-
}, gridProps,
|
242
|
+
}, gridProps, {
|
243
|
+
width: width,
|
244
|
+
height: height,
|
247
245
|
layout: layout,
|
248
246
|
collection: state.collection,
|
249
247
|
focusedKey: state.selectionManager.focusedKey,
|
@@ -256,6 +254,30 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
256
254
|
getColumnWidth: columnState.getColumnWidth
|
257
255
|
})));
|
258
256
|
});
|
257
|
+
DataTable.propTypes = {
|
258
|
+
/**
|
259
|
+
* Sets the amount of vertical padding within each cell.
|
260
|
+
* density: 'compact' | 'regular' | 'spacious'
|
261
|
+
* @default 'regular'
|
262
|
+
*/
|
263
|
+
density: _propTypes["default"].string,
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Sets the overflow behavior for the cell contents.
|
267
|
+
* overflowMode: 'wrap' | 'truncate'
|
268
|
+
* @default 'truncate'
|
269
|
+
*/
|
270
|
+
overflowMode: _propTypes["default"].string,
|
271
|
+
|
272
|
+
/** Handler that is called when a user performs an action on a row. */
|
273
|
+
onAction: _propTypes["default"].func,
|
274
|
+
width: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
275
|
+
height: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
|
276
|
+
};
|
277
|
+
DataTable.defaultProps = {
|
278
|
+
width: '100%',
|
279
|
+
height: 565
|
280
|
+
};
|
259
281
|
|
260
282
|
function TableHeader(_ref) {
|
261
283
|
var children = _ref.children,
|
@@ -423,24 +445,6 @@ function CenteredWrapper(_ref6) {
|
|
423
445
|
}, children));
|
424
446
|
}
|
425
447
|
|
426
|
-
DataTable.propTypes = {
|
427
|
-
/**
|
428
|
-
* Sets the amount of vertical padding within each cell.
|
429
|
-
* density: 'compact' | 'regular' | 'spacious'
|
430
|
-
* @default 'regular'
|
431
|
-
*/
|
432
|
-
density: _propTypes["default"].string,
|
433
|
-
|
434
|
-
/**
|
435
|
-
* Sets the overflow behavior for the cell contents.
|
436
|
-
* overflowMode: 'wrap' | 'truncate'
|
437
|
-
* @default 'truncate'
|
438
|
-
*/
|
439
|
-
overflowMode: _propTypes["default"].string,
|
440
|
-
|
441
|
-
/** Handler that is called when a user performs an action on a row. */
|
442
|
-
onAction: _propTypes["default"].func
|
443
|
-
};
|
444
448
|
TableCell.propTypes = {
|
445
449
|
cell: _propTypes["default"].shape({
|
446
450
|
column: _propTypes["default"].shape({
|
package/lib/cjs/index.js
CHANGED
@@ -1804,7 +1804,7 @@ _forEachInstanceProperty(_context69 = _Object$keys(_DataTable)).call(_context69,
|
|
1804
1804
|
});
|
1805
1805
|
});
|
1806
1806
|
|
1807
|
-
var _table = require("@react-
|
1807
|
+
var _table = require("@react-stately/table");
|
1808
1808
|
|
1809
1809
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
1810
1810
|
|
@@ -24,12 +24,12 @@ _Object$defineProperty(exports, "__esModule", {
|
|
24
24
|
|
25
25
|
exports["default"] = exports.Default = void 0;
|
26
26
|
|
27
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
28
|
-
|
29
27
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
30
28
|
|
31
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
32
30
|
|
31
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
32
|
+
|
33
33
|
var _react = _interopRequireDefault(require("react"));
|
34
34
|
|
35
35
|
var _slider = require("@react-aria/slider");
|
@@ -55,6 +55,61 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
55
55
|
var _default = {
|
56
56
|
title: 'Recipes/Slider'
|
57
57
|
};
|
58
|
+
exports["default"] = _default;
|
59
|
+
var sx = {
|
60
|
+
sliderContainer: {
|
61
|
+
position: 'relative',
|
62
|
+
alignItems: 'center',
|
63
|
+
width: '100%',
|
64
|
+
touchAction: 'none'
|
65
|
+
},
|
66
|
+
sliderInnerBox: {
|
67
|
+
flex: '1 0 auto',
|
68
|
+
textAlign: 'end'
|
69
|
+
},
|
70
|
+
sliderOuterBox: {
|
71
|
+
alignSelf: 'stretch'
|
72
|
+
},
|
73
|
+
sliderBox: {
|
74
|
+
position: 'relative',
|
75
|
+
height: 30,
|
76
|
+
width: ' 100%'
|
77
|
+
},
|
78
|
+
slider: {
|
79
|
+
position: 'absolute',
|
80
|
+
height: 10,
|
81
|
+
borderRadius: '5px',
|
82
|
+
top: 13,
|
83
|
+
width: '100%'
|
84
|
+
},
|
85
|
+
rangeSlider: {
|
86
|
+
position: 'absolute',
|
87
|
+
backgroundImage: 'linear-gradient(to right, rgb(169, 215, 50) 10%, rgb(226, 215, 20) 50%, rgb(235, 44, 56) 90%)',
|
88
|
+
height: 10,
|
89
|
+
borderRadius: '5px',
|
90
|
+
top: 13,
|
91
|
+
width: '100%'
|
92
|
+
},
|
93
|
+
thumbContainer: {
|
94
|
+
position: 'absolute',
|
95
|
+
top: 5,
|
96
|
+
transform: 'translateX(-50%)'
|
97
|
+
},
|
98
|
+
thumb: {
|
99
|
+
width: 25,
|
100
|
+
height: 25,
|
101
|
+
borderRadius: '50%',
|
102
|
+
backgroundColor: 'white',
|
103
|
+
border: '1px solid #C1C5C8',
|
104
|
+
boxShadow: '0 2px 2px 0 #CACACA'
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
var setSliderColor = function setSliderColor(thumbPosition) {
|
109
|
+
var _context, _context2, _context3, _context4;
|
110
|
+
|
111
|
+
return thumbPosition < 25 ? (0, _concat["default"])(_context = "linear-gradient(to right, rgb(169, 215, 50) 0%, rgb(169, 215, 50) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 25 && thumbPosition <= 49 ? (0, _concat["default"])(_context2 = "linear-gradient(to right, rgb(226, 215, 20) 0%, rgb(226, 215, 20) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context2, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 50 && thumbPosition <= 74 ? (0, _concat["default"])(_context3 = "linear-gradient(to right, rgb(231, 135, 38) 0%, rgb(231, 135, 38) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context3, thumbPosition, "%, rgb(242, 242, 242) 100%)") : (0, _concat["default"])(_context4 = "linear-gradient(to right, rgb(235, 44, 56) 0%, rgb(235, 44, 56) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context4, thumbPosition, "%, rgb(242, 242, 242) 100%)");
|
112
|
+
};
|
58
113
|
/*
|
59
114
|
* The slider value can be formatted by using the `formatOptions` prop.
|
60
115
|
`* formatOptions` is compatible with the option parameter of
|
@@ -63,7 +118,6 @@ var _default = {
|
|
63
118
|
* https://react-spectrum.adobe.com/react-aria/useSlider.html
|
64
119
|
*/
|
65
120
|
|
66
|
-
exports["default"] = _default;
|
67
121
|
|
68
122
|
var Default = function Default() {
|
69
123
|
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Box, {
|
@@ -83,8 +137,6 @@ var Default = function Default() {
|
|
83
137
|
exports.Default = Default;
|
84
138
|
|
85
139
|
var Slider = function Slider(props) {
|
86
|
-
var _context, _context2, _context3, _context4;
|
87
|
-
|
88
140
|
var trackRef = _react["default"].useRef(null);
|
89
141
|
|
90
142
|
var numberFormatter = (0, _i18n.useNumberFormatter)(props.formatOptions);
|
@@ -100,37 +152,18 @@ var Slider = function Slider(props) {
|
|
100
152
|
|
101
153
|
var thumbPosition = state.getThumbPercent(0) * 100;
|
102
154
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, groupProps, {
|
103
|
-
sx:
|
104
|
-
position: 'relative',
|
105
|
-
alignItems: 'center',
|
106
|
-
width: '100%',
|
107
|
-
touchAction: 'none'
|
108
|
-
}
|
155
|
+
sx: sx.sliderContainer
|
109
156
|
}), (0, _react2.jsx)(_index.Box, {
|
110
|
-
sx:
|
111
|
-
alignSelf: 'stretch'
|
112
|
-
}
|
157
|
+
sx: sx.sliderOuterBox
|
113
158
|
}, props.label && (0, _react2.jsx)("label", labelProps, props.label), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, outputProps, {
|
114
|
-
sx:
|
115
|
-
flex: '1 0 auto',
|
116
|
-
textAlign: 'end'
|
117
|
-
}
|
159
|
+
sx: sx.sliderInnerBox
|
118
160
|
}), "(", state.getThumbValueLabel(0), ")")), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, trackProps, {
|
119
161
|
ref: trackRef,
|
120
|
-
sx:
|
121
|
-
position: 'relative',
|
122
|
-
height: 30,
|
123
|
-
width: ' 100%'
|
124
|
-
}
|
162
|
+
sx: sx.sliderBox
|
125
163
|
}), (0, _react2.jsx)(_index.Box, {
|
126
|
-
sx: {
|
127
|
-
|
128
|
-
|
129
|
-
height: 10,
|
130
|
-
borderRadius: '5px',
|
131
|
-
top: 13,
|
132
|
-
width: '100%'
|
133
|
-
}
|
164
|
+
sx: _objectSpread(_objectSpread({}, sx.slider), {}, {
|
165
|
+
backgroundImage: setSliderColor(thumbPosition)
|
166
|
+
})
|
134
167
|
}), (0, _react2.jsx)(Thumb, {
|
135
168
|
index: 0,
|
136
169
|
state: state,
|
@@ -155,37 +188,16 @@ var RangeSlider = function RangeSlider(props) {
|
|
155
188
|
outputProps = _useSlider2.outputProps;
|
156
189
|
|
157
190
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, groupProps, {
|
158
|
-
sx:
|
159
|
-
position: 'relative',
|
160
|
-
alignItems: 'center',
|
161
|
-
width: '100%',
|
162
|
-
touchAction: 'none'
|
163
|
-
}
|
191
|
+
sx: sx.sliderContainer
|
164
192
|
}), (0, _react2.jsx)(_index.Box, {
|
165
|
-
sx:
|
166
|
-
alignSelf: 'stretch'
|
167
|
-
}
|
193
|
+
sx: sx.sliderOuterBox
|
168
194
|
}, props.label && (0, _react2.jsx)("label", labelProps, props.label), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, outputProps, {
|
169
|
-
sx:
|
170
|
-
flex: '1 0 auto',
|
171
|
-
textAlign: 'end'
|
172
|
-
}
|
195
|
+
sx: sx.sliderInnerBox
|
173
196
|
}), "(", (0, _concat["default"])(_context5 = "".concat(state.getThumbValueLabel(0), ", ")).call(_context5, state.getThumbValueLabel(1)), ")")), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, trackProps, {
|
174
197
|
ref: trackRef,
|
175
|
-
sx:
|
176
|
-
position: 'relative',
|
177
|
-
height: 30,
|
178
|
-
width: ' 100%'
|
179
|
-
}
|
198
|
+
sx: sx.sliderBox
|
180
199
|
}), (0, _react2.jsx)(_index.Box, {
|
181
|
-
sx:
|
182
|
-
position: 'absolute',
|
183
|
-
backgroundImage: 'linear-gradient(to right, rgb(169, 215, 50) 10%, rgb(226, 215, 20) 50%, rgb(235, 44, 56) 90%)',
|
184
|
-
height: 10,
|
185
|
-
borderRadius: '5px',
|
186
|
-
top: 13,
|
187
|
-
width: '100%'
|
188
|
-
}
|
200
|
+
sx: sx.rangeSlider
|
189
201
|
}), (0, _react2.jsx)(Thumb, {
|
190
202
|
index: 0,
|
191
203
|
state: state,
|
@@ -217,22 +229,13 @@ var Thumb = function Thumb(props) {
|
|
217
229
|
isFocusVisible = _useFocusRing.isFocusVisible;
|
218
230
|
|
219
231
|
return (0, _react2.jsx)(_index.Box, {
|
220
|
-
sx: {
|
221
|
-
position: 'absolute',
|
222
|
-
top: 5,
|
223
|
-
transform: 'translateX(-50%)',
|
232
|
+
sx: _objectSpread(_objectSpread({}, sx.thumbContainer), {}, {
|
224
233
|
left: "".concat(state.getThumbPercent(index) * 100, "%")
|
225
|
-
}
|
234
|
+
})
|
226
235
|
}, (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({}, thumbProps, {
|
227
|
-
sx: {
|
228
|
-
width: 25,
|
229
|
-
height: 25,
|
230
|
-
borderRadius: '50%',
|
231
|
-
backgroundColor: 'white',
|
232
|
-
border: '1px solid #C1C5C8',
|
233
|
-
boxShadow: '0 2px 2px 0 #CACACA',
|
236
|
+
sx: _objectSpread(_objectSpread({}, sx.thumb), {}, {
|
234
237
|
outline: isFocusVisible ? '5px solid rgba(41,150,204,0.5)' : 'none'
|
235
|
-
}
|
238
|
+
})
|
236
239
|
}), (0, _react2.jsx)(_visuallyHidden.VisuallyHidden, null, (0, _react2.jsx)("input", (0, _extends2["default"])({
|
237
240
|
ref: inputRef
|
238
241
|
}, (0, _utils.mergeProps)(inputProps, focusProps))))));
|
@@ -56,7 +56,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
56
56
|
|
57
57
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
58
58
|
|
59
|
-
// See
|
59
|
+
// See ThemeUI docs on variants and themes for intended structure
|
60
60
|
// Variants should be defined in the approprate file.
|
61
61
|
var _default = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, checkbox), {}, {
|
62
62
|
comboBox: _comboBox["default"]
|
@@ -79,7 +79,7 @@ label.radio = _objectSpread(_objectSpread({}, _text.text.base), {}, {
|
|
79
79
|
cursor: 'pointer',
|
80
80
|
alignItems: 'center',
|
81
81
|
mb: 'xs'
|
82
|
-
}); // NOTE:
|
82
|
+
}); // NOTE: ThemeUI label adds 'flex' after other styles, so we have to use !important to override it
|
83
83
|
|
84
84
|
label.checkbox = _objectSpread(_objectSpread({}, _text.text.base), {}, {
|
85
85
|
display: 'inline-flex !important',
|
@@ -58,7 +58,7 @@ select.currentValue = {
|
|
58
58
|
overflow: 'hidden',
|
59
59
|
whiteSpace: 'nowrap',
|
60
60
|
textOverflow: 'ellipsis',
|
61
|
-
//
|
61
|
+
// ThemeUI adds display: flex after other styles and ellipsis goes away
|
62
62
|
display: 'inline !important'
|
63
63
|
};
|
64
64
|
select.listBoxPopup = _objectSpread(_objectSpread({}, _input.input), {}, {
|
@@ -23,7 +23,6 @@ import { FocusRing, useFocusRing } from '@react-aria/focus';
|
|
23
23
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
24
24
|
import { layoutInfoToStyle, VirtualizerItem } from '@react-aria/virtualizer';
|
25
25
|
import { useTableColumnResizeState, useTableState } from '@react-stately/table';
|
26
|
-
import { useStyleProps } from '@react-spectrum/utils';
|
27
26
|
import { TableLayout } from '@react-stately/layout';
|
28
27
|
import { useTable, useTableCell, useTableColumnHeader, useTableHeaderRow, useTableRow, useTableRowGroup } from '@react-aria/table';
|
29
28
|
import PropTypes from 'prop-types';
|
@@ -60,11 +59,9 @@ var ROW_HEIGHTS = {
|
|
60
59
|
*/
|
61
60
|
|
62
61
|
var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
63
|
-
var
|
64
|
-
|
65
|
-
|
66
|
-
styleProps = _useStyleProps.styleProps;
|
67
|
-
|
62
|
+
var width = props.width,
|
63
|
+
height = props.height,
|
64
|
+
onAction = props.onAction;
|
68
65
|
var direction = 'ltr'; // useLocale override
|
69
66
|
|
70
67
|
var scale = 'large'; // useProvider override
|
@@ -197,7 +194,9 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
197
194
|
style: {
|
198
195
|
whiteSpace: props.overflowMode === 'wrap' ? 'normal' : 'initial'
|
199
196
|
}
|
200
|
-
}, gridProps,
|
197
|
+
}, gridProps, {
|
198
|
+
width: width,
|
199
|
+
height: height,
|
201
200
|
layout: layout,
|
202
201
|
collection: state.collection,
|
203
202
|
focusedKey: state.selectionManager.focusedKey,
|
@@ -210,6 +209,30 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
210
209
|
getColumnWidth: columnState.getColumnWidth
|
211
210
|
})));
|
212
211
|
});
|
212
|
+
DataTable.propTypes = {
|
213
|
+
/**
|
214
|
+
* Sets the amount of vertical padding within each cell.
|
215
|
+
* density: 'compact' | 'regular' | 'spacious'
|
216
|
+
* @default 'regular'
|
217
|
+
*/
|
218
|
+
density: PropTypes.string,
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Sets the overflow behavior for the cell contents.
|
222
|
+
* overflowMode: 'wrap' | 'truncate'
|
223
|
+
* @default 'truncate'
|
224
|
+
*/
|
225
|
+
overflowMode: PropTypes.string,
|
226
|
+
|
227
|
+
/** Handler that is called when a user performs an action on a row. */
|
228
|
+
onAction: PropTypes.func,
|
229
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
230
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
231
|
+
};
|
232
|
+
DataTable.defaultProps = {
|
233
|
+
width: '100%',
|
234
|
+
height: 565
|
235
|
+
};
|
213
236
|
|
214
237
|
function TableHeader(_ref) {
|
215
238
|
var children = _ref.children,
|
@@ -378,24 +401,6 @@ function CenteredWrapper(_ref6) {
|
|
378
401
|
}, children));
|
379
402
|
}
|
380
403
|
|
381
|
-
DataTable.propTypes = {
|
382
|
-
/**
|
383
|
-
* Sets the amount of vertical padding within each cell.
|
384
|
-
* density: 'compact' | 'regular' | 'spacious'
|
385
|
-
* @default 'regular'
|
386
|
-
*/
|
387
|
-
density: PropTypes.string,
|
388
|
-
|
389
|
-
/**
|
390
|
-
* Sets the overflow behavior for the cell contents.
|
391
|
-
* overflowMode: 'wrap' | 'truncate'
|
392
|
-
* @default 'truncate'
|
393
|
-
*/
|
394
|
-
overflowMode: PropTypes.string,
|
395
|
-
|
396
|
-
/** Handler that is called when a user performs an action on a row. */
|
397
|
-
onAction: PropTypes.func
|
398
|
-
};
|
399
404
|
TableCell.propTypes = {
|
400
405
|
cell: PropTypes.shape({
|
401
406
|
column: PropTypes.shape({
|
package/lib/index.js
CHANGED
@@ -154,4 +154,4 @@ export { OverlayProvider, useOverlayPosition, useOverlayTrigger } from '@react-a
|
|
154
154
|
export { useOverlayTriggerState } from '@react-stately/overlays';
|
155
155
|
export { default as DataTable } from './components/DataTable';
|
156
156
|
export * from './components/DataTable';
|
157
|
-
export { Cell as DataTableCell, Column as DataTableColumn, Row as DataTableRow, TableBody as DataTableBody, TableHeader as DataTableHeader } from '@react-
|
157
|
+
export { Cell as DataTableCell, Column as DataTableColumn, Row as DataTableRow, TableBody as DataTableBody, TableHeader as DataTableHeader } from '@react-stately/table';
|
@@ -6,9 +6,9 @@ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-sta
|
|
6
6
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
7
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
8
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
10
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
11
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
12
12
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
14
|
|
@@ -27,6 +27,60 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
27
27
|
export default {
|
28
28
|
title: 'Recipes/Slider'
|
29
29
|
};
|
30
|
+
var sx = {
|
31
|
+
sliderContainer: {
|
32
|
+
position: 'relative',
|
33
|
+
alignItems: 'center',
|
34
|
+
width: '100%',
|
35
|
+
touchAction: 'none'
|
36
|
+
},
|
37
|
+
sliderInnerBox: {
|
38
|
+
flex: '1 0 auto',
|
39
|
+
textAlign: 'end'
|
40
|
+
},
|
41
|
+
sliderOuterBox: {
|
42
|
+
alignSelf: 'stretch'
|
43
|
+
},
|
44
|
+
sliderBox: {
|
45
|
+
position: 'relative',
|
46
|
+
height: 30,
|
47
|
+
width: ' 100%'
|
48
|
+
},
|
49
|
+
slider: {
|
50
|
+
position: 'absolute',
|
51
|
+
height: 10,
|
52
|
+
borderRadius: '5px',
|
53
|
+
top: 13,
|
54
|
+
width: '100%'
|
55
|
+
},
|
56
|
+
rangeSlider: {
|
57
|
+
position: 'absolute',
|
58
|
+
backgroundImage: 'linear-gradient(to right, rgb(169, 215, 50) 10%, rgb(226, 215, 20) 50%, rgb(235, 44, 56) 90%)',
|
59
|
+
height: 10,
|
60
|
+
borderRadius: '5px',
|
61
|
+
top: 13,
|
62
|
+
width: '100%'
|
63
|
+
},
|
64
|
+
thumbContainer: {
|
65
|
+
position: 'absolute',
|
66
|
+
top: 5,
|
67
|
+
transform: 'translateX(-50%)'
|
68
|
+
},
|
69
|
+
thumb: {
|
70
|
+
width: 25,
|
71
|
+
height: 25,
|
72
|
+
borderRadius: '50%',
|
73
|
+
backgroundColor: 'white',
|
74
|
+
border: '1px solid #C1C5C8',
|
75
|
+
boxShadow: '0 2px 2px 0 #CACACA'
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
var setSliderColor = function setSliderColor(thumbPosition) {
|
80
|
+
var _context, _context2, _context3, _context4;
|
81
|
+
|
82
|
+
return thumbPosition < 25 ? _concatInstanceProperty(_context = "linear-gradient(to right, rgb(169, 215, 50) 0%, rgb(169, 215, 50) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 25 && thumbPosition <= 49 ? _concatInstanceProperty(_context2 = "linear-gradient(to right, rgb(226, 215, 20) 0%, rgb(226, 215, 20) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context2, thumbPosition, "%, rgb(242, 242, 242) 100%)") : thumbPosition >= 50 && thumbPosition <= 74 ? _concatInstanceProperty(_context3 = "linear-gradient(to right, rgb(231, 135, 38) 0%, rgb(231, 135, 38) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context3, thumbPosition, "%, rgb(242, 242, 242) 100%)") : _concatInstanceProperty(_context4 = "linear-gradient(to right, rgb(235, 44, 56) 0%, rgb(235, 44, 56) ".concat(thumbPosition, "%, rgb(242, 242, 242) ")).call(_context4, thumbPosition, "%, rgb(242, 242, 242) 100%)");
|
83
|
+
};
|
30
84
|
/*
|
31
85
|
* The slider value can be formatted by using the `formatOptions` prop.
|
32
86
|
`* formatOptions` is compatible with the option parameter of
|
@@ -35,6 +89,7 @@ export default {
|
|
35
89
|
* https://react-spectrum.adobe.com/react-aria/useSlider.html
|
36
90
|
*/
|
37
91
|
|
92
|
+
|
38
93
|
export var Default = function Default() {
|
39
94
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
40
95
|
mb: "xl"
|
@@ -51,8 +106,6 @@ export var Default = function Default() {
|
|
51
106
|
};
|
52
107
|
|
53
108
|
var Slider = function Slider(props) {
|
54
|
-
var _context, _context2, _context3, _context4;
|
55
|
-
|
56
109
|
var trackRef = React.useRef(null);
|
57
110
|
var numberFormatter = useNumberFormatter(props.formatOptions);
|
58
111
|
var state = useSliderState(_objectSpread(_objectSpread({}, props), {}, {
|
@@ -67,37 +120,18 @@ var Slider = function Slider(props) {
|
|
67
120
|
|
68
121
|
var thumbPosition = state.getThumbPercent(0) * 100;
|
69
122
|
return ___EmotionJSX(Box, _extends({}, groupProps, {
|
70
|
-
sx:
|
71
|
-
position: 'relative',
|
72
|
-
alignItems: 'center',
|
73
|
-
width: '100%',
|
74
|
-
touchAction: 'none'
|
75
|
-
}
|
123
|
+
sx: sx.sliderContainer
|
76
124
|
}), ___EmotionJSX(Box, {
|
77
|
-
sx:
|
78
|
-
alignSelf: 'stretch'
|
79
|
-
}
|
125
|
+
sx: sx.sliderOuterBox
|
80
126
|
}, props.label && ___EmotionJSX("label", labelProps, props.label), ___EmotionJSX(Box, _extends({}, outputProps, {
|
81
|
-
sx:
|
82
|
-
flex: '1 0 auto',
|
83
|
-
textAlign: 'end'
|
84
|
-
}
|
127
|
+
sx: sx.sliderInnerBox
|
85
128
|
}), "(", state.getThumbValueLabel(0), ")")), ___EmotionJSX(Box, _extends({}, trackProps, {
|
86
129
|
ref: trackRef,
|
87
|
-
sx:
|
88
|
-
position: 'relative',
|
89
|
-
height: 30,
|
90
|
-
width: ' 100%'
|
91
|
-
}
|
130
|
+
sx: sx.sliderBox
|
92
131
|
}), ___EmotionJSX(Box, {
|
93
|
-
sx: {
|
94
|
-
|
95
|
-
|
96
|
-
height: 10,
|
97
|
-
borderRadius: '5px',
|
98
|
-
top: 13,
|
99
|
-
width: '100%'
|
100
|
-
}
|
132
|
+
sx: _objectSpread(_objectSpread({}, sx.slider), {}, {
|
133
|
+
backgroundImage: setSliderColor(thumbPosition)
|
134
|
+
})
|
101
135
|
}), ___EmotionJSX(Thumb, {
|
102
136
|
index: 0,
|
103
137
|
state: state,
|
@@ -121,37 +155,16 @@ var RangeSlider = function RangeSlider(props) {
|
|
121
155
|
outputProps = _useSlider2.outputProps;
|
122
156
|
|
123
157
|
return ___EmotionJSX(Box, _extends({}, groupProps, {
|
124
|
-
sx:
|
125
|
-
position: 'relative',
|
126
|
-
alignItems: 'center',
|
127
|
-
width: '100%',
|
128
|
-
touchAction: 'none'
|
129
|
-
}
|
158
|
+
sx: sx.sliderContainer
|
130
159
|
}), ___EmotionJSX(Box, {
|
131
|
-
sx:
|
132
|
-
alignSelf: 'stretch'
|
133
|
-
}
|
160
|
+
sx: sx.sliderOuterBox
|
134
161
|
}, props.label && ___EmotionJSX("label", labelProps, props.label), ___EmotionJSX(Box, _extends({}, outputProps, {
|
135
|
-
sx:
|
136
|
-
flex: '1 0 auto',
|
137
|
-
textAlign: 'end'
|
138
|
-
}
|
162
|
+
sx: sx.sliderInnerBox
|
139
163
|
}), "(", _concatInstanceProperty(_context5 = "".concat(state.getThumbValueLabel(0), ", ")).call(_context5, state.getThumbValueLabel(1)), ")")), ___EmotionJSX(Box, _extends({}, trackProps, {
|
140
164
|
ref: trackRef,
|
141
|
-
sx:
|
142
|
-
position: 'relative',
|
143
|
-
height: 30,
|
144
|
-
width: ' 100%'
|
145
|
-
}
|
165
|
+
sx: sx.sliderBox
|
146
166
|
}), ___EmotionJSX(Box, {
|
147
|
-
sx:
|
148
|
-
position: 'absolute',
|
149
|
-
backgroundImage: 'linear-gradient(to right, rgb(169, 215, 50) 10%, rgb(226, 215, 20) 50%, rgb(235, 44, 56) 90%)',
|
150
|
-
height: 10,
|
151
|
-
borderRadius: '5px',
|
152
|
-
top: 13,
|
153
|
-
width: '100%'
|
154
|
-
}
|
167
|
+
sx: sx.rangeSlider
|
155
168
|
}), ___EmotionJSX(Thumb, {
|
156
169
|
index: 0,
|
157
170
|
state: state,
|
@@ -182,22 +195,13 @@ var Thumb = function Thumb(props) {
|
|
182
195
|
isFocusVisible = _useFocusRing.isFocusVisible;
|
183
196
|
|
184
197
|
return ___EmotionJSX(Box, {
|
185
|
-
sx: {
|
186
|
-
position: 'absolute',
|
187
|
-
top: 5,
|
188
|
-
transform: 'translateX(-50%)',
|
198
|
+
sx: _objectSpread(_objectSpread({}, sx.thumbContainer), {}, {
|
189
199
|
left: "".concat(state.getThumbPercent(index) * 100, "%")
|
190
|
-
}
|
200
|
+
})
|
191
201
|
}, ___EmotionJSX(Box, _extends({}, thumbProps, {
|
192
|
-
sx: {
|
193
|
-
width: 25,
|
194
|
-
height: 25,
|
195
|
-
borderRadius: '50%',
|
196
|
-
backgroundColor: 'white',
|
197
|
-
border: '1px solid #C1C5C8',
|
198
|
-
boxShadow: '0 2px 2px 0 #CACACA',
|
202
|
+
sx: _objectSpread(_objectSpread({}, sx.thumb), {}, {
|
199
203
|
outline: isFocusVisible ? '5px solid rgba(41,150,204,0.5)' : 'none'
|
200
|
-
}
|
204
|
+
})
|
201
205
|
}), ___EmotionJSX(VisuallyHidden, null, ___EmotionJSX("input", _extends({
|
202
206
|
ref: inputRef
|
203
207
|
}, mergeProps(inputProps, focusProps))))));
|
@@ -21,7 +21,7 @@ import search from './search';
|
|
21
21
|
import * as select from './select';
|
22
22
|
import * as switchable from './switch'; // 'switch' is a reserved keyword
|
23
23
|
|
24
|
-
import * as textarea from './textarea'; // See
|
24
|
+
import * as textarea from './textarea'; // See ThemeUI docs on variants and themes for intended structure
|
25
25
|
// Variants should be defined in the approprate file.
|
26
26
|
|
27
27
|
export default _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, checkbox), {}, {
|