@cashub/ui 0.26.1 → 0.26.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.26.1",
3
+ "version": "0.26.3",
4
4
  "private": false,
5
5
  "author": "CasHUB Team",
6
6
  "description": "CasHUB UI components library",
package/select/Select.js CHANGED
@@ -44,7 +44,8 @@ const Select = _ref => {
44
44
  fill,
45
45
  fillReverse,
46
46
  onBlur,
47
- onSearch
47
+ onSearch,
48
+ flexGrow
48
49
  } = _ref;
49
50
  const {
50
51
  t
@@ -494,64 +495,70 @@ const Select = _ref => {
494
495
  }
495
496
  }
496
497
  }, [setupFocus, display, allowSearch]);
497
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactOutsideClickHandler.default, {
498
- onOutsideClick: () => {
499
- setDisplay(false);
500
- if (onBlur) onBlur();
501
- setIsFocusCombobox(false);
498
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
499
+ style: {
500
+ flexGrow: flexGrow ? 1 : 0
502
501
  },
503
- disabled: !isFocusCombobox,
504
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Combobox, {
505
- role: "combobox",
506
- tabIndex: "0",
507
- "aria-haspopup": "listbox",
508
- "aria-expanded": display,
509
- "aria-owns": id,
510
- ref: setComboboxElement,
511
- onClick: handleToggle,
512
- onKeyUp: handleKeyUp,
513
- onKeyDown: handleKeyDown,
514
- $display: display,
515
- disabled: disabled,
516
- fullWidth: fullWidth,
517
- large: large,
518
- $fill: fill,
519
- fillReverse: fillReverse,
520
- onFocus: handleFocus,
521
- placeholder: placeholder,
522
- children: [selectedItem, selectedOptions.length > 0 && !multiple && !disabled && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButton, {
523
- onClick: () => {
524
- onSelect('');
525
- }
526
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandArrow, {
502
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactOutsideClickHandler.default, {
503
+ onOutsideClick: () => {
504
+ setDisplay(false);
505
+ if (onBlur) onBlur();
506
+ setIsFocusCombobox(false);
507
+ },
508
+ disabled: !isFocusCombobox,
509
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Combobox, {
510
+ flexGrow: flexGrow,
511
+ role: "combobox",
512
+ tabIndex: "0",
527
513
  "aria-haspopup": "listbox",
528
- "aria-expanded": display
529
- })]
530
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListBox.default, {
531
- role: "listbox",
532
- tabIndex: "0",
533
- id: id,
534
- ref: setListBoxElement,
535
- onKeyUp: handleKeyUp,
536
- onKeyDown: handleKeyDown,
537
- width: listBoxWidth,
538
- $display: display,
539
- style: styles.popper,
540
- ...attributes.popper,
541
- placement: state && state.placement,
542
- children: [allowSearch && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBox.default, {
543
- ref: searchBoxElement,
544
- placeholder: "Search",
545
- onChange: handleSearchChange,
546
- value: search
547
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Options.default, {
548
- ref: optionsElementRef,
549
- allowSearch: allowSearch,
550
- children: optionItem || /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
551
- children: "No results found"
552
- })
514
+ "aria-expanded": display,
515
+ "aria-owns": id,
516
+ ref: setComboboxElement,
517
+ onClick: handleToggle,
518
+ onKeyUp: handleKeyUp,
519
+ onKeyDown: handleKeyDown,
520
+ $display: display,
521
+ disabled: disabled,
522
+ fullWidth: fullWidth,
523
+ large: large,
524
+ $fill: fill,
525
+ fillReverse: fillReverse,
526
+ onFocus: handleFocus,
527
+ placeholder: placeholder,
528
+ children: [selectedItem, selectedOptions.length > 0 && !multiple && !disabled && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButton, {
529
+ onClick: () => {
530
+ onSelect('');
531
+ }
532
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandArrow, {
533
+ "aria-haspopup": "listbox",
534
+ "aria-expanded": display
535
+ })]
536
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListBox.default, {
537
+ role: "listbox",
538
+ tabIndex: "0",
539
+ id: id,
540
+ ref: setListBoxElement,
541
+ onKeyUp: handleKeyUp,
542
+ onKeyDown: handleKeyDown,
543
+ width: listBoxWidth,
544
+ $display: display,
545
+ style: styles.popper,
546
+ ...attributes.popper,
547
+ placement: state && state.placement,
548
+ children: [allowSearch && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBox.default, {
549
+ ref: searchBoxElement,
550
+ placeholder: "Search",
551
+ onChange: handleSearchChange,
552
+ value: search
553
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Options.default, {
554
+ ref: optionsElementRef,
555
+ allowSearch: allowSearch,
556
+ children: optionItem || /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
557
+ children: "No results found"
558
+ })
559
+ })]
553
560
  })]
554
- })]
561
+ })
555
562
  });
556
563
  };
557
564
  const Icon = _ref2 => {
@@ -570,45 +577,50 @@ const Icon = _ref2 => {
570
577
  }), "\xA0"]
571
578
  });
572
579
  };
573
- const Combobox = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n min-height: 36px;\n min-width: 160px;\n cursor: pointer;\n position: relative;\n background: transparent;\n color: var(--font-on-background);\n font-size: var(--font-body1);\n border: var(--border-width) solid var(--border-color);\n border-radius: var(--border-radius-l);\n padding: 0 calc(var(--spacing-s) * 2 + 8px) 0 var(--spacing-s);\n\n &:focus {\n ", ";\n }\n\n ", "\n\n ", "\n ", "\n \n ", ";\n\n ", "\n\n ", "\n\n ", "\n"])), _ref3 => {
580
+ const Combobox = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n min-height: 36px;\n cursor: pointer;\n position: relative;\n background: transparent;\n color: var(--font-on-background);\n font-size: var(--font-body1);\n border: var(--border-width) solid var(--border-color);\n border-radius: var(--border-radius-l);\n padding: 0 calc(var(--spacing-s) * 2 + 8px) 0 var(--spacing-s);\n\n &:focus {\n ", ";\n }\n\n ", "\n\n ", "\n\n ", "\n ", "\n \n ", ";\n\n ", "\n\n ", "\n\n ", "\n"])), _ref3 => {
574
581
  let {
575
582
  disabled
576
583
  } = _ref3;
577
584
  return !disabled && "\n border-color: var(--color-primary);\n outline: none;\n ";
578
585
  }, _ref4 => {
579
586
  let {
580
- $display
587
+ flexGrow
581
588
  } = _ref4;
582
- return $display && "\n border-color: var(--color-primary);\n outline: none;\n ";
589
+ return !flexGrow && 'min-width: 160px;';
583
590
  }, _ref5 => {
584
591
  let {
585
- disabled
592
+ $display
586
593
  } = _ref5;
587
- return disabled && 'cursor: not-allowed;opacity: 0.5;';
594
+ return $display && "\n border-color: var(--color-primary);\n outline: none;\n ";
588
595
  }, _ref6 => {
589
596
  let {
590
- placeholder
597
+ disabled
591
598
  } = _ref6;
592
- return placeholder && 'color: var(--font-on-mute);';
599
+ return disabled && 'cursor: not-allowed;opacity: 0.5;';
593
600
  }, _ref7 => {
594
601
  let {
595
- fullWidth
602
+ placeholder
596
603
  } = _ref7;
597
- return fullWidth ? 'width: 100%' : 'max-width: 320px';
604
+ return placeholder && 'color: var(--font-on-mute);';
598
605
  }, _ref8 => {
599
606
  let {
600
- large
607
+ fullWidth
601
608
  } = _ref8;
602
- return large && "\n height: 40px;\n padding: 12px calc(var(--spacing-s) * 2 + 8px) 12px var(--spacing-s);\n ";
609
+ return fullWidth ? 'width: 100%' : 'max-width: 320px';
603
610
  }, _ref9 => {
604
611
  let {
605
- $fill
612
+ large
606
613
  } = _ref9;
607
- return $fill && "\n background: var(--color-background2);\n border-color: transparent;\n ";
614
+ return large && "\n height: 40px;\n padding: 12px calc(var(--spacing-s) * 2 + 8px) 12px var(--spacing-s);\n ";
608
615
  }, _ref10 => {
609
616
  let {
610
- fillReverse
617
+ $fill
611
618
  } = _ref10;
619
+ return $fill && "\n background: var(--color-background2);\n border-color: transparent;\n ";
620
+ }, _ref11 => {
621
+ let {
622
+ fillReverse
623
+ } = _ref11;
612
624
  return fillReverse && "\n background: var(--color-background1);\n border-color: transparent;\n ";
613
625
  });
614
626
  Combobox.displayName = 'Combobox';
@@ -91,11 +91,11 @@ const Tooltip = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
91
91
  })
92
92
  });
93
93
  });
94
- const TooltipTooltip = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n white-space: pre-line;\n visibility: ", ";\n border: 1px solid var(--border-color);\n color: var(--font-on-background);\n background: var(--color-background2);\n box-shadow: var(--box-shadow);\n border-radius: calc(var(--border-radius) / 2);\n padding: var(--spacing-xs);\n z-index: 80;\n text-align: left;\n font-size: var(--font-body1);\n font-weight: var(--font-normal);\n line-height: 1.5;\n word-break: break-word;\n max-width: 50vw;\n"])), _ref2 => {
94
+ const TooltipTooltip = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n white-space: pre-line;\n display: ", ";\n border: 1px solid var(--border-color);\n color: var(--font-on-background);\n background: var(--color-background2);\n box-shadow: var(--box-shadow);\n border-radius: calc(var(--border-radius) / 2);\n padding: var(--spacing-xs);\n z-index: 80;\n text-align: left;\n font-size: var(--font-body1);\n font-weight: var(--font-normal);\n line-height: 1.5;\n word-break: break-word;\n max-width: 50vw;\n"])), _ref2 => {
95
95
  let {
96
96
  $display
97
97
  } = _ref2;
98
- return $display ? 'visible' : 'hidden';
98
+ return $display ? 'block' : 'none';
99
99
  });
100
100
  const TooltipArrow = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: ", ";\n top: -0.5rem;\n left: 0;\n width: 1rem;\n height: 1rem;\n\n &::before {\n position: absolute;\n display: block;\n content: '';\n border-color: transparent;\n border-style: solid;\n top: 0;\n border-width: 0 0.5rem 0.5rem 0.5rem;\n border-bottom-color: var(--border-color);\n }\n"])), _ref3 => {
101
101
  let {