bako-ui 0.2.1 → 0.2.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/dist/index.d.mts CHANGED
@@ -25,10 +25,9 @@ declare function GridItem(props: GridItemProps$1): react_jsx_runtime.JSX.Element
25
25
 
26
26
  declare const Badge: react.ForwardRefExoticComponent<_chakra_ui_react.BadgeProps & react.RefAttributes<HTMLSpanElement>>;
27
27
 
28
- interface ButtonProps extends ButtonProps$1 {
29
- }
28
+ declare const Button: react.ForwardRefExoticComponent<_chakra_ui_react.ButtonProps & react.RefAttributes<HTMLButtonElement>>;
30
29
 
31
- declare function Button({ colorPalette, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
30
+ type ButtonProps = ButtonProps$1;
32
31
 
33
32
  declare const Card: typeof Card$1;
34
33
 
@@ -266,11 +265,15 @@ declare const ProgressLabel: react.ForwardRefExoticComponent<Progress$1.LabelPro
266
265
  declare const ProgressValueText: react.ForwardRefExoticComponent<Progress$1.ValueTextProps & react.RefAttributes<HTMLDivElement>>;
267
266
 
268
267
  interface TooltipProps extends Tooltip$1.RootProps {
269
- content: react__default.ReactNode;
270
268
  showArrow?: boolean;
269
+ portalled?: boolean;
270
+ portalRef?: react__default.RefObject<HTMLElement | null>;
271
+ content: react__default.ReactNode;
272
+ contentProps?: Tooltip$1.ContentProps;
273
+ disabled?: boolean;
271
274
  }
272
275
 
273
- declare function Tooltip(props: TooltipProps): react_jsx_runtime.JSX.Element;
276
+ declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
274
277
 
275
278
  declare const Dialog: typeof Dialog$1 & {
276
279
  Portal: typeof Portal;
package/dist/index.d.ts CHANGED
@@ -25,10 +25,9 @@ declare function GridItem(props: GridItemProps$1): react_jsx_runtime.JSX.Element
25
25
 
26
26
  declare const Badge: react.ForwardRefExoticComponent<_chakra_ui_react.BadgeProps & react.RefAttributes<HTMLSpanElement>>;
27
27
 
28
- interface ButtonProps extends ButtonProps$1 {
29
- }
28
+ declare const Button: react.ForwardRefExoticComponent<_chakra_ui_react.ButtonProps & react.RefAttributes<HTMLButtonElement>>;
30
29
 
31
- declare function Button({ colorPalette, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
30
+ type ButtonProps = ButtonProps$1;
32
31
 
33
32
  declare const Card: typeof Card$1;
34
33
 
@@ -266,11 +265,15 @@ declare const ProgressLabel: react.ForwardRefExoticComponent<Progress$1.LabelPro
266
265
  declare const ProgressValueText: react.ForwardRefExoticComponent<Progress$1.ValueTextProps & react.RefAttributes<HTMLDivElement>>;
267
266
 
268
267
  interface TooltipProps extends Tooltip$1.RootProps {
269
- content: react__default.ReactNode;
270
268
  showArrow?: boolean;
269
+ portalled?: boolean;
270
+ portalRef?: react__default.RefObject<HTMLElement | null>;
271
+ content: react__default.ReactNode;
272
+ contentProps?: Tooltip$1.ContentProps;
273
+ disabled?: boolean;
271
274
  }
272
275
 
273
- declare function Tooltip(props: TooltipProps): react_jsx_runtime.JSX.Element;
276
+ declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
274
277
 
275
278
  declare const Dialog: typeof Dialog$1 & {
276
279
  Portal: typeof Portal;
package/dist/index.js CHANGED
@@ -2,12 +2,32 @@
2
2
 
3
3
  var react = require('@chakra-ui/react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
- var react$1 = require('react');
5
+ var React = require('react');
6
6
  var reactDom = require('react-dom');
7
7
  var reactHookForm = require('react-hook-form');
8
8
  var useMaskInput = require('use-mask-input');
9
9
  var anatomy = require('@chakra-ui/react/anatomy');
10
10
 
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
11
31
  // src/components/Stack/stack.tsx
12
32
  var Stack = react.Stack;
13
33
  var HStack = react.HStack;
@@ -23,16 +43,17 @@ var text_default = react.Text;
23
43
  var heading_default = react.Heading;
24
44
  var box_default = react.Box;
25
45
  var Badge = react.Badge;
26
- function Button({
27
- colorPalette = "primary",
28
- ...props
29
- }) {
30
- return /* @__PURE__ */ jsxRuntime.jsx(react.Button, { colorPalette, ...props });
31
- }
46
+ var Button = React.forwardRef(
47
+ function Button2(props, ref) {
48
+ const { colorPalette = "primary", ...rest } = props;
49
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Button, { ref, colorPalette, ...rest });
50
+ }
51
+ );
52
+ var button_default = Button;
32
53
  var Card = react.Card;
33
54
  var card_default = Card;
34
55
  var Clipboard = react.Clipboard;
35
- var close_button_default = react$1.forwardRef(
56
+ var close_button_default = React.forwardRef(
36
57
  function CloseButton(props, ref) {
37
58
  return /* @__PURE__ */ jsxRuntime.jsx(react.CloseButton, { ref, ...props });
38
59
  }
@@ -40,7 +61,7 @@ var close_button_default = react$1.forwardRef(
40
61
  function Container(props) {
41
62
  return /* @__PURE__ */ jsxRuntime.jsx(react.Container, { ...props });
42
63
  }
43
- var icon_button_default = react$1.forwardRef(
64
+ var icon_button_default = React.forwardRef(
44
65
  function IconButton(props, ref) {
45
66
  return /* @__PURE__ */ jsxRuntime.jsx(react.IconButton, { ref, ...props });
46
67
  }
@@ -48,16 +69,16 @@ var icon_button_default = react$1.forwardRef(
48
69
  var QrCode = react.QrCode;
49
70
  var separator_default = react.Separator;
50
71
  var image_default = react.Image;
51
- var Icon = react$1.forwardRef(function Icon2(props, ref) {
72
+ var Icon = React.forwardRef(function Icon2(props, ref) {
52
73
  return /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { ref, ...props });
53
74
  });
54
75
  var icon_default = Icon;
55
- var link_default = react$1.forwardRef(
76
+ var link_default = React.forwardRef(
56
77
  function Link(props, ref) {
57
78
  return /* @__PURE__ */ jsxRuntime.jsx(react.Link, { ref, ...props });
58
79
  }
59
80
  );
60
- var link_overlay_default = react$1.forwardRef(
81
+ var link_overlay_default = React.forwardRef(
61
82
  function LinkOverlay(props, ref) {
62
83
  return /* @__PURE__ */ jsxRuntime.jsx(react.LinkOverlay, { ref, ...props });
63
84
  }
@@ -66,7 +87,7 @@ var loader_default = react.Spinner;
66
87
  var Skeleton = react.Skeleton;
67
88
  var SkeletonCircle = react.SkeletonCircle;
68
89
  var SkeletonText = react.SkeletonText;
69
- var Checkbox = react$1.forwardRef(
90
+ var Checkbox = React.forwardRef(
70
91
  function Checkbox2(props, ref) {
71
92
  const { icon, children, inputProps, rootRef, ...rest } = props;
72
93
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Checkbox.Root, { ref: rootRef, ...rest, children: [
@@ -81,7 +102,7 @@ var Combobox = {
81
102
  ...react.Combobox,
82
103
  Portal: react.Portal
83
104
  };
84
- var input_default = react$1.forwardRef(
105
+ var input_default = React.forwardRef(
85
106
  function Input(props, ref) {
86
107
  return /* @__PURE__ */ jsxRuntime.jsx(react.Input, { ref, ...props });
87
108
  }
@@ -94,8 +115,8 @@ function MoneyField({
94
115
  decimalScale = 2,
95
116
  ...props
96
117
  }) {
97
- const inputRef = react$1.useRef(null);
98
- const config2 = react$1.useMemo(
118
+ const inputRef = React.useRef(null);
119
+ const config2 = React.useMemo(
99
120
  () => ({
100
121
  thousandSeparator,
101
122
  decimalSeparator,
@@ -103,7 +124,7 @@ function MoneyField({
103
124
  }),
104
125
  [thousandSeparator, decimalSeparator, decimalScale]
105
126
  );
106
- const formatNumber = react$1.useCallback(
127
+ const formatNumber = React.useCallback(
107
128
  (num) => {
108
129
  const numStr = String(num).replace(/[^\d.-]/g, "");
109
130
  if (!numStr || numStr === "-") return "";
@@ -121,17 +142,17 @@ function MoneyField({
121
142
  },
122
143
  [config2]
123
144
  );
124
- const unformatNumber = react$1.useCallback(
145
+ const unformatNumber = React.useCallback(
125
146
  (formatted) => {
126
147
  return formatted.replace(new RegExp(`\\${config2.thousandSeparator}`, "g"), "").replace(new RegExp(`\\${config2.decimalSeparator}`, "g"), ".");
127
148
  },
128
149
  [config2]
129
150
  );
130
- const displayValue = react$1.useMemo(() => {
151
+ const displayValue = React.useMemo(() => {
131
152
  if (!value && value !== 0) return "";
132
153
  return formatNumber(value);
133
154
  }, [value, formatNumber]);
134
- const handleChange = react$1.useCallback(
155
+ const handleChange = React.useCallback(
135
156
  (event) => {
136
157
  const inputValue = event.target.value;
137
158
  const cursorPosition = event.target.selectionStart || 0;
@@ -164,12 +185,12 @@ function MoneyField({
164
185
  }
165
186
  );
166
187
  }
167
- var RadioGroup = react$1.forwardRef(
188
+ var RadioGroup = React.forwardRef(
168
189
  function RadioGroup2(props, ref) {
169
190
  return /* @__PURE__ */ jsxRuntime.jsx(react.RadioGroup.Root, { ref, spaceX: 2, ...props });
170
191
  }
171
192
  );
172
- var Radio = react$1.forwardRef(
193
+ var Radio = React.forwardRef(
173
194
  function Radio2(props, ref) {
174
195
  const { children, inputProps, ...rest } = props;
175
196
  return /* @__PURE__ */ jsxRuntime.jsxs(react.RadioGroup.Item, { ...rest, children: [
@@ -234,15 +255,15 @@ function RhfCombobox({
234
255
  initialItems: options,
235
256
  filter: contains
236
257
  });
237
- const [inputValue, setInputValue] = react$1.useState(value || "");
238
- const [isTyping, setIsTyping] = react$1.useState(false);
239
- react$1.useEffect(() => {
258
+ const [inputValue, setInputValue] = React.useState(value || "");
259
+ const [isTyping, setIsTyping] = React.useState(false);
260
+ React.useEffect(() => {
240
261
  if (isTyping) return;
241
262
  if (value !== inputValue) {
242
263
  setInputValue(value || "");
243
264
  }
244
265
  }, [value, inputValue, isTyping]);
245
- const handleValueChange = react$1.useCallback(
266
+ const handleValueChange = React.useCallback(
246
267
  (details) => {
247
268
  const newValue = details.value[0] || "";
248
269
  setIsTyping(false);
@@ -252,7 +273,7 @@ function RhfCombobox({
252
273
  },
253
274
  [onChange, onInputValueChange]
254
275
  );
255
- const handleInputValueChange = react$1.useCallback(
276
+ const handleInputValueChange = React.useCallback(
256
277
  (details) => {
257
278
  setIsTyping(true);
258
279
  setInputValue(details.inputValue);
@@ -267,7 +288,7 @@ function RhfCombobox({
267
288
  },
268
289
  [filter, allowCustomValue, onChange, onInputValueChange]
269
290
  );
270
- const handleOpenChange = react$1.useCallback(
291
+ const handleOpenChange = React.useCallback(
271
292
  (details) => {
272
293
  var _a, _b;
273
294
  if (allowCustomValue && details.open && inputValue.trim() !== "") {
@@ -280,7 +301,7 @@ function RhfCombobox({
280
301
  },
281
302
  [slotProps == null ? void 0 : slotProps.root, allowCustomValue, inputValue, collection.items.length]
282
303
  );
283
- const hasValue = react$1.useMemo(() => {
304
+ const hasValue = React.useMemo(() => {
284
305
  if (!value) {
285
306
  return false;
286
307
  }
@@ -391,7 +412,7 @@ function RhfInput({
391
412
  field: { value, onChange, ref, ...rest }
392
413
  } = reactHookForm.useController({ control, defaultValue, name });
393
414
  const { inputGroup } = slotProps || {};
394
- const hasValue = react$1.useMemo(
415
+ const hasValue = React.useMemo(
395
416
  () => value != null && value !== "" && value.toString().length > 0,
396
417
  [value]
397
418
  );
@@ -454,7 +475,7 @@ function RhfMoneyField({
454
475
  const {
455
476
  field: { value, onChange, ...rest }
456
477
  } = reactHookForm.useController({ control, defaultValue, name });
457
- const hasValue = react$1.useMemo(() => {
478
+ const hasValue = React.useMemo(() => {
458
479
  return String(value).length > 0;
459
480
  }, [value]);
460
481
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Field.Root, { invalid: !!error, children: [
@@ -503,7 +524,7 @@ var Select = {
503
524
  ...react.Select,
504
525
  Portal: react.Portal
505
526
  };
506
- var Switch = react$1.forwardRef(
527
+ var Switch = React.forwardRef(
507
528
  function Switch2(props, ref) {
508
529
  const { children, inputProps, thumbLabel, ...rest } = props;
509
530
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Switch.Root, { ...rest, children: [
@@ -525,7 +546,7 @@ var defaultMaskOptions = {
525
546
  showMaskOnFocus: false,
526
547
  showMaskOnHover: false
527
548
  };
528
- var TextMask = react$1.forwardRef(
549
+ var TextMask = React.forwardRef(
529
550
  ({ mask, maskOptions, ...props }, ref) => {
530
551
  const mergedMaskOptions = {
531
552
  ...defaultMaskOptions,
@@ -553,7 +574,7 @@ function AvatarGroup(props) {
553
574
  return /* @__PURE__ */ jsxRuntime.jsx(react.Group, { ...props });
554
575
  }
555
576
  var EmptyState = react.EmptyState;
556
- var Progress = react$1.forwardRef(
577
+ var Progress = React.forwardRef(
557
578
  function Progress2(props, ref) {
558
579
  const {
559
580
  showValueText,
@@ -577,16 +598,29 @@ var ProgressTrack = react.Progress.Track;
577
598
  var ProgressRange = react.Progress.Range;
578
599
  var ProgressLabel = react.Progress.Label;
579
600
  var ProgressValueText = react.Progress.ValueText;
580
- function Tooltip(props) {
581
- const { children, content, showArrow = true, ...rest } = props;
582
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Tooltip.Root, { ...rest, children: [
583
- /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Trigger, { asChild: true, children }),
584
- /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Tooltip.Content, { children: [
585
- showArrow && /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Arrow, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.ArrowTip, {}) }),
586
- content
587
- ] }) }) })
588
- ] });
589
- }
601
+ var Tooltip = React__namespace.forwardRef(
602
+ function Tooltip2(props, ref) {
603
+ const {
604
+ showArrow,
605
+ children,
606
+ disabled,
607
+ portalled = true,
608
+ content,
609
+ contentProps,
610
+ portalRef,
611
+ ...rest
612
+ } = props;
613
+ if (disabled) return children;
614
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Tooltip.Root, { ...rest, children: [
615
+ /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Trigger, { asChild: true, children }),
616
+ /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Tooltip.Content, { ref, ...contentProps, children: [
617
+ showArrow && /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Arrow, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.ArrowTip, {}) }),
618
+ content
619
+ ] }) }) })
620
+ ] });
621
+ }
622
+ );
623
+ var tooltip_default = Tooltip;
590
624
  var Dialog = {
591
625
  ...react.Dialog,
592
626
  Portal: react.Portal
@@ -775,10 +809,10 @@ var semanticColors = react.defineSemanticTokens.colors({
775
809
  }
776
810
  },
777
811
  panel: {
778
- value: { _light: "{colors.gray.600}", _dark: "{colors.gray.600}" }
812
+ value: { _light: "{colors.gray.700}", _dark: "{colors.gray.700}" }
779
813
  },
780
814
  muted: {
781
- value: { _light: "{colors.gray.500}", _dark: "{colors.gray.500}" }
815
+ value: { _light: "{colors.gray.600}", _dark: "{colors.gray.600}" }
782
816
  }
783
817
  },
784
818
  fg: {
@@ -821,8 +855,8 @@ var semanticColors = react.defineSemanticTokens.colors({
821
855
  },
822
856
  solid: {
823
857
  value: {
824
- _light: "{colors.primary.default}",
825
- _dark: "{colors.primary.default}"
858
+ _light: "{colors.primary.main}",
859
+ _dark: "{colors.primary.main}"
826
860
  }
827
861
  },
828
862
  muted: {
@@ -848,8 +882,8 @@ var semanticColors = react.defineSemanticTokens.colors({
848
882
  },
849
883
  border: {
850
884
  value: {
851
- _light: "{colors.gray.600}",
852
- _dark: "{colors.gray.600}"
885
+ _light: "{colors.gray.700}",
886
+ _dark: "{colors.gray.700}"
853
887
  }
854
888
  }
855
889
  },
@@ -913,6 +947,26 @@ var semanticColors = react.defineSemanticTokens.colors({
913
947
  var semanticTokens = {
914
948
  colors: semanticColors
915
949
  };
950
+ var accordionSlotRecipe = react.defineSlotRecipe({
951
+ slots: anatomy.accordionAnatomy.keys(),
952
+ base: {
953
+ root: {
954
+ "--accordion-radius": "radii.lg"
955
+ }
956
+ },
957
+ variants: {
958
+ variant: {
959
+ subtle: {
960
+ item: {
961
+ bg: "bg.panel",
962
+ _open: {
963
+ bg: "bg.panel"
964
+ }
965
+ }
966
+ }
967
+ }
968
+ }
969
+ });
916
970
  var menuSlotRecipe = react.defineSlotRecipe({
917
971
  slots: anatomy.menuAnatomy.keys(),
918
972
  base: {
@@ -981,6 +1035,22 @@ var tabsSlotRecipe = react.defineSlotRecipe({
981
1035
  color: "fg"
982
1036
  }
983
1037
  }
1038
+ },
1039
+ subtle: {
1040
+ trigger: {
1041
+ rounded: "lg",
1042
+ color: "textSecondary",
1043
+ bg: "bg.panel",
1044
+ transition: "all 0.3s",
1045
+ _hover: {
1046
+ bg: "bg.muted",
1047
+ color: "textPrimary"
1048
+ },
1049
+ _selected: {
1050
+ color: "textPrimary",
1051
+ bg: "bg.muted"
1052
+ }
1053
+ }
984
1054
  }
985
1055
  }
986
1056
  }
@@ -1035,15 +1105,16 @@ var slotRecipes = {
1035
1105
  menu: menuSlotRecipe,
1036
1106
  tabs: tabsSlotRecipe,
1037
1107
  progress: progessSlotRecipes,
1038
- toast: toastSlotRecipe
1108
+ toast: toastSlotRecipe,
1109
+ accordion: accordionSlotRecipe
1039
1110
  };
1040
1111
  var colorsTokens = react.defineTokens.colors({
1041
1112
  primary: {
1042
- contrast: { value: "{colors.gray.500}" },
1043
- default: { value: "{colors.yellow.100}" }
1113
+ contrast: { value: "{colors.gray.600}" },
1114
+ main: { value: "{colors.yellow.100}" }
1044
1115
  },
1045
1116
  secondary: {
1046
- default: { value: "{colors.gray.500}" },
1117
+ main: { value: "{colors.gray.600}" },
1047
1118
  contrast: { value: "{colors.gray.300}" }
1048
1119
  },
1049
1120
  textPrimary: { value: "{colors.gray.100}" },
@@ -1056,8 +1127,10 @@ var colorsTokens = react.defineTokens.colors({
1056
1127
  "200": { value: "#AAA6A1" },
1057
1128
  "300": { value: "#868079" },
1058
1129
  "400": { value: "#5E5955" },
1059
- "500": { value: "#201F1D" },
1060
- "600": { value: "#151413" }
1130
+ "500": { value: "#353230" },
1131
+ "550": { value: "#2B2927" },
1132
+ "600": { value: "#201F1D" },
1133
+ "700": { value: "#151413" }
1061
1134
  },
1062
1135
  yellow: {
1063
1136
  "50": { value: "#EED07C" },
@@ -1221,7 +1294,7 @@ exports.AvatarGroup = AvatarGroup;
1221
1294
  exports.Badge = Badge;
1222
1295
  exports.Box = box_default;
1223
1296
  exports.Breadcrumb = Breadcrumb;
1224
- exports.Button = Button;
1297
+ exports.Button = button_default;
1225
1298
  exports.Card = card_default;
1226
1299
  exports.CheckIcon = CheckIcon;
1227
1300
  exports.Checkbox = checkbox_default;
@@ -1275,7 +1348,7 @@ exports.TextArea = TextArea;
1275
1348
  exports.TextMask = text_mask_default;
1276
1349
  exports.ThemeProvider = ThemeProvider;
1277
1350
  exports.Toast = Toast;
1278
- exports.Tooltip = Tooltip;
1351
+ exports.Tooltip = tooltip_default;
1279
1352
  exports.VStack = VStack;
1280
1353
  exports.WalletIcon = WalletIcon;
1281
1354
  exports.theme = theme_default;