@paubox/ui 0.8.2 → 0.8.4

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/index.esm.js CHANGED
@@ -1663,7 +1663,7 @@ function _templateObject5$3() {
1663
1663
  };
1664
1664
  return data;
1665
1665
  }
1666
- function _templateObject6$3() {
1666
+ function _templateObject6$2() {
1667
1667
  var data = _tagged_template_literal$o([
1668
1668
  "\n ",
1669
1669
  "\n font-size: ",
@@ -1671,7 +1671,7 @@ function _templateObject6$3() {
1671
1671
  "rem;\n letter-spacing: ",
1672
1672
  "px;\n font-weight: 600;\n"
1673
1673
  ]);
1674
- _templateObject6$3 = function _templateObject() {
1674
+ _templateObject6$2 = function _templateObject() {
1675
1675
  return data;
1676
1676
  };
1677
1677
  return data;
@@ -1930,7 +1930,7 @@ var $headline100Semibold = css(_templateObject2$a(), commonStyles, headline100Fo
1930
1930
  var $headline200Regular = css(_templateObject3$7(), commonStyles, headline200FontSize / BASE_FONT_SIZE, headline200LineHeight / BASE_FONT_SIZE, headline200LetterSpacing);
1931
1931
  var $headline200Semibold = css(_templateObject4$5(), commonStyles, headline200FontSize / BASE_FONT_SIZE, headline200LineHeight / BASE_FONT_SIZE, headline200LetterSpacing);
1932
1932
  var $headline300Regular = css(_templateObject5$3(), commonStyles, headline300FontSize / BASE_FONT_SIZE, headline300LineHeight / BASE_FONT_SIZE, headline300LetterSpacing);
1933
- var $headline300Semibold = css(_templateObject6$3(), commonStyles, headline300FontSize / BASE_FONT_SIZE, headline300LineHeight / BASE_FONT_SIZE, headline300LetterSpacing);
1933
+ var $headline300Semibold = css(_templateObject6$2(), commonStyles, headline300FontSize / BASE_FONT_SIZE, headline300LineHeight / BASE_FONT_SIZE, headline300LetterSpacing);
1934
1934
  // PARAGRAPH
1935
1935
  var $paragraph100Regular = css(_templateObject7$1(), commonStyles, paragraph100FontSize / BASE_FONT_SIZE, paragraph100LineHeight / BASE_FONT_SIZE, paragraph100LetterSpacing);
1936
1936
  var $paragraph100Semibold = css(_templateObject8$1(), commonStyles, paragraph100FontSize / BASE_FONT_SIZE, paragraph100LineHeight / BASE_FONT_SIZE, paragraph100LetterSpacing);
@@ -2100,12 +2100,12 @@ function _templateObject5$2() {
2100
2100
  };
2101
2101
  return data;
2102
2102
  }
2103
- function _templateObject6$2() {
2103
+ function _templateObject6$1() {
2104
2104
  var data = _tagged_template_literal$n([
2105
2105
  "\n background-color: ",
2106
2106
  ";\n "
2107
2107
  ]);
2108
- _templateObject6$2 = function _templateObject() {
2108
+ _templateObject6$1 = function _templateObject() {
2109
2109
  return data;
2110
2110
  };
2111
2111
  return data;
@@ -2154,7 +2154,7 @@ var AlertBar = function(props) {
2154
2154
  info: css(_templateObject3$6(), primary100),
2155
2155
  warning: css(_templateObject4$4(), warning100),
2156
2156
  error: css(_templateObject5$2(), danger100),
2157
- success: css(_templateObject6$2(), success100)
2157
+ success: css(_templateObject6$1(), success100)
2158
2158
  };
2159
2159
  var iconStyles = css(_templateObject7(), type === 'info' ? "".concat(primary700) : type === 'error' ? "".concat(danger700) : type === 'success' ? "".concat(success700) : "".concat(warning700));
2160
2160
  var textWrapperStyles = css(_templateObject8());
@@ -2400,13 +2400,15 @@ var IconWrapper$3 = styled.span(_templateObject$l(), function(props) {
2400
2400
  return props.iconLeft ? '0 8px 0 0' : props.iconRight ? '0 0 0 8px' : '0';
2401
2401
  });
2402
2402
  var Button = /*#__PURE__*/ forwardRef(function(_param, ref) {
2403
- var IconLeft = _param.iconLeft, IconRight = _param.iconRight, children = _param.children, props = _object_without_properties$i(_param, [
2403
+ var IconLeft = _param.iconLeft, IconRight = _param.iconRight, _param_type = _param.type, type = _param_type === void 0 ? 'button' : _param_type, children = _param.children, props = _object_without_properties$i(_param, [
2404
2404
  "iconLeft",
2405
2405
  "iconRight",
2406
+ "type",
2406
2407
  "children"
2407
2408
  ]);
2408
2409
  return /*#__PURE__*/ jsxs(BaseButton, _object_spread_props$n(_object_spread$t({
2409
- ref: ref
2410
+ ref: ref,
2411
+ type: type
2410
2412
  }, props), {
2411
2413
  children: [
2412
2414
  IconLeft && /*#__PURE__*/ jsx(IconWrapper$3, {
@@ -22537,15 +22539,16 @@ var IconButton = /*#__PURE__*/ forwardRef(function(_param, ref) {
22537
22539
  ]);
22538
22540
  return /*#__PURE__*/ jsx(BaseButton, _object_spread_props$f(_object_spread$j({
22539
22541
  style: _object_spread$j({
22540
- width: size === 'large' ? 40 : 32,
22541
- height: size === 'large' ? 40 : 32,
22542
+ width: size === 'large' ? 40 : size === 'small' ? 32 : 26,
22543
+ height: size === 'large' ? 40 : size === 'small' ? 32 : 26,
22542
22544
  padding: 0,
22543
- fontSize: fontSize || 16,
22544
22545
  borderRadius: circular ? '50%' : undefined
22545
22546
  }, style),
22546
22547
  ref: ref
22547
22548
  }, props), {
22548
- children: /*#__PURE__*/ jsx(Icon, {})
22549
+ children: /*#__PURE__*/ jsx(Icon, {
22550
+ fontSize: fontSize ? "".concat(fontSize, "px") : '16px'
22551
+ })
22549
22552
  }));
22550
22553
  });
22551
22554
 
@@ -22701,9 +22704,10 @@ var IconWrapper$2 = styled.span(_templateObject2$6(), function(param) {
22701
22704
  return position === 'right' ? '0.5rem' : 'auto';
22702
22705
  });
22703
22706
  var Input = function(_param) {
22704
- var LeftIcon = _param.leftIcon, RightIcon = _param.rightIcon, _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz, _param_error = _param.error, error = _param_error === void 0 ? false : _param_error, style = _param.style, props = _object_without_properties$b(_param, [
22707
+ var LeftIcon = _param.leftIcon, RightIcon = _param.rightIcon, _param_clearable = _param.clearable, clearable = _param_clearable === void 0 ? false : _param_clearable, _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz, _param_error = _param.error, error = _param_error === void 0 ? false : _param_error, style = _param.style, props = _object_without_properties$b(_param, [
22705
22708
  "leftIcon",
22706
22709
  "rightIcon",
22710
+ "clearable",
22707
22711
  "sz",
22708
22712
  "error",
22709
22713
  "style"
@@ -22722,6 +22726,25 @@ var Input = function(_param) {
22722
22726
  paddingRight: RightIcon ? '2.063rem' : '0.563rem'
22723
22727
  }, style)
22724
22728
  })),
22729
+ clearable && props.value && /*#__PURE__*/ jsx(IconButton, {
22730
+ onClick: function() {
22731
+ var _props_onChange;
22732
+ return props === null || props === void 0 ? void 0 : (_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, {
22733
+ target: {
22734
+ value: ''
22735
+ }
22736
+ });
22737
+ },
22738
+ icon: Close,
22739
+ circular: true,
22740
+ size: sz === 'lg' ? 'small' : 'xsmall',
22741
+ fontSize: sz === 'lg' ? 16 : 12,
22742
+ style: {
22743
+ position: 'absolute',
22744
+ right: RightIcon ? '2rem' : '0.5rem'
22745
+ },
22746
+ color: "secondary"
22747
+ }),
22725
22748
  RightIcon && /*#__PURE__*/ jsx(IconWrapper$2, {
22726
22749
  position: "right",
22727
22750
  children: /*#__PURE__*/ jsx(RightIcon, {})
@@ -22938,13 +22961,13 @@ function _templateObject5$1() {
22938
22961
  };
22939
22962
  return data;
22940
22963
  }
22941
- function _templateObject6$1() {
22964
+ function _templateObject6() {
22942
22965
  var data = _tagged_template_literal$d([
22943
22966
  "\n ",
22944
22967
  "\n color: ",
22945
22968
  "/80;\n"
22946
22969
  ]);
22947
- _templateObject6$1 = function _templateObject() {
22970
+ _templateObject6 = function _templateObject() {
22948
22971
  return data;
22949
22972
  };
22950
22973
  return data;
@@ -22996,7 +23019,7 @@ var MultiSelectChip = function(option) {
22996
23019
  };
22997
23020
  // Style for the Icons
22998
23021
  var IconWrapper$1 = styled.span(_templateObject5$1());
22999
- var PlaceholderOption = styled.option(_templateObject6$1(), $paragraph100Semibold, textSecondary);
23022
+ var PlaceholderOption = styled.option(_templateObject6(), $paragraph100Semibold, textSecondary);
23000
23023
  var MultiSelect = function(_param) {
23001
23024
  var _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz; _param.error; var _param_options = _param.options, options = _param_options === void 0 ? [] : _param_options; _param.checkbox; var placeholder = _param.placeholder, initialValue = _param.initialValue, _param_type = _param.type, type = _param_type === void 0 ? 'primary' : _param_type, props = _object_without_properties$a(_param, [
23002
23025
  "sz",
@@ -23212,22 +23235,23 @@ var Loader = function() {
23212
23235
  });
23213
23236
  };
23214
23237
  var Search = function(_param) {
23215
- var loading = _param.loading, setLoading = _param.setLoading, setSearchValue = _param.setSearchValue, _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz, props = _object_without_properties$9(_param, [
23238
+ var loading = _param.loading, setLoading = _param.setLoading, setSearchValue = _param.setSearchValue, _param_clearable = _param.clearable, clearable = _param_clearable === void 0 ? false : _param_clearable, _param_sz = _param.sz, sz = _param_sz === void 0 ? 'sm' : _param_sz, props = _object_without_properties$9(_param, [
23216
23239
  "loading",
23217
23240
  "setLoading",
23218
23241
  "setSearchValue",
23242
+ "clearable",
23219
23243
  "sz"
23220
23244
  ]);
23221
23245
  var _useState = _sliced_to_array$6(useState(''), 2), value = _useState[0], setValue = _useState[1];
23222
23246
  var debounceDelay = 1200;
23223
23247
  var handleChange = function(e) {
23224
- setLoading(true);
23248
+ setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
23225
23249
  setValue(e.target.value);
23226
23250
  };
23227
23251
  useEffect(function() {
23228
23252
  // Set a timeout for the debounce
23229
23253
  var handler = setTimeout(function() {
23230
- setLoading(false);
23254
+ setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
23231
23255
  setSearchValue(value);
23232
23256
  }, debounceDelay);
23233
23257
  return function() {
@@ -23240,6 +23264,7 @@ var Search = function(_param) {
23240
23264
  ]);
23241
23265
  return /*#__PURE__*/ jsx(Input, _object_spread$g({
23242
23266
  value: value,
23267
+ clearable: clearable,
23243
23268
  leftIcon: SearchIcon,
23244
23269
  rightIcon: loading ? Loader : undefined,
23245
23270
  onChange: handleChange,
@@ -31571,7 +31596,7 @@ function _tagged_template_literal$4(strings, raw) {
31571
31596
  }
31572
31597
  function _templateObject$4() {
31573
31598
  var data = _tagged_template_literal$4([
31574
- "\n width: 100%;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n"
31599
+ "\n position: sticky;\n top: 0;\n z-index: 1;\n"
31575
31600
  ]);
31576
31601
  _templateObject$4 = function _templateObject() {
31577
31602
  return data;
@@ -31579,135 +31604,110 @@ function _templateObject$4() {
31579
31604
  return data;
31580
31605
  }
31581
31606
  function _templateObject1$4() {
31582
- var data = _tagged_template_literal$4([
31583
- "\n position: sticky;\n top: 0;\n z-index: 1;\n"
31584
- ]);
31585
- _templateObject1$4 = function _templateObject() {
31586
- return data;
31587
- };
31588
- return data;
31589
- }
31590
- function _templateObject2$2() {
31591
31607
  var data = _tagged_template_literal$4([
31592
31608
  "\n padding: ",
31593
31609
  "px;\n text-align: left;\n position: relative;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n background: ",
31594
31610
  ";\n border-bottom: 1px solid ",
31595
31611
  ";\n\n &:hover .pbui-table-resize-handle {\n height: 100%;\n }\n"
31596
31612
  ]);
31597
- _templateObject2$2 = function _templateObject() {
31613
+ _templateObject1$4 = function _templateObject() {
31598
31614
  return data;
31599
31615
  };
31600
31616
  return data;
31601
31617
  }
31602
- function _templateObject3$1() {
31618
+ function _templateObject2$2() {
31603
31619
  var data = _tagged_template_literal$4([
31604
31620
  "\n display: flex;\n align-items: center;\n overflow: hidden;\n text-overflow: ellipsis;\n"
31605
31621
  ]);
31606
- _templateObject3$1 = function _templateObject() {
31622
+ _templateObject2$2 = function _templateObject() {
31607
31623
  return data;
31608
31624
  };
31609
31625
  return data;
31610
31626
  }
31611
- function _templateObject4() {
31627
+ function _templateObject3$1() {
31612
31628
  var data = _tagged_template_literal$4([
31613
31629
  "\n position: absolute;\n right: 0;\n top: 0;\n display: flex;\n align-items: center;\n height: 100%;\n width: 6px;\n padding-right: 10px;\n"
31614
31630
  ]);
31615
- _templateObject4 = function _templateObject() {
31631
+ _templateObject3$1 = function _templateObject() {
31616
31632
  return data;
31617
31633
  };
31618
31634
  return data;
31619
31635
  }
31620
- function _templateObject5() {
31636
+ function _templateObject4() {
31621
31637
  var data = _tagged_template_literal$4([
31622
31638
  "\n position: absolute;\n height: 0%;\n width: 6px;\n background-color: ",
31623
31639
  ";\n cursor: col-resize;\n user-select: none;\n touch-action: none;\n transition: height ease 0.25s;\n"
31624
31640
  ]);
31625
- _templateObject5 = function _templateObject() {
31641
+ _templateObject4 = function _templateObject() {
31626
31642
  return data;
31627
31643
  };
31628
31644
  return data;
31629
31645
  }
31630
- function _templateObject6() {
31646
+ function _templateObject5() {
31631
31647
  var data = _tagged_template_literal$4([
31632
31648
  "\n font-size: 9px;\n display: inline-flex;\n flex-direction: column;\n margin-left: ",
31633
31649
  "px;\n align-items: center;\n\n & svg:first-of-type {\n margin-bottom: -1.5px;\n }\n & svg:last-of-type {\n margin-top: -1.5px;\n }\n"
31634
31650
  ]);
31635
- _templateObject6 = function _templateObject() {
31651
+ _templateObject5 = function _templateObject() {
31636
31652
  return data;
31637
31653
  };
31638
31654
  return data;
31639
31655
  }
31640
- var StyledTable$1 = styled.table(_templateObject$4());
31641
- var StyledHeader = styled.div(_templateObject1$4());
31642
- var Th = styled(Typography)(_templateObject2$2(), spacing(1), neutral100, neutral300);
31643
- var HeaderContent = styled.div(_templateObject3$1());
31644
- var ResizeHandleContainer = styled.div(_templateObject4());
31645
- var ResizeHandle = styled.div(_templateObject5(), neutral300);
31646
- var SortIcon = styled.span(_templateObject6(), spacing(1));
31656
+ var StyledHeader = styled.thead(_templateObject$4());
31657
+ var Th = styled(Typography)(_templateObject1$4(), spacing(1), neutral100, neutral300);
31658
+ var HeaderContent = styled.div(_templateObject2$2());
31659
+ var ResizeHandleContainer = styled.div(_templateObject3$1());
31660
+ var ResizeHandle = styled.div(_templateObject4(), neutral300);
31661
+ var SortIcon = styled.span(_templateObject5(), spacing(1));
31647
31662
  var TableHeader = function(param) {
31648
- var table = param.table, columnWidths = param.columnWidths, disableControls = param.disableControls, dense = param.dense;
31663
+ var table = param.table, disableControls = param.disableControls, dense = param.dense;
31649
31664
  return /*#__PURE__*/ jsx(StyledHeader, {
31650
- children: /*#__PURE__*/ jsxs(StyledTable$1, {
31651
- children: [
31652
- /*#__PURE__*/ jsx("colgroup", {
31653
- children: columnWidths.map(function(param) {
31654
- var id = param.id, width = param.width;
31655
- return /*#__PURE__*/ jsx("col", {
31656
- style: {
31657
- width: "".concat(width, "px")
31658
- }
31659
- }, id);
31660
- })
31661
- }),
31662
- /*#__PURE__*/ jsx("thead", {
31663
- children: table.getHeaderGroups().map(function(headerGroup) {
31664
- return /*#__PURE__*/ jsx("tr", {
31665
- children: headerGroup.headers.map(function(header) {
31666
- return /*#__PURE__*/ jsxs(Th, {
31667
- variant: "paragraph200Semibold",
31668
- as: "th",
31669
- style: {
31670
- padding: dense ? "".concat(spacing(1), "px ").concat(spacing(header.id === 'row-select' ? 1 : 1.5), "px") : "".concat(spacing(1.5), "px ").concat(spacing(header.id === 'row-select' ? 1 : 1.5), "px")
31671
- },
31672
- children: [
31673
- header.isPlaceholder ? null : /*#__PURE__*/ jsxs(HeaderContent, {
31674
- role: header.column.getCanSort() ? 'button' : undefined,
31675
- onClick: !disableControls ? header.column.getToggleSortingHandler() : undefined,
31676
- style: {
31677
- cursor: header.column.getCanSort() ? 'pointer' : 'default'
31678
- },
31679
- children: [
31680
- flexRender(header.column.columnDef.header, header.getContext()),
31681
- header.column.getCanSort() && /*#__PURE__*/ jsxs(SortIcon, {
31682
- children: [
31683
- /*#__PURE__*/ jsx(ChevronUp, {
31684
- color: header.column.getIsSorted() === 'desc' ? neutral400 : undefined
31685
- }),
31686
- /*#__PURE__*/ jsx(ChevronDown, {
31687
- color: header.column.getIsSorted() === 'asc' ? neutral400 : undefined
31688
- })
31689
- ]
31690
- })
31691
- ]
31692
- }),
31693
- header.column.getCanResize() && /*#__PURE__*/ jsx(ResizeHandleContainer, {
31694
- children: /*#__PURE__*/ jsx(ResizeHandle, {
31695
- onMouseDown: header.getResizeHandler(),
31696
- onTouchStart: header.getResizeHandler(),
31697
- className: "pbui-table-resize-handle",
31698
- onClick: function(e) {
31699
- e.stopPropagation();
31700
- e.preventDefault();
31701
- }
31665
+ children: table.getHeaderGroups().map(function(headerGroup) {
31666
+ return /*#__PURE__*/ jsx("tr", {
31667
+ children: headerGroup.headers.map(function(header) {
31668
+ return /*#__PURE__*/ jsxs(Th, {
31669
+ variant: "paragraph200Semibold",
31670
+ as: "th",
31671
+ style: {
31672
+ width: "".concat(header.column.getSize(), "px"),
31673
+ padding: dense ? "".concat(spacing(1), "px ").concat(spacing(header.id === 'row-select' ? 1 : 1.5), "px") : "".concat(spacing(1.5), "px ").concat(spacing(header.id === 'row-select' ? 1 : 1.5), "px")
31674
+ },
31675
+ children: [
31676
+ header.isPlaceholder ? null : /*#__PURE__*/ jsxs(HeaderContent, {
31677
+ role: header.column.getCanSort() ? 'button' : undefined,
31678
+ onClick: !disableControls ? header.column.getToggleSortingHandler() : undefined,
31679
+ style: {
31680
+ cursor: header.column.getCanSort() ? 'pointer' : 'default'
31681
+ },
31682
+ children: [
31683
+ flexRender(header.column.columnDef.header, header.getContext()),
31684
+ header.column.getCanSort() && /*#__PURE__*/ jsxs(SortIcon, {
31685
+ children: [
31686
+ /*#__PURE__*/ jsx(ChevronUp, {
31687
+ color: header.column.getIsSorted() === 'desc' ? neutral400 : undefined
31688
+ }),
31689
+ /*#__PURE__*/ jsx(ChevronDown, {
31690
+ color: header.column.getIsSorted() === 'asc' ? neutral400 : undefined
31702
31691
  })
31703
- })
31704
- ]
31705
- }, header.id);
31692
+ ]
31693
+ })
31694
+ ]
31695
+ }),
31696
+ header.column.getCanResize() && /*#__PURE__*/ jsx(ResizeHandleContainer, {
31697
+ children: /*#__PURE__*/ jsx(ResizeHandle, {
31698
+ onMouseDown: header.getResizeHandler(),
31699
+ onTouchStart: header.getResizeHandler(),
31700
+ className: "pbui-table-resize-handle",
31701
+ onClick: function(e) {
31702
+ e.stopPropagation();
31703
+ e.preventDefault();
31704
+ }
31705
+ })
31706
31706
  })
31707
- }, headerGroup.id);
31708
- })
31707
+ ]
31708
+ }, header.id);
31709
31709
  })
31710
- ]
31710
+ }, headerGroup.id);
31711
31711
  })
31712
31712
  });
31713
31713
  };
@@ -31724,7 +31724,7 @@ function _tagged_template_literal$3(strings, raw) {
31724
31724
  }
31725
31725
  function _templateObject$3() {
31726
31726
  var data = _tagged_template_literal$3([
31727
- "\n width: 100%;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n"
31727
+ "\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n"
31728
31728
  ]);
31729
31729
  _templateObject$3 = function _templateObject() {
31730
31730
  return data;
@@ -31761,50 +31761,45 @@ function _templateObject3() {
31761
31761
  };
31762
31762
  return data;
31763
31763
  }
31764
- var StyledTable = styled.table(_templateObject$3());
31764
+ var StyledTableBody = styled.tbody(_templateObject$3());
31765
31765
  var Tr = styled.tr(_templateObject2$1(), function(props) {
31766
31766
  return props.enableHover && css(_templateObject1$3(), primary100);
31767
31767
  });
31768
31768
  var Td = styled(Typography)(_templateObject3(), neutral300);
31769
31769
  var TableBody = function(param) {
31770
31770
  var table = param.table, columnWidths = param.columnWidths, enableRowSelection = param.enableRowSelection, onRowClick = param.onRowClick, dense = param.dense;
31771
- return /*#__PURE__*/ jsxs(StyledTable, {
31771
+ return /*#__PURE__*/ jsxs(StyledTableBody, {
31772
31772
  children: [
31773
31773
  /*#__PURE__*/ jsx("colgroup", {
31774
31774
  children: columnWidths.map(function(param) {
31775
- var id = param.id, width = param.width;
31776
- return /*#__PURE__*/ jsx("col", {
31777
- style: {
31778
- width: "".concat(width, "px")
31779
- }
31780
- }, id);
31775
+ var id = param.id; param.width;
31776
+ return /*#__PURE__*/ jsx("col", {}, id);
31781
31777
  })
31782
31778
  }),
31783
- /*#__PURE__*/ jsx("tbody", {
31784
- children: table.getRowModel().rows.map(function(row) {
31785
- var rowClickEnabled = enableRowSelection || !!onRowClick;
31786
- return /*#__PURE__*/ jsx(Tr, {
31787
- role: rowClickEnabled ? 'button' : undefined,
31788
- onClick: onRowClick ? function() {
31789
- return onRowClick(row.original);
31790
- } : row.getToggleSelectedHandler(),
31791
- style: {
31792
- cursor: rowClickEnabled ? 'pointer' : undefined,
31793
- background: row.getIsSelected() ? primary100 : undefined
31794
- },
31795
- enableHover: rowClickEnabled,
31796
- children: row.getVisibleCells().map(function(cell) {
31797
- return /*#__PURE__*/ jsx(Td, {
31798
- variant: "paragraph200Regular",
31799
- as: "td",
31800
- style: {
31801
- padding: dense ? "".concat(spacing(1), "px ").concat(spacing(cell.column.id === 'row-select' ? 1 : 1.5), "px") : "".concat(spacing(1.5), "px ").concat(spacing(cell.column.id === 'row-select' ? 1 : 1.5), "px")
31802
- },
31803
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
31804
- }, cell.id);
31805
- })
31806
- }, row.id);
31807
- })
31779
+ table.getRowModel().rows.map(function(row) {
31780
+ var rowClickEnabled = enableRowSelection || !!onRowClick;
31781
+ return /*#__PURE__*/ jsx(Tr, {
31782
+ role: rowClickEnabled ? 'button' : undefined,
31783
+ onClick: onRowClick ? function() {
31784
+ return onRowClick(row.original);
31785
+ } : row.getToggleSelectedHandler(),
31786
+ style: {
31787
+ cursor: rowClickEnabled ? 'pointer' : undefined,
31788
+ background: row.getIsSelected() ? primary100 : undefined
31789
+ },
31790
+ enableHover: rowClickEnabled,
31791
+ children: row.getVisibleCells().map(function(cell) {
31792
+ return /*#__PURE__*/ jsx(Td, {
31793
+ variant: "paragraph200Regular",
31794
+ as: "td",
31795
+ style: {
31796
+ width: "".concat(cell.column.getSize(), "px"),
31797
+ padding: dense ? "".concat(spacing(1), "px ").concat(spacing(cell.column.id === 'row-select' ? 1 : 1.5), "px") : "".concat(spacing(1.5), "px ").concat(spacing(cell.column.id === 'row-select' ? 1 : 1.5), "px")
31798
+ },
31799
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
31800
+ }, cell.id);
31801
+ })
31802
+ }, row.id);
31808
31803
  })
31809
31804
  ]
31810
31805
  });
@@ -31992,7 +31987,7 @@ function _templateObject$1() {
31992
31987
  var data = _tagged_template_literal$1([
31993
31988
  "\n position: relative;\n display: flex;\n flex-direction: column;\n min-height: 400px;\n z-index: 1;\n border: 1px solid ",
31994
31989
  ";\n border-radius: ",
31995
- "px;\n overflow: hidden;\n"
31990
+ "px;\n overflow: scroll;\n"
31996
31991
  ]);
31997
31992
  _templateObject$1 = function _templateObject() {
31998
31993
  return data;
@@ -32001,7 +31996,7 @@ function _templateObject$1() {
32001
31996
  }
32002
31997
  function _templateObject1$1() {
32003
31998
  var data = _tagged_template_literal$1([
32004
- "\n position: relative;\n flex: 1;\n min-height: 0;\n overflow-x: auto;\n"
31999
+ "\n position: relative;\n border-collapse: collapse;\n flex: 1;\n table-layout: fixed;\n min-height: 0;\n width: 100%;\n overflow-x: auto;\n"
32005
32000
  ]);
32006
32001
  _templateObject1$1 = function _templateObject() {
32007
32002
  return data;
@@ -32009,7 +32004,7 @@ function _templateObject1$1() {
32009
32004
  return data;
32010
32005
  }
32011
32006
  var TableContainer = styled.div(_templateObject$1(), neutral300, spacing(1));
32012
- var TableWrapper = styled.div(_templateObject1$1());
32007
+ var TableWrapper = styled.table(_templateObject1$1());
32013
32008
  var Table = function(param) {
32014
32009
  var columns = param.columns, _param_data = param.data, data = _param_data === void 0 ? [] : _param_data, getRowId = param.getRowId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, _param_pageInfo = param.pageInfo, pageInfo = _param_pageInfo === void 0 ? {
32015
32010
  pageCount: 1,
@@ -32037,9 +32032,11 @@ var Table = function(param) {
32037
32032
  if (enableRowSelection) {
32038
32033
  cols.unshift({
32039
32034
  id: 'row-select',
32035
+ size: 30,
32040
32036
  header: function(param) {
32041
32037
  var table = param.table;
32042
32038
  return /*#__PURE__*/ jsx(Checkbox, {
32039
+ width: 'min-content',
32043
32040
  checked: table.getIsAllRowsSelected(),
32044
32041
  indeterminate: table.getIsSomeRowsSelected(),
32045
32042
  onChange: table.getToggleAllPageRowsSelectedHandler(),
@@ -32048,23 +32045,16 @@ var Table = function(param) {
32048
32045
  },
32049
32046
  cell: function(param) {
32050
32047
  var row = param.row;
32051
- return /*#__PURE__*/ jsx("div", {
32052
- style: {
32053
- display: 'flex'
32048
+ return /*#__PURE__*/ jsx(Checkbox, {
32049
+ width: 'min-content',
32050
+ checked: row.getIsSelected(),
32051
+ disabled: disableControls || !row.getCanSelect(),
32052
+ onClick: function(e) {
32053
+ return e.stopPropagation();
32054
32054
  },
32055
- children: /*#__PURE__*/ jsx(Checkbox, {
32056
- checked: row.getIsSelected(),
32057
- disabled: disableControls || !row.getCanSelect(),
32058
- onClick: function(e) {
32059
- return e.stopPropagation();
32060
- },
32061
- onChange: row.getToggleSelectedHandler()
32062
- })
32055
+ onChange: row.getToggleSelectedHandler()
32063
32056
  });
32064
32057
  },
32065
- size: 40,
32066
- minSize: 40,
32067
- maxSize: 40,
32068
32058
  enableResizing: false
32069
32059
  });
32070
32060
  }
@@ -32081,9 +32071,7 @@ var Table = function(param) {
32081
32071
  contextMenuActions: contextMenuActions
32082
32072
  });
32083
32073
  },
32084
- size: 50,
32085
- minSize: 50,
32086
- maxSize: 50,
32074
+ size: 20,
32087
32075
  enableResizing: false
32088
32076
  });
32089
32077
  }
@@ -32116,9 +32104,9 @@ var Table = function(param) {
32116
32104
  columns: allColumns,
32117
32105
  getRowId: getRowId,
32118
32106
  defaultColumn: {
32119
- minSize: 80,
32107
+ minSize: 20,
32120
32108
  maxSize: 1000,
32121
- size: 150
32109
+ size: 20
32122
32110
  },
32123
32111
  state: {
32124
32112
  pagination: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@paubox/ui",
3
3
  "author": "Paubox, Inc.",
4
4
  "description": "Paubox Component Library",
5
- "version": "0.8.2",
5
+ "version": "0.8.4",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "publishConfig": {
@@ -1,8 +1,8 @@
1
1
  import { CSSProperties, MouseEventHandler } from 'react';
2
- export interface BaseButtonProps {
2
+ export interface BaseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
3
  color?: 'primary' | 'secondary' | 'danger';
4
4
  disabled?: boolean;
5
- size?: 'large' | 'small';
5
+ size?: 'large' | 'small' | 'xsmall';
6
6
  round?: boolean;
7
7
  children: React.ReactNode;
8
8
  onClick?: MouseEventHandler<HTMLButtonElement>;
@@ -2,6 +2,7 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
2
2
  sz?: 'sm' | 'lg';
3
3
  error?: boolean;
4
4
  leftIcon?: React.ElementType;
5
+ clearable?: boolean;
5
6
  rightIcon?: React.ElementType;
6
7
  }
7
8
  export declare const InputWrapper: import("@emotion/styled").StyledComponent<{
@@ -18,4 +19,4 @@ export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
18
19
  } & {
19
20
  position: "left" | "right";
20
21
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
21
- export declare const Input: ({ leftIcon: LeftIcon, rightIcon: RightIcon, sz, error, style, ...props }: InputProps) => import("@emotion/react/jsx-runtime").JSX.Element;
22
+ export declare const Input: ({ leftIcon: LeftIcon, rightIcon: RightIcon, clearable, sz, error, style, ...props }: InputProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  export interface SearchProps extends React.InputHTMLAttributes<HTMLInputElement> {
2
2
  sz?: 'sm' | 'lg';
3
+ clearable?: boolean;
3
4
  loading: boolean;
4
- setLoading: (value: boolean) => void;
5
+ setLoading?: (value: boolean) => void;
5
6
  setSearchValue: (value: string) => void;
6
7
  }
7
8
  export declare const loadingWheelStyle: import("@emotion/react").SerializedStyles;
8
- export declare const Search: ({ loading, setLoading, setSearchValue, sz, ...props }: SearchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare const Search: ({ loading, setLoading, setSearchValue, clearable, sz, ...props }: SearchProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ export declare const TableContainer: import("@emotion/styled").StyledComponent<{
7
7
  export declare const TableWrapper: import("@emotion/styled").StyledComponent<{
8
8
  theme?: import("@emotion/react").Theme;
9
9
  as?: React.ElementType;
10
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ }, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
11
11
  export interface ColumnWidth {
12
12
  id: string;
13
13
  width: number;
@@ -6,5 +6,5 @@ interface TableHeaderProps<T> {
6
6
  disableControls: boolean;
7
7
  dense: boolean;
8
8
  }
9
- export declare const TableHeader: <T extends object>({ table, columnWidths, disableControls, dense, }: TableHeaderProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare const TableHeader: <T extends object>({ table, disableControls, dense, }: TableHeaderProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
10
10
  export {};