@paubox/ui 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1637,7 +1637,7 @@ function _templateObject3$7() {
1637
1637
  };
1638
1638
  return data;
1639
1639
  }
1640
- function _templateObject4$4() {
1640
+ function _templateObject4$5() {
1641
1641
  var data = _tagged_template_literal$o([
1642
1642
  "\n ",
1643
1643
  "\n font-size: ",
@@ -1645,7 +1645,7 @@ function _templateObject4$4() {
1645
1645
  "rem;\n letter-spacing: ",
1646
1646
  "px;\n font-weight: 600;\n"
1647
1647
  ]);
1648
- _templateObject4$4 = function _templateObject() {
1648
+ _templateObject4$5 = function _templateObject() {
1649
1649
  return data;
1650
1650
  };
1651
1651
  return data;
@@ -1928,7 +1928,7 @@ var commonStyles = css(_templateObject$o());
1928
1928
  var $headline100Regular = css(_templateObject1$d(), commonStyles, headline100FontSize / BASE_FONT_SIZE, headline100LineHeight / BASE_FONT_SIZE, headline100LetterSpacing);
1929
1929
  var $headline100Semibold = css(_templateObject2$a(), commonStyles, headline100FontSize / BASE_FONT_SIZE, headline100LineHeight / BASE_FONT_SIZE, headline100LetterSpacing);
1930
1930
  var $headline200Regular = css(_templateObject3$7(), commonStyles, headline200FontSize / BASE_FONT_SIZE, headline200LineHeight / BASE_FONT_SIZE, headline200LetterSpacing);
1931
- var $headline200Semibold = css(_templateObject4$4(), commonStyles, headline200FontSize / BASE_FONT_SIZE, headline200LineHeight / BASE_FONT_SIZE, headline200LetterSpacing);
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
1933
  var $headline300Semibold = css(_templateObject6$3(), commonStyles, headline300FontSize / BASE_FONT_SIZE, headline300LineHeight / BASE_FONT_SIZE, headline300LetterSpacing);
1934
1934
  // PARAGRAPH
@@ -2080,12 +2080,12 @@ function _templateObject3$6() {
2080
2080
  };
2081
2081
  return data;
2082
2082
  }
2083
- function _templateObject4$3() {
2083
+ function _templateObject4$4() {
2084
2084
  var data = _tagged_template_literal$n([
2085
2085
  "\n background-color: ",
2086
2086
  ";\n "
2087
2087
  ]);
2088
- _templateObject4$3 = function _templateObject() {
2088
+ _templateObject4$4 = function _templateObject() {
2089
2089
  return data;
2090
2090
  };
2091
2091
  return data;
@@ -2152,7 +2152,7 @@ var AlertBar = function(props) {
2152
2152
  var textStyles = css(_templateObject2$9(), $paragraph200Regular);
2153
2153
  var alertStyles = {
2154
2154
  info: css(_templateObject3$6(), primary100),
2155
- warning: css(_templateObject4$3(), warning100),
2155
+ warning: css(_templateObject4$4(), warning100),
2156
2156
  error: css(_templateObject5$2(), danger100),
2157
2157
  success: css(_templateObject6$2(), success100)
2158
2158
  };
@@ -22359,8 +22359,7 @@ function _tagged_template_literal$f(strings, raw) {
22359
22359
  }
22360
22360
  function _templateObject$f() {
22361
22361
  var data = _tagged_template_literal$f([
22362
- "\n cursor: pointer;\n width: 100%;\n padding: 0 0.5rem;\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n white-space: nowrap;\n gap: 0.5rem;\n\n &:hover {\n background-color: ",
22363
- ";\n }\n "
22362
+ "\n cursor: pointer;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n box-sizing: border-box;\n white-space: nowrap;\n gap: 0.5rem;\n "
22364
22363
  ]);
22365
22364
  _templateObject$f = function _templateObject() {
22366
22365
  return data;
@@ -22369,8 +22368,8 @@ function _templateObject$f() {
22369
22368
  }
22370
22369
  function _templateObject1$a() {
22371
22370
  var data = _tagged_template_literal$f([
22372
- "\n cursor: pointer;\n background-color: transparent;\n text-align: left;\n border: none;\n padding: 1rem 0.625rem;\n white-space: nowrap;\n width: 100%;\n ",
22373
- "\n "
22371
+ "\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 0.5rem;\n &:hover {\n background-color: ",
22372
+ ";\n }\n "
22374
22373
  ]);
22375
22374
  _templateObject1$a = function _templateObject() {
22376
22375
  return data;
@@ -22379,7 +22378,8 @@ function _templateObject1$a() {
22379
22378
  }
22380
22379
  function _templateObject2$7() {
22381
22380
  var data = _tagged_template_literal$f([
22382
- "\n display: flex;\n align-items: center;\n justify-content: center;\n "
22381
+ "\n cursor: pointer;\n background-color: transparent;\n text-align: left;\n border: none;\n padding: 1rem 0.625rem;\n white-space: nowrap;\n width: 100%;\n ",
22382
+ "\n "
22383
22383
  ]);
22384
22384
  _templateObject2$7 = function _templateObject() {
22385
22385
  return data;
@@ -22388,44 +22388,65 @@ function _templateObject2$7() {
22388
22388
  }
22389
22389
  function _templateObject3$5() {
22390
22390
  var data = _tagged_template_literal$f([
22391
- "\n display: inline-block;\n width: 100%;\n "
22391
+ "\n display: flex;\n align-items: center;\n justify-content: center;\n "
22392
22392
  ]);
22393
22393
  _templateObject3$5 = function _templateObject() {
22394
22394
  return data;
22395
22395
  };
22396
22396
  return data;
22397
22397
  }
22398
+ function _templateObject4$3() {
22399
+ var data = _tagged_template_literal$f([
22400
+ "\n display: inline-block;\n width: 100%;\n "
22401
+ ]);
22402
+ _templateObject4$3 = function _templateObject() {
22403
+ return data;
22404
+ };
22405
+ return data;
22406
+ }
22398
22407
  var DropdownOption = function(param) {
22399
- var label = param.label, href = param.href, onClick = param.onClick, icon = param.icon;
22400
- var dropdownOptionStyles = css(_templateObject$f(), primary100);
22401
- var optionStyles = css(_templateObject1$a(), $paragraph200Regular);
22402
- var iconStyles = css(_templateObject2$7());
22403
- var dropdownOptionWrapper = css(_templateObject3$5());
22408
+ var label = param.label, href = param.href, selected = param.selected, checkbox = param.checkbox, onClick = param.onClick, icon = param.icon;
22409
+ var dropdownOptionStyles = css(_templateObject$f());
22410
+ var checkboxStyles = css(_templateObject1$a(), primary100);
22411
+ var optionStyles = css(_templateObject2$7(), $paragraph200Regular);
22412
+ var iconStyles = css(_templateObject3$5());
22413
+ var dropdownOptionWrapper = css(_templateObject4$3());
22404
22414
  return /*#__PURE__*/ jsx("div", {
22405
22415
  css: dropdownOptionWrapper,
22406
22416
  children: /*#__PURE__*/ jsxs("div", {
22407
- css: dropdownOptionStyles,
22417
+ css: checkboxStyles,
22408
22418
  children: [
22409
- icon && /*#__PURE__*/ jsx("div", {
22410
- css: iconStyles,
22411
- children: icon
22412
- }),
22413
- href ? /*#__PURE__*/ jsx("a", {
22414
- css: optionStyles,
22415
- href: href,
22419
+ checkbox && /*#__PURE__*/ jsx(Checkbox, {
22420
+ checked: selected,
22416
22421
  onClick: function() {
22417
22422
  return onClick === null || onClick === void 0 ? void 0 : onClick();
22418
- },
22419
- children: /*#__PURE__*/ jsx("div", {
22420
- children: label
22421
- })
22422
- }) : /*#__PURE__*/ jsx("button", {
22423
- css: optionStyles,
22424
- type: "button",
22425
- onClick: function() {
22426
- return onClick === null || onClick === void 0 ? void 0 : onClick();
22427
- },
22428
- children: label
22423
+ }
22424
+ }),
22425
+ /*#__PURE__*/ jsxs("div", {
22426
+ css: dropdownOptionStyles,
22427
+ children: [
22428
+ icon && /*#__PURE__*/ jsx("div", {
22429
+ css: iconStyles,
22430
+ children: icon
22431
+ }),
22432
+ href ? /*#__PURE__*/ jsx("a", {
22433
+ css: optionStyles,
22434
+ href: href,
22435
+ onClick: function() {
22436
+ return onClick === null || onClick === void 0 ? void 0 : onClick();
22437
+ },
22438
+ children: /*#__PURE__*/ jsx("div", {
22439
+ children: label
22440
+ })
22441
+ }) : /*#__PURE__*/ jsx("button", {
22442
+ css: optionStyles,
22443
+ type: "button",
22444
+ onClick: function() {
22445
+ return onClick === null || onClick === void 0 ? void 0 : onClick();
22446
+ },
22447
+ children: label
22448
+ })
22449
+ ]
22429
22450
  })
22430
22451
  ]
22431
22452
  })
@@ -22872,11 +22893,13 @@ function _templateObject1$8() {
22872
22893
  function _templateObject2$5() {
22873
22894
  var data = _tagged_template_literal$d([
22874
22895
  "\n flex: 1;\n cursor: pointer;\n border: 1px solid\n ",
22875
- ";\n background-color: ",
22896
+ ";\n\n background-color: ",
22876
22897
  ";\n border-radius: 0.5rem;\n -webkit-appearance: none;\n -moz-appearance: none;\n &::-ms-expand {\n display: none;\n }\n color: ",
22877
22898
  ";\n padding: ",
22878
22899
  ";\n outline: none;\n &::placeholder {\n color: ",
22879
22900
  ";\n opacity: 0.3;\n }\n transition: all 150ms ease-in-out;\n\n &:focus-within {\n border-color: ",
22901
+ ";\n }\n\n &:hover {\n background-color: ",
22902
+ ";\n }\n\n &:focus {\n background-color: ",
22880
22903
  ";\n }\n\n ",
22881
22904
  "\n"
22882
22905
  ]);
@@ -22931,11 +22954,11 @@ var InputWrapper = styled.div(_templateObject$d());
22931
22954
  var DropdownWrapper = styled.div(_templateObject1$8());
22932
22955
  // Style for the Select itself
22933
22956
  var BaseSelect = styled.select(_templateObject2$5(), function(param) {
22934
- var error = param.error, disabled = param.disabled;
22935
- return error && !disabled ? danger600 : neutral200;
22957
+ var error = param.error, disabled = param.disabled, type = param.type;
22958
+ return type === 'primary' ? error && !disabled ? danger600 : neutral200 : error && !disabled ? danger600 : 'transparent';
22936
22959
  }, function(param) {
22937
- var disabled = param.disabled;
22938
- return disabled ? neutral100 : 'white';
22960
+ var disabled = param.disabled, type = param.type;
22961
+ return disabled || type === 'secondary' ? neutral100 : 'white';
22939
22962
  }, textPrimary, function(param) {
22940
22963
  var sz = param.sz;
22941
22964
  return sz === 'lg' ? '0.5rem 0.563rem' : '0.375rem 0.563rem';
@@ -22943,18 +22966,28 @@ var BaseSelect = styled.select(_templateObject2$5(), function(param) {
22943
22966
  var error = param.error;
22944
22967
  return error ? danger600 : primary600;
22945
22968
  }, function(param) {
22946
- var sz = param.sz;
22947
- return sz === 'lg' ? $paragraph100Regular : $paragraph200Regular;
22969
+ var type = param.type;
22970
+ return type === 'primary' ? neutral100 : neutral200;
22971
+ }, function(param) {
22972
+ var type = param.type;
22973
+ return type === 'primary' ? neutral100 : neutral200;
22974
+ }, function(param) {
22975
+ var sz = param.sz, type = param.type;
22976
+ return type === 'primary' ? sz === 'lg' ? $paragraph100Regular : $paragraph200Regular : sz === 'lg' ? $paragraph100Semibold : $paragraph200Semibold;
22948
22977
  });
22949
- var Chip = styled.button(_templateObject3$4(), neutral100, $label200Medium);
22978
+ var Chip = styled.button(_templateObject3$4(), function(param) {
22979
+ var secondary = param.secondary;
22980
+ return secondary ? neutral300 : neutral100;
22981
+ }, $label200Medium);
22950
22982
  var ChipWrapper = styled.div(_templateObject4$2(), function(param) {
22951
22983
  var sz = param.sz;
22952
22984
  return sz === 'lg' ? '0.5rem 0.563rem' : '0.375rem 0.563rem';
22953
22985
  });
22954
22986
  var MultiSelectChip = function(option) {
22955
- var label = option.label, onClick = option.onClick;
22987
+ var label = option.label, onClick = option.onClick, _option_type = option.type, type = _option_type === void 0 ? 'primary' : _option_type;
22956
22988
  return /*#__PURE__*/ jsxs(Chip, {
22957
22989
  onClick: onClick,
22990
+ secondary: type === 'secondary',
22958
22991
  children: [
22959
22992
  label,
22960
22993
  /*#__PURE__*/ jsx(Cancel, {})
@@ -22963,15 +22996,21 @@ var MultiSelectChip = function(option) {
22963
22996
  };
22964
22997
  // Style for the Icons
22965
22998
  var IconWrapper$1 = styled.span(_templateObject5$1());
22966
- var PlaceholderOption = styled.option(_templateObject6$1(), $paragraph100Regular, textSecondary);
22999
+ var PlaceholderOption = styled.option(_templateObject6$1(), $paragraph100Semibold, textSecondary);
22967
23000
  var MultiSelect = function(_param) {
22968
- 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, props = _object_without_properties$a(_param, [
23001
+ 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, [
22969
23002
  "sz",
22970
23003
  "error",
22971
- "options"
23004
+ "options",
23005
+ "checkbox",
23006
+ "placeholder",
23007
+ "initialValue",
23008
+ "type"
22972
23009
  ]);
22973
23010
  var _useState = _sliced_to_array$7(useState(false), 2), open = _useState[0], setOpen = _useState[1];
22974
- var _useState1 = _sliced_to_array$7(useState([]), 2), values = _useState1[0], setValues = _useState1[1];
23011
+ var _useState1 = _sliced_to_array$7(useState(initialValue ? [
23012
+ initialValue
23013
+ ] : []), 2), values = _useState1[0], setValues = _useState1[1];
22975
23014
  var toggleSelect = function(option) {
22976
23015
  setValues(function(prevValues) {
22977
23016
  if (prevValues.some(function(val) {
@@ -22991,6 +23030,7 @@ var MultiSelect = function(_param) {
22991
23030
  /*#__PURE__*/ jsxs(InputWrapper, {
22992
23031
  children: [
22993
23032
  /*#__PURE__*/ jsx(BaseSelect, _object_spread_props$d(_object_spread$h({}, props), {
23033
+ type: type,
22994
23034
  onMouseDown: function(e) {
22995
23035
  setOpen(!open);
22996
23036
  e.stopPropagation();
@@ -23000,7 +23040,8 @@ var MultiSelect = function(_param) {
23000
23040
  value: "",
23001
23041
  disabled: true,
23002
23042
  hidden: true,
23003
- children: "Please select..."
23043
+ selected: true,
23044
+ children: "".concat(placeholder || 'Please select...')
23004
23045
  })
23005
23046
  })),
23006
23047
  /*#__PURE__*/ jsx(IconWrapper$1, {
@@ -23010,6 +23051,7 @@ var MultiSelect = function(_param) {
23010
23051
  sz: sz,
23011
23052
  children: values.map(function(option) {
23012
23053
  return /*#__PURE__*/ jsx(MultiSelectChip, _object_spread_props$d(_object_spread$h({}, option), {
23054
+ type: type,
23013
23055
  onClick: function() {
23014
23056
  return toggleSelect(option);
23015
23057
  }
@@ -23024,7 +23066,12 @@ var MultiSelect = function(_param) {
23024
23066
  bottom: 110,
23025
23067
  children: /*#__PURE__*/ jsx(Fragment, {
23026
23068
  children: options.map(function(option) {
23027
- return /*#__PURE__*/ jsx(DropdownOption, _object_spread_props$d(_object_spread$h({}, option), {
23069
+ return /*#__PURE__*/ jsx(DropdownOption, _object_spread_props$d(_object_spread$h({
23070
+ checkbox: true,
23071
+ selected: values.some(function(val) {
23072
+ return val.value === option.value;
23073
+ })
23074
+ }, option), {
23028
23075
  onClick: function() {
23029
23076
  return toggleSelect(option);
23030
23077
  }
@@ -32302,7 +32349,8 @@ function _templateObject() {
32302
32349
  }
32303
32350
  function _templateObject1() {
32304
32351
  var data = _tagged_template_literal([
32305
- "\n position: relative;\n display: inline-block;\n overflow: visible;\n width: 100%;\n max-width: max-content;\n height: fit-content;\n cursor: help;\n"
32352
+ "\n position: relative;\n display: inline-block;\n overflow: ",
32353
+ ";\n width: 100%;\n max-width: max-content;\n height: fit-content;\n cursor: help;\n"
32306
32354
  ]);
32307
32355
  _templateObject1 = function _templateObject() {
32308
32356
  return data;
@@ -32324,12 +32372,15 @@ var TooltipWrapper = styled.div(_templateObject(), neutral900, $paragraph300Regu
32324
32372
  return hover ? 'block' : 'none';
32325
32373
  }, function(param) {
32326
32374
  var size = param.size;
32327
- return size === 'small' ? 'min-content' : '100%';
32375
+ return size === 'small' ? 'min-content' : 'max-content';
32328
32376
  }, function(param) {
32329
32377
  var _param_x = param.x, x = _param_x === void 0 ? 'bottom' : _param_x, _param_y = param.y, y = _param_y === void 0 ? 'left' : _param_y;
32330
32378
  return "\n margin-right: ".concat(x === 'left' ? '100%' : 'auto', ";\n margin-left: ").concat(x === 'right' ? '100%' : 'auto', ";\n z-index: 50;\n top: ").concat(y === 'bottom' ? '150%' : y === 'center' ? '0rem' : 'auto', ";\n bottom: ").concat(y === 'top' ? '150%' : y === 'center' ? '0rem' : 'auto', ";\n left: ").concat(y === 'center' ? x === 'right' ? '1rem' : 'auto' : x === 'right' ? '-1.5rem' : x === 'center' ? '0' : 'auto', ";\n right: ").concat(y === 'center' ? x === 'left' ? '1rem' : 'auto' : x === 'left' ? '-1.5rem' : x === 'center' ? '0' : 'auto', ";\n ");
32331
32379
  });
32332
- var TooltipContainer = styled.div(_templateObject1());
32380
+ var TooltipContainer = styled.div(_templateObject1(), function(param) {
32381
+ var hover = param.hover;
32382
+ return hover ? 'visible' : 'hidden';
32383
+ });
32333
32384
  var Triangle = function(param) {
32334
32385
  var className = param.className;
32335
32386
  return /*#__PURE__*/ jsx("svg", {
@@ -32362,10 +32413,11 @@ var Tooltip = function(_param) {
32362
32413
  setHover(false);
32363
32414
  };
32364
32415
  return /*#__PURE__*/ jsxs(TooltipContainer, {
32416
+ onMouseEnter: handleMouseEnter,
32417
+ onMouseLeave: handleMouseLeave,
32418
+ hover: hover,
32365
32419
  children: [
32366
32420
  /*#__PURE__*/ jsx("div", {
32367
- onMouseEnter: handleMouseEnter,
32368
- onMouseLeave: handleMouseLeave,
32369
32421
  children: children
32370
32422
  }),
32371
32423
  /*#__PURE__*/ jsxs(TooltipWrapper, _object_spread_props(_object_spread({}, rest), {
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.0",
5
+ "version": "0.8.2",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "publishConfig": {
@@ -3,5 +3,7 @@ export interface DropdownOptionProps {
3
3
  href?: string;
4
4
  onClick?: () => void;
5
5
  icon?: React.ReactNode;
6
+ selected?: boolean;
7
+ checkbox?: boolean;
6
8
  }
7
- export declare const DropdownOption: ({ label, href, onClick, icon, }: DropdownOptionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare const DropdownOption: ({ label, href, selected, checkbox, onClick, icon, }: DropdownOptionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -8,8 +8,12 @@ export interface MultiSelectProps extends React.InputHTMLAttributes<HTMLSelectEl
8
8
  leftIcon?: React.ElementType;
9
9
  rightIcon?: React.ElementType;
10
10
  options?: MultiSelectOption[];
11
+ checkbox?: boolean;
12
+ initialValue?: MultiSelectOption;
13
+ type?: 'primary' | 'secondary';
11
14
  }
12
15
  export interface ChipProps {
13
16
  sz?: 'sm' | 'lg';
17
+ secondary?: boolean;
14
18
  }
15
- export declare const MultiSelect: ({ sz, error, options, ...props }: MultiSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
19
+ export declare const MultiSelect: ({ sz, error, options, checkbox, placeholder, initialValue, type, ...props }: MultiSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;