@fragment-build/ui 2.2.1 → 3.0.9
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/README.md +23 -34
- package/components/grid/Grid.js +1 -22
- package/components/grid/Grid.js.map +1 -1
- package/components/grid/Grid.styles.d.ts +43 -0
- package/components/grid/Grid.styles.js +17 -0
- package/components/grid/Grid.styles.js.map +1 -0
- package/components/multi-switch/MultiSwitch.d.ts +3 -6
- package/components/multi-switch/MultiSwitch.js +4 -29
- package/components/multi-switch/MultiSwitch.js.map +1 -1
- package/components/multi-switch/MultiSwitch.styles.d.ts +43 -0
- package/components/multi-switch/MultiSwitch.styles.js +14 -0
- package/components/multi-switch/MultiSwitch.styles.js.map +1 -0
- package/components/theme-switch/ThemeSwitch.d.ts +1 -1
- package/components/theme-switch/ThemeSwitch.js +2 -2
- package/components/theme-switch/ThemeSwitch.js.map +1 -1
- package/context.d.ts +6 -105
- package/context.js +5 -466
- package/context.js.map +1 -1
- package/fragments/form/Form.js +5 -11
- package/fragments/form/Form.js.map +1 -1
- package/fragments/form/Form.styles.d.ts +25 -0
- package/fragments/form/Form.styles.js +7 -0
- package/fragments/form/Form.styles.js.map +1 -0
- package/fragments/form/FormSection.js +3 -34
- package/fragments/form/FormSection.js.map +1 -1
- package/fragments/form/FormSection.styles.d.ts +61 -0
- package/fragments/form/FormSection.styles.js +24 -0
- package/fragments/form/FormSection.styles.js.map +1 -0
- package/fragments/navbar/Navbar.d.ts +30 -0
- package/fragments/navbar/Navbar.js +26 -0
- package/fragments/navbar/Navbar.js.map +1 -0
- package/fragments/navbar/Navbar.styles.d.ts +55 -0
- package/fragments/navbar/Navbar.styles.js +12 -0
- package/fragments/navbar/Navbar.styles.js.map +1 -0
- package/fragments/page/PageHeader.js +1 -8
- package/fragments/page/PageHeader.js.map +1 -1
- package/fragments/page/PageHeader.styles.d.ts +37 -0
- package/fragments/page/PageHeader.styles.js +9 -0
- package/fragments/page/PageHeader.styles.js.map +1 -0
- package/fragments/shell/Shell.d.ts +10 -1
- package/fragments/shell/Shell.js +8 -2
- package/fragments/shell/Shell.js.map +1 -1
- package/fragments/shell/Shell.styles.d.ts +37 -0
- package/fragments/shell/Shell.styles.js +18 -0
- package/fragments/shell/Shell.styles.js.map +1 -0
- package/fragments/sidebar/Sidebar.d.ts +5 -15
- package/fragments/sidebar/Sidebar.js +39 -49
- package/fragments/sidebar/Sidebar.js.map +1 -1
- package/fragments/sidebar/Sidebar.styles.d.ts +9 -48
- package/fragments/sidebar/Sidebar.styles.js +16 -35
- package/fragments/sidebar/Sidebar.styles.js.map +1 -1
- package/fragments/sidebar/SidebarNavigation.d.ts +19 -0
- package/fragments/sidebar/SidebarNavigation.js +51 -0
- package/fragments/sidebar/SidebarNavigation.js.map +1 -0
- package/fragments/widget/Widget.d.ts +2 -2
- package/fragments/widget/Widget.js +5 -304
- package/fragments/widget/Widget.js.map +1 -1
- package/fragments/widget/Widget.styles.d.ts +52 -0
- package/fragments/widget/Widget.styles.js +20 -0
- package/fragments/widget/Widget.styles.js.map +1 -0
- package/index.d.ts +1 -54
- package/index.js +2 -55
- package/index.js.map +1 -1
- package/package.json +47 -41
- package/provider.d.ts +4 -4
- package/provider.js +3 -13
- package/provider.js.map +1 -1
- package/components/base/Accordion.d.ts +0 -2
- package/components/base/Accordion.js +0 -5
- package/components/base/Accordion.js.map +0 -1
- package/components/base/Alert.d.ts +0 -1
- package/components/base/Alert.js +0 -4
- package/components/base/Alert.js.map +0 -1
- package/components/base/Autocomplete.d.ts +0 -3
- package/components/base/Autocomplete.js +0 -6
- package/components/base/Autocomplete.js.map +0 -1
- package/components/base/Avatar.d.ts +0 -2
- package/components/base/Avatar.js +0 -5
- package/components/base/Avatar.js.map +0 -1
- package/components/base/Badge.d.ts +0 -1
- package/components/base/Badge.js +0 -4
- package/components/base/Badge.js.map +0 -1
- package/components/base/Breadcrumbs.d.ts +0 -2
- package/components/base/Breadcrumbs.js +0 -5
- package/components/base/Breadcrumbs.js.map +0 -1
- package/components/base/Button.d.ts +0 -2
- package/components/base/Button.js +0 -5
- package/components/base/Button.js.map +0 -1
- package/components/base/Calendar.d.ts +0 -1
- package/components/base/Calendar.js +0 -4
- package/components/base/Calendar.js.map +0 -1
- package/components/base/Card.d.ts +0 -2
- package/components/base/Card.js +0 -5
- package/components/base/Card.js.map +0 -1
- package/components/base/Checkbox.d.ts +0 -2
- package/components/base/Checkbox.js +0 -5
- package/components/base/Checkbox.js.map +0 -1
- package/components/base/Chip.d.ts +0 -1
- package/components/base/Chip.js +0 -4
- package/components/base/Chip.js.map +0 -1
- package/components/base/CircularProgress.d.ts +0 -1
- package/components/base/CircularProgress.js +0 -4
- package/components/base/CircularProgress.js.map +0 -1
- package/components/base/Code.d.ts +0 -1
- package/components/base/Code.js +0 -4
- package/components/base/Code.js.map +0 -1
- package/components/base/DateInput.d.ts +0 -1
- package/components/base/DateInput.js +0 -4
- package/components/base/DateInput.js.map +0 -1
- package/components/base/DatePicker.d.ts +0 -1
- package/components/base/DatePicker.js +0 -4
- package/components/base/DatePicker.js.map +0 -1
- package/components/base/DateRangePicker.d.ts +0 -1
- package/components/base/DateRangePicker.js +0 -4
- package/components/base/DateRangePicker.js.map +0 -1
- package/components/base/Divider.d.ts +0 -1
- package/components/base/Divider.js +0 -4
- package/components/base/Divider.js.map +0 -1
- package/components/base/Drawer.d.ts +0 -8
- package/components/base/Drawer.js +0 -8
- package/components/base/Drawer.js.map +0 -1
- package/components/base/Dropdown.d.ts +0 -11
- package/components/base/Dropdown.js +0 -8
- package/components/base/Dropdown.js.map +0 -1
- package/components/base/Form.d.ts +0 -0
- package/components/base/Form.js +0 -6
- package/components/base/Form.js.map +0 -1
- package/components/base/Image.d.ts +0 -1
- package/components/base/Image.js +0 -4
- package/components/base/Image.js.map +0 -1
- package/components/base/Input.d.ts +0 -1
- package/components/base/Input.js +0 -4
- package/components/base/Input.js.map +0 -1
- package/components/base/InputOtp.d.ts +0 -1
- package/components/base/InputOtp.js +0 -4
- package/components/base/InputOtp.js.map +0 -1
- package/components/base/Kbd.d.ts +0 -1
- package/components/base/Kbd.js +0 -4
- package/components/base/Kbd.js.map +0 -1
- package/components/base/Link.d.ts +0 -1
- package/components/base/Link.js +0 -4
- package/components/base/Link.js.map +0 -1
- package/components/base/Listbox.d.ts +0 -3
- package/components/base/Listbox.js +0 -6
- package/components/base/Listbox.js.map +0 -1
- package/components/base/Modal.d.ts +0 -8
- package/components/base/Modal.js +0 -8
- package/components/base/Modal.js.map +0 -1
- package/components/base/Navbar.d.ts +0 -7
- package/components/base/Navbar.js +0 -10
- package/components/base/Navbar.js.map +0 -1
- package/components/base/NumberInput.d.ts +0 -1
- package/components/base/NumberInput.js +0 -4
- package/components/base/NumberInput.js.map +0 -1
- package/components/base/Pagination.d.ts +0 -3
- package/components/base/Pagination.js +0 -6
- package/components/base/Pagination.js.map +0 -1
- package/components/base/Popover.d.ts +0 -234
- package/components/base/Popover.js +0 -6
- package/components/base/Popover.js.map +0 -1
- package/components/base/Progress.d.ts +0 -1
- package/components/base/Progress.js +0 -4
- package/components/base/Progress.js.map +0 -1
- package/components/base/Radio.d.ts +0 -2
- package/components/base/Radio.js +0 -5
- package/components/base/Radio.js.map +0 -1
- package/components/base/RangeCalendar.d.ts +0 -1
- package/components/base/RangeCalendar.js +0 -4
- package/components/base/RangeCalendar.js.map +0 -1
- package/components/base/ScrollShadow.d.ts +0 -1
- package/components/base/ScrollShadow.js +0 -4
- package/components/base/ScrollShadow.js.map +0 -1
- package/components/base/Select.d.ts +0 -3
- package/components/base/Select.js +0 -6
- package/components/base/Select.js.map +0 -1
- package/components/base/Skeleton.d.ts +0 -1
- package/components/base/Skeleton.js +0 -4
- package/components/base/Skeleton.js.map +0 -1
- package/components/base/Slider.d.ts +0 -1
- package/components/base/Slider.js +0 -4
- package/components/base/Slider.js.map +0 -1
- package/components/base/Snippet.d.ts +0 -1
- package/components/base/Snippet.js +0 -4
- package/components/base/Snippet.js.map +0 -1
- package/components/base/Spacer.d.ts +0 -1
- package/components/base/Spacer.js +0 -4
- package/components/base/Spacer.js.map +0 -1
- package/components/base/Spinner.d.ts +0 -1
- package/components/base/Spinner.js +0 -4
- package/components/base/Spinner.js.map +0 -1
- package/components/base/Switch.d.ts +0 -1
- package/components/base/Switch.js +0 -4
- package/components/base/Switch.js.map +0 -1
- package/components/base/Table.d.ts +0 -6
- package/components/base/Table.js +0 -9
- package/components/base/Table.js.map +0 -1
- package/components/base/Tabs.d.ts +0 -2
- package/components/base/Tabs.js +0 -5
- package/components/base/Tabs.js.map +0 -1
- package/components/base/Textarea.d.ts +0 -1
- package/components/base/Textarea.js +0 -4
- package/components/base/Textarea.js.map +0 -1
- package/components/base/TimeInput.d.ts +0 -1
- package/components/base/TimeInput.js +0 -4
- package/components/base/TimeInput.js.map +0 -1
- package/components/base/Toast.d.ts +0 -2
- package/components/base/Toast.js +0 -5
- package/components/base/Toast.js.map +0 -1
- package/components/base/Tooltip.d.ts +0 -1
- package/components/base/Tooltip.js +0 -4
- package/components/base/Tooltip.js.map +0 -1
- package/components/base/User.d.ts +0 -1
- package/components/base/User.js +0 -4
- package/components/base/User.js.map +0 -1
- package/components/chart/Chart.d.ts +0 -13
- package/components/chart/Chart.js +0 -18
- package/components/chart/Chart.js.map +0 -1
- package/components/color-input/ColorInput.d.ts +0 -8
- package/components/color-input/ColorInput.js +0 -24
- package/components/color-input/ColorInput.js.map +0 -1
- package/components/color-selector/ColorSelector.d.ts +0 -14
- package/components/color-selector/ColorSelector.js +0 -16
- package/components/color-selector/ColorSelector.js.map +0 -1
- package/tailwind.plugin.d.ts +0 -3
- package/tailwind.plugin.js +0 -52
- package/tailwind.plugin.js.map +0 -1
- package/withFragment.d.ts +0 -2
- package/withFragment.js +0 -21
- package/withFragment.js.map +0 -1
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Fragment UI is a design system and React component library which provides alread
|
|
|
26
26
|
- [✨ Components](#-components)
|
|
27
27
|
- [⏳ Installation](#-installation)
|
|
28
28
|
- [🔧 Configuration](#-configuration)
|
|
29
|
+
- [`linkComponent`](#linkcomponent)
|
|
29
30
|
- [Next.js 13+](#nextjs-13)
|
|
30
31
|
- [🤝 Contributing](#-contributing)
|
|
31
32
|
- [👨💻 Development](#-development)
|
|
@@ -57,9 +58,9 @@ Fragment UI is a design system and React component library which provides alread
|
|
|
57
58
|
1. Setup Tailwind CSS
|
|
58
59
|
[Installation Guide](https://tailwindcss.com/docs/installation)
|
|
59
60
|
|
|
60
|
-
2. Install Fragment UI
|
|
61
|
+
2. Install Fragment UI and its peer dependencies
|
|
61
62
|
```bash
|
|
62
|
-
npm install -S @fragment-build/ui
|
|
63
|
+
npm install -S @fragment-build/ui @heroui/react @heroui/styles
|
|
63
64
|
```
|
|
64
65
|
|
|
65
66
|
As a next step you must configure the library the way you want to. See [**Configuration**](#🔧-configuration) section.
|
|
@@ -68,44 +69,23 @@ All done. Enjoy 🎉
|
|
|
68
69
|
|
|
69
70
|
## 🔧 Configuration
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
// fragment.ts
|
|
73
|
-
import { fragmentui } from '@fragment-build/tailwind.plugin';
|
|
74
|
-
|
|
75
|
-
export default fragmentui();
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
// hero.ts
|
|
80
|
-
import { heroui } from '@fragment-build/tailwind.plugin';
|
|
81
|
-
|
|
82
|
-
export default heroui();
|
|
83
|
-
```
|
|
72
|
+
Import the HeroUI styles and Fragment UI styles in your global CSS file:
|
|
84
73
|
|
|
85
74
|
```ts
|
|
86
75
|
// src/main.css
|
|
87
76
|
|
|
88
77
|
@import 'tailwindcss';
|
|
89
|
-
|
|
90
|
-
@
|
|
91
|
-
@plugin '../fragment.ts';
|
|
92
|
-
|
|
93
|
-
/* Note: You may need to change the path to fit your project structure */
|
|
94
|
-
@source '../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}';
|
|
95
|
-
@source '../node_modules/@fragment-build/ui/dist/**/*.{js,ts,jsx,tsx}';
|
|
96
|
-
@custom-variant dark (&:is(.dark *));
|
|
78
|
+
@import "@heroui/styles";
|
|
79
|
+
@import "@fragment-build/ui";
|
|
97
80
|
```
|
|
98
81
|
|
|
99
|
-
|
|
82
|
+
Add `FragmentUIProvider` at the root of your application:
|
|
100
83
|
|
|
101
84
|
```tsx
|
|
102
85
|
import React from 'react';
|
|
103
|
-
|
|
104
|
-
// 1. import `FragmentUIProvider` component
|
|
105
86
|
import { FragmentUIProvider } from '@fragment-build/ui';
|
|
106
87
|
|
|
107
88
|
function App() {
|
|
108
|
-
// 2. Wrap FragmentUIProvider at the root of your app
|
|
109
89
|
return (
|
|
110
90
|
<FragmentUIProvider>
|
|
111
91
|
<YourApplication />
|
|
@@ -114,19 +94,28 @@ function App() {
|
|
|
114
94
|
}
|
|
115
95
|
```
|
|
116
96
|
|
|
117
|
-
|
|
97
|
+
#### `linkComponent`
|
|
118
98
|
|
|
119
|
-
|
|
99
|
+
Fragment UI renders navigation links internally (e.g. in `Navbar`, `Sidebar`). By default it uses a plain `<a>` tag. Pass a `linkComponent` to use your router's link component instead so navigation stays client-side:
|
|
120
100
|
|
|
121
|
-
```
|
|
122
|
-
|
|
101
|
+
```tsx
|
|
102
|
+
import Link from 'next/link';
|
|
103
|
+
import { FragmentUIProvider } from '@fragment-build/ui';
|
|
123
104
|
|
|
124
|
-
|
|
105
|
+
function App() {
|
|
106
|
+
return (
|
|
107
|
+
<FragmentUIProvider linkComponent={Link}>
|
|
108
|
+
<YourApplication />
|
|
109
|
+
</FragmentUIProvider>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
125
112
|
```
|
|
126
113
|
|
|
127
|
-
|
|
114
|
+
Any component that accepts an `href` prop works — React Router's `<Link>`, TanStack Router's `<Link>`, etc.
|
|
115
|
+
|
|
116
|
+
### Next.js 13+
|
|
128
117
|
|
|
129
|
-
|
|
118
|
+
You need to [setup Tailwind 4 using PostCSS](https://tailwindcss.com/docs/installation/framework-guides/nextjs)
|
|
130
119
|
|
|
131
120
|
```ts
|
|
132
121
|
// postcss.config.mjs
|
package/components/grid/Grid.js
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
const grid = tv({
|
|
4
|
-
slots: {
|
|
5
|
-
base: 'grid gap-6 grid-flow-row-dense',
|
|
6
|
-
},
|
|
7
|
-
variants: {
|
|
8
|
-
size: {
|
|
9
|
-
sm: {
|
|
10
|
-
base: 'grid-cols-1'
|
|
11
|
-
},
|
|
12
|
-
md: {
|
|
13
|
-
base: 'grid-cols-1 lg:grid-cols-2'
|
|
14
|
-
},
|
|
15
|
-
lg: {
|
|
16
|
-
base: 'grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3'
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
defaultVariants: {
|
|
21
|
-
size: 'md',
|
|
22
|
-
},
|
|
23
|
-
});
|
|
2
|
+
import { grid } from './Grid.styles';
|
|
24
3
|
export const Grid = ({ children, ...props }) => {
|
|
25
4
|
const { base } = grid(props);
|
|
26
5
|
return _jsx("div", { className: base(), children: children });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/components/grid/Grid.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/components/grid/Grid.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAWrC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAClE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAE7B,OAAO,cAAK,SAAS,EAAE,IAAI,EAAE,YAAG,QAAQ,GAAO,CAAC;AAClD,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const grid: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
size: {
|
|
3
|
+
sm: {
|
|
4
|
+
base: string;
|
|
5
|
+
};
|
|
6
|
+
md: {
|
|
7
|
+
base: string;
|
|
8
|
+
};
|
|
9
|
+
lg: {
|
|
10
|
+
base: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
base: string;
|
|
15
|
+
}, undefined, {
|
|
16
|
+
size: {
|
|
17
|
+
sm: {
|
|
18
|
+
base: string;
|
|
19
|
+
};
|
|
20
|
+
md: {
|
|
21
|
+
base: string;
|
|
22
|
+
};
|
|
23
|
+
lg: {
|
|
24
|
+
base: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
base: string;
|
|
29
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
30
|
+
size: {
|
|
31
|
+
sm: {
|
|
32
|
+
base: string;
|
|
33
|
+
};
|
|
34
|
+
md: {
|
|
35
|
+
base: string;
|
|
36
|
+
};
|
|
37
|
+
lg: {
|
|
38
|
+
base: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
base: string;
|
|
43
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const grid = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
base: 'fragment-grid',
|
|
5
|
+
},
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: { base: 'fragment-grid--sm' },
|
|
9
|
+
md: { base: 'fragment-grid--md' },
|
|
10
|
+
lg: { base: 'fragment-grid--lg' },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: 'md',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=Grid.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.styles.js","sourceRoot":"","sources":["../../src/components/grid/Grid.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;IACrB,KAAK,EAAE;QACL,IAAI,EAAE,eAAe;KACtB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;YACjC,EAAE,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;YACjC,EAAE,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;SAClC;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,IAAI;KACX;CACF,CAAC,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
* Primary UI component for selecting a color
|
|
4
|
-
*/
|
|
5
|
-
export interface MultiSwitchProps extends Omit<ButtonGroupProps, 'className'> {
|
|
1
|
+
import { type ToggleButtonGroup as ToggleButtonGroupType } from '@heroui/react';
|
|
2
|
+
export interface MultiSwitchProps extends Omit<ToggleButtonGroupType['RootProps'], 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionMode' | 'disallowEmptySelection'> {
|
|
6
3
|
defaultValue?: number;
|
|
7
4
|
onValueChange: (value: number) => void;
|
|
8
5
|
}
|
|
9
|
-
export declare const MultiSwitch: import("react").ForwardRefExoticComponent<Omit<MultiSwitchProps, "ref"> & import("react").RefAttributes<
|
|
6
|
+
export declare const MultiSwitch: import("react").ForwardRefExoticComponent<Omit<MultiSwitchProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,31 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { Button, ButtonGroup } from '../base/Button';
|
|
4
|
-
import { withFragment } from '../../withFragment';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
5
3
|
import { IconCheck, IconSlash, IconX } from '@tabler/icons-react';
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
8
|
-
slots: {
|
|
9
|
-
button: 'min-w-0',
|
|
10
|
-
},
|
|
11
|
-
variants: {
|
|
12
|
-
size: {
|
|
13
|
-
sm: {
|
|
14
|
-
button: 'px-3'
|
|
15
|
-
},
|
|
16
|
-
md: {
|
|
17
|
-
button: 'px-4'
|
|
18
|
-
},
|
|
19
|
-
lg: {
|
|
20
|
-
button: 'px-5'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
export const MultiSwitch = withFragment(forwardRef(({ defaultValue, onValueChange, size = 'md', ...props }, ref) => {
|
|
26
|
-
const [value, setValue] = useState(defaultValue ?? 0);
|
|
27
|
-
const { button } = multiSwitch({ size });
|
|
28
|
-
useEffect(() => onValueChange && onValueChange(value), [value, onValueChange]);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [_jsx("input", { ref: ref, value: value, type: "number", className: "hidden", min: 0, max: 2, required: true }), _jsxs(ButtonGroup, { size: size, ...props, children: [_jsx(Button, { className: button(), onPress: () => setValue(0), ...value === 0 ? { color: 'danger' } : {}, children: _jsx(IconX, { size: 20 }) }), _jsx(Button, { className: button(), onPress: () => setValue(1), ...value === 1 ? { color: 'default', variant: 'solid' } : {}, children: _jsx(IconSlash, { size: 20 }) }), _jsx(Button, { className: button(), onPress: () => setValue(2), ...value === 2 ? { color: 'success' } : {}, children: _jsx(IconCheck, { size: 20 }) })] })] }));
|
|
30
|
-
}), 'multiSwitch');
|
|
4
|
+
import { ToggleButton, ToggleButtonGroup } from '@heroui/react';
|
|
5
|
+
export const MultiSwitch = forwardRef(({ defaultValue = 1, onValueChange, size = 'md', ...props }, ref) => (_jsxs(ToggleButtonGroup, { ref: ref, className: "fragment-multi-switch", selectionMode: "single", disallowEmptySelection: true, defaultSelectedKeys: [String(defaultValue)], onSelectionChange: (keys) => onValueChange(Number([...keys][0])), size: size, ...props, children: [_jsx(ToggleButton, { id: "0", isIconOnly: true, className: "fragment-multi-switch__btn--danger", children: _jsx(IconX, {}) }), _jsx(ToggleButton, { id: "1", isIconOnly: true, className: "fragment-multi-switch__btn--neutral", children: _jsx(IconSlash, {}) }), _jsx(ToggleButton, { id: "2", isIconOnly: true, children: _jsx(IconCheck, {}) })] })));
|
|
31
6
|
//# sourceMappingURL=MultiSwitch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSwitch.js","sourceRoot":"","sources":["../../src/components/multi-switch/MultiSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"MultiSwitch.js","sourceRoot":"","sources":["../../src/components/multi-switch/MultiSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAmD,MAAM,eAAe,CAAC;AAOjH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAmC,CAAC,EACvE,YAAY,GAAG,CAAC,EAChB,aAAa,EACb,IAAI,GAAG,IAAI,EACX,GAAG,KAAK,EACT,EAAE,GAAG,EAAE,EAAE,CAAC,CACT,MAAC,iBAAiB,IAChB,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,uBAAuB,EACjC,aAAa,EAAC,QAAQ,EACtB,sBAAsB,QACtB,mBAAmB,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAC3C,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAChE,IAAI,EAAE,IAAI,KACN,KAAK,aAET,KAAC,YAAY,IAAC,EAAE,EAAC,GAAG,EAAC,UAAU,QAAC,SAAS,EAAC,oCAAoC,YAAC,KAAC,KAAK,KAAG,GAAe,EACvG,KAAC,YAAY,IAAC,EAAE,EAAC,GAAG,EAAC,UAAU,QAAC,SAAS,EAAC,qCAAqC,YAC7E,KAAC,SAAS,KAAG,GACA,EACf,KAAC,YAAY,IAAC,EAAE,EAAC,GAAG,EAAC,UAAU,kBAC7B,KAAC,SAAS,KAAG,GACA,IACG,CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const multiSwitch: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
size: {
|
|
3
|
+
sm: {
|
|
4
|
+
button: string;
|
|
5
|
+
};
|
|
6
|
+
md: {
|
|
7
|
+
button: string;
|
|
8
|
+
};
|
|
9
|
+
lg: {
|
|
10
|
+
button: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
button: string;
|
|
15
|
+
}, undefined, {
|
|
16
|
+
size: {
|
|
17
|
+
sm: {
|
|
18
|
+
button: string;
|
|
19
|
+
};
|
|
20
|
+
md: {
|
|
21
|
+
button: string;
|
|
22
|
+
};
|
|
23
|
+
lg: {
|
|
24
|
+
button: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
button: string;
|
|
29
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
30
|
+
size: {
|
|
31
|
+
sm: {
|
|
32
|
+
button: string;
|
|
33
|
+
};
|
|
34
|
+
md: {
|
|
35
|
+
button: string;
|
|
36
|
+
};
|
|
37
|
+
lg: {
|
|
38
|
+
button: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
button: string;
|
|
43
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const multiSwitch = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
button: 'fragment-multi-switch__button',
|
|
5
|
+
},
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: { button: 'fragment-multi-switch__button--sm' },
|
|
9
|
+
md: { button: 'fragment-multi-switch__button--md' },
|
|
10
|
+
lg: { button: 'fragment-multi-switch__button--lg' },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=MultiSwitch.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSwitch.styles.js","sourceRoot":"","sources":["../../src/components/multi-switch/MultiSwitch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;IAC5B,KAAK,EAAE;QACL,MAAM,EAAE,+BAA+B;KACxC;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;YACnD,EAAE,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;YACnD,EAAE,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE;SACpD;KACF;CACF,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTheme } from 'next-themes';
|
|
3
3
|
import { IconMoon, IconSun } from '@tabler/icons-react';
|
|
4
|
-
import { Button } from '
|
|
4
|
+
import { Button } from '@heroui/react';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
export const ThemeSwitch = (props) => {
|
|
7
7
|
const [mounted, setMounted] = useState(false);
|
|
@@ -11,6 +11,6 @@ export const ThemeSwitch = (props) => {
|
|
|
11
11
|
}, []);
|
|
12
12
|
if (!mounted)
|
|
13
13
|
return null;
|
|
14
|
-
return (_jsx(Button, { isIconOnly: true, size: "sm", onPress: () => setTheme(theme === 'light' ? 'dark' : 'light'), ...props, children: theme === 'light' ? _jsx(IconSun, { size: 18 }) : _jsx(IconMoon, { size: 18 }) }));
|
|
14
|
+
return (_jsx(Button, { isIconOnly: true, size: "sm", variant: "tertiary", onPress: () => setTheme(theme === 'light' ? 'dark' : 'light'), ...props, children: theme === 'light' ? _jsx(IconSun, { size: 18 }) : _jsx(IconMoon, { size: 18 }) }));
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=ThemeSwitch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeSwitch.js","sourceRoot":"","sources":["../../src/components/theme-switch/ThemeSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxD,
|
|
1
|
+
{"version":3,"file":"ThemeSwitch.js","sourceRoot":"","sources":["../../src/components/theme-switch/ThemeSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAQ,EAAE,MAAM,EAAoB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ5C,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAC;IAEvC,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAG,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAEzB,OAAO,CACL,KAAC,MAAM,IAAC,UAAU,QAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAM,KAAK,YACrH,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,GAAI,GAC5D,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/context.d.ts
CHANGED
|
@@ -1,106 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { ColorInputProps } from './components/color-input/ColorInput';
|
|
5
|
-
import type { ColorSelectorProps } from './components/color-selector/ColorSelector';
|
|
6
|
-
import type { FormProps } from './fragments/form/Form';
|
|
7
|
-
import type { FormSectionProps } from './fragments/form/FormSection';
|
|
8
|
-
import type { MultiSwitchProps } from './components/multi-switch/MultiSwitch';
|
|
9
|
-
export interface FragmentUIContext {
|
|
10
|
-
defaults: {
|
|
11
|
-
accordion?: Partial<AccordionProps>;
|
|
12
|
-
accordionItem?: Partial<AccordionItemProps>;
|
|
13
|
-
alert?: Partial<AlertProps>;
|
|
14
|
-
autocomplete?: Partial<AutocompleteProps>;
|
|
15
|
-
autocompleteItem?: Partial<AutocompleteItemProps>;
|
|
16
|
-
autocompleteSection?: Partial<AutocompleteSectionProps>;
|
|
17
|
-
avatar?: Partial<AvatarProps>;
|
|
18
|
-
avatarGroup?: Partial<AvatarGroupProps>;
|
|
19
|
-
badge?: Partial<BadgeProps>;
|
|
20
|
-
breadcrumbs?: Partial<BreadcrumbsProps>;
|
|
21
|
-
button?: Partial<ButtonProps>;
|
|
22
|
-
buttonGroup?: Partial<ButtonGroupProps>;
|
|
23
|
-
calendar?: Partial<CalendarProps>;
|
|
24
|
-
card?: Partial<CardProps>;
|
|
25
|
-
chart?: Partial<Record<ChartProps['type'], Partial<Pick<ApexChartProps, 'options' | 'series'>>>>;
|
|
26
|
-
checkbox?: Partial<CheckboxProps>;
|
|
27
|
-
checkboxGroup?: Partial<CheckboxGroupProps>;
|
|
28
|
-
chip?: Partial<ChipProps>;
|
|
29
|
-
circularProgress?: Partial<CircularProgressProps>;
|
|
30
|
-
code?: Partial<CodeProps>;
|
|
31
|
-
colorInput?: Partial<ColorInputProps>;
|
|
32
|
-
colorSelector?: Partial<ColorSelectorProps>;
|
|
33
|
-
dateInput?: Partial<DateInputProps>;
|
|
34
|
-
datePicker?: Partial<DatePickerProps>;
|
|
35
|
-
dateRangePicker?: Partial<DateRangePickerProps>;
|
|
36
|
-
divider?: Partial<DividerProps>;
|
|
37
|
-
drawer?: Partial<DrawerProps>;
|
|
38
|
-
drawerBody?: Partial<DrawerBodyProps>;
|
|
39
|
-
drawerContent?: Partial<DrawerContentProps>;
|
|
40
|
-
drawerFooter?: Partial<DrawerFooterProps>;
|
|
41
|
-
drawerHeader?: Partial<DrawerHeaderProps>;
|
|
42
|
-
dropdown?: Partial<DropdownProps>;
|
|
43
|
-
dropdownItem?: Partial<DropdownItemProps>;
|
|
44
|
-
dropdownMenu?: Partial<DropdownMenuProps>;
|
|
45
|
-
dropdownSection?: Partial<DropdownSectionProps>;
|
|
46
|
-
dropdownTrigger?: Partial<DropdownTriggerProps>;
|
|
47
|
-
form?: Partial<FormProps>;
|
|
48
|
-
formSection?: Partial<FormSectionProps>;
|
|
49
|
-
image?: Partial<ImageProps>;
|
|
50
|
-
input?: Partial<InputProps>;
|
|
51
|
-
inputOtp?: Partial<InputOtpProps>;
|
|
52
|
-
kbd?: Partial<KbdProps>;
|
|
53
|
-
link?: Partial<LinkProps>;
|
|
54
|
-
listbox?: Partial<ListboxProps>;
|
|
55
|
-
listboxItem?: Partial<ListboxItemProps>;
|
|
56
|
-
listboxSection?: Partial<ListboxSectionProps>;
|
|
57
|
-
modal?: Partial<ModalProps>;
|
|
58
|
-
modalBody?: Partial<ModalBodyProps>;
|
|
59
|
-
modalContent?: Partial<ModalContentProps>;
|
|
60
|
-
modalFooter?: Partial<ModalFooterProps>;
|
|
61
|
-
modalHeader?: Partial<ModalHeaderProps>;
|
|
62
|
-
multiSwitch?: Partial<MultiSwitchProps>;
|
|
63
|
-
navbar?: Partial<NavbarProps>;
|
|
64
|
-
navbarBrand?: Partial<NavbarBrandProps>;
|
|
65
|
-
navbarContent?: Partial<NavbarContentProps>;
|
|
66
|
-
navbarItem?: Partial<NavbarItemProps>;
|
|
67
|
-
navbarMenuItem?: Partial<NavbarMenuItemProps>;
|
|
68
|
-
navbarMenuToggle?: Partial<NavbarMenuToggleProps>;
|
|
69
|
-
numberInput?: Partial<NumberInputProps>;
|
|
70
|
-
pagination?: Partial<PaginationProps>;
|
|
71
|
-
paginationItem?: Partial<PaginationItemProps>;
|
|
72
|
-
paginationCursor?: Partial<PaginationCursorProps>;
|
|
73
|
-
popover?: Partial<PopoverProps>;
|
|
74
|
-
popoverContent?: Partial<PopoverContentProps>;
|
|
75
|
-
popoverTrigger?: Partial<PopoverTriggerProps>;
|
|
76
|
-
progress?: Partial<ProgressProps>;
|
|
77
|
-
radio?: Partial<RadioProps>;
|
|
78
|
-
radioGroup?: Partial<RadioGroupProps>;
|
|
79
|
-
rangeCalendar?: Partial<RangeCalendarProps>;
|
|
80
|
-
scrollShadow?: Partial<ScrollShadowProps>;
|
|
81
|
-
select?: Partial<SelectProps>;
|
|
82
|
-
selectItem?: Partial<SelectItemProps>;
|
|
83
|
-
selectSection?: Partial<SelectSectionProps>;
|
|
84
|
-
skeleton?: Partial<SkeletonProps>;
|
|
85
|
-
slider?: Partial<SliderProps>;
|
|
86
|
-
snippet?: Partial<SnippetProps>;
|
|
87
|
-
spacer?: Partial<SpacerProps>;
|
|
88
|
-
spinner?: Partial<SpinnerProps>;
|
|
89
|
-
switch?: Partial<SwitchProps>;
|
|
90
|
-
table?: Partial<TableProps>;
|
|
91
|
-
tableBody?: Partial<TableBodyProps<unknown>>;
|
|
92
|
-
tableCell?: Partial<TableCellProps>;
|
|
93
|
-
tableColumn?: Partial<TableColumnProps<unknown>>;
|
|
94
|
-
tableHeader?: Partial<TableHeaderProps<unknown>>;
|
|
95
|
-
tableRow?: Partial<TableRowProps>;
|
|
96
|
-
tab?: Partial<TabItemProps>;
|
|
97
|
-
tabs?: Partial<TabsProps>;
|
|
98
|
-
textArea?: Partial<TextAreaProps>;
|
|
99
|
-
timeInput?: Partial<TimeInputProps>;
|
|
100
|
-
toast?: Partial<ToastProps>;
|
|
101
|
-
tooltip?: Partial<TooltipProps>;
|
|
102
|
-
user?: Partial<UserProps>;
|
|
103
|
-
};
|
|
1
|
+
export type LinkComponent = React.ElementType;
|
|
2
|
+
interface FragmentUIContextValue {
|
|
3
|
+
linkComponent: LinkComponent;
|
|
104
4
|
}
|
|
105
|
-
export declare const
|
|
106
|
-
export declare const
|
|
5
|
+
export declare const FragmentUIContext: import("react").Context<FragmentUIContextValue>;
|
|
6
|
+
export declare const useFragmentUI: () => FragmentUIContextValue;
|
|
7
|
+
export {};
|