luan-ui 0.5.2 → 0.6.0

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 (103) hide show
  1. package/README.md +7 -3
  2. package/dist/components/accordion/accordion.d.ts +14 -15
  3. package/dist/components/accordion/accordion.js +11 -9
  4. package/dist/components/accordion/accordion.js.map +1 -1
  5. package/dist/components/alert/alert.d.ts +19 -18
  6. package/dist/components/alert/alert.js +35 -15
  7. package/dist/components/alert/alert.js.map +1 -1
  8. package/dist/components/alert-dialog/alert-dialog.d.ts +14 -9
  9. package/dist/components/alert-dialog/alert-dialog.js +21 -15
  10. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  11. package/dist/components/avatar/avatar-group.d.ts +3 -2
  12. package/dist/components/avatar/avatar-group.js +4 -4
  13. package/dist/components/avatar/avatar-group.js.map +1 -1
  14. package/dist/components/avatar/avatar.d.ts +8 -4
  15. package/dist/components/avatar/avatar.js +10 -8
  16. package/dist/components/avatar/avatar.js.map +1 -1
  17. package/dist/components/badge/badge.d.ts +12 -5
  18. package/dist/components/badge/badge.js +18 -7
  19. package/dist/components/badge/badge.js.map +1 -1
  20. package/dist/components/button/button.d.ts +24 -18
  21. package/dist/components/button/button.js +30 -15
  22. package/dist/components/button/button.js.map +1 -1
  23. package/dist/components/card/card.d.ts +32 -19
  24. package/dist/components/card/card.js +52 -20
  25. package/dist/components/card/card.js.map +1 -1
  26. package/dist/components/checkbox/checkbox.d.ts +6 -7
  27. package/dist/components/checkbox/checkbox.js +6 -8
  28. package/dist/components/checkbox/checkbox.js.map +1 -1
  29. package/dist/components/dialog/dialog.d.ts +16 -9
  30. package/dist/components/dialog/dialog.js +23 -18
  31. package/dist/components/dialog/dialog.js.map +1 -1
  32. package/dist/components/drawer/drawer.d.ts +19 -9
  33. package/dist/components/drawer/drawer.js +31 -25
  34. package/dist/components/drawer/drawer.js.map +1 -1
  35. package/dist/components/dropdown-menu/dropdown-menu.d.ts +30 -21
  36. package/dist/components/dropdown-menu/dropdown-menu.js +35 -30
  37. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  38. package/dist/components/form-field/form-field.d.ts +4 -8
  39. package/dist/components/form-field/form-field.js +3 -4
  40. package/dist/components/form-field/form-field.js.map +1 -1
  41. package/dist/components/form-helper/form-helper.d.ts +4 -6
  42. package/dist/components/form-helper/form-helper.js +2 -3
  43. package/dist/components/form-helper/form-helper.js.map +1 -1
  44. package/dist/components/icon/icon.d.ts +9 -15
  45. package/dist/components/icon/icon.js +20 -19
  46. package/dist/components/icon/icon.js.map +1 -1
  47. package/dist/components/input/input.d.ts +4 -4
  48. package/dist/components/input/input.js +2 -4
  49. package/dist/components/input/input.js.map +1 -1
  50. package/dist/components/label/label.d.ts +3 -4
  51. package/dist/components/label/label.js +5 -6
  52. package/dist/components/label/label.js.map +1 -1
  53. package/dist/components/pagination/pagination.d.ts +25 -21
  54. package/dist/components/pagination/pagination.js +30 -19
  55. package/dist/components/pagination/pagination.js.map +1 -1
  56. package/dist/components/popover/popover.d.ts +30 -14
  57. package/dist/components/popover/popover.js +30 -22
  58. package/dist/components/popover/popover.js.map +1 -1
  59. package/dist/components/progress/progress.d.ts +4 -6
  60. package/dist/components/progress/progress.js +4 -6
  61. package/dist/components/progress/progress.js.map +1 -1
  62. package/dist/components/radio-group/radio-group.d.ts +8 -7
  63. package/dist/components/radio-group/radio-group.js +8 -35
  64. package/dist/components/radio-group/radio-group.js.map +1 -1
  65. package/dist/components/select/select.d.ts +26 -15
  66. package/dist/components/select/select.js +28 -50
  67. package/dist/components/select/select.js.map +1 -1
  68. package/dist/components/skeleton/skeleton.d.ts +3 -1
  69. package/dist/components/skeleton/skeleton.js +3 -6
  70. package/dist/components/skeleton/skeleton.js.map +1 -1
  71. package/dist/components/slider/slider.d.ts +7 -14
  72. package/dist/components/slider/slider.js +23 -13
  73. package/dist/components/slider/slider.js.map +1 -1
  74. package/dist/components/switch/switch.d.ts +7 -7
  75. package/dist/components/switch/switch.js +9 -11
  76. package/dist/components/switch/switch.js.map +1 -1
  77. package/dist/components/table/table.d.ts +17 -8
  78. package/dist/components/table/table.js +24 -41
  79. package/dist/components/table/table.js.map +1 -1
  80. package/dist/components/tabs/tabs.d.ts +9 -5
  81. package/dist/components/tabs/tabs.js +10 -8
  82. package/dist/components/tabs/tabs.js.map +1 -1
  83. package/dist/components/text-area/text-area.d.ts +3 -5
  84. package/dist/components/text-area/text-area.js +2 -4
  85. package/dist/components/text-area/text-area.js.map +1 -1
  86. package/dist/components/toast/toast.d.ts +4 -10
  87. package/dist/components/toast/toast.js +4 -7
  88. package/dist/components/toast/toast.js.map +1 -1
  89. package/dist/components/tooltip/tooltip.d.ts +18 -9
  90. package/dist/components/tooltip/tooltip.js +21 -20
  91. package/dist/components/tooltip/tooltip.js.map +1 -1
  92. package/dist/index.d.ts +2 -2
  93. package/dist/index.js +2 -2
  94. package/dist/index.js.map +1 -1
  95. package/dist/styles/index.css +2 -2
  96. package/dist/utilities/merge-refs/merge-refs.d.ts +2 -2
  97. package/dist/utilities/merge-refs/merge-refs.js +1 -1
  98. package/dist/utilities/merge-refs/merge-refs.js.map +1 -1
  99. package/dist/utilities/responsive/responsive.d.ts +14 -10
  100. package/package.json +71 -72
  101. package/dist/components/slot/slot.d.ts +0 -13
  102. package/dist/components/slot/slot.js +0 -70
  103. package/dist/components/slot/slot.js.map +0 -1
package/package.json CHANGED
@@ -1,74 +1,73 @@
1
1
  {
2
- "name": "luan-ui",
3
- "version": "0.5.2",
4
- "description": "A UI library for React",
5
- "author": "benebene84 <benedikt.sperl@gmail.com> (https://github.com/benebene84)",
6
- "main": "/dist/index.js",
7
- "type": "module",
8
- "types": "./dist/index.d.ts",
9
- "files": [
10
- "dist",
11
- "README.md",
12
- "LICENSE"
13
- ],
14
- "scripts": {
15
- "build": "node --experimental-strip-types scripts/build.ts",
16
- "dev": "storybook dev -p 6006",
17
- "build-storybook": "storybook build",
18
- "check": "biome check",
19
- "fix": "biome check --write",
20
- "fix:unsafe": "biome check --write --unsafe",
21
- "lint": "biome lint",
22
- "format": "biome format --write",
23
- "test": "vitest",
24
- "test:ci": "vitest --run"
25
- },
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/benebene84/luan-ui.git"
29
- },
30
- "license": "MIT",
31
- "bugs": {
32
- "url": "https://github.com/benebene84/luan-ui/issues"
33
- },
34
- "homepage": "https://github.com/benebene84/luan-ui#readme",
35
- "devDependencies": {
36
- "@biomejs/biome": "2.2.4",
37
- "@chromatic-com/storybook": "^4.1.1",
38
- "@storybook/addon-docs": "^9.1.6",
39
- "@storybook/addon-onboarding": "^9.1.6",
40
- "@storybook/react-vite": "^9.1.6",
41
- "@tailwindcss/postcss": "^4.1.13",
42
- "@tailwindcss/vite": "^4.1.13",
43
- "@testing-library/dom": "^10.4.1",
44
- "@testing-library/jest-dom": "^6.8.0",
45
- "@testing-library/react": "^16.3.0",
46
- "@testing-library/user-event": "^14.6.1",
47
- "@types/node": "^24.5.0",
48
- "@types/react": "^19.1.13",
49
- "@types/react-dom": "^19.1.9",
50
- "@vitejs/plugin-react": "^5.0.2",
51
- "jsdom": "^27.0.0",
52
- "lefthook": "^1.13.0",
53
- "responsive-class-variants": "^1.1.1",
54
- "storybook": "^9.1.6",
55
- "tailwindcss": "^4.1.13",
56
- "tsc-alias": "^1.8.16",
57
- "typescript": "^5.9.2",
58
- "vite": "^7.1.5",
59
- "vitest": "^3.2.4"
60
- },
61
- "peerDependencies": {
62
- "react": "^18.0.0 || ^19.0.0",
63
- "react-dom": "^18.0.0 || ^19.0.0"
64
- },
65
- "dependencies": {
66
- "@radix-ui/react-compose-refs": "^1.1.2",
67
- "@radix-ui/react-icons": "^1.3.2",
68
- "clsx": "^2.1.1",
69
- "radix-ui": "^1.4.3",
70
- "sonner": "^2.0.7",
71
- "tailwind-merge": "^3.3.1"
72
- },
73
- "packageManager": "pnpm@9.14.2"
2
+ "name": "luan-ui",
3
+ "version": "0.6.0",
4
+ "description": "A UI library for React",
5
+ "author": "benebene84 <benedikt.sperl@gmail.com> (https://github.com/benebene84)",
6
+ "main": "/dist/index.js",
7
+ "type": "module",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "build": "node --experimental-strip-types scripts/build.ts",
16
+ "dev": "storybook dev -p 6006",
17
+ "build-storybook": "storybook build",
18
+ "check": "biome check",
19
+ "fix": "biome check --write",
20
+ "fix:unsafe": "biome check --write --unsafe",
21
+ "lint": "biome lint",
22
+ "format": "biome format --write",
23
+ "test": "vitest",
24
+ "test:ci": "vitest --run"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/benebene84/luan-ui.git"
29
+ },
30
+ "license": "MIT",
31
+ "bugs": {
32
+ "url": "https://github.com/benebene84/luan-ui/issues"
33
+ },
34
+ "homepage": "https://github.com/benebene84/luan-ui#readme",
35
+ "devDependencies": {
36
+ "@biomejs/biome": "2.3.9",
37
+ "@chromatic-com/storybook": "^4.1.3",
38
+ "@storybook/addon-docs": "^10.1.9",
39
+ "@storybook/addon-onboarding": "^10.1.9",
40
+ "@storybook/react-vite": "^10.1.9",
41
+ "@tailwindcss/postcss": "^4.1.18",
42
+ "@tailwindcss/vite": "^4.1.18",
43
+ "@testing-library/dom": "^10.4.1",
44
+ "@testing-library/jest-dom": "^6.9.1",
45
+ "@testing-library/react": "^16.3.1",
46
+ "@testing-library/user-event": "^14.6.1",
47
+ "@types/node": "^25.0.2",
48
+ "@types/react": "^19.2.7",
49
+ "@types/react-dom": "^19.2.3",
50
+ "@vitejs/plugin-react": "^5.1.2",
51
+ "jsdom": "^27.3.0",
52
+ "lefthook": "^2.0.12",
53
+ "responsive-class-variants": "^1.2.3",
54
+ "storybook": "^10.1.9",
55
+ "tailwindcss": "^4.1.18",
56
+ "tsc-alias": "^1.8.16",
57
+ "typescript": "^5.9.3",
58
+ "vite": "^7.3.0",
59
+ "vitest": "^4.0.15"
60
+ },
61
+ "peerDependencies": {
62
+ "react": "^19.0.0",
63
+ "react-dom": "^19.0.0"
64
+ },
65
+ "dependencies": {
66
+ "@base-ui/react": "^1.0.0",
67
+ "@radix-ui/react-icons": "^1.3.2",
68
+ "clsx": "^2.1.1",
69
+ "sonner": "^2.0.7",
70
+ "tailwind-merge": "^3.4.0"
71
+ },
72
+ "packageManager": "pnpm@10.26.2"
74
73
  }
@@ -1,13 +0,0 @@
1
- import * as React from "react";
2
- interface SlotProps {
3
- children?: React.ReactNode;
4
- }
5
- declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<unknown>>;
6
- type SlottableProps = {
7
- child: React.ReactNode;
8
- children: (child: React.ReactNode) => React.JSX.Element;
9
- };
10
- declare const Slottable: ({ child, children }: SlottableProps) => React.JSX.Element;
11
- declare const Root: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<unknown>>;
12
- export { Root, Slot, Slottable };
13
- export type { SlotProps };
@@ -1,70 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { composeRefs } from "@radix-ui/react-compose-refs";
3
- import * as React from "react";
4
- const Slot = React.forwardRef((props, forwardedRef) => {
5
- const { children, ...slotProps } = props;
6
- if (isSlottable(children)) {
7
- const slottable = children;
8
- return (_jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(slottable.props.child)
9
- ? React.cloneElement(slottable.props.child, undefined, slottable.props.children(slottable.props.child.props.children))
10
- : null }));
11
- }
12
- return (_jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: children }));
13
- });
14
- Slot.displayName = "Slot";
15
- const SlotClone = React.forwardRef((props, forwardedRef) => {
16
- const { children, ...slotProps } = props;
17
- if (React.isValidElement(children)) {
18
- return React.cloneElement(children, {
19
- ...mergeProps(slotProps, children.props),
20
- ref: forwardedRef
21
- ? composeRefs(forwardedRef, children.ref)
22
- : children.ref,
23
- });
24
- }
25
- return React.Children.count(children) > 1
26
- ? React.Children.only(null)
27
- : null;
28
- });
29
- SlotClone.displayName = "SlotClone";
30
- const Slottable = ({ child, children }) => {
31
- return children(child);
32
- };
33
- function isSlottable(child) {
34
- return React.isValidElement(child) && child.type === Slottable;
35
- }
36
- function mergeProps(slotProps, childProps) {
37
- // all child props should override
38
- const overrideProps = { ...childProps };
39
- for (const propName in childProps) {
40
- const slotPropValue = slotProps[propName];
41
- const childPropValue = childProps[propName];
42
- const isHandler = /^on[A-Z]/.test(propName);
43
- if (isHandler) {
44
- // if the handler exists on both, we compose them
45
- if (slotPropValue && childPropValue) {
46
- overrideProps[propName] = (...args) => {
47
- childPropValue(...args);
48
- slotPropValue(...args);
49
- };
50
- }
51
- // but if it exists only on the slot, we use only this one
52
- else if (slotPropValue) {
53
- overrideProps[propName] = slotPropValue;
54
- }
55
- }
56
- // if it's `style`, we merge them
57
- else if (propName === "style") {
58
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
59
- }
60
- else if (propName === "className") {
61
- overrideProps[propName] = [slotPropValue, childPropValue]
62
- .filter(Boolean)
63
- .join(" ");
64
- }
65
- }
66
- return { ...slotProps, ...overrideProps };
67
- }
68
- const Root = Slot;
69
- export { Root, Slot, Slottable };
70
- //# sourceMappingURL=slot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slot.js","sourceRoot":"/","sources":["components/slot/slot.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACxE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAEzC,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,QAAQ,CAAC;QAE3B,OAAO,CACN,KAAC,SAAS,OAAK,SAAS,EAAE,G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Aa,EAAE,cAAc,CAAC;iBACvD,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,aAAa,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport type { ComponentRef } from \"react\";\nimport * as React from \"react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps {\n\tchildren?: React.ReactNode;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <We don't know anything about the ref>\ntype AnyRef = ComponentRef<any>;\n// biome-ignore lint/suspicious/noExplicitAny: <We don't know anything about the ref>\ntype AnyRefAttributes = React.RefAttributes<any>;\n\nconst Slot = React.forwardRef<AnyRef, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\tif (isSlottable(children)) {\n\t\tconst slottable = children;\n\n\t\treturn (\n\t\t\t<SlotClone {...slotProps} ref={forwardedRef}>\n\t\t\t\t{React.isValidElement<React.PropsWithChildren<unknown>>(\n\t\t\t\t\tslottable.props.child,\n\t\t\t\t)\n\t\t\t\t\t? React.cloneElement(\n\t\t\t\t\t\t\tslottable.props.child,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tslottable.props.children(slottable.props.child.props.children),\n\t\t\t\t\t\t)\n\t\t\t\t\t: null}\n\t\t\t</SlotClone>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotClone {...slotProps} ref={forwardedRef}>\n\t\t\t{children}\n\t\t</SlotClone>\n\t);\n});\n\nSlot.displayName = \"Slot\";\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n\tchildren: React.ReactNode;\n}\n\nconst SlotClone = React.forwardRef<AnyRef, SlotCloneProps>(\n\t(props, forwardedRef) => {\n\t\tconst { children, ...slotProps } = props;\n\n\t\tif (React.isValidElement<AnyRefAttributes>(children)) {\n\t\t\treturn React.cloneElement(children, {\n\t\t\t\t...mergeProps(slotProps, children.props),\n\t\t\t\tref: forwardedRef\n\t\t\t\t\t? composeRefs(forwardedRef, (children as AnyRefAttributes).ref)\n\t\t\t\t\t: (children as AnyRefAttributes).ref,\n\t\t\t});\n\t\t}\n\n\t\treturn React.Children.count(children) > 1\n\t\t\t? React.Children.only(null)\n\t\t\t: null;\n\t},\n);\n\nSlotClone.displayName = \"SlotClone\";\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\ntype SlottableProps = {\n\tchild: React.ReactNode;\n\tchildren: (child: React.ReactNode) => React.JSX.Element;\n};\n\nconst Slottable = ({ child, children }: SlottableProps) => {\n\treturn children(child);\n};\n\n/* ---------------------------------------------------------------------------------------------- */\n\n// biome-ignore lint/suspicious/noExplicitAny: <We don't know anything about the props>\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n\tchild: React.ReactNode,\n): child is React.ReactElement<SlottableProps> {\n\treturn React.isValidElement(child) && child.type === Slottable;\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n\t// all child props should override\n\tconst overrideProps = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\tconst isHandler = /^on[A-Z]/.test(propName);\n\t\tif (isHandler) {\n\t\t\t// if the handler exists on both, we compose them\n\t\t\tif (slotPropValue && childPropValue) {\n\t\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\t\tchildPropValue(...args);\n\t\t\t\t\tslotPropValue(...args);\n\t\t\t\t};\n\t\t\t}\n\t\t\t// but if it exists only on the slot, we use only this one\n\t\t\telse if (slotPropValue) {\n\t\t\t\toverrideProps[propName] = slotPropValue;\n\t\t\t}\n\t\t}\n\t\t// if it's `style`, we merge them\n\t\telse if (propName === \"style\") {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t} else if (propName === \"className\") {\n\t\t\toverrideProps[propName] = [slotPropValue, childPropValue]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\" \");\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\nconst Root = Slot;\n\nexport { Root, Slot, Slottable };\nexport type { SlotProps };\n"]}