bako-ui 0.2.1 → 0.2.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/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +104 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -266,11 +266,15 @@ declare const ProgressLabel: react.ForwardRefExoticComponent<Progress$1.LabelPro
|
|
|
266
266
|
declare const ProgressValueText: react.ForwardRefExoticComponent<Progress$1.ValueTextProps & react.RefAttributes<HTMLDivElement>>;
|
|
267
267
|
|
|
268
268
|
interface TooltipProps extends Tooltip$1.RootProps {
|
|
269
|
-
content: react__default.ReactNode;
|
|
270
269
|
showArrow?: boolean;
|
|
270
|
+
portalled?: boolean;
|
|
271
|
+
portalRef?: react__default.RefObject<HTMLElement | null>;
|
|
272
|
+
content: react__default.ReactNode;
|
|
273
|
+
contentProps?: Tooltip$1.ContentProps;
|
|
274
|
+
disabled?: boolean;
|
|
271
275
|
}
|
|
272
276
|
|
|
273
|
-
declare
|
|
277
|
+
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
|
|
274
278
|
|
|
275
279
|
declare const Dialog: typeof Dialog$1 & {
|
|
276
280
|
Portal: typeof Portal;
|
package/dist/index.d.ts
CHANGED
|
@@ -266,11 +266,15 @@ declare const ProgressLabel: react.ForwardRefExoticComponent<Progress$1.LabelPro
|
|
|
266
266
|
declare const ProgressValueText: react.ForwardRefExoticComponent<Progress$1.ValueTextProps & react.RefAttributes<HTMLDivElement>>;
|
|
267
267
|
|
|
268
268
|
interface TooltipProps extends Tooltip$1.RootProps {
|
|
269
|
-
content: react__default.ReactNode;
|
|
270
269
|
showArrow?: boolean;
|
|
270
|
+
portalled?: boolean;
|
|
271
|
+
portalRef?: react__default.RefObject<HTMLElement | null>;
|
|
272
|
+
content: react__default.ReactNode;
|
|
273
|
+
contentProps?: Tooltip$1.ContentProps;
|
|
274
|
+
disabled?: boolean;
|
|
271
275
|
}
|
|
272
276
|
|
|
273
|
-
declare
|
|
277
|
+
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
|
|
274
278
|
|
|
275
279
|
declare const Dialog: typeof Dialog$1 & {
|
|
276
280
|
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
|
|
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;
|
|
@@ -32,7 +52,7 @@ function Button({
|
|
|
32
52
|
var Card = react.Card;
|
|
33
53
|
var card_default = Card;
|
|
34
54
|
var Clipboard = react.Clipboard;
|
|
35
|
-
var close_button_default =
|
|
55
|
+
var close_button_default = React.forwardRef(
|
|
36
56
|
function CloseButton(props, ref) {
|
|
37
57
|
return /* @__PURE__ */ jsxRuntime.jsx(react.CloseButton, { ref, ...props });
|
|
38
58
|
}
|
|
@@ -40,7 +60,7 @@ var close_button_default = react$1.forwardRef(
|
|
|
40
60
|
function Container(props) {
|
|
41
61
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Container, { ...props });
|
|
42
62
|
}
|
|
43
|
-
var icon_button_default =
|
|
63
|
+
var icon_button_default = React.forwardRef(
|
|
44
64
|
function IconButton(props, ref) {
|
|
45
65
|
return /* @__PURE__ */ jsxRuntime.jsx(react.IconButton, { ref, ...props });
|
|
46
66
|
}
|
|
@@ -48,16 +68,16 @@ var icon_button_default = react$1.forwardRef(
|
|
|
48
68
|
var QrCode = react.QrCode;
|
|
49
69
|
var separator_default = react.Separator;
|
|
50
70
|
var image_default = react.Image;
|
|
51
|
-
var Icon =
|
|
71
|
+
var Icon = React.forwardRef(function Icon2(props, ref) {
|
|
52
72
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { ref, ...props });
|
|
53
73
|
});
|
|
54
74
|
var icon_default = Icon;
|
|
55
|
-
var link_default =
|
|
75
|
+
var link_default = React.forwardRef(
|
|
56
76
|
function Link(props, ref) {
|
|
57
77
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Link, { ref, ...props });
|
|
58
78
|
}
|
|
59
79
|
);
|
|
60
|
-
var link_overlay_default =
|
|
80
|
+
var link_overlay_default = React.forwardRef(
|
|
61
81
|
function LinkOverlay(props, ref) {
|
|
62
82
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LinkOverlay, { ref, ...props });
|
|
63
83
|
}
|
|
@@ -66,7 +86,7 @@ var loader_default = react.Spinner;
|
|
|
66
86
|
var Skeleton = react.Skeleton;
|
|
67
87
|
var SkeletonCircle = react.SkeletonCircle;
|
|
68
88
|
var SkeletonText = react.SkeletonText;
|
|
69
|
-
var Checkbox =
|
|
89
|
+
var Checkbox = React.forwardRef(
|
|
70
90
|
function Checkbox2(props, ref) {
|
|
71
91
|
const { icon, children, inputProps, rootRef, ...rest } = props;
|
|
72
92
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Checkbox.Root, { ref: rootRef, ...rest, children: [
|
|
@@ -81,7 +101,7 @@ var Combobox = {
|
|
|
81
101
|
...react.Combobox,
|
|
82
102
|
Portal: react.Portal
|
|
83
103
|
};
|
|
84
|
-
var input_default =
|
|
104
|
+
var input_default = React.forwardRef(
|
|
85
105
|
function Input(props, ref) {
|
|
86
106
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Input, { ref, ...props });
|
|
87
107
|
}
|
|
@@ -94,8 +114,8 @@ function MoneyField({
|
|
|
94
114
|
decimalScale = 2,
|
|
95
115
|
...props
|
|
96
116
|
}) {
|
|
97
|
-
const inputRef =
|
|
98
|
-
const config2 =
|
|
117
|
+
const inputRef = React.useRef(null);
|
|
118
|
+
const config2 = React.useMemo(
|
|
99
119
|
() => ({
|
|
100
120
|
thousandSeparator,
|
|
101
121
|
decimalSeparator,
|
|
@@ -103,7 +123,7 @@ function MoneyField({
|
|
|
103
123
|
}),
|
|
104
124
|
[thousandSeparator, decimalSeparator, decimalScale]
|
|
105
125
|
);
|
|
106
|
-
const formatNumber =
|
|
126
|
+
const formatNumber = React.useCallback(
|
|
107
127
|
(num) => {
|
|
108
128
|
const numStr = String(num).replace(/[^\d.-]/g, "");
|
|
109
129
|
if (!numStr || numStr === "-") return "";
|
|
@@ -121,17 +141,17 @@ function MoneyField({
|
|
|
121
141
|
},
|
|
122
142
|
[config2]
|
|
123
143
|
);
|
|
124
|
-
const unformatNumber =
|
|
144
|
+
const unformatNumber = React.useCallback(
|
|
125
145
|
(formatted) => {
|
|
126
146
|
return formatted.replace(new RegExp(`\\${config2.thousandSeparator}`, "g"), "").replace(new RegExp(`\\${config2.decimalSeparator}`, "g"), ".");
|
|
127
147
|
},
|
|
128
148
|
[config2]
|
|
129
149
|
);
|
|
130
|
-
const displayValue =
|
|
150
|
+
const displayValue = React.useMemo(() => {
|
|
131
151
|
if (!value && value !== 0) return "";
|
|
132
152
|
return formatNumber(value);
|
|
133
153
|
}, [value, formatNumber]);
|
|
134
|
-
const handleChange =
|
|
154
|
+
const handleChange = React.useCallback(
|
|
135
155
|
(event) => {
|
|
136
156
|
const inputValue = event.target.value;
|
|
137
157
|
const cursorPosition = event.target.selectionStart || 0;
|
|
@@ -164,12 +184,12 @@ function MoneyField({
|
|
|
164
184
|
}
|
|
165
185
|
);
|
|
166
186
|
}
|
|
167
|
-
var RadioGroup =
|
|
187
|
+
var RadioGroup = React.forwardRef(
|
|
168
188
|
function RadioGroup2(props, ref) {
|
|
169
189
|
return /* @__PURE__ */ jsxRuntime.jsx(react.RadioGroup.Root, { ref, spaceX: 2, ...props });
|
|
170
190
|
}
|
|
171
191
|
);
|
|
172
|
-
var Radio =
|
|
192
|
+
var Radio = React.forwardRef(
|
|
173
193
|
function Radio2(props, ref) {
|
|
174
194
|
const { children, inputProps, ...rest } = props;
|
|
175
195
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.RadioGroup.Item, { ...rest, children: [
|
|
@@ -234,15 +254,15 @@ function RhfCombobox({
|
|
|
234
254
|
initialItems: options,
|
|
235
255
|
filter: contains
|
|
236
256
|
});
|
|
237
|
-
const [inputValue, setInputValue] =
|
|
238
|
-
const [isTyping, setIsTyping] =
|
|
239
|
-
|
|
257
|
+
const [inputValue, setInputValue] = React.useState(value || "");
|
|
258
|
+
const [isTyping, setIsTyping] = React.useState(false);
|
|
259
|
+
React.useEffect(() => {
|
|
240
260
|
if (isTyping) return;
|
|
241
261
|
if (value !== inputValue) {
|
|
242
262
|
setInputValue(value || "");
|
|
243
263
|
}
|
|
244
264
|
}, [value, inputValue, isTyping]);
|
|
245
|
-
const handleValueChange =
|
|
265
|
+
const handleValueChange = React.useCallback(
|
|
246
266
|
(details) => {
|
|
247
267
|
const newValue = details.value[0] || "";
|
|
248
268
|
setIsTyping(false);
|
|
@@ -252,7 +272,7 @@ function RhfCombobox({
|
|
|
252
272
|
},
|
|
253
273
|
[onChange, onInputValueChange]
|
|
254
274
|
);
|
|
255
|
-
const handleInputValueChange =
|
|
275
|
+
const handleInputValueChange = React.useCallback(
|
|
256
276
|
(details) => {
|
|
257
277
|
setIsTyping(true);
|
|
258
278
|
setInputValue(details.inputValue);
|
|
@@ -267,7 +287,7 @@ function RhfCombobox({
|
|
|
267
287
|
},
|
|
268
288
|
[filter, allowCustomValue, onChange, onInputValueChange]
|
|
269
289
|
);
|
|
270
|
-
const handleOpenChange =
|
|
290
|
+
const handleOpenChange = React.useCallback(
|
|
271
291
|
(details) => {
|
|
272
292
|
var _a, _b;
|
|
273
293
|
if (allowCustomValue && details.open && inputValue.trim() !== "") {
|
|
@@ -280,7 +300,7 @@ function RhfCombobox({
|
|
|
280
300
|
},
|
|
281
301
|
[slotProps == null ? void 0 : slotProps.root, allowCustomValue, inputValue, collection.items.length]
|
|
282
302
|
);
|
|
283
|
-
const hasValue =
|
|
303
|
+
const hasValue = React.useMemo(() => {
|
|
284
304
|
if (!value) {
|
|
285
305
|
return false;
|
|
286
306
|
}
|
|
@@ -391,7 +411,7 @@ function RhfInput({
|
|
|
391
411
|
field: { value, onChange, ref, ...rest }
|
|
392
412
|
} = reactHookForm.useController({ control, defaultValue, name });
|
|
393
413
|
const { inputGroup } = slotProps || {};
|
|
394
|
-
const hasValue =
|
|
414
|
+
const hasValue = React.useMemo(
|
|
395
415
|
() => value != null && value !== "" && value.toString().length > 0,
|
|
396
416
|
[value]
|
|
397
417
|
);
|
|
@@ -454,7 +474,7 @@ function RhfMoneyField({
|
|
|
454
474
|
const {
|
|
455
475
|
field: { value, onChange, ...rest }
|
|
456
476
|
} = reactHookForm.useController({ control, defaultValue, name });
|
|
457
|
-
const hasValue =
|
|
477
|
+
const hasValue = React.useMemo(() => {
|
|
458
478
|
return String(value).length > 0;
|
|
459
479
|
}, [value]);
|
|
460
480
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Field.Root, { invalid: !!error, children: [
|
|
@@ -503,7 +523,7 @@ var Select = {
|
|
|
503
523
|
...react.Select,
|
|
504
524
|
Portal: react.Portal
|
|
505
525
|
};
|
|
506
|
-
var Switch =
|
|
526
|
+
var Switch = React.forwardRef(
|
|
507
527
|
function Switch2(props, ref) {
|
|
508
528
|
const { children, inputProps, thumbLabel, ...rest } = props;
|
|
509
529
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Switch.Root, { ...rest, children: [
|
|
@@ -525,7 +545,7 @@ var defaultMaskOptions = {
|
|
|
525
545
|
showMaskOnFocus: false,
|
|
526
546
|
showMaskOnHover: false
|
|
527
547
|
};
|
|
528
|
-
var TextMask =
|
|
548
|
+
var TextMask = React.forwardRef(
|
|
529
549
|
({ mask, maskOptions, ...props }, ref) => {
|
|
530
550
|
const mergedMaskOptions = {
|
|
531
551
|
...defaultMaskOptions,
|
|
@@ -553,7 +573,7 @@ function AvatarGroup(props) {
|
|
|
553
573
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Group, { ...props });
|
|
554
574
|
}
|
|
555
575
|
var EmptyState = react.EmptyState;
|
|
556
|
-
var Progress =
|
|
576
|
+
var Progress = React.forwardRef(
|
|
557
577
|
function Progress2(props, ref) {
|
|
558
578
|
const {
|
|
559
579
|
showValueText,
|
|
@@ -577,16 +597,29 @@ var ProgressTrack = react.Progress.Track;
|
|
|
577
597
|
var ProgressRange = react.Progress.Range;
|
|
578
598
|
var ProgressLabel = react.Progress.Label;
|
|
579
599
|
var ProgressValueText = react.Progress.ValueText;
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
600
|
+
var Tooltip = React__namespace.forwardRef(
|
|
601
|
+
function Tooltip2(props, ref) {
|
|
602
|
+
const {
|
|
603
|
+
showArrow,
|
|
604
|
+
children,
|
|
605
|
+
disabled,
|
|
606
|
+
portalled = true,
|
|
607
|
+
content,
|
|
608
|
+
contentProps,
|
|
609
|
+
portalRef,
|
|
610
|
+
...rest
|
|
611
|
+
} = props;
|
|
612
|
+
if (disabled) return children;
|
|
613
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Tooltip.Root, { ...rest, children: [
|
|
614
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Trigger, { asChild: true, children }),
|
|
615
|
+
/* @__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: [
|
|
616
|
+
showArrow && /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.Arrow, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Tooltip.ArrowTip, {}) }),
|
|
617
|
+
content
|
|
618
|
+
] }) }) })
|
|
619
|
+
] });
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
var tooltip_default = Tooltip;
|
|
590
623
|
var Dialog = {
|
|
591
624
|
...react.Dialog,
|
|
592
625
|
Portal: react.Portal
|
|
@@ -775,10 +808,10 @@ var semanticColors = react.defineSemanticTokens.colors({
|
|
|
775
808
|
}
|
|
776
809
|
},
|
|
777
810
|
panel: {
|
|
778
|
-
value: { _light: "{colors.gray.
|
|
811
|
+
value: { _light: "{colors.gray.700}", _dark: "{colors.gray.700}" }
|
|
779
812
|
},
|
|
780
813
|
muted: {
|
|
781
|
-
value: { _light: "{colors.gray.
|
|
814
|
+
value: { _light: "{colors.gray.600}", _dark: "{colors.gray.600}" }
|
|
782
815
|
}
|
|
783
816
|
},
|
|
784
817
|
fg: {
|
|
@@ -848,8 +881,8 @@ var semanticColors = react.defineSemanticTokens.colors({
|
|
|
848
881
|
},
|
|
849
882
|
border: {
|
|
850
883
|
value: {
|
|
851
|
-
_light: "{colors.gray.
|
|
852
|
-
_dark: "{colors.gray.
|
|
884
|
+
_light: "{colors.gray.700}",
|
|
885
|
+
_dark: "{colors.gray.700}"
|
|
853
886
|
}
|
|
854
887
|
}
|
|
855
888
|
},
|
|
@@ -913,6 +946,26 @@ var semanticColors = react.defineSemanticTokens.colors({
|
|
|
913
946
|
var semanticTokens = {
|
|
914
947
|
colors: semanticColors
|
|
915
948
|
};
|
|
949
|
+
var accordionSlotRecipe = react.defineSlotRecipe({
|
|
950
|
+
slots: anatomy.accordionAnatomy.keys(),
|
|
951
|
+
base: {
|
|
952
|
+
root: {
|
|
953
|
+
"--accordion-radius": "radii.lg"
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
variants: {
|
|
957
|
+
variant: {
|
|
958
|
+
subtle: {
|
|
959
|
+
item: {
|
|
960
|
+
bg: "bg.panel",
|
|
961
|
+
_open: {
|
|
962
|
+
bg: "bg.panel"
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
});
|
|
916
969
|
var menuSlotRecipe = react.defineSlotRecipe({
|
|
917
970
|
slots: anatomy.menuAnatomy.keys(),
|
|
918
971
|
base: {
|
|
@@ -1035,15 +1088,16 @@ var slotRecipes = {
|
|
|
1035
1088
|
menu: menuSlotRecipe,
|
|
1036
1089
|
tabs: tabsSlotRecipe,
|
|
1037
1090
|
progress: progessSlotRecipes,
|
|
1038
|
-
toast: toastSlotRecipe
|
|
1091
|
+
toast: toastSlotRecipe,
|
|
1092
|
+
accordion: accordionSlotRecipe
|
|
1039
1093
|
};
|
|
1040
1094
|
var colorsTokens = react.defineTokens.colors({
|
|
1041
1095
|
primary: {
|
|
1042
|
-
contrast: { value: "{colors.gray.
|
|
1096
|
+
contrast: { value: "{colors.gray.600}" },
|
|
1043
1097
|
default: { value: "{colors.yellow.100}" }
|
|
1044
1098
|
},
|
|
1045
1099
|
secondary: {
|
|
1046
|
-
default: { value: "{colors.gray.
|
|
1100
|
+
default: { value: "{colors.gray.600}" },
|
|
1047
1101
|
contrast: { value: "{colors.gray.300}" }
|
|
1048
1102
|
},
|
|
1049
1103
|
textPrimary: { value: "{colors.gray.100}" },
|
|
@@ -1056,8 +1110,10 @@ var colorsTokens = react.defineTokens.colors({
|
|
|
1056
1110
|
"200": { value: "#AAA6A1" },
|
|
1057
1111
|
"300": { value: "#868079" },
|
|
1058
1112
|
"400": { value: "#5E5955" },
|
|
1059
|
-
"500": { value: "#
|
|
1060
|
-
"
|
|
1113
|
+
"500": { value: "#353230" },
|
|
1114
|
+
"550": { value: "#2B2927" },
|
|
1115
|
+
"600": { value: "#201F1D" },
|
|
1116
|
+
"700": { value: "#151413" }
|
|
1061
1117
|
},
|
|
1062
1118
|
yellow: {
|
|
1063
1119
|
"50": { value: "#EED07C" },
|
|
@@ -1275,7 +1331,7 @@ exports.TextArea = TextArea;
|
|
|
1275
1331
|
exports.TextMask = text_mask_default;
|
|
1276
1332
|
exports.ThemeProvider = ThemeProvider;
|
|
1277
1333
|
exports.Toast = Toast;
|
|
1278
|
-
exports.Tooltip =
|
|
1334
|
+
exports.Tooltip = tooltip_default;
|
|
1279
1335
|
exports.VStack = VStack;
|
|
1280
1336
|
exports.WalletIcon = WalletIcon;
|
|
1281
1337
|
exports.theme = theme_default;
|