@bolio-ui/core 1.0.2 → 1.0.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.
@@ -0,0 +1,1139 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var styledJsx_cjs = require('../styled-jsx.cjs.js');
6
+ var React = require('react');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
11
+
12
+ function ownKeys(object, enumerableOnly) {
13
+ var keys = Object.keys(object);
14
+
15
+ if (Object.getOwnPropertySymbols) {
16
+ var symbols = Object.getOwnPropertySymbols(object);
17
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
18
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19
+ })), keys.push.apply(keys, symbols);
20
+ }
21
+
22
+ return keys;
23
+ }
24
+
25
+ function _objectSpread2(target) {
26
+ for (var i = 1; i < arguments.length; i++) {
27
+ var source = null != arguments[i] ? arguments[i] : {};
28
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
29
+ _defineProperty(target, key, source[key]);
30
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
31
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
32
+ });
33
+ }
34
+
35
+ return target;
36
+ }
37
+
38
+ function _typeof(obj) {
39
+ "@babel/helpers - typeof";
40
+
41
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
42
+ return typeof obj;
43
+ } : function (obj) {
44
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
45
+ }, _typeof(obj);
46
+ }
47
+
48
+ function _defineProperty(obj, key, value) {
49
+ if (key in obj) {
50
+ Object.defineProperty(obj, key, {
51
+ value: value,
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true
55
+ });
56
+ } else {
57
+ obj[key] = value;
58
+ }
59
+
60
+ return obj;
61
+ }
62
+
63
+ function _extends() {
64
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
65
+ for (var i = 1; i < arguments.length; i++) {
66
+ var source = arguments[i];
67
+
68
+ for (var key in source) {
69
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
70
+ target[key] = source[key];
71
+ }
72
+ }
73
+ }
74
+
75
+ return target;
76
+ };
77
+ return _extends.apply(this, arguments);
78
+ }
79
+
80
+ function _objectWithoutPropertiesLoose(source, excluded) {
81
+ if (source == null) return {};
82
+ var target = {};
83
+ var sourceKeys = Object.keys(source);
84
+ var key, i;
85
+
86
+ for (i = 0; i < sourceKeys.length; i++) {
87
+ key = sourceKeys[i];
88
+ if (excluded.indexOf(key) >= 0) continue;
89
+ target[key] = source[key];
90
+ }
91
+
92
+ return target;
93
+ }
94
+
95
+ function _objectWithoutProperties(source, excluded) {
96
+ if (source == null) return {};
97
+
98
+ var target = _objectWithoutPropertiesLoose(source, excluded);
99
+
100
+ var key, i;
101
+
102
+ if (Object.getOwnPropertySymbols) {
103
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
104
+
105
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
106
+ key = sourceSymbolKeys[i];
107
+ if (excluded.indexOf(key) >= 0) continue;
108
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
109
+ target[key] = source[key];
110
+ }
111
+ }
112
+
113
+ return target;
114
+ }
115
+
116
+ function _slicedToArray(arr, i) {
117
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
118
+ }
119
+
120
+ function _toConsumableArray(arr) {
121
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
122
+ }
123
+
124
+ function _arrayWithoutHoles(arr) {
125
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
126
+ }
127
+
128
+ function _arrayWithHoles(arr) {
129
+ if (Array.isArray(arr)) return arr;
130
+ }
131
+
132
+ function _iterableToArray(iter) {
133
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
134
+ }
135
+
136
+ function _iterableToArrayLimit(arr, i) {
137
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
138
+
139
+ if (_i == null) return;
140
+ var _arr = [];
141
+ var _n = true;
142
+ var _d = false;
143
+
144
+ var _s, _e;
145
+
146
+ try {
147
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
148
+ _arr.push(_s.value);
149
+
150
+ if (i && _arr.length === i) break;
151
+ }
152
+ } catch (err) {
153
+ _d = true;
154
+ _e = err;
155
+ } finally {
156
+ try {
157
+ if (!_n && _i["return"] != null) _i["return"]();
158
+ } finally {
159
+ if (_d) throw _e;
160
+ }
161
+ }
162
+
163
+ return _arr;
164
+ }
165
+
166
+ function _unsupportedIterableToArray(o, minLen) {
167
+ if (!o) return;
168
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
169
+ var n = Object.prototype.toString.call(o).slice(8, -1);
170
+ if (n === "Object" && o.constructor) n = o.constructor.name;
171
+ if (n === "Map" || n === "Set") return Array.from(o);
172
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
173
+ }
174
+
175
+ function _arrayLikeToArray(arr, len) {
176
+ if (len == null || len > arr.length) len = arr.length;
177
+
178
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
179
+
180
+ return arr2;
181
+ }
182
+
183
+ function _nonIterableSpread() {
184
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
185
+ }
186
+
187
+ function _nonIterableRest() {
188
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
189
+ }
190
+
191
+ function _createForOfIteratorHelper(o, allowArrayLike) {
192
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
193
+
194
+ if (!it) {
195
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
196
+ if (it) o = it;
197
+ var i = 0;
198
+
199
+ var F = function () {};
200
+
201
+ return {
202
+ s: F,
203
+ n: function () {
204
+ if (i >= o.length) return {
205
+ done: true
206
+ };
207
+ return {
208
+ done: false,
209
+ value: o[i++]
210
+ };
211
+ },
212
+ e: function (e) {
213
+ throw e;
214
+ },
215
+ f: F
216
+ };
217
+ }
218
+
219
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
220
+ }
221
+
222
+ var normalCompletion = true,
223
+ didErr = false,
224
+ err;
225
+ return {
226
+ s: function () {
227
+ it = it.call(o);
228
+ },
229
+ n: function () {
230
+ var step = it.next();
231
+ normalCompletion = step.done;
232
+ return step;
233
+ },
234
+ e: function (e) {
235
+ didErr = true;
236
+ err = e;
237
+ },
238
+ f: function () {
239
+ try {
240
+ if (!normalCompletion && it.return != null) it.return();
241
+ } finally {
242
+ if (didErr) throw err;
243
+ }
244
+ }
245
+ };
246
+ }
247
+
248
+ var defaultFont = {
249
+ sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
250
+ mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
251
+ prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
252
+ };
253
+ var defaultBreakpoints = {
254
+ xs: {
255
+ min: '0',
256
+ max: '650px'
257
+ },
258
+ sm: {
259
+ min: '650px',
260
+ max: '900px'
261
+ },
262
+ md: {
263
+ min: '900px',
264
+ max: '1280px'
265
+ },
266
+ lg: {
267
+ min: '1280px',
268
+ max: '1920px'
269
+ },
270
+ xl: {
271
+ min: '1920px',
272
+ max: '10000px'
273
+ }
274
+ };
275
+ var defaultLayout = {
276
+ gap: '16pt',
277
+ gapNegative: '-16pt',
278
+ gapHalf: '8pt',
279
+ gapHalfNegative: '-8pt',
280
+ gapQuarter: '4pt',
281
+ gapQuarterNegative: '-4pt',
282
+ pageMargin: '16pt',
283
+ pageWidth: '900pt',
284
+ pageWidthWithMargin: '930pt',
285
+ breakpointMobile: defaultBreakpoints.xs.max,
286
+ breakpointTablet: defaultBreakpoints.sm.max,
287
+ radius: '6px',
288
+ unit: '16px'
289
+ };
290
+
291
+ var palette$1 = {
292
+ background: '#fff',
293
+ foreground: '#000',
294
+ accents_1: '#fafafa',
295
+ accents_2: '#eaeaea',
296
+ accents_3: '#999',
297
+ accents_4: '#888',
298
+ accents_5: '#666',
299
+ accents_6: '#444',
300
+ accents_7: '#333',
301
+ accents_8: '#111',
302
+ selection: '#cee4fe',
303
+ code: '#C25FFF',
304
+ border: '#eaeaea',
305
+ primary: '#0072F6',
306
+ primaryLight: '#96C1F3',
307
+ primaryLighter: '#CEE4FF',
308
+ primaryDark: '#00254E',
309
+ secondary: '#7828C9',
310
+ secondaryLighter: '#D1B1F1',
311
+ secondaryLight: '#EADCF9',
312
+ secondaryDark: '#290E45',
313
+ error: '#F31261',
314
+ errorLight: '#FAA8C6',
315
+ errorLighter: '#FDD8E6',
316
+ errorDark: '#4E041F',
317
+ success: '#17C965',
318
+ successLight: '#ADF5CD',
319
+ successLighter: '#DAFBE9',
320
+ successDark: '#06371C',
321
+ warning: '#F5A525',
322
+ warningLight: '#FBDBA8',
323
+ warningLighter: '#FDEFD9',
324
+ warningDark: '#4E3105',
325
+ info: '#06B7DC',
326
+ infoLighter: '#A5EEFE',
327
+ infoLight: '#D7F8FF',
328
+ infoDark: '#053B49',
329
+ purple: '#f81ce5',
330
+ alert: '#ff0080',
331
+ link: '#0070f3',
332
+ pre: '#363450'
333
+ };
334
+ var expressiveness$1 = {
335
+ linkStyle: 'none',
336
+ linkHoverStyle: 'none',
337
+ dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
338
+ scrollerStart: 'rgba(255, 255, 255, 1)',
339
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
340
+ shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
341
+ shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
342
+ shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
343
+ portalOpacity: 0.25
344
+ };
345
+ var font$1 = defaultFont;
346
+ var breakpoints$1 = defaultBreakpoints;
347
+ var layout$1 = defaultLayout;
348
+ var themes$1 = {
349
+ type: 'light',
350
+ font: font$1,
351
+ layout: layout$1,
352
+ palette: palette$1,
353
+ breakpoints: breakpoints$1,
354
+ expressiveness: expressiveness$1
355
+ };
356
+ var lightTheme = themes$1;
357
+
358
+ var palette = {
359
+ background: '#000',
360
+ foreground: '#fff',
361
+ accents_1: '#111',
362
+ accents_2: '#333',
363
+ accents_3: '#444',
364
+ accents_4: '#666',
365
+ accents_5: '#888',
366
+ accents_6: '#999',
367
+ accents_7: '#eaeaea',
368
+ accents_8: '#fafafa',
369
+ selection: '#f81ce5',
370
+ code: '#C25FFF',
371
+ border: '#333',
372
+ primary: '#0072F6',
373
+ primaryLight: '#96C1F3',
374
+ primaryLighter: '#CEE4FF',
375
+ primaryDark: '#00254E',
376
+ secondary: '#7828C9',
377
+ secondaryLighter: '#D1B1F1',
378
+ secondaryLight: '#EADCF9',
379
+ secondaryDark: '#290E45',
380
+ error: '#F31261',
381
+ errorLight: '#FAA8C6',
382
+ errorLighter: '#FDD8E6',
383
+ errorDark: '#4E041F',
384
+ success: '#17C965',
385
+ successLight: '#ADF5CD',
386
+ successLighter: '#DAFBE9',
387
+ successDark: '#06371C',
388
+ warning: '#F5A525',
389
+ warningLight: '#FBDBA8',
390
+ warningLighter: '#FDEFD9',
391
+ warningDark: '#4E3105',
392
+ info: '#06B7DC',
393
+ infoLighter: '#A5EEFE',
394
+ infoLight: '#D7F8FF',
395
+ infoDark: '#053B49',
396
+ purple: '#f81ce5',
397
+ alert: '#ff0080',
398
+ link: '#3291ff',
399
+ pre: '#363450'
400
+ };
401
+ var expressiveness = {
402
+ linkStyle: 'none',
403
+ linkHoverStyle: 'none',
404
+ dropdownBoxShadow: '0 0 0 1px #333',
405
+ scrollerStart: 'rgba(255, 255, 255, 1)',
406
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
407
+ shadowSmall: '0 0 0 1px #333',
408
+ shadowMedium: '0 0 0 1px #333',
409
+ shadowLarge: '0 0 0 1px #333',
410
+ portalOpacity: 0.75
411
+ };
412
+ var font = defaultFont;
413
+ var breakpoints = defaultBreakpoints;
414
+ var layout = defaultLayout;
415
+ var themes = {
416
+ type: 'dark',
417
+ font: font,
418
+ layout: layout,
419
+ palette: palette,
420
+ breakpoints: breakpoints,
421
+ expressiveness: expressiveness
422
+ };
423
+ var darkTheme = themes;
424
+
425
+ var isObject = function isObject(target) {
426
+ return target && _typeof(target) === 'object';
427
+ };
428
+ var deepDuplicable = function deepDuplicable(source, target) {
429
+ if (!isObject(target) || !isObject(source)) return source;
430
+ var sourceKeys = Object.keys(source);
431
+ var result = {};
432
+
433
+ for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
434
+ var key = _sourceKeys[_i];
435
+ var sourceValue = source[key];
436
+ var targetValue = target[key];
437
+
438
+ if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
439
+ result[key] = targetValue.concat(sourceValue);
440
+ } else if (isObject(sourceValue) && isObject(targetValue)) {
441
+ result[key] = deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
442
+ } else if (targetValue) {
443
+ result[key] = targetValue;
444
+ } else {
445
+ result[key] = sourceValue;
446
+ }
447
+ }
448
+
449
+ return result;
450
+ };
451
+
452
+ var getPresets = function getPresets() {
453
+ return [lightTheme, darkTheme];
454
+ };
455
+
456
+ var getPresetStaticTheme = function getPresetStaticTheme() {
457
+ return lightTheme;
458
+ };
459
+
460
+ var isAvailableThemeType = function isAvailableThemeType(type) {
461
+ if (!type) return false;
462
+ var presetThemes = getPresets();
463
+ var hasType = presetThemes.find(function (theme) {
464
+ return theme.type === type;
465
+ });
466
+ return !hasType;
467
+ };
468
+
469
+ var isPresetTheme = function isPresetTheme(themeOrType) {
470
+ if (!themeOrType) return false;
471
+ var isType = typeof themeOrType === 'string';
472
+ var type = isType ? themeOrType : themeOrType.type;
473
+ return !isAvailableThemeType(type);
474
+ };
475
+
476
+ var hasUserCustomTheme = function hasUserCustomTheme() {
477
+ var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
478
+ return !!themes.find(function (item) {
479
+ return isAvailableThemeType(item.type);
480
+ });
481
+ };
482
+
483
+ var create = function create(base, custom) {
484
+ if (!isAvailableThemeType(custom.type)) {
485
+ throw new Error('Duplicate or unavailable theme type');
486
+ }
487
+
488
+ return deepDuplicable(base, custom);
489
+ };
490
+
491
+ var createFromDark = function createFromDark(custom) {
492
+ return create(darkTheme, custom);
493
+ };
494
+
495
+ var createFromLight = function createFromLight(custom) {
496
+ return create(lightTheme, custom);
497
+ };
498
+
499
+ var Themes = {
500
+ isPresetTheme: isPresetTheme,
501
+ isAvailableThemeType: isAvailableThemeType,
502
+ hasUserCustomTheme: hasUserCustomTheme,
503
+ getPresets: getPresets,
504
+ getPresetStaticTheme: getPresetStaticTheme,
505
+ create: create,
506
+ createFromDark: createFromDark,
507
+ createFromLight: createFromLight
508
+ };
509
+ var Themes$1 = Themes;
510
+
511
+ var defaultTheme = Themes$1.getPresetStaticTheme();
512
+ var ThemeContext = /*#__PURE__*/React__default["default"].createContext(defaultTheme);
513
+ var useTheme$1 = function useTheme() {
514
+ return React__default["default"].useContext(ThemeContext);
515
+ };
516
+
517
+ var useTheme = useTheme$1;
518
+
519
+ var defaultProps$3 = {
520
+ className: ''
521
+ };
522
+
523
+ var makeColgroup = function makeColgroup(width, columns) {
524
+ var unsetWidthCount = columns.filter(function (c) {
525
+ return !c.width;
526
+ }).length;
527
+ var customWidthTotal = columns.reduce(function (pre, current) {
528
+ return current.width ? pre + current.width : pre;
529
+ }, 0);
530
+ var averageWidth = (width - customWidthTotal) / unsetWidthCount;
531
+ if (averageWidth <= 0) return /*#__PURE__*/React__default["default"].createElement("colgroup", null);
532
+ return /*#__PURE__*/React__default["default"].createElement("colgroup", null, columns.map(function (column, index) {
533
+ return /*#__PURE__*/React__default["default"].createElement("col", {
534
+ key: "colgroup-".concat(index),
535
+ width: column.width || averageWidth
536
+ });
537
+ }));
538
+ };
539
+
540
+ var TableHead = function TableHead(props) {
541
+ var theme = useTheme();
542
+ var _ref = props,
543
+ columns = _ref.columns,
544
+ width = _ref.width;
545
+ var isScalableWidth = React.useMemo(function () {
546
+ return columns.find(function (item) {
547
+ return !!item.width;
548
+ });
549
+ }, [columns]);
550
+ var colgroup = React.useMemo(function () {
551
+ if (!isScalableWidth) return /*#__PURE__*/React__default["default"].createElement("colgroup", null);
552
+ return makeColgroup(width, columns);
553
+ }, [isScalableWidth, width]);
554
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, colgroup, /*#__PURE__*/React__default["default"].createElement("thead", {
555
+ className: styledJsx_cjs.style.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
556
+ }, /*#__PURE__*/React__default["default"].createElement("tr", {
557
+ className: styledJsx_cjs.style.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
558
+ }, columns.map(function (column, index) {
559
+ return /*#__PURE__*/React__default["default"].createElement("th", {
560
+ key: "table-th-".concat(column.prop, "-").concat(index),
561
+ className: styledJsx_cjs.style.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + (column.className || "")
562
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
563
+ className: styledJsx_cjs.style.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + "thead-box"
564
+ }, column.label));
565
+ }))), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
566
+ id: "134865897",
567
+ dynamic: [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]
568
+ }, "thead.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;font-size:inherit;}th.__jsx-style-dynamic-selector{padding:0 0.5em;font-size:calc(0.75 * var(--table-font-size));font-weight:normal;text-align:left;-webkit-letter-spacing:0;-moz-letter-spacing:0;-ms-letter-spacing:0;letter-spacing:0;vertical-align:middle;min-height:calc(2.5 * var(--table-font-size));color:".concat(theme.palette.accents_5, ";background:").concat(theme.palette.accents_1, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-radius:0;}th.__jsx-style-dynamic-selector:nth-child(1){border-bottom:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}th.__jsx-style-dynamic-selector:last-child{border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.thead-box.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-align:center;min-height:calc(2.5 * var(--table-font-size));text-transform:uppercase;}")));
569
+ };
570
+
571
+ TableHead.defaultProps = defaultProps$3;
572
+ TableHead.displayName = 'BolioUITableHead';
573
+ var TableHead$1 = TableHead;
574
+
575
+ var TableCell = function TableCell(_ref) {
576
+ var columns = _ref.columns,
577
+ row = _ref.row,
578
+ rowIndex = _ref.rowIndex,
579
+ emptyText = _ref.emptyText,
580
+ onCellClick = _ref.onCellClick;
581
+
582
+ /* eslint-disable react/jsx-no-useless-fragment */
583
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, columns.map(function (column, index) {
584
+ var currentRowValue = row[column.prop];
585
+ var cellValue = currentRowValue || emptyText;
586
+ var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
587
+ return /*#__PURE__*/React__default["default"].createElement("td", {
588
+ key: "row-td-".concat(index, "-").concat(column.prop),
589
+ onClick: function onClick() {
590
+ return onCellClick && onCellClick(currentRowValue, rowIndex, index);
591
+ },
592
+ className: column.className
593
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
594
+ className: "cell"
595
+ }, shouldBeRenderElement ? shouldBeRenderElement : cellValue));
596
+ }));
597
+ /* eslint-enable */
598
+ };
599
+
600
+ var TableCell$1 = TableCell;
601
+
602
+ var defaultContext$1 = {
603
+ columns: [],
604
+ updateColumn: function updateColumn() {}
605
+ };
606
+ var TableContext = /*#__PURE__*/React__default["default"].createContext(defaultContext$1);
607
+ var useTableContext = function useTableContext() {
608
+ return React__default["default"].useContext(TableContext);
609
+ };
610
+
611
+ var classObjectToString = function classObjectToString(className) {
612
+ var keys = Object.keys(className);
613
+ var len = keys.length;
614
+ var str = '';
615
+
616
+ for (var index = 0; index < len; index++) {
617
+ var key = keys[index];
618
+ var val = className[keys[index]];
619
+ if (!val) continue;
620
+ str = str ? "".concat(str, " ").concat(String(key)) : String(key);
621
+ }
622
+
623
+ return str;
624
+ };
625
+
626
+ var isObjectClassName = function isObjectClassName(value) {
627
+ return _typeof(value) === 'object' && !Array.isArray(value);
628
+ };
629
+
630
+ var useClasses = function useClasses() {
631
+ var len = arguments.length;
632
+ var classes = '';
633
+ if (len === 0) return classes;
634
+
635
+ for (var index = 0; index < len; index++) {
636
+ var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
637
+ if (!val) continue;
638
+
639
+ if (isObjectClassName(val)) {
640
+ classes += " ".concat(classObjectToString(val));
641
+ } else {
642
+ classes += " ".concat(String(val).trim());
643
+ }
644
+ }
645
+
646
+ return classes.trim();
647
+ };
648
+
649
+ var useClasses$1 = useClasses;
650
+
651
+ var defaultProps$2 = {
652
+ className: ''
653
+ };
654
+
655
+ var TableBody = function TableBody(_ref) {
656
+ var data = _ref.data,
657
+ hover = _ref.hover,
658
+ emptyText = _ref.emptyText,
659
+ onRow = _ref.onRow,
660
+ onCell = _ref.onCell,
661
+ rowClassName = _ref.rowClassName;
662
+ var theme = useTheme();
663
+
664
+ var _useTableContext = useTableContext(),
665
+ columns = _useTableContext.columns;
666
+
667
+ var rowClickHandler = function rowClickHandler(row, index) {
668
+ onRow && onRow(row, index);
669
+ };
670
+
671
+ return /*#__PURE__*/React__default["default"].createElement("tbody", {
672
+ className: styledJsx_cjs.style.dynamic([["3433300570", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
673
+ }, data.map(function (row, index) {
674
+ var className = rowClassName(row, index);
675
+ return /*#__PURE__*/React__default["default"].createElement("tr", {
676
+ key: "tbody-row-".concat(index),
677
+ onClick: function onClick() {
678
+ return rowClickHandler(row, index);
679
+ },
680
+ className: styledJsx_cjs.style.dynamic([["3433300570", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]]) + " " + (useClasses$1({
681
+ hover: hover
682
+ }, className) || "")
683
+ }, /*#__PURE__*/React__default["default"].createElement(TableCell$1, {
684
+ columns: columns,
685
+ row: row,
686
+ rowIndex: index,
687
+ emptyText: emptyText,
688
+ onCellClick: onCell
689
+ }));
690
+ }), /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
691
+ id: "3433300570",
692
+ dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
693
+ }, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(3.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
694
+ };
695
+
696
+ TableBody.defaultProps = defaultProps$2;
697
+ TableBody.displayName = 'BolioUITableBody';
698
+ var TableBody$1 = TableBody;
699
+
700
+ var getRealShape = function getRealShape(el) {
701
+ var defaultShape = {
702
+ width: 0,
703
+ height: 0
704
+ };
705
+ if (!el || typeof window === 'undefined') return defaultShape;
706
+ var rect = el.getBoundingClientRect();
707
+
708
+ var _window$getComputedSt = window.getComputedStyle(el),
709
+ width = _window$getComputedSt.width,
710
+ height = _window$getComputedSt.height;
711
+
712
+ var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
713
+ if (!str) return 0;
714
+ var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
715
+ return Number.isNaN(+strVal) ? 0 : +strVal;
716
+ };
717
+
718
+ return {
719
+ width: getCSSStyleVal("".concat(width), rect.width),
720
+ height: getCSSStyleVal("".concat(height), rect.height)
721
+ };
722
+ };
723
+
724
+ var useRealShape = function useRealShape(ref) {
725
+ var _useState = React.useState({
726
+ width: 0,
727
+ height: 0
728
+ }),
729
+ _useState2 = _slicedToArray(_useState, 2),
730
+ state = _useState2[0],
731
+ setState = _useState2[1];
732
+
733
+ var update = function update() {
734
+ var _getRealShape = getRealShape(ref.current),
735
+ width = _getRealShape.width,
736
+ height = _getRealShape.height;
737
+
738
+ setState({
739
+ width: width,
740
+ height: height
741
+ });
742
+ };
743
+
744
+ React.useEffect(function () {
745
+ return update();
746
+ }, [ref.current]);
747
+ return [state, update];
748
+ };
749
+
750
+ var useRealShape$1 = useRealShape;
751
+
752
+ var useResize = function useResize(callback) {
753
+ var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
754
+ React.useEffect(function () {
755
+ var fn = function fn() {
756
+ return callback();
757
+ };
758
+
759
+ if (immediatelyInvoke) {
760
+ fn();
761
+ }
762
+
763
+ window.addEventListener('resize', fn);
764
+ return function () {
765
+ return window.removeEventListener('resize', fn);
766
+ };
767
+ }, []);
768
+ };
769
+
770
+ var useResize$1 = useResize;
771
+
772
+ var ScalePropKeys = ['width', 'height', 'padding', 'margin', 'w', 'h', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'pl', 'pr', 'pt', 'pb', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom', 'ml', 'mr', 'mt', 'mb', 'px', 'py', 'mx', 'my', 'font', 'unit', 'scale'];
773
+
774
+ var defaultDynamicLayoutPipe = function defaultDynamicLayoutPipe(scale1x) {
775
+ return "".concat(scale1x);
776
+ };
777
+
778
+ var defaultContext = {
779
+ getScaleProps: function getScaleProps() {
780
+ return undefined;
781
+ },
782
+ getAllScaleProps: function getAllScaleProps() {
783
+ return {};
784
+ },
785
+ SCALES: {
786
+ pl: defaultDynamicLayoutPipe,
787
+ pr: defaultDynamicLayoutPipe,
788
+ pb: defaultDynamicLayoutPipe,
789
+ pt: defaultDynamicLayoutPipe,
790
+ px: defaultDynamicLayoutPipe,
791
+ py: defaultDynamicLayoutPipe,
792
+ mb: defaultDynamicLayoutPipe,
793
+ ml: defaultDynamicLayoutPipe,
794
+ mr: defaultDynamicLayoutPipe,
795
+ mt: defaultDynamicLayoutPipe,
796
+ mx: defaultDynamicLayoutPipe,
797
+ my: defaultDynamicLayoutPipe,
798
+ width: defaultDynamicLayoutPipe,
799
+ height: defaultDynamicLayoutPipe,
800
+ font: defaultDynamicLayoutPipe
801
+ },
802
+ unit: '16px'
803
+ };
804
+ var ScaleContext = /*#__PURE__*/React__default["default"].createContext(defaultContext);
805
+ var useScale$1 = function useScale() {
806
+ return React__default["default"].useContext(ScaleContext);
807
+ };
808
+
809
+ var isCSSNumberValue = function isCSSNumberValue(value) {
810
+ return value !== undefined && !Number.isNaN(+value);
811
+ };
812
+
813
+ var generateGetScaleProps = function generateGetScaleProps(props) {
814
+ var getScaleProps = function getScaleProps(keyOrKeys) {
815
+ if (!Array.isArray(keyOrKeys)) return props[keyOrKeys];
816
+ var value = undefined;
817
+
818
+ var _iterator = _createForOfIteratorHelper(keyOrKeys),
819
+ _step;
820
+
821
+ try {
822
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
823
+ var key = _step.value;
824
+ var currentValue = props[key];
825
+
826
+ if (typeof currentValue !== 'undefined') {
827
+ value = currentValue;
828
+ }
829
+ }
830
+ } catch (err) {
831
+ _iterator.e(err);
832
+ } finally {
833
+ _iterator.f();
834
+ }
835
+
836
+ return value;
837
+ };
838
+
839
+ return getScaleProps;
840
+ };
841
+ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
842
+ var getAllScaleProps = function getAllScaleProps() {
843
+ var scaleProps = {};
844
+
845
+ var _iterator2 = _createForOfIteratorHelper(ScalePropKeys),
846
+ _step2;
847
+
848
+ try {
849
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
850
+ var key = _step2.value;
851
+ var value = props[key];
852
+
853
+ if (typeof value !== 'undefined') {
854
+ scaleProps[key] = value;
855
+ }
856
+ }
857
+ } catch (err) {
858
+ _iterator2.e(err);
859
+ } finally {
860
+ _iterator2.f();
861
+ }
862
+
863
+ return scaleProps;
864
+ };
865
+
866
+ return getAllScaleProps;
867
+ };
868
+
869
+ var _excluded$1 = ["children"],
870
+ _excluded2 = ["paddingLeft", "pl", "paddingRight", "pr", "paddingTop", "pt", "paddingBottom", "pb", "marginTop", "mt", "marginRight", "mr", "marginBottom", "mb", "marginLeft", "ml", "px", "py", "mx", "my", "width", "height", "font", "w", "h", "margin", "padding", "unit", "scale"];
871
+
872
+ var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
873
+ if (scale === 1) return scale;
874
+ var diff = Math.abs((scale - 1) / 2);
875
+ return scale > 1 ? 1 + diff : 1 - diff;
876
+ }; // eslint-disable-next-line @typescript-eslint/ban-types
877
+
878
+
879
+ var withScale = function withScale(Render) {
880
+ var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
881
+ var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33;
882
+
883
+ var children = _ref.children,
884
+ props = _objectWithoutProperties(_ref, _excluded$1);
885
+
886
+ var _useTheme = useTheme(),
887
+ layout = _useTheme.layout;
888
+
889
+ var paddingLeft = props.paddingLeft,
890
+ pl = props.pl,
891
+ paddingRight = props.paddingRight,
892
+ pr = props.pr,
893
+ paddingTop = props.paddingTop,
894
+ pt = props.pt,
895
+ paddingBottom = props.paddingBottom,
896
+ pb = props.pb,
897
+ marginTop = props.marginTop,
898
+ mt = props.mt,
899
+ marginRight = props.marginRight,
900
+ mr = props.mr,
901
+ marginBottom = props.marginBottom,
902
+ mb = props.mb,
903
+ marginLeft = props.marginLeft,
904
+ ml = props.ml,
905
+ px = props.px,
906
+ py = props.py,
907
+ mx = props.mx,
908
+ my = props.my,
909
+ width = props.width,
910
+ height = props.height,
911
+ font = props.font,
912
+ w = props.w,
913
+ h = props.h,
914
+ margin = props.margin,
915
+ padding = props.padding,
916
+ _props$unit = props.unit,
917
+ unit = _props$unit === void 0 ? layout.unit : _props$unit,
918
+ _props$scale = props.scale,
919
+ scale = _props$scale === void 0 ? 1 : _props$scale,
920
+ innerProps = _objectWithoutProperties(props, _excluded2);
921
+
922
+ var makeScaleHandler = function makeScaleHandler(attrValue) {
923
+ return function (scale1x, defaultValue) {
924
+ // 0 means disable scale and the default value is 0
925
+ if (scale1x === 0) {
926
+ scale1x = 1;
927
+ defaultValue = defaultValue || 0;
928
+ }
929
+
930
+ var factor = reduceScaleCoefficient(scale) * scale1x;
931
+
932
+ if (typeof attrValue === 'undefined') {
933
+ if (typeof defaultValue !== 'undefined') return "".concat(defaultValue);
934
+ return "calc(".concat(factor, " * ").concat(unit, ")");
935
+ }
936
+
937
+ if (!isCSSNumberValue(attrValue)) return "".concat(attrValue);
938
+ var customFactor = factor * Number(attrValue);
939
+ return "calc(".concat(customFactor, " * ").concat(unit, ")");
940
+ };
941
+ };
942
+
943
+ var value = {
944
+ unit: unit,
945
+ SCALES: {
946
+ pt: makeScaleHandler((_ref2 = (_ref3 = paddingTop !== null && paddingTop !== void 0 ? paddingTop : pt) !== null && _ref3 !== void 0 ? _ref3 : py) !== null && _ref2 !== void 0 ? _ref2 : padding),
947
+ pr: makeScaleHandler((_ref4 = (_ref5 = paddingRight !== null && paddingRight !== void 0 ? paddingRight : pr) !== null && _ref5 !== void 0 ? _ref5 : px) !== null && _ref4 !== void 0 ? _ref4 : padding),
948
+ pb: makeScaleHandler((_ref6 = (_ref7 = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : pb) !== null && _ref7 !== void 0 ? _ref7 : py) !== null && _ref6 !== void 0 ? _ref6 : padding),
949
+ pl: makeScaleHandler((_ref8 = (_ref9 = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : pl) !== null && _ref9 !== void 0 ? _ref9 : px) !== null && _ref8 !== void 0 ? _ref8 : padding),
950
+ px: makeScaleHandler((_ref10 = (_ref11 = (_ref12 = (_ref13 = px !== null && px !== void 0 ? px : paddingLeft) !== null && _ref13 !== void 0 ? _ref13 : paddingRight) !== null && _ref12 !== void 0 ? _ref12 : pl) !== null && _ref11 !== void 0 ? _ref11 : pr) !== null && _ref10 !== void 0 ? _ref10 : padding),
951
+ py: makeScaleHandler((_ref14 = (_ref15 = (_ref16 = (_ref17 = py !== null && py !== void 0 ? py : paddingTop) !== null && _ref17 !== void 0 ? _ref17 : paddingBottom) !== null && _ref16 !== void 0 ? _ref16 : pt) !== null && _ref15 !== void 0 ? _ref15 : pb) !== null && _ref14 !== void 0 ? _ref14 : padding),
952
+ mt: makeScaleHandler((_ref18 = (_ref19 = marginTop !== null && marginTop !== void 0 ? marginTop : mt) !== null && _ref19 !== void 0 ? _ref19 : my) !== null && _ref18 !== void 0 ? _ref18 : margin),
953
+ mr: makeScaleHandler((_ref20 = (_ref21 = marginRight !== null && marginRight !== void 0 ? marginRight : mr) !== null && _ref21 !== void 0 ? _ref21 : mx) !== null && _ref20 !== void 0 ? _ref20 : margin),
954
+ mb: makeScaleHandler((_ref22 = (_ref23 = marginBottom !== null && marginBottom !== void 0 ? marginBottom : mb) !== null && _ref23 !== void 0 ? _ref23 : my) !== null && _ref22 !== void 0 ? _ref22 : margin),
955
+ ml: makeScaleHandler((_ref24 = (_ref25 = marginLeft !== null && marginLeft !== void 0 ? marginLeft : ml) !== null && _ref25 !== void 0 ? _ref25 : mx) !== null && _ref24 !== void 0 ? _ref24 : margin),
956
+ mx: makeScaleHandler((_ref26 = (_ref27 = (_ref28 = (_ref29 = mx !== null && mx !== void 0 ? mx : marginLeft) !== null && _ref29 !== void 0 ? _ref29 : marginRight) !== null && _ref28 !== void 0 ? _ref28 : ml) !== null && _ref27 !== void 0 ? _ref27 : mr) !== null && _ref26 !== void 0 ? _ref26 : margin),
957
+ my: makeScaleHandler((_ref30 = (_ref31 = (_ref32 = (_ref33 = my !== null && my !== void 0 ? my : marginTop) !== null && _ref33 !== void 0 ? _ref33 : marginBottom) !== null && _ref32 !== void 0 ? _ref32 : mt) !== null && _ref31 !== void 0 ? _ref31 : mb) !== null && _ref30 !== void 0 ? _ref30 : margin),
958
+ width: makeScaleHandler(width !== null && width !== void 0 ? width : w),
959
+ height: makeScaleHandler(height !== null && height !== void 0 ? height : h),
960
+ font: makeScaleHandler(font)
961
+ },
962
+ getScaleProps: generateGetScaleProps(props),
963
+ getAllScaleProps: generateGetAllScaleProps(props)
964
+ };
965
+ return /*#__PURE__*/React__default["default"].createElement(ScaleContext.Provider, {
966
+ value: value
967
+ }, /*#__PURE__*/React__default["default"].createElement(Render, _extends({}, innerProps, {
968
+ ref: ref
969
+ }), children));
970
+ });
971
+ ScaleFC.displayName = "Scale".concat(Render.displayName || 'Wrapper');
972
+ return ScaleFC;
973
+ };
974
+
975
+ var withScale$1 = withScale;
976
+
977
+ var useScale = useScale$1;
978
+
979
+ var warningStack = {};
980
+
981
+ var useWarning = function useWarning(message, component) {
982
+ var tag = component ? " [".concat(component, "]") : ' ';
983
+ var log = "[Bolio UI]".concat(tag, ": ").concat(message);
984
+ if (typeof console === 'undefined') return;
985
+ if (warningStack[log]) return;
986
+ warningStack[log] = true;
987
+
988
+ if (process.env.NODE_ENV !== 'production') {
989
+ return console.error(log);
990
+ }
991
+
992
+ console.warn(log);
993
+ };
994
+
995
+ var useWarning$1 = useWarning;
996
+
997
+ var defaultProps$1 = {
998
+ className: '',
999
+ render: function render() {}
1000
+ };
1001
+
1002
+ var TableColumn = function TableColumn(columnProps) {
1003
+ var _ref = columnProps,
1004
+ children = _ref.children,
1005
+ prop = _ref.prop,
1006
+ label = _ref.label,
1007
+ width = _ref.width,
1008
+ className = _ref.className,
1009
+ renderHandler = _ref.render;
1010
+
1011
+ var _useTableContext = useTableContext(),
1012
+ updateColumn = _useTableContext.updateColumn;
1013
+
1014
+ var safeProp = "".concat(prop).trim();
1015
+
1016
+ if (!safeProp) {
1017
+ useWarning$1('The props "prop" is required.', 'Table.Column');
1018
+ }
1019
+
1020
+ React.useEffect(function () {
1021
+ updateColumn({
1022
+ label: children || label,
1023
+ prop: safeProp,
1024
+ width: width,
1025
+ className: className,
1026
+ renderHandler: renderHandler
1027
+ });
1028
+ }, [children, label, prop, width, className, renderHandler]);
1029
+ return null;
1030
+ };
1031
+
1032
+ TableColumn.defaultProps = defaultProps$1;
1033
+ TableColumn.displayName = 'BolioUITableColumn';
1034
+ var TableColumn$1 = TableColumn;
1035
+
1036
+ var _excluded = ["children", "data", "initialData", "hover", "emptyText", "onRow", "onCell", "onChange", "className", "rowClassName"];
1037
+ var defaultProps = {
1038
+ hover: true,
1039
+ initialData: [],
1040
+ emptyText: '',
1041
+ className: '',
1042
+ rowClassName: function rowClassName() {
1043
+ return '';
1044
+ }
1045
+ };
1046
+
1047
+ function TableComponent(tableProps) {
1048
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1049
+ var _ref = tableProps,
1050
+ children = _ref.children,
1051
+ customData = _ref.data,
1052
+ initialData = _ref.initialData,
1053
+ hover = _ref.hover,
1054
+ emptyText = _ref.emptyText,
1055
+ onRow = _ref.onRow,
1056
+ onCell = _ref.onCell;
1057
+ _ref.onChange;
1058
+ var className = _ref.className,
1059
+ rowClassName = _ref.rowClassName,
1060
+ props = _objectWithoutProperties(_ref, _excluded);
1061
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1062
+
1063
+
1064
+ var _useScale = useScale(),
1065
+ SCALES = _useScale.SCALES;
1066
+
1067
+ var ref = React.useRef(null);
1068
+
1069
+ var _useRealShape = useRealShape$1(ref),
1070
+ _useRealShape2 = _slicedToArray(_useRealShape, 2),
1071
+ width = _useRealShape2[0].width,
1072
+ updateShape = _useRealShape2[1];
1073
+
1074
+ var _useState = React.useState([]),
1075
+ _useState2 = _slicedToArray(_useState, 2),
1076
+ columns = _useState2[0],
1077
+ setColumns = _useState2[1];
1078
+
1079
+ var _useState3 = React.useState(initialData),
1080
+ _useState4 = _slicedToArray(_useState3, 2),
1081
+ data = _useState4[0],
1082
+ setData = _useState4[1];
1083
+
1084
+ var updateColumn = function updateColumn(column) {
1085
+ setColumns(function (last) {
1086
+ var hasColumn = last.find(function (item) {
1087
+ return item.prop === column.prop;
1088
+ });
1089
+ if (!hasColumn) return [].concat(_toConsumableArray(last), [column]);
1090
+ return last.map(function (item) {
1091
+ if (item.prop !== column.prop) return item;
1092
+ return column;
1093
+ });
1094
+ });
1095
+ };
1096
+
1097
+ var contextValue = React.useMemo(function () {
1098
+ return {
1099
+ columns: columns,
1100
+ updateColumn: updateColumn
1101
+ };
1102
+ }, [columns]);
1103
+ React.useEffect(function () {
1104
+ if (typeof customData === 'undefined') return;
1105
+ setData(customData);
1106
+ }, [customData]);
1107
+ useResize$1(function () {
1108
+ return updateShape();
1109
+ });
1110
+ return /*#__PURE__*/React__default["default"].createElement(TableContext.Provider, {
1111
+ value: contextValue
1112
+ }, /*#__PURE__*/React__default["default"].createElement("table", _extends({
1113
+ ref: ref
1114
+ }, props, {
1115
+ className: styledJsx_cjs.style.dynamic([["2991182230", [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]]]) + " " + (props && props.className != null && props.className || className || "")
1116
+ }), /*#__PURE__*/React__default["default"].createElement(TableHead$1, {
1117
+ columns: columns,
1118
+ width: width
1119
+ }), /*#__PURE__*/React__default["default"].createElement(TableBody$1, {
1120
+ data: data,
1121
+ hover: hover,
1122
+ emptyText: emptyText,
1123
+ onRow: onRow,
1124
+ onCell: onCell,
1125
+ rowClassName: rowClassName
1126
+ }), children, /*#__PURE__*/React__default["default"].createElement(styledJsx_cjs.style, {
1127
+ id: "2991182230",
1128
+ dynamic: [SCALES.font(1), SCALES.width(1, '100%'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0)]
1129
+ }, "table.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;--table-font-size:".concat(SCALES.font(1), ";font-size:var(--table-font-size);width:").concat(SCALES.width(1, '100%'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}"))));
1130
+ }
1131
+
1132
+ TableComponent.defaultProps = defaultProps;
1133
+ TableComponent.displayName = 'BolioUITable';
1134
+ TableComponent.Column = TableColumn$1;
1135
+ var Table = withScale$1(TableComponent);
1136
+ Table.Column = TableColumn$1;
1137
+ var Table$1 = Table;
1138
+
1139
+ exports["default"] = Table$1;