bako-ui 0.2.0 → 0.2.1
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 +44 -4
- package/dist/index.d.ts +44 -4
- package/dist/index.js +128 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -15
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CloseButton, IconButton, Icon as Icon$1, Link, LinkOverlay, Checkbox as Checkbox$1, Combobox as Combobox$1, Input, RadioGroup as RadioGroup$1, Select as Select$1, Switch as Switch$1, mergeRefs, Dialog as Dialog$1, Drawer as Drawer$1, Popover as Popover$1, createToaster, Toast as Toast$1, Accordion as Accordion$1, Breadcrumb as Breadcrumb$1, Steps as Steps$1, Menu as Menu$1, createIcon, defineRecipe, defineSemanticTokens, defineSlotRecipe, defineTokens, defineConfig, createSystem, defaultConfig, Badge as Badge$1, Box, Card as Card$1, Clipboard as Clipboard$1, Portal, EmptyState as EmptyState$1, Flex, HStack as HStack$1, Heading, Image, List as List$1, Spinner, QrCode as QrCode$1, Separator, Skeleton as Skeleton$1, SkeletonCircle as SkeletonCircle$1, SkeletonText as SkeletonText$1, Stack as Stack$1, Tabs as Tabs$1, Text, Toaster, VStack as VStack$1, Grid as Grid$1, GridItem as GridItem$1, Button as Button$1, Container as Container$1, useFilter, useListCollection, Field, defineStyle, Span, InputGroup, Textarea, Avatar as Avatar$1, Group, Tooltip as Tooltip$1, ChakraProvider } from '@chakra-ui/react';
|
|
1
|
+
import { CloseButton, IconButton, Icon as Icon$1, Link, LinkOverlay, Checkbox as Checkbox$1, Combobox as Combobox$1, Input, RadioGroup as RadioGroup$1, Select as Select$1, Switch as Switch$1, mergeRefs, Progress as Progress$1, Dialog as Dialog$1, Drawer as Drawer$1, Popover as Popover$1, createToaster, Toast as Toast$1, Accordion as Accordion$1, Breadcrumb as Breadcrumb$1, Steps as Steps$1, Menu as Menu$1, createIcon, defineRecipe, defineSemanticTokens, defineSlotRecipe, defineTokens, defineConfig, createSystem, defaultConfig, Badge as Badge$1, Box, Card as Card$1, Clipboard as Clipboard$1, Portal, EmptyState as EmptyState$1, Flex, HStack as HStack$1, Heading, Image, List as List$1, Spinner, QrCode as QrCode$1, Separator, Skeleton as Skeleton$1, SkeletonCircle as SkeletonCircle$1, SkeletonText as SkeletonText$1, Stack as Stack$1, Tabs as Tabs$1, Text, Toaster, VStack as VStack$1, Grid as Grid$1, GridItem as GridItem$1, Button as Button$1, Container as Container$1, useFilter, useListCollection, Field, defineStyle, Span, InputGroup, Textarea, Avatar as Avatar$1, Group, Tooltip as Tooltip$1, ChakraProvider } from '@chakra-ui/react';
|
|
2
2
|
export { Alert, ButtonGroup, Center, Icon as ChakraIcon, ClientOnly, Field, FormatNumber, InputGroup, Portal, Spacer, Span, createIcon, createListCollection, createToaster, useAccordion, useAccordionContext, useAccordionItemContext, useClipboard, useMediaQuery, useSteps, useStepsContext, useStepsItemContext } from '@chakra-ui/react';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { forwardRef, useRef, useMemo, useCallback, useState } from 'react';
|
|
4
|
+
import { forwardRef, useRef, useMemo, useCallback, useState, useEffect } from 'react';
|
|
5
5
|
import { flushSync } from 'react-dom';
|
|
6
6
|
import { useController } from 'react-hook-form';
|
|
7
7
|
import { withMask } from 'use-mask-input';
|
|
8
|
-
import { menuAnatomy, tabsAnatomy } from '@chakra-ui/react/anatomy';
|
|
8
|
+
import { menuAnatomy, progressAnatomy, tabsAnatomy, toastAnatomy } from '@chakra-ui/react/anatomy';
|
|
9
9
|
|
|
10
10
|
// src/components/Stack/stack.tsx
|
|
11
11
|
var Stack = Stack$1;
|
|
@@ -222,7 +222,8 @@ function RhfCombobox({
|
|
|
222
222
|
variant,
|
|
223
223
|
clearTriggerIcon,
|
|
224
224
|
showTrigger = false,
|
|
225
|
-
allowCustomValue = true
|
|
225
|
+
allowCustomValue = true,
|
|
226
|
+
onInputValueChange
|
|
226
227
|
}) {
|
|
227
228
|
const {
|
|
228
229
|
field: { value, onChange, ref, ...rest }
|
|
@@ -233,25 +234,37 @@ function RhfCombobox({
|
|
|
233
234
|
filter: contains
|
|
234
235
|
});
|
|
235
236
|
const [inputValue, setInputValue] = useState(value || "");
|
|
237
|
+
const [isTyping, setIsTyping] = useState(false);
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
if (isTyping) return;
|
|
240
|
+
if (value !== inputValue) {
|
|
241
|
+
setInputValue(value || "");
|
|
242
|
+
}
|
|
243
|
+
}, [value, inputValue, isTyping]);
|
|
236
244
|
const handleValueChange = useCallback(
|
|
237
245
|
(details) => {
|
|
238
246
|
const newValue = details.value[0] || "";
|
|
247
|
+
setIsTyping(false);
|
|
239
248
|
onChange(newValue);
|
|
240
249
|
setInputValue(newValue);
|
|
250
|
+
onInputValueChange == null ? void 0 : onInputValueChange(newValue);
|
|
241
251
|
},
|
|
242
|
-
[onChange]
|
|
252
|
+
[onChange, onInputValueChange]
|
|
243
253
|
);
|
|
244
254
|
const handleInputValueChange = useCallback(
|
|
245
255
|
(details) => {
|
|
256
|
+
setIsTyping(true);
|
|
246
257
|
setInputValue(details.inputValue);
|
|
247
258
|
flushSync(() => {
|
|
248
259
|
filter(details.inputValue);
|
|
249
260
|
});
|
|
261
|
+
onInputValueChange == null ? void 0 : onInputValueChange(details.inputValue);
|
|
250
262
|
if (allowCustomValue) {
|
|
251
263
|
onChange(details.inputValue);
|
|
252
264
|
}
|
|
265
|
+
setTimeout(() => setIsTyping(false), 100);
|
|
253
266
|
},
|
|
254
|
-
[filter, allowCustomValue, onChange]
|
|
267
|
+
[filter, allowCustomValue, onChange, onInputValueChange]
|
|
255
268
|
);
|
|
256
269
|
const handleOpenChange = useCallback(
|
|
257
270
|
(details) => {
|
|
@@ -313,6 +326,7 @@ function RhfCombobox({
|
|
|
313
326
|
invalid: !!error,
|
|
314
327
|
allowCustomValue,
|
|
315
328
|
selectionBehavior: "preserve",
|
|
329
|
+
defaultValue: [defaultValue || ""],
|
|
316
330
|
...slotProps == null ? void 0 : slotProps.root,
|
|
317
331
|
children: [
|
|
318
332
|
/* @__PURE__ */ jsxs(Combobox$1.Control, { children: [
|
|
@@ -538,6 +552,30 @@ function AvatarGroup(props) {
|
|
|
538
552
|
return /* @__PURE__ */ jsx(Group, { ...props });
|
|
539
553
|
}
|
|
540
554
|
var EmptyState = EmptyState$1;
|
|
555
|
+
var Progress = forwardRef(
|
|
556
|
+
function Progress2(props, ref) {
|
|
557
|
+
const {
|
|
558
|
+
showValueText,
|
|
559
|
+
valueText,
|
|
560
|
+
label,
|
|
561
|
+
trackProps,
|
|
562
|
+
rangeProps,
|
|
563
|
+
labelProps,
|
|
564
|
+
valueTextProps,
|
|
565
|
+
...rootProps
|
|
566
|
+
} = props;
|
|
567
|
+
return /* @__PURE__ */ jsxs(Progress$1.Root, { ref, ...rootProps, children: [
|
|
568
|
+
label && /* @__PURE__ */ jsx(Progress$1.Label, { ...labelProps, children: label }),
|
|
569
|
+
/* @__PURE__ */ jsx(Progress$1.Track, { ...trackProps, children: /* @__PURE__ */ jsx(Progress$1.Range, { ...rangeProps }) }),
|
|
570
|
+
showValueText && /* @__PURE__ */ jsx(Progress$1.ValueText, { ...valueTextProps, children: valueText })
|
|
571
|
+
] });
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
var ProgressRoot = Progress$1.Root;
|
|
575
|
+
var ProgressTrack = Progress$1.Track;
|
|
576
|
+
var ProgressRange = Progress$1.Range;
|
|
577
|
+
var ProgressLabel = Progress$1.Label;
|
|
578
|
+
var ProgressValueText = Progress$1.ValueText;
|
|
541
579
|
function Tooltip(props) {
|
|
542
580
|
const { children, content, showArrow = true, ...rest } = props;
|
|
543
581
|
return /* @__PURE__ */ jsxs(Tooltip$1.Root, { ...rest, children: [
|
|
@@ -761,7 +799,7 @@ var semanticColors = defineSemanticTokens.colors({
|
|
|
761
799
|
value: { _light: "white", _dark: "white" }
|
|
762
800
|
},
|
|
763
801
|
fg: {
|
|
764
|
-
value: { _light: "{colors.red.
|
|
802
|
+
value: { _light: "{colors.red.50}", _dark: "{colors.red.50}" }
|
|
765
803
|
},
|
|
766
804
|
subtle: {
|
|
767
805
|
value: { _light: "{colors.red.100}", _dark: "{colors.red.900}" }
|
|
@@ -819,7 +857,7 @@ var semanticColors = defineSemanticTokens.colors({
|
|
|
819
857
|
value: { _light: "white", _dark: "white" }
|
|
820
858
|
},
|
|
821
859
|
fg: {
|
|
822
|
-
value: { _light: "{colors.green.
|
|
860
|
+
value: { _light: "{colors.green.50}", _dark: "{colors.green.50}" }
|
|
823
861
|
},
|
|
824
862
|
subtle: {
|
|
825
863
|
value: { _light: "{colors.green.100}", _dark: "{colors.green.100}" }
|
|
@@ -842,7 +880,7 @@ var semanticColors = defineSemanticTokens.colors({
|
|
|
842
880
|
value: { _light: "black", _dark: "black" }
|
|
843
881
|
},
|
|
844
882
|
fg: {
|
|
845
|
-
value: { _light: "{colors.yellow.
|
|
883
|
+
value: { _light: "{colors.yellow.50}", _dark: "{colors.yellow.50}" }
|
|
846
884
|
},
|
|
847
885
|
subtle: {
|
|
848
886
|
value: { _light: "{colors.yellow.150}", _dark: "{colors.yellow.150}" }
|
|
@@ -859,6 +897,14 @@ var semanticColors = defineSemanticTokens.colors({
|
|
|
859
897
|
focusRing: {
|
|
860
898
|
value: { _light: "{colors.yellow.500}", _dark: "{colors.yellow.500}" }
|
|
861
899
|
}
|
|
900
|
+
},
|
|
901
|
+
blue: {
|
|
902
|
+
solid: {
|
|
903
|
+
value: { _light: "{colors.blue.200}", _dark: "{colors.blue.200}" }
|
|
904
|
+
},
|
|
905
|
+
fg: {
|
|
906
|
+
value: { _light: "{colors.blue.50}", _dark: "{colors.blue.50}" }
|
|
907
|
+
}
|
|
862
908
|
}
|
|
863
909
|
});
|
|
864
910
|
|
|
@@ -888,6 +934,28 @@ var menuSlotRecipe = defineSlotRecipe({
|
|
|
888
934
|
}
|
|
889
935
|
}
|
|
890
936
|
});
|
|
937
|
+
var progessSlotRecipes = defineSlotRecipe({
|
|
938
|
+
slots: progressAnatomy.keys(),
|
|
939
|
+
variants: {
|
|
940
|
+
size: {
|
|
941
|
+
xs: {
|
|
942
|
+
track: { h: "0.5" }
|
|
943
|
+
},
|
|
944
|
+
sm: {
|
|
945
|
+
track: { h: "1" }
|
|
946
|
+
},
|
|
947
|
+
md: {
|
|
948
|
+
track: { h: "2.5" }
|
|
949
|
+
},
|
|
950
|
+
lg: {
|
|
951
|
+
track: { h: "3" }
|
|
952
|
+
},
|
|
953
|
+
xl: {
|
|
954
|
+
track: { h: "4" }
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
});
|
|
891
959
|
var tabsSlotRecipe = defineSlotRecipe({
|
|
892
960
|
slots: tabsAnatomy.keys(),
|
|
893
961
|
variants: {
|
|
@@ -916,11 +984,57 @@ var tabsSlotRecipe = defineSlotRecipe({
|
|
|
916
984
|
}
|
|
917
985
|
}
|
|
918
986
|
});
|
|
987
|
+
var toastSlotRecipe = defineSlotRecipe({
|
|
988
|
+
slots: toastAnatomy.keys(),
|
|
989
|
+
base: {
|
|
990
|
+
root: {
|
|
991
|
+
py: "2",
|
|
992
|
+
ps: "2",
|
|
993
|
+
pe: "4",
|
|
994
|
+
gap: "2",
|
|
995
|
+
borderRadius: "lg",
|
|
996
|
+
border: "1px solid",
|
|
997
|
+
borderColor: "variable(--toast-border-color, transparent)",
|
|
998
|
+
"&[data-type=info]": {
|
|
999
|
+
bg: "blue.solid/15",
|
|
1000
|
+
color: "blue.fg",
|
|
1001
|
+
"--toast-trigger-bg": "{white/10}",
|
|
1002
|
+
"--toast-border-color": "{blue.solid/30}"
|
|
1003
|
+
},
|
|
1004
|
+
"&[data-type=warning]": {
|
|
1005
|
+
bg: "yellow.solid/15",
|
|
1006
|
+
color: "yellow.fg",
|
|
1007
|
+
"--toast-trigger-bg": "{white/10}",
|
|
1008
|
+
"--toast-border-color": "{yellow.solid/30}"
|
|
1009
|
+
},
|
|
1010
|
+
"&[data-type=success]": {
|
|
1011
|
+
bg: "green.solid/15",
|
|
1012
|
+
color: "green.fg",
|
|
1013
|
+
"--toast-trigger-bg": "{white/10}",
|
|
1014
|
+
"--toast-border-color": "{green.solid/30}"
|
|
1015
|
+
},
|
|
1016
|
+
"&[data-type=error]": {
|
|
1017
|
+
bg: "red.solid/15",
|
|
1018
|
+
color: "red.fg",
|
|
1019
|
+
"--toast-trigger-bg": "{white/10}",
|
|
1020
|
+
"--toast-border-color": "{red.solid/30}"
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
title: {
|
|
1024
|
+
fontWeight: "semibold"
|
|
1025
|
+
},
|
|
1026
|
+
description: {
|
|
1027
|
+
fontStyle: "xs"
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
919
1031
|
|
|
920
1032
|
// src/theme/slot-recipes/index.ts
|
|
921
1033
|
var slotRecipes = {
|
|
922
1034
|
menu: menuSlotRecipe,
|
|
923
|
-
tabs: tabsSlotRecipe
|
|
1035
|
+
tabs: tabsSlotRecipe,
|
|
1036
|
+
progress: progessSlotRecipes,
|
|
1037
|
+
toast: toastSlotRecipe
|
|
924
1038
|
};
|
|
925
1039
|
var colorsTokens = defineTokens.colors({
|
|
926
1040
|
primary: {
|
|
@@ -931,7 +1045,7 @@ var colorsTokens = defineTokens.colors({
|
|
|
931
1045
|
default: { value: "{colors.gray.500}" },
|
|
932
1046
|
contrast: { value: "{colors.gray.300}" }
|
|
933
1047
|
},
|
|
934
|
-
textPrimary: { value: "{colors.gray.
|
|
1048
|
+
textPrimary: { value: "{colors.gray.100}" },
|
|
935
1049
|
textSecondary: { value: "{colors.gray.300}" },
|
|
936
1050
|
background: { value: "#0D0D0C" },
|
|
937
1051
|
// ------------------------------------------
|
|
@@ -1012,6 +1126,6 @@ var config = defineConfig({
|
|
|
1012
1126
|
var theme = createSystem(defaultConfig, config);
|
|
1013
1127
|
var theme_default = theme;
|
|
1014
1128
|
|
|
1015
|
-
export { Accordion, Avatar, AvatarGroup, Badge, box_default as Box, Breadcrumb, Button, card_default as Card, CheckIcon, checkbox_default as Checkbox, Clipboard, close_button_default as CloseButton, CloseIcon, Combobox, Container, Dialog, Drawer, EmptyState, flex_default as Flex, Grid, GridItem, HStack, heading_default as Heading, icon_default as Icon, icon_button_default as IconButton, image_default as Image, input_default as Input, link_default as Link, link_overlay_default as LinkOverlay, List, loader_default as Loader, Menu, MoneyField, Popover, QrCode, radio_default as Radio, RadioGroup, RhfCombobox, RhfInput, RhfMoneyField, Select, separator_default as Separator, Skeleton, SkeletonCircle, SkeletonText, Stack, Steps, switch_default as Switch, Tabs, text_default as Text, TextArea, text_mask_default as TextMask, ThemeProvider, Toast, Tooltip, VStack, WalletIcon, theme_default as theme, toaster };
|
|
1129
|
+
export { Accordion, Avatar, AvatarGroup, Badge, box_default as Box, Breadcrumb, Button, card_default as Card, CheckIcon, checkbox_default as Checkbox, Clipboard, close_button_default as CloseButton, CloseIcon, Combobox, Container, Dialog, Drawer, EmptyState, flex_default as Flex, Grid, GridItem, HStack, heading_default as Heading, icon_default as Icon, icon_button_default as IconButton, image_default as Image, input_default as Input, link_default as Link, link_overlay_default as LinkOverlay, List, loader_default as Loader, Menu, MoneyField, Popover, Progress, ProgressLabel, ProgressRange, ProgressRoot, ProgressTrack, ProgressValueText, QrCode, radio_default as Radio, RadioGroup, RhfCombobox, RhfInput, RhfMoneyField, Select, separator_default as Separator, Skeleton, SkeletonCircle, SkeletonText, Stack, Steps, switch_default as Switch, Tabs, text_default as Text, TextArea, text_mask_default as TextMask, ThemeProvider, Toast, Tooltip, VStack, WalletIcon, theme_default as theme, toaster };
|
|
1016
1130
|
//# sourceMappingURL=index.mjs.map
|
|
1017
1131
|
//# sourceMappingURL=index.mjs.map
|