@mks2508/mks-ui 0.1.0 → 0.1.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.
Files changed (180) hide show
  1. package/dist/components/animate-ui/primitives/animate/slot.js +35 -40
  2. package/dist/components/animate-ui/primitives/base/menu.d.ts +1 -1
  3. package/dist/components/animate-ui/primitives/base/progress.d.ts +1 -1
  4. package/dist/components/animate-ui/primitives/base/switch.js +86 -32
  5. package/dist/components/animate-ui/primitives/base/tabs.d.ts +2 -2
  6. package/dist/components/animate-ui/primitives/base/tabs.js +118 -39
  7. package/dist/components/animate-ui/primitives/effects/auto-height.d.ts +1 -1
  8. package/dist/components/animate-ui/primitives/effects/auto-height.js +33 -14
  9. package/dist/components/animate-ui/primitives/effects/highlight.js +345 -304
  10. package/dist/components/animate-ui/primitives/texts/counting-number.d.ts +1 -1
  11. package/dist/components/ui/alert-dialog.d.ts +1 -1
  12. package/dist/components/ui/alert-dialog.js +75 -19
  13. package/dist/components/ui/badge/badge.d.ts +1 -1
  14. package/dist/components/ui/badge/badge.js +49 -37
  15. package/dist/components/ui/badge/badge.styles.js +31 -36
  16. package/dist/components/ui/badge/index.js +2 -7
  17. package/dist/components/ui/button/button.d.ts +1 -1
  18. package/dist/components/ui/button/button.js +154 -114
  19. package/dist/components/ui/button/button.styles.js +41 -49
  20. package/dist/components/ui/button/index.js +2 -7
  21. package/dist/components/ui/card.js +50 -21
  22. package/dist/components/ui/combobox.js +143 -27
  23. package/dist/components/ui/devenv-bracket.js +60 -43
  24. package/dist/components/ui/dropdown-menu.js +118 -20
  25. package/dist/components/ui/field.d.ts +1 -1
  26. package/dist/components/ui/field.js +88 -44
  27. package/dist/components/ui/index.d.ts +2 -0
  28. package/dist/components/ui/index.d.ts.map +1 -1
  29. package/dist/components/ui/index.js +24 -25
  30. package/dist/components/ui/input-group.d.ts +1 -1
  31. package/dist/components/ui/input-group.js +67 -41
  32. package/dist/components/ui/input.js +16 -7
  33. package/dist/components/ui/label.js +13 -5
  34. package/dist/components/ui/morphing-popover/index.js +1 -9
  35. package/dist/components/ui/morphing-popover/morphing-popover.js +73 -44
  36. package/dist/components/ui/morphing-popover/morphing-popover.module-yxDDcJHZ.css +154 -0
  37. package/dist/components/ui/morphing-popover/morphing-popover.module.js +5 -0
  38. package/dist/components/ui/select.js +95 -16
  39. package/dist/components/ui/separator.js +16 -7
  40. package/dist/components/ui/switch.d.ts +9 -0
  41. package/dist/components/ui/switch.d.ts.map +1 -0
  42. package/dist/components/ui/switch.js +1 -0
  43. package/dist/components/ui/tabs.d.ts +9 -0
  44. package/dist/components/ui/tabs.d.ts.map +1 -0
  45. package/dist/components/ui/tabs.js +1 -0
  46. package/dist/components/ui/textarea.js +13 -5
  47. package/dist/hooks/use-auto-height.js +63 -72
  48. package/dist/hooks/use-controlled-state.js +16 -15
  49. package/dist/icons/index.js +36 -11
  50. package/dist/icons/lucide-animated/activity.js +68 -50
  51. package/dist/icons/lucide-animated/arrow-down-to-line.js +42 -20
  52. package/dist/icons/lucide-animated/arrow-up.js +38 -20
  53. package/dist/icons/lucide-animated/bell-electric.js +197 -53
  54. package/dist/icons/lucide-animated/bell.js +58 -36
  55. package/dist/icons/lucide-animated/bot.js +113 -53
  56. package/dist/icons/lucide-animated/box.js +79 -47
  57. package/dist/icons/lucide-animated/check.js +21 -8
  58. package/dist/icons/lucide-animated/circle-check.js +69 -47
  59. package/dist/icons/lucide-animated/delete.js +101 -45
  60. package/dist/icons/lucide-animated/download.js +63 -41
  61. package/dist/icons/lucide-animated/edit-2.js +21 -8
  62. package/dist/icons/lucide-animated/globe.js +29 -8
  63. package/dist/icons/lucide-animated/home.js +59 -41
  64. package/dist/icons/lucide-animated/index.js +32 -38
  65. package/dist/icons/lucide-animated/layers.js +25 -8
  66. package/dist/icons/lucide-animated/layout-panel-top.js +125 -63
  67. package/dist/icons/lucide-animated/list.js +75 -20
  68. package/dist/icons/lucide-animated/package.js +26 -8
  69. package/dist/icons/lucide-animated/palette.js +47 -8
  70. package/dist/icons/lucide-animated/plus.js +54 -38
  71. package/dist/icons/lucide-animated/refresh-cw.js +26 -8
  72. package/dist/icons/lucide-animated/rocket.js +26 -8
  73. package/dist/icons/lucide-animated/save.js +25 -8
  74. package/dist/icons/lucide-animated/search.js +73 -40
  75. package/dist/icons/lucide-animated/settings.js +58 -38
  76. package/dist/icons/lucide-animated/terminal.js +35 -4
  77. package/dist/icons/lucide-animated/trash-2.js +37 -8
  78. package/dist/icons/lucide-animated/trending-down.js +114 -78
  79. package/dist/icons/lucide-animated/trending-up.js +114 -78
  80. package/dist/icons/lucide-animated/type.js +35 -8
  81. package/dist/icons/lucide-animated/upload.js +30 -8
  82. package/dist/icons/lucide-animated/x.js +61 -39
  83. package/dist/index.js +56 -18
  84. package/dist/lib/get-strict-context.js +18 -14
  85. package/dist/lib/utils.js +24 -20
  86. package/package.json +14 -17
  87. package/src/components/ui/index.ts +2 -0
  88. package/src/components/ui/switch.tsx +9 -0
  89. package/src/components/ui/tabs.tsx +9 -0
  90. package/dist/components/animate-ui/primitives/animate/slot.js.map +0 -1
  91. package/dist/components/animate-ui/primitives/base/accordion.js +0 -52
  92. package/dist/components/animate-ui/primitives/base/accordion.js.map +0 -1
  93. package/dist/components/animate-ui/primitives/base/alert-dialog.js +0 -60
  94. package/dist/components/animate-ui/primitives/base/alert-dialog.js.map +0 -1
  95. package/dist/components/animate-ui/primitives/base/checkbox.js +0 -41
  96. package/dist/components/animate-ui/primitives/base/checkbox.js.map +0 -1
  97. package/dist/components/animate-ui/primitives/base/dialog.js +0 -60
  98. package/dist/components/animate-ui/primitives/base/dialog.js.map +0 -1
  99. package/dist/components/animate-ui/primitives/base/menu.js +0 -122
  100. package/dist/components/animate-ui/primitives/base/menu.js.map +0 -1
  101. package/dist/components/animate-ui/primitives/base/popover.js +0 -45
  102. package/dist/components/animate-ui/primitives/base/popover.js.map +0 -1
  103. package/dist/components/animate-ui/primitives/base/progress.js +0 -27
  104. package/dist/components/animate-ui/primitives/base/progress.js.map +0 -1
  105. package/dist/components/animate-ui/primitives/base/switch.js.map +0 -1
  106. package/dist/components/animate-ui/primitives/base/tabs.js.map +0 -1
  107. package/dist/components/animate-ui/primitives/base/tooltip.js +0 -71
  108. package/dist/components/animate-ui/primitives/base/tooltip.js.map +0 -1
  109. package/dist/components/animate-ui/primitives/effects/auto-height.js.map +0 -1
  110. package/dist/components/animate-ui/primitives/effects/highlight.js.map +0 -1
  111. package/dist/components/animate-ui/primitives/texts/counting-number.js +0 -69
  112. package/dist/components/animate-ui/primitives/texts/counting-number.js.map +0 -1
  113. package/dist/components/ui/alert-dialog.js.map +0 -1
  114. package/dist/components/ui/badge/badge.js.map +0 -1
  115. package/dist/components/ui/badge/badge.styles.js.map +0 -1
  116. package/dist/components/ui/badge/badge.types.js +0 -2
  117. package/dist/components/ui/badge/badge.types.js.map +0 -1
  118. package/dist/components/ui/badge/index.js.map +0 -1
  119. package/dist/components/ui/button/button.js.map +0 -1
  120. package/dist/components/ui/button/button.styles.js.map +0 -1
  121. package/dist/components/ui/button/button.types.js +0 -2
  122. package/dist/components/ui/button/button.types.js.map +0 -1
  123. package/dist/components/ui/button/index.js.map +0 -1
  124. package/dist/components/ui/card.js.map +0 -1
  125. package/dist/components/ui/combobox.js.map +0 -1
  126. package/dist/components/ui/devenv-bracket.js.map +0 -1
  127. package/dist/components/ui/dropdown-menu.js.map +0 -1
  128. package/dist/components/ui/field.js.map +0 -1
  129. package/dist/components/ui/index.js.map +0 -1
  130. package/dist/components/ui/input-group.js.map +0 -1
  131. package/dist/components/ui/input.js.map +0 -1
  132. package/dist/components/ui/label.js.map +0 -1
  133. package/dist/components/ui/morphing-popover/index.js.map +0 -1
  134. package/dist/components/ui/morphing-popover/morphing-popover.js.map +0 -1
  135. package/dist/components/ui/select.js.map +0 -1
  136. package/dist/components/ui/separator.js.map +0 -1
  137. package/dist/components/ui/textarea.js.map +0 -1
  138. package/dist/hooks/use-auto-height.js.map +0 -1
  139. package/dist/hooks/use-controlled-state.js.map +0 -1
  140. package/dist/hooks/use-data-state.js +0 -45
  141. package/dist/hooks/use-data-state.js.map +0 -1
  142. package/dist/hooks/use-is-in-view.js +0 -15
  143. package/dist/hooks/use-is-in-view.js.map +0 -1
  144. package/dist/icons/index.js.map +0 -1
  145. package/dist/icons/lucide-animated/activity.js.map +0 -1
  146. package/dist/icons/lucide-animated/arrow-down-to-line.js.map +0 -1
  147. package/dist/icons/lucide-animated/arrow-up.js.map +0 -1
  148. package/dist/icons/lucide-animated/bell-electric.js.map +0 -1
  149. package/dist/icons/lucide-animated/bell.js.map +0 -1
  150. package/dist/icons/lucide-animated/bot.js.map +0 -1
  151. package/dist/icons/lucide-animated/box.js.map +0 -1
  152. package/dist/icons/lucide-animated/check.js.map +0 -1
  153. package/dist/icons/lucide-animated/circle-check.js.map +0 -1
  154. package/dist/icons/lucide-animated/delete.js.map +0 -1
  155. package/dist/icons/lucide-animated/download.js.map +0 -1
  156. package/dist/icons/lucide-animated/edit-2.js.map +0 -1
  157. package/dist/icons/lucide-animated/globe.js.map +0 -1
  158. package/dist/icons/lucide-animated/home.js.map +0 -1
  159. package/dist/icons/lucide-animated/index.js.map +0 -1
  160. package/dist/icons/lucide-animated/layers.js.map +0 -1
  161. package/dist/icons/lucide-animated/layout-panel-top.js.map +0 -1
  162. package/dist/icons/lucide-animated/list.js.map +0 -1
  163. package/dist/icons/lucide-animated/package.js.map +0 -1
  164. package/dist/icons/lucide-animated/palette.js.map +0 -1
  165. package/dist/icons/lucide-animated/plus.js.map +0 -1
  166. package/dist/icons/lucide-animated/refresh-cw.js.map +0 -1
  167. package/dist/icons/lucide-animated/rocket.js.map +0 -1
  168. package/dist/icons/lucide-animated/save.js.map +0 -1
  169. package/dist/icons/lucide-animated/search.js.map +0 -1
  170. package/dist/icons/lucide-animated/settings.js.map +0 -1
  171. package/dist/icons/lucide-animated/terminal.js.map +0 -1
  172. package/dist/icons/lucide-animated/trash-2.js.map +0 -1
  173. package/dist/icons/lucide-animated/trending-down.js.map +0 -1
  174. package/dist/icons/lucide-animated/trending-up.js.map +0 -1
  175. package/dist/icons/lucide-animated/type.js.map +0 -1
  176. package/dist/icons/lucide-animated/upload.js.map +0 -1
  177. package/dist/icons/lucide-animated/x.js.map +0 -1
  178. package/dist/index.js.map +0 -1
  179. package/dist/lib/get-strict-context.js.map +0 -1
  180. package/dist/lib/utils.js.map +0 -1
@@ -1,47 +1,42 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from 'react';
4
- import { motion, isMotionComponent } from 'motion/react';
5
- import { cn } from '@/lib/utils';
2
+
3
+ import { cn } from "../../../../lib/utils.js";
4
+ import * as React from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { isMotionComponent, motion } from "motion/react";
7
+
8
+ //#region src/components/animate-ui/primitives/animate/slot.tsx
6
9
  function mergeRefs(...refs) {
7
- return (node) => {
8
- refs.forEach((ref) => {
9
- if (!ref)
10
- return;
11
- if (typeof ref === 'function') {
12
- ref(node);
13
- }
14
- else {
15
- ref.current = node;
16
- }
17
- });
18
- };
10
+ return (node) => {
11
+ refs.forEach((ref) => {
12
+ if (!ref) return;
13
+ if (typeof ref === "function") ref(node);
14
+ else ref.current = node;
15
+ });
16
+ };
19
17
  }
20
18
  function mergeProps(childProps, slotProps) {
21
- const merged = { ...childProps, ...slotProps };
22
- if (childProps.className || slotProps.className) {
23
- merged.className = cn(childProps.className, slotProps.className);
24
- }
25
- if (childProps.style || slotProps.style) {
26
- merged.style = {
27
- ...childProps.style,
28
- ...slotProps.style,
29
- };
30
- }
31
- return merged;
19
+ const merged = {
20
+ ...childProps,
21
+ ...slotProps
22
+ };
23
+ if (childProps.className || slotProps.className) merged.className = cn(childProps.className, slotProps.className);
24
+ if (childProps.style || slotProps.style) merged.style = {
25
+ ...childProps.style,
26
+ ...slotProps.style
27
+ };
28
+ return merged;
32
29
  }
33
30
  function Slot({ children, ref, ...props }) {
34
- const isAlreadyMotion = typeof children.type === 'object' &&
35
- children.type !== null &&
36
- isMotionComponent(children.type);
37
- const Base = React.useMemo(() => isAlreadyMotion
38
- ? children.type
39
- : motion.create(children.type), [isAlreadyMotion, children.type]);
40
- if (!React.isValidElement(children))
41
- return null;
42
- const { ref: childRef, ...childProps } = children.props;
43
- const mergedProps = mergeProps(childProps, props);
44
- return (_jsx(Base, { ...mergedProps, ref: mergeRefs(childRef, ref) }));
31
+ const isAlreadyMotion = typeof children.type === "object" && children.type !== null && isMotionComponent(children.type);
32
+ const Base = React.useMemo(() => isAlreadyMotion ? children.type : motion.create(children.type), [isAlreadyMotion, children.type]);
33
+ if (!React.isValidElement(children)) return null;
34
+ const { ref: childRef, ...childProps } = children.props;
35
+ return /* @__PURE__ */ jsx(Base, {
36
+ ...mergeProps(childProps, props),
37
+ ref: mergeRefs(childRef, ref)
38
+ });
45
39
  }
46
- export { Slot, };
47
- //# sourceMappingURL=slot.js.map
40
+
41
+ //#endregion
42
+ export { Slot };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Menu as MenuPrimitive } from '@base-ui-components/react/menu';
3
3
  import { type HTMLMotionProps } from 'motion/react';
4
- import { type HighlightItemProps, type HighlightProps } from '@/components/animate-ui/primitives/effects/highlight';
4
+ import { type HighlightItemProps, type HighlightProps } from '../../../../components/animate-ui/primitives/effects/highlight';
5
5
  type MenuActiveValueContextType = {
6
6
  highlightedValue: string | null;
7
7
  setHighlightedValue: (value: string | null) => void;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Progress as ProgressPrimitives } from '@base-ui-components/react/progress';
3
- import { type CountingNumberProps } from '@/components/animate-ui/primitives/texts/counting-number';
3
+ import { type CountingNumberProps } from '../../../../components/animate-ui/primitives/texts/counting-number';
4
4
  type ProgressContextType = {
5
5
  value: number;
6
6
  };
@@ -1,36 +1,90 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from 'react';
4
- import { Switch as SwitchPrimitives } from '@base-ui-components/react/switch';
5
- import { motion, } from 'motion/react';
6
- import { getStrictContext } from '@/lib/get-strict-context';
7
- import { useControlledState } from '@/hooks/use-controlled-state';
8
- const [SwitchProvider, useSwitch] = getStrictContext('SwitchContext');
9
- function Switch({ name, defaultChecked, checked, onCheckedChange, nativeButton, disabled, readOnly, required, inputRef, id, ...props }) {
10
- const [isPressed, setIsPressed] = React.useState(false);
11
- const [isChecked, setIsChecked] = useControlledState({
12
- value: checked,
13
- defaultValue: defaultChecked,
14
- onChange: onCheckedChange,
15
- });
16
- return (_jsx(SwitchProvider, { value: { isChecked, setIsChecked, isPressed, setIsPressed }, children: _jsx(SwitchPrimitives.Root, { name: name, defaultChecked: defaultChecked, checked: checked, onCheckedChange: setIsChecked, nativeButton: nativeButton, disabled: disabled, readOnly: readOnly, required: required, inputRef: inputRef, id: id, render: _jsx(motion.button, { "data-slot": "switch", whileTap: "tap", initial: false, onTapStart: () => setIsPressed(true), onTapCancel: () => setIsPressed(false), onTap: () => setIsPressed(false), ...props }) }) }));
2
+
3
+ import { getStrictContext } from "../../../../lib/get-strict-context.js";
4
+ import { useControlledState } from "../../../../hooks/use-controlled-state.js";
5
+ import * as React from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { Switch } from "@base-ui-components/react/switch";
8
+ import { motion } from "motion/react";
9
+
10
+ //#region src/components/animate-ui/primitives/base/switch.tsx
11
+ const [SwitchProvider, useSwitch] = getStrictContext("SwitchContext");
12
+ function Switch$1({ name, defaultChecked, checked, onCheckedChange, nativeButton, disabled, readOnly, required, inputRef, id, ...props }) {
13
+ const [isPressed, setIsPressed] = React.useState(false);
14
+ const [isChecked, setIsChecked] = useControlledState({
15
+ value: checked,
16
+ defaultValue: defaultChecked,
17
+ onChange: onCheckedChange
18
+ });
19
+ return /* @__PURE__ */ jsx(SwitchProvider, {
20
+ value: {
21
+ isChecked,
22
+ setIsChecked,
23
+ isPressed,
24
+ setIsPressed
25
+ },
26
+ children: /* @__PURE__ */ jsx(Switch.Root, {
27
+ name,
28
+ defaultChecked,
29
+ checked,
30
+ onCheckedChange: setIsChecked,
31
+ nativeButton,
32
+ disabled,
33
+ readOnly,
34
+ required,
35
+ inputRef,
36
+ id,
37
+ render: /* @__PURE__ */ jsx(motion.button, {
38
+ "data-slot": "switch",
39
+ whileTap: "tap",
40
+ initial: false,
41
+ onTapStart: () => setIsPressed(true),
42
+ onTapCancel: () => setIsPressed(false),
43
+ onTap: () => setIsPressed(false),
44
+ ...props
45
+ })
46
+ })
47
+ });
17
48
  }
18
- function SwitchThumb({ pressedAnimation, transition = { type: 'spring', stiffness: 300, damping: 25 }, ...props }) {
19
- const { isPressed } = useSwitch();
20
- return (_jsx(SwitchPrimitives.Thumb, { render: _jsx(motion.div, { "data-slot": "switch-thumb", whileTap: "tab", layout: true, transition: transition, animate: isPressed ? pressedAnimation : undefined, ...props }) }));
49
+ function SwitchThumb({ pressedAnimation, transition = {
50
+ type: "spring",
51
+ stiffness: 300,
52
+ damping: 25
53
+ }, ...props }) {
54
+ const { isPressed } = useSwitch();
55
+ return /* @__PURE__ */ jsx(Switch.Thumb, { render: /* @__PURE__ */ jsx(motion.div, {
56
+ "data-slot": "switch-thumb",
57
+ whileTap: "tab",
58
+ layout: true,
59
+ transition,
60
+ animate: isPressed ? pressedAnimation : void 0,
61
+ ...props
62
+ }) });
21
63
  }
22
- function SwitchIcon({ position, transition = { type: 'spring', bounce: 0 }, ...props }) {
23
- const { isChecked } = useSwitch();
24
- const isAnimated = React.useMemo(() => {
25
- if (position === 'right')
26
- return !isChecked;
27
- if (position === 'left')
28
- return isChecked;
29
- if (position === 'thumb')
30
- return true;
31
- return false;
32
- }, [position, isChecked]);
33
- return (_jsx(motion.div, { "data-slot": `switch-${position}-icon`, animate: isAnimated ? { scale: 1, opacity: 1 } : { scale: 0, opacity: 0 }, transition: transition, ...props }));
64
+ function SwitchIcon({ position, transition = {
65
+ type: "spring",
66
+ bounce: 0
67
+ }, ...props }) {
68
+ const { isChecked } = useSwitch();
69
+ const isAnimated = React.useMemo(() => {
70
+ if (position === "right") return !isChecked;
71
+ if (position === "left") return isChecked;
72
+ if (position === "thumb") return true;
73
+ return false;
74
+ }, [position, isChecked]);
75
+ return /* @__PURE__ */ jsx(motion.div, {
76
+ "data-slot": `switch-${position}-icon`,
77
+ animate: isAnimated ? {
78
+ scale: 1,
79
+ opacity: 1
80
+ } : {
81
+ scale: 0,
82
+ opacity: 0
83
+ },
84
+ transition,
85
+ ...props
86
+ });
34
87
  }
35
- export { Switch, SwitchThumb, SwitchIcon, useSwitch, };
36
- //# sourceMappingURL=switch.js.map
88
+
89
+ //#endregion
90
+ export { Switch$1 as Switch, SwitchIcon, SwitchThumb, useSwitch };
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { Tabs as TabsPrimitive } from '@base-ui-components/react/tabs';
3
3
  import { type HTMLMotionProps, type Transition } from 'motion/react';
4
- import { type HighlightProps, type HighlightItemProps } from '@/components/animate-ui/primitives/effects/highlight';
5
- import { type AutoHeightProps } from '@/components/animate-ui/primitives/effects/auto-height';
4
+ import { type HighlightProps, type HighlightItemProps } from '../../../../components/animate-ui/primitives/effects/highlight';
5
+ import { type AutoHeightProps } from '../../../../components/animate-ui/primitives/effects/auto-height';
6
6
  type TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>;
7
7
  declare function Tabs(props: TabsProps): import("react/jsx-runtime").JSX.Element;
8
8
  type TabsHighlightProps = Omit<HighlightProps, 'controlledItems' | 'value'>;
@@ -1,53 +1,132 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from 'react';
4
- import { Tabs as TabsPrimitive } from '@base-ui-components/react/tabs';
5
- import { motion, AnimatePresence, } from 'motion/react';
6
- import { Highlight, HighlightItem, } from '@/components/animate-ui/primitives/effects/highlight';
7
- import { getStrictContext } from '@/lib/get-strict-context';
8
- import { useControlledState } from '@/hooks/use-controlled-state';
9
- import { AutoHeight, } from '@/components/animate-ui/primitives/effects/auto-height';
10
- const [TabsProvider, useTabs] = getStrictContext('TabsContext');
11
- function Tabs(props) {
12
- const [value, setValue] = useControlledState({
13
- value: props.value,
14
- defaultValue: props.defaultValue,
15
- onChange: props.onValueChange,
16
- });
17
- return (_jsx(TabsProvider, { value: { value, setValue }, children: _jsx(TabsPrimitive.Root, { "data-slot": "tabs", ...props, onValueChange: setValue }) }));
18
- }
19
- function TabsHighlight({ transition = { type: 'spring', stiffness: 200, damping: 25 }, ...props }) {
20
- const { value } = useTabs();
21
- return (_jsx(Highlight, { "data-slot": "tabs-highlight", controlledItems: true, value: value, transition: transition, click: false, ...props }));
2
+
3
+ import { getStrictContext } from "../../../../lib/get-strict-context.js";
4
+ import { useControlledState } from "../../../../hooks/use-controlled-state.js";
5
+ import { Highlight, HighlightItem } from "../effects/highlight.js";
6
+ import { AutoHeight } from "../effects/auto-height.js";
7
+ import * as React from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { AnimatePresence, motion } from "motion/react";
10
+ import { Tabs } from "@base-ui-components/react/tabs";
11
+
12
+ //#region src/components/animate-ui/primitives/base/tabs.tsx
13
+ const [TabsProvider, useTabs] = getStrictContext("TabsContext");
14
+ function Tabs$1(props) {
15
+ const [value, setValue] = useControlledState({
16
+ value: props.value,
17
+ defaultValue: props.defaultValue,
18
+ onChange: props.onValueChange
19
+ });
20
+ return /* @__PURE__ */ jsx(TabsProvider, {
21
+ value: {
22
+ value,
23
+ setValue
24
+ },
25
+ children: /* @__PURE__ */ jsx(Tabs.Root, {
26
+ "data-slot": "tabs",
27
+ ...props,
28
+ onValueChange: setValue
29
+ })
30
+ });
31
+ }
32
+ function TabsHighlight({ transition = {
33
+ type: "spring",
34
+ stiffness: 200,
35
+ damping: 25
36
+ }, ...props }) {
37
+ const { value } = useTabs();
38
+ return /* @__PURE__ */ jsx(Highlight, {
39
+ "data-slot": "tabs-highlight",
40
+ controlledItems: true,
41
+ value,
42
+ transition,
43
+ click: false,
44
+ ...props
45
+ });
22
46
  }
23
47
  function TabsList(props) {
24
- return _jsx(TabsPrimitive.List, { "data-slot": "tabs-list", ...props });
48
+ return /* @__PURE__ */ jsx(Tabs.List, {
49
+ "data-slot": "tabs-list",
50
+ ...props
51
+ });
25
52
  }
26
53
  function TabsHighlightItem(props) {
27
- return _jsx(HighlightItem, { "data-slot": "tabs-highlight-item", ...props });
54
+ return /* @__PURE__ */ jsx(HighlightItem, {
55
+ "data-slot": "tabs-highlight-item",
56
+ ...props
57
+ });
28
58
  }
29
59
  function TabsTab(props) {
30
- return _jsx(TabsPrimitive.Tab, { "data-slot": "tabs-tab", ...props });
60
+ return /* @__PURE__ */ jsx(Tabs.Tab, {
61
+ "data-slot": "tabs-tab",
62
+ ...props
63
+ });
31
64
  }
32
- function TabsPanel({ value, keepMounted, transition = { duration: 0.5, ease: 'easeInOut' }, ...props }) {
33
- return (_jsx(AnimatePresence, { mode: "wait", children: _jsx(TabsPrimitive.Panel, { render: _jsx(motion.div, { "data-slot": "tabs-panel", layout: true, layoutDependency: value, initial: { opacity: 0, filter: 'blur(4px)' }, animate: { opacity: 1, filter: 'blur(0px)' }, exit: { opacity: 0, filter: 'blur(4px)' }, transition: transition, ...props }), keepMounted: keepMounted, value: value }) }));
65
+ function TabsPanel({ value, keepMounted, transition = {
66
+ duration: .5,
67
+ ease: "easeInOut"
68
+ }, ...props }) {
69
+ return /* @__PURE__ */ jsx(AnimatePresence, {
70
+ mode: "wait",
71
+ children: /* @__PURE__ */ jsx(Tabs.Panel, {
72
+ render: /* @__PURE__ */ jsx(motion.div, {
73
+ "data-slot": "tabs-panel",
74
+ layout: true,
75
+ layoutDependency: value,
76
+ initial: {
77
+ opacity: 0,
78
+ filter: "blur(4px)"
79
+ },
80
+ animate: {
81
+ opacity: 1,
82
+ filter: "blur(0px)"
83
+ },
84
+ exit: {
85
+ opacity: 0,
86
+ filter: "blur(4px)"
87
+ },
88
+ transition,
89
+ ...props
90
+ }),
91
+ keepMounted,
92
+ value
93
+ })
94
+ });
34
95
  }
35
96
  const defaultTransition = {
36
- type: 'spring',
37
- stiffness: 200,
38
- damping: 30,
97
+ type: "spring",
98
+ stiffness: 200,
99
+ damping: 30
39
100
  };
40
101
  function isAutoMode(props) {
41
- return !props.mode || props.mode === 'auto-height';
102
+ return !props.mode || props.mode === "auto-height";
42
103
  }
43
104
  function TabsPanels(props) {
44
- const { value } = useTabs();
45
- if (isAutoMode(props)) {
46
- const { children, transition = defaultTransition, ...autoProps } = props;
47
- return (_jsx(AutoHeight, { "data-slot": "tabs-panels", deps: [value], transition: transition, ...autoProps, children: _jsx(React.Fragment, { children: children }, value) }));
48
- }
49
- const { children, style, transition = defaultTransition, ...layoutProps } = props;
50
- return (_jsx(motion.div, { "data-slot": "tabs-panels", layout: "size", layoutDependency: value, transition: { layout: transition }, style: { overflow: 'hidden', ...style }, ...layoutProps, children: _jsx(React.Fragment, { children: children }, value) }));
51
- }
52
- export { Tabs, TabsHighlight, TabsHighlightItem, TabsList, TabsTab, TabsPanel, TabsPanels, };
53
- //# sourceMappingURL=tabs.js.map
105
+ const { value } = useTabs();
106
+ if (isAutoMode(props)) {
107
+ const { children, transition = defaultTransition, ...autoProps } = props;
108
+ return /* @__PURE__ */ jsx(AutoHeight, {
109
+ "data-slot": "tabs-panels",
110
+ deps: [value],
111
+ transition,
112
+ ...autoProps,
113
+ children: /* @__PURE__ */ jsx(React.Fragment, { children }, value)
114
+ });
115
+ }
116
+ const { children, style, transition = defaultTransition, ...layoutProps } = props;
117
+ return /* @__PURE__ */ jsx(motion.div, {
118
+ "data-slot": "tabs-panels",
119
+ layout: "size",
120
+ layoutDependency: value,
121
+ transition: { layout: transition },
122
+ style: {
123
+ overflow: "hidden",
124
+ ...style
125
+ },
126
+ ...layoutProps,
127
+ children: /* @__PURE__ */ jsx(React.Fragment, { children }, value)
128
+ });
129
+ }
130
+
131
+ //#endregion
132
+ export { Tabs$1 as Tabs, TabsHighlight, TabsHighlightItem, TabsList, TabsPanel, TabsPanels, TabsTab };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type HTMLMotionProps, type LegacyAnimationControls, type TargetAndTransition, type Transition } from 'motion/react';
3
- import { WithAsChild } from '@/components/animate-ui/primitives/animate/slot';
3
+ import { WithAsChild } from '../../../../components/animate-ui/primitives/animate/slot';
4
4
  type AutoHeightProps = WithAsChild<{
5
5
  children: React.ReactNode;
6
6
  deps?: React.DependencyList;
@@ -1,18 +1,37 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { motion, } from 'motion/react';
4
- import { useAutoHeight } from '@/hooks/use-auto-height';
5
- import { Slot } from '@/components/animate-ui/primitives/animate/slot';
2
+
3
+ import { useAutoHeight } from "../../../../hooks/use-auto-height.js";
4
+ import { Slot } from "../animate/slot.js";
5
+ import "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { motion } from "motion/react";
8
+
9
+ //#region src/components/animate-ui/primitives/effects/auto-height.tsx
6
10
  function AutoHeight({ children, deps = [], transition = {
7
- type: 'spring',
8
- stiffness: 300,
9
- damping: 30,
10
- bounce: 0,
11
- restDelta: 0.01,
11
+ type: "spring",
12
+ stiffness: 300,
13
+ damping: 30,
14
+ bounce: 0,
15
+ restDelta: .01
12
16
  }, style, animate, asChild = false, ...props }) {
13
- const { ref, height } = useAutoHeight(deps);
14
- const Comp = asChild ? Slot : motion.div;
15
- return (_jsx(Comp, { style: { overflow: 'hidden', ...style }, animate: { height, ...animate }, transition: transition, ...props, children: _jsx("div", { ref: ref, children: children }) }));
17
+ const { ref, height } = useAutoHeight(deps);
18
+ return /* @__PURE__ */ jsx(asChild ? Slot : motion.div, {
19
+ style: {
20
+ overflow: "hidden",
21
+ ...style
22
+ },
23
+ animate: {
24
+ height,
25
+ ...animate
26
+ },
27
+ transition,
28
+ ...props,
29
+ children: /* @__PURE__ */ jsx("div", {
30
+ ref,
31
+ children
32
+ })
33
+ });
16
34
  }
17
- export { AutoHeight };
18
- //# sourceMappingURL=auto-height.js.map
35
+
36
+ //#endregion
37
+ export { AutoHeight };