bako-ui 0.2.0 → 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.mjs CHANGED
@@ -1,11 +1,12 @@
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, Tooltip as Tooltip$1, Portal, 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, 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, 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 * as React from 'react';
5
+ import { forwardRef, useRef, useMemo, useCallback, useState, useEffect } from 'react';
5
6
  import { flushSync } from 'react-dom';
6
7
  import { useController } from 'react-hook-form';
7
8
  import { withMask } from 'use-mask-input';
8
- import { menuAnatomy, tabsAnatomy } from '@chakra-ui/react/anatomy';
9
+ import { accordionAnatomy, menuAnatomy, progressAnatomy, tabsAnatomy, toastAnatomy } from '@chakra-ui/react/anatomy';
9
10
 
10
11
  // src/components/Stack/stack.tsx
11
12
  var Stack = Stack$1;
@@ -222,7 +223,8 @@ function RhfCombobox({
222
223
  variant,
223
224
  clearTriggerIcon,
224
225
  showTrigger = false,
225
- allowCustomValue = true
226
+ allowCustomValue = true,
227
+ onInputValueChange
226
228
  }) {
227
229
  const {
228
230
  field: { value, onChange, ref, ...rest }
@@ -233,25 +235,37 @@ function RhfCombobox({
233
235
  filter: contains
234
236
  });
235
237
  const [inputValue, setInputValue] = useState(value || "");
238
+ const [isTyping, setIsTyping] = useState(false);
239
+ useEffect(() => {
240
+ if (isTyping) return;
241
+ if (value !== inputValue) {
242
+ setInputValue(value || "");
243
+ }
244
+ }, [value, inputValue, isTyping]);
236
245
  const handleValueChange = useCallback(
237
246
  (details) => {
238
247
  const newValue = details.value[0] || "";
248
+ setIsTyping(false);
239
249
  onChange(newValue);
240
250
  setInputValue(newValue);
251
+ onInputValueChange == null ? void 0 : onInputValueChange(newValue);
241
252
  },
242
- [onChange]
253
+ [onChange, onInputValueChange]
243
254
  );
244
255
  const handleInputValueChange = useCallback(
245
256
  (details) => {
257
+ setIsTyping(true);
246
258
  setInputValue(details.inputValue);
247
259
  flushSync(() => {
248
260
  filter(details.inputValue);
249
261
  });
262
+ onInputValueChange == null ? void 0 : onInputValueChange(details.inputValue);
250
263
  if (allowCustomValue) {
251
264
  onChange(details.inputValue);
252
265
  }
266
+ setTimeout(() => setIsTyping(false), 100);
253
267
  },
254
- [filter, allowCustomValue, onChange]
268
+ [filter, allowCustomValue, onChange, onInputValueChange]
255
269
  );
256
270
  const handleOpenChange = useCallback(
257
271
  (details) => {
@@ -313,6 +327,7 @@ function RhfCombobox({
313
327
  invalid: !!error,
314
328
  allowCustomValue,
315
329
  selectionBehavior: "preserve",
330
+ defaultValue: [defaultValue || ""],
316
331
  ...slotProps == null ? void 0 : slotProps.root,
317
332
  children: [
318
333
  /* @__PURE__ */ jsxs(Combobox$1.Control, { children: [
@@ -538,16 +553,53 @@ function AvatarGroup(props) {
538
553
  return /* @__PURE__ */ jsx(Group, { ...props });
539
554
  }
540
555
  var EmptyState = EmptyState$1;
541
- function Tooltip(props) {
542
- const { children, content, showArrow = true, ...rest } = props;
543
- return /* @__PURE__ */ jsxs(Tooltip$1.Root, { ...rest, children: [
544
- /* @__PURE__ */ jsx(Tooltip$1.Trigger, { asChild: true, children }),
545
- /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, { children: /* @__PURE__ */ jsxs(Tooltip$1.Content, { children: [
546
- showArrow && /* @__PURE__ */ jsx(Tooltip$1.Arrow, { children: /* @__PURE__ */ jsx(Tooltip$1.ArrowTip, {}) }),
547
- content
548
- ] }) }) })
549
- ] });
550
- }
556
+ var Progress = forwardRef(
557
+ function Progress2(props, ref) {
558
+ const {
559
+ showValueText,
560
+ valueText,
561
+ label,
562
+ trackProps,
563
+ rangeProps,
564
+ labelProps,
565
+ valueTextProps,
566
+ ...rootProps
567
+ } = props;
568
+ return /* @__PURE__ */ jsxs(Progress$1.Root, { ref, ...rootProps, children: [
569
+ label && /* @__PURE__ */ jsx(Progress$1.Label, { ...labelProps, children: label }),
570
+ /* @__PURE__ */ jsx(Progress$1.Track, { ...trackProps, children: /* @__PURE__ */ jsx(Progress$1.Range, { ...rangeProps }) }),
571
+ showValueText && /* @__PURE__ */ jsx(Progress$1.ValueText, { ...valueTextProps, children: valueText })
572
+ ] });
573
+ }
574
+ );
575
+ var ProgressRoot = Progress$1.Root;
576
+ var ProgressTrack = Progress$1.Track;
577
+ var ProgressRange = Progress$1.Range;
578
+ var ProgressLabel = Progress$1.Label;
579
+ var ProgressValueText = Progress$1.ValueText;
580
+ var Tooltip = React.forwardRef(
581
+ function Tooltip2(props, ref) {
582
+ const {
583
+ showArrow,
584
+ children,
585
+ disabled,
586
+ portalled = true,
587
+ content,
588
+ contentProps,
589
+ portalRef,
590
+ ...rest
591
+ } = props;
592
+ if (disabled) return children;
593
+ return /* @__PURE__ */ jsxs(Tooltip$1.Root, { ...rest, children: [
594
+ /* @__PURE__ */ jsx(Tooltip$1.Trigger, { asChild: true, children }),
595
+ /* @__PURE__ */ jsx(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, { children: /* @__PURE__ */ jsxs(Tooltip$1.Content, { ref, ...contentProps, children: [
596
+ showArrow && /* @__PURE__ */ jsx(Tooltip$1.Arrow, { children: /* @__PURE__ */ jsx(Tooltip$1.ArrowTip, {}) }),
597
+ content
598
+ ] }) }) })
599
+ ] });
600
+ }
601
+ );
602
+ var tooltip_default = Tooltip;
551
603
  var Dialog = {
552
604
  ...Dialog$1,
553
605
  Portal: Portal
@@ -736,10 +788,10 @@ var semanticColors = defineSemanticTokens.colors({
736
788
  }
737
789
  },
738
790
  panel: {
739
- value: { _light: "{colors.gray.600}", _dark: "{colors.gray.600}" }
791
+ value: { _light: "{colors.gray.700}", _dark: "{colors.gray.700}" }
740
792
  },
741
793
  muted: {
742
- value: { _light: "{colors.gray.500}", _dark: "{colors.gray.500}" }
794
+ value: { _light: "{colors.gray.600}", _dark: "{colors.gray.600}" }
743
795
  }
744
796
  },
745
797
  fg: {
@@ -761,7 +813,7 @@ var semanticColors = defineSemanticTokens.colors({
761
813
  value: { _light: "white", _dark: "white" }
762
814
  },
763
815
  fg: {
764
- value: { _light: "{colors.red.700}", _dark: "{colors.red.300}" }
816
+ value: { _light: "{colors.red.50}", _dark: "{colors.red.50}" }
765
817
  },
766
818
  subtle: {
767
819
  value: { _light: "{colors.red.100}", _dark: "{colors.red.900}" }
@@ -809,8 +861,8 @@ var semanticColors = defineSemanticTokens.colors({
809
861
  },
810
862
  border: {
811
863
  value: {
812
- _light: "{colors.gray.600}",
813
- _dark: "{colors.gray.600}"
864
+ _light: "{colors.gray.700}",
865
+ _dark: "{colors.gray.700}"
814
866
  }
815
867
  }
816
868
  },
@@ -819,7 +871,7 @@ var semanticColors = defineSemanticTokens.colors({
819
871
  value: { _light: "white", _dark: "white" }
820
872
  },
821
873
  fg: {
822
- value: { _light: "{colors.green.300}", _dark: "{colors.green.300}" }
874
+ value: { _light: "{colors.green.50}", _dark: "{colors.green.50}" }
823
875
  },
824
876
  subtle: {
825
877
  value: { _light: "{colors.green.100}", _dark: "{colors.green.100}" }
@@ -842,7 +894,7 @@ var semanticColors = defineSemanticTokens.colors({
842
894
  value: { _light: "black", _dark: "black" }
843
895
  },
844
896
  fg: {
845
- value: { _light: "{colors.yellow.800}", _dark: "{colors.yellow.300}" }
897
+ value: { _light: "{colors.yellow.50}", _dark: "{colors.yellow.50}" }
846
898
  },
847
899
  subtle: {
848
900
  value: { _light: "{colors.yellow.150}", _dark: "{colors.yellow.150}" }
@@ -859,6 +911,14 @@ var semanticColors = defineSemanticTokens.colors({
859
911
  focusRing: {
860
912
  value: { _light: "{colors.yellow.500}", _dark: "{colors.yellow.500}" }
861
913
  }
914
+ },
915
+ blue: {
916
+ solid: {
917
+ value: { _light: "{colors.blue.200}", _dark: "{colors.blue.200}" }
918
+ },
919
+ fg: {
920
+ value: { _light: "{colors.blue.50}", _dark: "{colors.blue.50}" }
921
+ }
862
922
  }
863
923
  });
864
924
 
@@ -866,6 +926,26 @@ var semanticColors = defineSemanticTokens.colors({
866
926
  var semanticTokens = {
867
927
  colors: semanticColors
868
928
  };
929
+ var accordionSlotRecipe = defineSlotRecipe({
930
+ slots: accordionAnatomy.keys(),
931
+ base: {
932
+ root: {
933
+ "--accordion-radius": "radii.lg"
934
+ }
935
+ },
936
+ variants: {
937
+ variant: {
938
+ subtle: {
939
+ item: {
940
+ bg: "bg.panel",
941
+ _open: {
942
+ bg: "bg.panel"
943
+ }
944
+ }
945
+ }
946
+ }
947
+ }
948
+ });
869
949
  var menuSlotRecipe = defineSlotRecipe({
870
950
  slots: menuAnatomy.keys(),
871
951
  base: {
@@ -888,6 +968,28 @@ var menuSlotRecipe = defineSlotRecipe({
888
968
  }
889
969
  }
890
970
  });
971
+ var progessSlotRecipes = defineSlotRecipe({
972
+ slots: progressAnatomy.keys(),
973
+ variants: {
974
+ size: {
975
+ xs: {
976
+ track: { h: "0.5" }
977
+ },
978
+ sm: {
979
+ track: { h: "1" }
980
+ },
981
+ md: {
982
+ track: { h: "2.5" }
983
+ },
984
+ lg: {
985
+ track: { h: "3" }
986
+ },
987
+ xl: {
988
+ track: { h: "4" }
989
+ }
990
+ }
991
+ }
992
+ });
891
993
  var tabsSlotRecipe = defineSlotRecipe({
892
994
  slots: tabsAnatomy.keys(),
893
995
  variants: {
@@ -916,22 +1018,69 @@ var tabsSlotRecipe = defineSlotRecipe({
916
1018
  }
917
1019
  }
918
1020
  });
1021
+ var toastSlotRecipe = defineSlotRecipe({
1022
+ slots: toastAnatomy.keys(),
1023
+ base: {
1024
+ root: {
1025
+ py: "2",
1026
+ ps: "2",
1027
+ pe: "4",
1028
+ gap: "2",
1029
+ borderRadius: "lg",
1030
+ border: "1px solid",
1031
+ borderColor: "variable(--toast-border-color, transparent)",
1032
+ "&[data-type=info]": {
1033
+ bg: "blue.solid/15",
1034
+ color: "blue.fg",
1035
+ "--toast-trigger-bg": "{white/10}",
1036
+ "--toast-border-color": "{blue.solid/30}"
1037
+ },
1038
+ "&[data-type=warning]": {
1039
+ bg: "yellow.solid/15",
1040
+ color: "yellow.fg",
1041
+ "--toast-trigger-bg": "{white/10}",
1042
+ "--toast-border-color": "{yellow.solid/30}"
1043
+ },
1044
+ "&[data-type=success]": {
1045
+ bg: "green.solid/15",
1046
+ color: "green.fg",
1047
+ "--toast-trigger-bg": "{white/10}",
1048
+ "--toast-border-color": "{green.solid/30}"
1049
+ },
1050
+ "&[data-type=error]": {
1051
+ bg: "red.solid/15",
1052
+ color: "red.fg",
1053
+ "--toast-trigger-bg": "{white/10}",
1054
+ "--toast-border-color": "{red.solid/30}"
1055
+ }
1056
+ },
1057
+ title: {
1058
+ fontWeight: "semibold"
1059
+ },
1060
+ description: {
1061
+ fontStyle: "xs"
1062
+ }
1063
+ }
1064
+ });
919
1065
 
920
1066
  // src/theme/slot-recipes/index.ts
921
1067
  var slotRecipes = {
922
1068
  menu: menuSlotRecipe,
923
- tabs: tabsSlotRecipe
1069
+ tabs: tabsSlotRecipe,
1070
+ progress: progessSlotRecipes,
1071
+ toast: toastSlotRecipe,
1072
+ accordion: accordionSlotRecipe
924
1073
  };
925
1074
  var colorsTokens = defineTokens.colors({
926
1075
  primary: {
927
- contrast: { value: "{colors.gray.500}" },
1076
+ contrast: { value: "{colors.gray.600}" },
928
1077
  default: { value: "{colors.yellow.100}" }
929
1078
  },
930
1079
  secondary: {
931
- default: { value: "{colors.gray.500}" },
1080
+ default: { value: "{colors.gray.600}" },
932
1081
  contrast: { value: "{colors.gray.300}" }
933
1082
  },
934
- textPrimary: { value: "{colors.gray.50}" },
1083
+ textPrimary: { value: "{colors.gray.100}" },
935
1084
  textSecondary: { value: "{colors.gray.300}" },
936
1085
  background: { value: "#0D0D0C" },
937
1086
  // ------------------------------------------
@@ -941,8 +1090,10 @@ var colorsTokens = defineTokens.colors({
941
1090
  "200": { value: "#AAA6A1" },
942
1091
  "300": { value: "#868079" },
943
1092
  "400": { value: "#5E5955" },
944
- "500": { value: "#201F1D" },
945
- "600": { value: "#151413" }
1093
+ "500": { value: "#353230" },
1094
+ "550": { value: "#2B2927" },
1095
+ "600": { value: "#201F1D" },
1096
+ "700": { value: "#151413" }
946
1097
  },
947
1098
  yellow: {
948
1099
  "50": { value: "#EED07C" },
@@ -1012,6 +1163,6 @@ var config = defineConfig({
1012
1163
  var theme = createSystem(defaultConfig, config);
1013
1164
  var theme_default = theme;
1014
1165
 
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 };
1166
+ 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_default as Tooltip, VStack, WalletIcon, theme_default as theme, toaster };
1016
1167
  //# sourceMappingURL=index.mjs.map
1017
1168
  //# sourceMappingURL=index.mjs.map