@saas-ui/react 3.0.0-alpha.4 → 3.0.0-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/chunk-2EUACKRH.js +26 -0
  3. package/dist/chunk-3Z2C27LI.js +51 -0
  4. package/dist/chunk-4TR3AOMG.js +33 -0
  5. package/dist/chunk-6LOMIKR5.js +69 -0
  6. package/dist/chunk-6ZNR6N2K.js +45 -0
  7. package/dist/chunk-7C3IZBNJ.js +38 -0
  8. package/dist/chunk-BCNPBZZK.js +45 -0
  9. package/dist/{chunk-KHRLZUV4.js → chunk-BFA5FCA2.js} +16 -1
  10. package/dist/chunk-CTOVNZVS.js +1 -0
  11. package/dist/chunk-DPMEXCSG.js +137 -0
  12. package/dist/chunk-F3CVOMG5.js +160 -0
  13. package/dist/chunk-FJFNGSPL.js +23 -0
  14. package/dist/chunk-GEPWRHHH.js +65 -0
  15. package/dist/chunk-HELHPHIQ.js +35 -0
  16. package/dist/chunk-I2RXEKTB.js +38 -0
  17. package/dist/chunk-L356FPLY.js +20 -0
  18. package/dist/chunk-LIYUBUOP.js +119 -0
  19. package/dist/chunk-M7FOBCOV.js +184 -0
  20. package/dist/chunk-NSD5HRIP.js +46 -0
  21. package/dist/chunk-QMG6HP7Z.js +87 -0
  22. package/dist/chunk-QSNSWCTM.js +32 -0
  23. package/dist/chunk-S3CQW7GD.js +100 -0
  24. package/dist/chunk-SA3OGTOO.js +23 -0
  25. package/dist/chunk-UCQ3LZIE.js +43 -0
  26. package/dist/chunk-ULAJ3JEO.js +32 -0
  27. package/dist/chunk-VF3BV2BY.js +87 -0
  28. package/dist/chunk-WYLMBMAH.js +22 -0
  29. package/dist/chunk-YWJZWB6I.js +1892 -0
  30. package/dist/chunk-ZWSZQZ5G.js +73 -0
  31. package/dist/components/app-shell/index.js +3 -40
  32. package/dist/components/avatar/index.cjs +69 -0
  33. package/dist/components/avatar/index.d.cts +18 -0
  34. package/dist/components/avatar/index.d.ts +18 -0
  35. package/dist/components/avatar/index.js +10 -0
  36. package/dist/components/breadcrumbs/index.js +3 -32
  37. package/dist/components/button/index.js +3 -40
  38. package/dist/components/checkbox/index.js +3 -15
  39. package/dist/components/command/index.js +3 -28
  40. package/dist/components/dialog/index.js +5 -67
  41. package/dist/components/drawer/index.d.cts +2 -2
  42. package/dist/components/drawer/index.d.ts +2 -2
  43. package/dist/components/drawer/index.js +5 -59
  44. package/dist/components/empty-state/index.js +3 -18
  45. package/dist/components/grid-list/index.js +3 -40
  46. package/dist/components/icon-badge/index.js +3 -33
  47. package/dist/components/link/index.js +2 -14
  48. package/dist/components/loading-overlay/index.js +5 -1885
  49. package/dist/components/menu/index.cjs +263 -0
  50. package/dist/components/menu/index.d.cts +30 -0
  51. package/dist/components/menu/index.d.ts +30 -0
  52. package/dist/components/menu/index.js +9 -0
  53. package/dist/components/navbar/index.d.cts +4 -4
  54. package/dist/components/navbar/index.d.ts +4 -4
  55. package/dist/components/navbar/index.js +3 -45
  56. package/dist/components/number-input/index.js +3 -26
  57. package/dist/components/password-input/index.js +4 -225
  58. package/dist/components/persona/index.js +6 -178
  59. package/dist/components/pin-input/index.js +3 -21
  60. package/dist/components/radio/index.js +4 -16
  61. package/dist/components/search-input/index.js +4 -114
  62. package/dist/components/segmented-control/index.cjs +2 -0
  63. package/dist/components/segmented-control/index.d.cts +2 -0
  64. package/dist/components/segmented-control/index.d.ts +2 -0
  65. package/dist/components/segmented-control/index.js +2 -0
  66. package/dist/components/select/index.js +4 -94
  67. package/dist/components/sidebar/index.d.cts +11 -11
  68. package/dist/components/sidebar/index.d.ts +11 -11
  69. package/dist/components/sidebar/index.js +7 -129
  70. package/dist/components/steps/index.js +5 -64
  71. package/dist/components/switch/index.js +3 -18
  72. package/dist/components/toaster/index.cjs +54 -0
  73. package/dist/components/toaster/index.d.cts +10 -0
  74. package/dist/components/toaster/index.d.ts +10 -0
  75. package/dist/components/toaster/index.js +10 -0
  76. package/dist/components/tooltip/index.cjs +57 -0
  77. package/dist/components/tooltip/index.d.cts +14 -0
  78. package/dist/components/tooltip/index.d.ts +14 -0
  79. package/dist/components/tooltip/index.js +8 -0
  80. package/dist/index.cjs +3564 -8
  81. package/dist/index.d.cts +37 -2
  82. package/dist/index.d.ts +37 -2
  83. package/dist/index.js +142 -4
  84. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ 'use client'
2
+ import {
3
+ DialogContext
4
+ } from "./chunk-VBIVLREP.js";
5
+ import {
6
+ CloseButton
7
+ } from "./chunk-FZW2DYK3.js";
8
+ import {
9
+ __export
10
+ } from "./chunk-RTMS5TJN.js";
11
+
12
+ // src/components/drawer/namespace.ts
13
+ var namespace_exports = {};
14
+ __export(namespace_exports, {
15
+ ActionTrigger: () => DrawerActionTrigger,
16
+ Backdrop: () => DrawerBackdrop,
17
+ Body: () => DrawerBody,
18
+ CloseTrigger: () => DrawerCloseTrigger,
19
+ Content: () => DrawerContent,
20
+ Context: () => DrawerContext,
21
+ Description: () => DrawerDescription,
22
+ Footer: () => DrawerFooter,
23
+ Header: () => DrawerHeader,
24
+ Root: () => DrawerRoot,
25
+ Title: () => DrawerTitle,
26
+ Trigger: () => DrawerTrigger
27
+ });
28
+
29
+ // src/components/drawer/drawer.tsx
30
+ import { forwardRef } from "react";
31
+ import { Drawer as ChakraDrawer, Portal } from "@chakra-ui/react";
32
+ import { jsx } from "react/jsx-runtime";
33
+ var DrawerContent = forwardRef(
34
+ function DrawerContent2(props, ref) {
35
+ const { children, portalled = true, portalRef, offset, ...rest } = props;
36
+ return /* @__PURE__ */ jsx(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx(ChakraDrawer.Positioner, { padding: offset, children: /* @__PURE__ */ jsx(ChakraDrawer.Content, { ref, ...rest, asChild: false, children }) }) });
37
+ }
38
+ );
39
+ var DrawerCloseTrigger = forwardRef(function DrawerCloseTrigger2(props, ref) {
40
+ return /* @__PURE__ */ jsx(
41
+ ChakraDrawer.CloseTrigger,
42
+ {
43
+ position: "absolute",
44
+ top: "2",
45
+ insetEnd: "2",
46
+ ...props,
47
+ asChild: true,
48
+ children: /* @__PURE__ */ jsx(CloseButton, { size: "sm", ref })
49
+ }
50
+ );
51
+ });
52
+ var DrawerTrigger = ChakraDrawer.Trigger;
53
+ var DrawerRoot = ChakraDrawer.Root;
54
+ var DrawerFooter = ChakraDrawer.Footer;
55
+ var DrawerHeader = ChakraDrawer.Header;
56
+ var DrawerBody = ChakraDrawer.Body;
57
+ var DrawerBackdrop = ChakraDrawer.Backdrop;
58
+ var DrawerDescription = ChakraDrawer.Description;
59
+ var DrawerTitle = ChakraDrawer.Title;
60
+ var DrawerActionTrigger = ChakraDrawer.ActionTrigger;
61
+ var DrawerContext = DialogContext;
62
+
63
+ export {
64
+ namespace_exports
65
+ };
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+
3
+ // src/components/toaster/toaster.tsx
4
+ import {
5
+ Toaster as ChakraToaster,
6
+ Portal,
7
+ Spinner,
8
+ Stack,
9
+ Toast,
10
+ createToaster
11
+ } from "@chakra-ui/react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var toast = createToaster({
14
+ placement: "bottom-end",
15
+ pauseOnPageIdle: true
16
+ });
17
+ var Toaster = () => {
18
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(ChakraToaster, { toaster: toast, insetInline: { mdDown: "4" }, children: (toast2) => {
19
+ var _a;
20
+ return /* @__PURE__ */ jsxs(Toast.Root, { width: { md: "sm" }, children: [
21
+ toast2.type === "loading" ? /* @__PURE__ */ jsx(Spinner, { size: "sm", color: "colorPalette.solid" }) : /* @__PURE__ */ jsx(Toast.Indicator, {}),
22
+ /* @__PURE__ */ jsxs(Stack, { gap: "1", flex: "1", maxWidth: "100%", children: [
23
+ toast2.title && /* @__PURE__ */ jsx(Toast.Title, { children: toast2.title }),
24
+ toast2.description && /* @__PURE__ */ jsx(Toast.Description, { children: toast2.description })
25
+ ] }),
26
+ toast2.action && /* @__PURE__ */ jsx(Toast.ActionTrigger, { children: toast2.action.label }),
27
+ ((_a = toast2.meta) == null ? void 0 : _a.closable) && /* @__PURE__ */ jsx(Toast.CloseTrigger, {})
28
+ ] });
29
+ } }) });
30
+ };
31
+
32
+ export {
33
+ toast,
34
+ Toaster
35
+ };
@@ -0,0 +1,38 @@
1
+ 'use client'
2
+
3
+ // src/components/icon-badge/icon-badge.tsx
4
+ import * as React from "react";
5
+ import { cloneElement, isValidElement } from "react";
6
+ import {
7
+ chakra,
8
+ useRecipe
9
+ } from "@chakra-ui/react";
10
+ import { cx } from "@saas-ui/core/utils";
11
+ import { jsx } from "react/jsx-runtime";
12
+ var IconBadge = React.forwardRef(
13
+ (props, ref) => {
14
+ const { icon, children, ...rest } = props;
15
+ const recipe = useRecipe({ key: "suiIconBadge", recipe: props.recipe });
16
+ const [variantProps, localProps] = recipe.splitVariantProps(rest);
17
+ const styles = recipe(variantProps);
18
+ const element = icon || children;
19
+ const _children = isValidElement(element) ? cloneElement(element, {
20
+ "aria-hidden": true,
21
+ focusable: false
22
+ }) : null;
23
+ return /* @__PURE__ */ jsx(
24
+ chakra.div,
25
+ {
26
+ ref,
27
+ ...localProps,
28
+ css: [styles, props.css],
29
+ className: cx(recipe.className, props.className),
30
+ children: _children
31
+ }
32
+ );
33
+ }
34
+ );
35
+
36
+ export {
37
+ IconBadge
38
+ };
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+
3
+ // src/components/checkbox/checkbox.tsx
4
+ import { forwardRef } from "react";
5
+ import { Checkbox as ChakraCheckbox } from "@chakra-ui/react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var Checkbox = forwardRef(
8
+ function Checkbox2(props, ref) {
9
+ const { icon, children, inputProps, rootRef, ...rest } = props;
10
+ return /* @__PURE__ */ jsxs(ChakraCheckbox.Root, { ref: rootRef, ...rest, children: [
11
+ /* @__PURE__ */ jsx(ChakraCheckbox.HiddenInput, { ref, ...inputProps }),
12
+ /* @__PURE__ */ jsx(ChakraCheckbox.Control, { children: icon || /* @__PURE__ */ jsx(ChakraCheckbox.Indicator, {}) }),
13
+ children != null && /* @__PURE__ */ jsx(ChakraCheckbox.Label, { children })
14
+ ] });
15
+ }
16
+ );
17
+
18
+ export {
19
+ Checkbox
20
+ };
@@ -0,0 +1,119 @@
1
+ 'use client'
2
+ import {
3
+ CloseIcon,
4
+ SearchIcon
5
+ } from "./chunk-VDXTEASE.js";
6
+
7
+ // src/components/search-input/search-input.tsx
8
+ import React, { forwardRef } from "react";
9
+ import {
10
+ Group,
11
+ IconButton,
12
+ Input,
13
+ InputElement,
14
+ mergeRefs,
15
+ useControllableState
16
+ } from "@chakra-ui/react";
17
+ import { callAll } from "@saas-ui/core/utils";
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ var SearchInput = forwardRef(
20
+ (props, ref) => {
21
+ const {
22
+ placeholder = "Search",
23
+ value: valueProp,
24
+ defaultValue: defaultValueProp,
25
+ size,
26
+ variant,
27
+ width = "full",
28
+ icon = /* @__PURE__ */ jsx(SearchIcon, {}),
29
+ resetIcon,
30
+ endElement: endElementProp,
31
+ onChange: onChangeProp,
32
+ onReset: onResetProp,
33
+ onKeyDown: onKeyDownProp,
34
+ disabled,
35
+ ...inputProps
36
+ } = props;
37
+ const inputRef = React.useRef(null);
38
+ const [value, setValue] = useControllableState({
39
+ value: valueProp,
40
+ defaultValue: defaultValueProp
41
+ });
42
+ const onChange = React.useCallback(
43
+ (e) => {
44
+ setValue(e.target.value);
45
+ },
46
+ [setValue]
47
+ );
48
+ const onKeyDown = React.useCallback(
49
+ (event) => {
50
+ if (event.key === "Escape") {
51
+ setValue("");
52
+ onReset();
53
+ }
54
+ },
55
+ [onResetProp, setValue]
56
+ );
57
+ const onReset = () => {
58
+ var _a;
59
+ setValue("");
60
+ onResetProp == null ? void 0 : onResetProp();
61
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
62
+ };
63
+ const showReset = value && !props.disabled;
64
+ const endElement = showReset ? /* @__PURE__ */ jsx(SearchInputResetButton, { size, children: resetIcon }) : endElementProp;
65
+ return /* @__PURE__ */ jsxs(Group, { width, children: [
66
+ /* @__PURE__ */ jsx(
67
+ InputElement,
68
+ {
69
+ placement: "start",
70
+ px: "0",
71
+ aspectRatio: "9/10",
72
+ fontSize: size,
73
+ children: icon
74
+ }
75
+ ),
76
+ /* @__PURE__ */ jsx(
77
+ Input,
78
+ {
79
+ type: "text",
80
+ placeholder,
81
+ variant,
82
+ size,
83
+ value,
84
+ disabled,
85
+ ref: mergeRefs(ref, inputRef),
86
+ onChange: callAll(onChange, onChangeProp),
87
+ onKeyDown: callAll(onKeyDown, onKeyDownProp),
88
+ ps: "calc(var(--input-height) - var(--input-height) / 10)",
89
+ pe: "calc(var(--input-height) - var(--input-height) / 10)",
90
+ ...inputProps
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx(InputElement, { placement: "end", children: endElement })
94
+ ] });
95
+ }
96
+ );
97
+ var SearchInputResetButton = forwardRef(
98
+ (props, ref) => {
99
+ const { children = /* @__PURE__ */ jsx(CloseIcon, {}), ...rest } = props;
100
+ return /* @__PURE__ */ jsx(
101
+ IconButton,
102
+ {
103
+ ref,
104
+ variant: "ghost",
105
+ "aria-label": "Reset search",
106
+ me: "-2",
107
+ aspectRatio: "square",
108
+ height: "calc(100% - {spacing.2})",
109
+ ...rest,
110
+ children
111
+ }
112
+ );
113
+ }
114
+ );
115
+ SearchInput.displayName = "SearchInput";
116
+
117
+ export {
118
+ SearchInput
119
+ };
@@ -0,0 +1,184 @@
1
+ 'use client'
2
+
3
+ // src/components/persona/persona.tsx
4
+ import * as React2 from "react";
5
+
6
+ // src/components/persona/persona-primitive.tsx
7
+ import { forwardRef } from "react";
8
+ import {
9
+ Avatar,
10
+ chakra
11
+ } from "@chakra-ui/react";
12
+ import { dataAttr } from "@saas-ui/core/utils";
13
+
14
+ // src/components/persona/persona.context.ts
15
+ import { createSlotRecipeContext } from "@chakra-ui/react";
16
+ var {
17
+ useStyles: usePersonaStyles,
18
+ withProvider,
19
+ withContext
20
+ } = createSlotRecipeContext({
21
+ key: "suiPersona"
22
+ });
23
+
24
+ // src/components/persona/persona-primitive.tsx
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ var PersonaRoot = withProvider(
27
+ forwardRef((props, ref) => {
28
+ const { outOfOffice, presence, ...rest } = props;
29
+ return /* @__PURE__ */ jsx(
30
+ chakra.div,
31
+ {
32
+ ref,
33
+ ...rest,
34
+ "data-out-of-office": dataAttr(outOfOffice),
35
+ "data-presence": presence,
36
+ css: [
37
+ presence ? {
38
+ "--persona-presence": `colors.presence.${presence}`
39
+ } : void 0,
40
+ rest.css
41
+ ]
42
+ }
43
+ );
44
+ }),
45
+ "root"
46
+ );
47
+ var PersonaAvatar = forwardRef(
48
+ (props, ref) => {
49
+ const {
50
+ name,
51
+ getInitials = (name2) => name2 == null ? void 0 : name2[0],
52
+ icon,
53
+ loading,
54
+ onError,
55
+ src,
56
+ srcSet,
57
+ children,
58
+ ...rest
59
+ } = props;
60
+ return /* @__PURE__ */ jsxs(Avatar.Root, { ref, ...rest, children: [
61
+ /* @__PURE__ */ jsx(Avatar.Fallback, { children: getInitials(name) }),
62
+ /* @__PURE__ */ jsx(
63
+ Avatar.Image,
64
+ {
65
+ src,
66
+ srcSet,
67
+ loading,
68
+ onError
69
+ }
70
+ ),
71
+ children
72
+ ] });
73
+ }
74
+ );
75
+ var PersonaPresenceBadge = withContext("span", "presence");
76
+ var PersonaDetails = withContext(
77
+ "div",
78
+ "details"
79
+ );
80
+ var PersonaLabel = withContext(
81
+ "span",
82
+ "label"
83
+ );
84
+ PersonaLabel.displayName = "PersonaLabel";
85
+ var PersonaSecondaryLabel = withContext(
86
+ "span",
87
+ "secondaryLabel"
88
+ );
89
+ var PersonaTertiaryLabel = withContext(
90
+ "span",
91
+ "tertiaryLabel"
92
+ );
93
+
94
+ // src/components/persona/persona.tsx
95
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
96
+ var Persona = React2.forwardRef(
97
+ (props, ref) => {
98
+ const {
99
+ name,
100
+ presence,
101
+ presenceIcon,
102
+ isOutOfOffice,
103
+ label,
104
+ secondaryLabel,
105
+ tertiaryLabel,
106
+ size,
107
+ hideDetails,
108
+ children,
109
+ /** Avatar props */
110
+ getInitials,
111
+ icon,
112
+ loading,
113
+ onError,
114
+ src,
115
+ srcSet,
116
+ ...rest
117
+ } = props;
118
+ return /* @__PURE__ */ jsxs2(
119
+ PersonaRoot,
120
+ {
121
+ ref,
122
+ outOfOffice: isOutOfOffice,
123
+ presence,
124
+ ...rest,
125
+ children: [
126
+ /* @__PURE__ */ jsx2(
127
+ PersonaAvatar,
128
+ {
129
+ name,
130
+ size,
131
+ getInitials,
132
+ icon,
133
+ loading,
134
+ onError,
135
+ src,
136
+ srcSet,
137
+ children: /* @__PURE__ */ jsx2(PersonaPresenceBadge, { children: presenceIcon })
138
+ }
139
+ ),
140
+ !hideDetails && /* @__PURE__ */ jsxs2(PersonaDetails, { children: [
141
+ /* @__PURE__ */ jsx2(PersonaLabel, { children: label || name }),
142
+ secondaryLabel && /* @__PURE__ */ jsx2(PersonaSecondaryLabel, { children: secondaryLabel }),
143
+ tertiaryLabel && /* @__PURE__ */ jsx2(PersonaTertiaryLabel, { children: tertiaryLabel }),
144
+ children
145
+ ] })
146
+ ]
147
+ }
148
+ );
149
+ }
150
+ );
151
+ Persona.displayName = "Persona";
152
+ var PersonaAvatar2 = React2.forwardRef(function PersonaAvatar3(props, ref) {
153
+ return /* @__PURE__ */ jsx2(Persona, { ref, ...props, hideDetails: true });
154
+ });
155
+
156
+ // src/components/persona/presence.ts
157
+ var defaultPresenceOptions = {
158
+ online: {
159
+ label: "Online",
160
+ color: "presence.online"
161
+ },
162
+ offline: {
163
+ label: "Offline",
164
+ color: "presence.offline"
165
+ },
166
+ busy: {
167
+ label: "Busy",
168
+ color: "presence.busy"
169
+ },
170
+ dnd: {
171
+ label: "Do-not-disturb",
172
+ color: "presence.dnd"
173
+ },
174
+ away: {
175
+ label: "Away",
176
+ color: "presence.away"
177
+ }
178
+ };
179
+
180
+ export {
181
+ Persona,
182
+ PersonaAvatar2 as PersonaAvatar,
183
+ defaultPresenceOptions
184
+ };
@@ -0,0 +1,46 @@
1
+ 'use client'
2
+ import {
3
+ __export
4
+ } from "./chunk-RTMS5TJN.js";
5
+
6
+ // src/components/grid-list/grid-list.tsx
7
+ var grid_list_exports = {};
8
+ __export(grid_list_exports, {
9
+ Cell: () => GridListCell,
10
+ Header: () => GridListHeader,
11
+ Item: () => GridListItem,
12
+ Root: () => GridListRoot
13
+ });
14
+ import { GridList } from "@saas-ui/core/grid-list";
15
+
16
+ // src/components/grid-list/grid-list.context.ts
17
+ import { createSlotRecipeContext } from "@chakra-ui/react";
18
+ var {
19
+ withProvider,
20
+ withContext,
21
+ useStyles: useGridListStyles
22
+ } = createSlotRecipeContext({
23
+ key: "suiGridList"
24
+ });
25
+
26
+ // src/components/grid-list/grid-list.tsx
27
+ var GridListRoot = withProvider(
28
+ GridList.Root,
29
+ "root"
30
+ );
31
+ var GridListItem = withContext(
32
+ GridList.Item,
33
+ "item"
34
+ );
35
+ var GridListHeader = withContext(
36
+ GridList.Header,
37
+ "header"
38
+ );
39
+ var GridListCell = withContext(
40
+ GridList.Cell,
41
+ "cell"
42
+ );
43
+
44
+ export {
45
+ grid_list_exports
46
+ };
@@ -0,0 +1,87 @@
1
+ 'use client'
2
+ import {
3
+ LuEye,
4
+ LuEyeOff
5
+ } from "./chunk-F3CVOMG5.js";
6
+ import {
7
+ InputGroup
8
+ } from "./chunk-PKI6YH2V.js";
9
+
10
+ // src/components/password-input/password-input.tsx
11
+ import { forwardRef, useRef } from "react";
12
+ import {
13
+ IconButton,
14
+ Input,
15
+ mergeRefs,
16
+ useControllableState
17
+ } from "@chakra-ui/react";
18
+ import { jsx } from "react/jsx-runtime";
19
+ var PasswordInput = forwardRef(
20
+ function PasswordInput2(props, ref) {
21
+ const {
22
+ rootProps,
23
+ defaultVisible,
24
+ visible: visibleProp,
25
+ onVisibleChange,
26
+ visibilityIcon = { on: /* @__PURE__ */ jsx(LuEye, {}), off: /* @__PURE__ */ jsx(LuEyeOff, {}) },
27
+ ...rest
28
+ } = props;
29
+ const [visible, setVisible] = useControllableState({
30
+ value: visibleProp,
31
+ defaultValue: defaultVisible || false,
32
+ onChange: onVisibleChange
33
+ });
34
+ const inputRef = useRef(null);
35
+ return /* @__PURE__ */ jsx(
36
+ InputGroup,
37
+ {
38
+ width: "full",
39
+ endElement: /* @__PURE__ */ jsx(
40
+ VisibilityTrigger,
41
+ {
42
+ disabled: rest.disabled,
43
+ onPointerDown: (e) => {
44
+ if (rest.disabled) return;
45
+ if (e.button !== 0) return;
46
+ e.preventDefault();
47
+ setVisible(!visible);
48
+ },
49
+ children: visible ? visibilityIcon.off : visibilityIcon.on
50
+ }
51
+ ),
52
+ ...rootProps,
53
+ children: /* @__PURE__ */ jsx(
54
+ Input,
55
+ {
56
+ ...rest,
57
+ ref: mergeRefs(ref, inputRef),
58
+ type: visible ? "text" : "password"
59
+ }
60
+ )
61
+ }
62
+ );
63
+ }
64
+ );
65
+ var VisibilityTrigger = forwardRef(
66
+ function VisibilityTrigger2(props, ref) {
67
+ return /* @__PURE__ */ jsx(
68
+ IconButton,
69
+ {
70
+ tabIndex: -1,
71
+ ref,
72
+ me: "-2",
73
+ aspectRatio: "square",
74
+ size: "sm",
75
+ variant: "ghost",
76
+ colorPalette: "gray",
77
+ height: "calc(100% - {spacing.2})",
78
+ "aria-label": "Toggle password visibility",
79
+ ...props
80
+ }
81
+ );
82
+ }
83
+ );
84
+
85
+ export {
86
+ PasswordInput
87
+ };
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+
3
+ // src/components/tooltip/tooltip.tsx
4
+ import { forwardRef } from "react";
5
+ import { Tooltip as ChakraTooltip, Portal } from "@chakra-ui/react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var Tooltip = forwardRef(
8
+ function Tooltip2(props, ref) {
9
+ const {
10
+ showArrow,
11
+ children,
12
+ disabled,
13
+ portalled,
14
+ content,
15
+ contentProps,
16
+ portalRef,
17
+ ...rest
18
+ } = props;
19
+ if (disabled) return children;
20
+ return /* @__PURE__ */ jsxs(ChakraTooltip.Root, { ...rest, children: [
21
+ /* @__PURE__ */ jsx(ChakraTooltip.Trigger, { asChild: true, children }),
22
+ /* @__PURE__ */ jsx(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx(ChakraTooltip.Positioner, { children: /* @__PURE__ */ jsxs(ChakraTooltip.Content, { ref, ...contentProps, children: [
23
+ showArrow && /* @__PURE__ */ jsx(ChakraTooltip.Arrow, { children: /* @__PURE__ */ jsx(ChakraTooltip.ArrowTip, {}) }),
24
+ content
25
+ ] }) }) })
26
+ ] });
27
+ }
28
+ );
29
+
30
+ export {
31
+ Tooltip
32
+ };