@fragment-build/ui 1.2.3 → 1.4.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.
- package/dist/components/base/Breadcrumbs.js +1 -1
- package/dist/components/base/Breadcrumbs.js.map +1 -1
- package/dist/components/base/Button.d.ts +1 -0
- package/dist/components/base/Button.js +2 -1
- package/dist/components/base/Button.js.map +1 -1
- package/dist/components/base/Navbar.js +1 -1
- package/dist/components/base/Navbar.js.map +1 -1
- package/dist/components/chart/Chart.d.ts +1 -1
- package/dist/components/chart/Chart.js +9 -3
- package/dist/components/chart/Chart.js.map +1 -1
- package/dist/components/chart/Chart.stories.d.ts +6 -0
- package/dist/components/chart/Chart.stories.js +167 -1
- package/dist/components/chart/Chart.stories.js.map +1 -1
- package/dist/components/color-input/ColorInput.d.ts +1 -2
- package/dist/components/color-input/ColorInput.js +9 -4
- package/dist/components/color-input/ColorInput.js.map +1 -1
- package/dist/components/grid/Grid.d.ts +9 -0
- package/dist/components/grid/Grid.js +28 -0
- package/dist/components/grid/Grid.js.map +1 -0
- package/dist/components/grid/Grid.stories.d.ts +8 -0
- package/dist/components/grid/Grid.stories.js +29 -0
- package/dist/components/grid/Grid.stories.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/multi-switch/MultiSwitch.d.ts +10 -0
- package/dist/components/multi-switch/MultiSwitch.js +31 -0
- package/dist/components/multi-switch/MultiSwitch.js.map +1 -0
- package/dist/components/multi-switch/MultiSwitch.stories.d.ts +8 -0
- package/dist/components/multi-switch/MultiSwitch.stories.js +28 -0
- package/dist/components/multi-switch/MultiSwitch.stories.js.map +1 -0
- package/dist/context.d.ts +6 -6
- package/dist/context.js +376 -2
- package/dist/context.js.map +1 -1
- package/dist/fragments/form/FormSection.js +4 -7
- package/dist/fragments/form/FormSection.js.map +1 -1
- package/dist/fragments/shell/Shell.js +1 -1
- package/dist/fragments/shell/Shell.js.map +1 -1
- package/dist/fragments/shell/Shell.stories.js +142 -3
- package/dist/fragments/shell/Shell.stories.js.map +1 -1
- package/dist/fragments/widget/Widget.d.ts +1 -0
- package/dist/fragments/widget/Widget.js +21 -3
- package/dist/fragments/widget/Widget.js.map +1 -1
- package/dist/tailwind.plugin.js +34 -7
- package/dist/tailwind.plugin.js.map +1 -1
- package/dist/withFragment.js +3 -4
- package/dist/withFragment.js.map +1 -1
- package/package.json +16 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Breadcrumbs as NextBreadcrumbs, BreadcrumbItem as NextBreadcrumbItem, } from '@nextui-org/react';
|
|
2
2
|
import { withFragment } from '../../withFragment';
|
|
3
3
|
export const Breadcrumbs = withFragment(NextBreadcrumbs, 'breadcrumbs');
|
|
4
|
-
export const BreadcrumbItem =
|
|
4
|
+
export const BreadcrumbItem = NextBreadcrumbItem;
|
|
5
5
|
//# sourceMappingURL=Breadcrumbs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/components/base/Breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/components/base/Breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,GACrC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const Button: import("@nextui-org/react").InternalForwardRefRenderFunction<"button", import("@nextui-org/react").ButtonProps, never>;
|
|
2
|
+
export declare const ButtonGroup: import("@nextui-org/react").InternalForwardRefRenderFunction<"div", import("@nextui-org/react").ButtonGroupProps, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Button as NextButton } from '@nextui-org/react';
|
|
1
|
+
import { Button as NextButton, ButtonGroup as NextButtonGroup } from '@nextui-org/react';
|
|
2
2
|
import { withFragment } from '../../withFragment';
|
|
3
3
|
export const Button = withFragment(NextButton, 'button');
|
|
4
|
+
export const ButtonGroup = withFragment(NextButtonGroup, 'buttonGroup');
|
|
4
5
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/base/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/base/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ export const Navbar = withFragment(NextNavbar, 'navbar');
|
|
|
4
4
|
export const NavbarBrand = withFragment(NextNavbarBrand, 'navbarBrand');
|
|
5
5
|
export const NavbarContent = withFragment(NextNavbarContent, 'navbarContent');
|
|
6
6
|
export const NavbarItem = withFragment(NextNavbarItem, 'navbarItem');
|
|
7
|
-
export const NavbarMenu =
|
|
7
|
+
export const NavbarMenu = NextNavbarMenu;
|
|
8
8
|
export const NavbarMenuItem = withFragment(NextNavbarMenuItem, 'navbarMenuItem');
|
|
9
9
|
export const NavbarMenuToggle = withFragment(NextNavbarMenuToggle, 'navbarMenuToggle');
|
|
10
10
|
//# sourceMappingURL=Navbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navbar.js","sourceRoot":"","sources":["../../../src/components/base/Navbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,aAAa,IAAI,iBAAiB,EAClC,UAAU,IAAI,cAAc,EAC5B,UAAU,IAAI,cAAc,EAC5B,cAAc,IAAI,kBAAkB,EACpC,gBAAgB,IAAI,oBAAoB,GACzC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"Navbar.js","sourceRoot":"","sources":["../../../src/components/base/Navbar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,UAAU,EACpB,WAAW,IAAI,eAAe,EAC9B,aAAa,IAAI,iBAAiB,EAClC,UAAU,IAAI,cAAc,EAC5B,UAAU,IAAI,cAAc,EAC5B,cAAc,IAAI,kBAAkB,EACpC,gBAAgB,IAAI,oBAAoB,GACzC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import type { Props as ApexChartProps } from "react-apexcharts";
|
|
6
6
|
export interface ChartProps {
|
|
7
|
-
type: 'line';
|
|
7
|
+
type: 'area' | 'line' | 'column' | 'bar' | 'pie' | 'donut' | 'radial';
|
|
8
8
|
series: ApexAxisChartSeries | ApexNonAxisChartSeries;
|
|
9
9
|
options?: ApexCharts.ApexOptions;
|
|
10
10
|
height?: ApexChartProps['height'];
|
|
@@ -9,16 +9,22 @@ import { FragmentUIContext } from "../../context";
|
|
|
9
9
|
export const Chart = (props) => {
|
|
10
10
|
const context = useContext(FragmentUIContext);
|
|
11
11
|
const defaults = context['defaults']['chart']?.[props.type];
|
|
12
|
-
const mergedProps = React.useMemo(() => defaultsDeep(
|
|
12
|
+
const mergedProps = React.useMemo(() => defaultsDeep({ ...props }, defaults ?? {}), [props, defaults]);
|
|
13
13
|
const [component, setComponent] = useState(_jsx("div", { style: { height: mergedProps.height, width: mergedProps.width }, className: "flex justify-center align-center", children: _jsx(Spinner, {}) }));
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const importComponent = async () => {
|
|
16
16
|
const module = await import('react-apexcharts');
|
|
17
17
|
const ApexChart = module.default;
|
|
18
|
-
setComponent(_jsx(ApexChart, { ...mergedProps }));
|
|
18
|
+
setComponent(_jsx(ApexChart, { ...mergedProps, type: defaults?.options?.chart?.type, height: props.height ?? defaults?.options?.chart?.height, width: props.width ?? defaults?.options?.chart?.width }));
|
|
19
19
|
};
|
|
20
20
|
importComponent();
|
|
21
|
-
}, [
|
|
21
|
+
}, [
|
|
22
|
+
mergedProps,
|
|
23
|
+
defaults?.options?.chart?.type,
|
|
24
|
+
defaults?.options?.chart?.height,
|
|
25
|
+
defaults?.options?.chart?.width,
|
|
26
|
+
props.height, props.width,
|
|
27
|
+
]);
|
|
22
28
|
return component;
|
|
23
29
|
};
|
|
24
30
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/components/chart/Chart.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,MAAM,CAAC,MAAM,KAAK,GAAyB,CAAC,KAAK,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC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AAS,OACJ,WAAW,EACf,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EACpC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EACxD,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GACrD,CACH,CAAC;QACJ,CAAC,CAAC;QAEF,eAAe,EAAE,CAAC;IACpB,CAAC,EAAE;QACD,WAAW;QACX,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI;QAC9B,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;QAChC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK;QAC/B,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK;KAC1B,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -3,4 +3,10 @@ import { Chart } from "./Chart";
|
|
|
3
3
|
declare const meta: Meta<typeof Chart>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Area: Story;
|
|
6
7
|
export declare const Line: Story;
|
|
8
|
+
export declare const Column: Story;
|
|
9
|
+
export declare const Bar: Story;
|
|
10
|
+
export declare const Pie: Story;
|
|
11
|
+
export declare const Donut: Story;
|
|
12
|
+
export declare const Radial: Story;
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import { Chart } from "./Chart";
|
|
2
2
|
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
3
3
|
const meta = {
|
|
4
|
-
title: "
|
|
4
|
+
title: "components/Chart",
|
|
5
5
|
component: Chart,
|
|
6
6
|
tags: ['autodocs'],
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
10
|
+
export const Area = {
|
|
11
|
+
args: {
|
|
12
|
+
type: 'area',
|
|
13
|
+
height: '500px',
|
|
14
|
+
options: {
|
|
15
|
+
xaxis: {
|
|
16
|
+
categories: ['01 February', '02 February', '03 February', '04 February', '05 February', '06 February', '07 February'],
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
series: [
|
|
20
|
+
{
|
|
21
|
+
name: "New users",
|
|
22
|
+
data: [6500, 6418, 6456, 6526, 6356, 6456],
|
|
23
|
+
color: "#1A56DB",
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
10
28
|
export const Line = {
|
|
11
29
|
args: {
|
|
12
30
|
type: 'line',
|
|
@@ -25,4 +43,152 @@ export const Line = {
|
|
|
25
43
|
],
|
|
26
44
|
},
|
|
27
45
|
};
|
|
46
|
+
export const Column = {
|
|
47
|
+
args: {
|
|
48
|
+
type: 'column',
|
|
49
|
+
height: '500px',
|
|
50
|
+
series: [
|
|
51
|
+
{
|
|
52
|
+
name: "Organic",
|
|
53
|
+
color: "#1A56DB",
|
|
54
|
+
data: [
|
|
55
|
+
{ x: "Mon", y: 231 },
|
|
56
|
+
{ x: "Tue", y: 122 },
|
|
57
|
+
{ x: "Wed", y: 63 },
|
|
58
|
+
{ x: "Thu", y: 421 },
|
|
59
|
+
{ x: "Fri", y: 122 },
|
|
60
|
+
{ x: "Sat", y: 323 },
|
|
61
|
+
{ x: "Sun", y: 111 },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "Social media",
|
|
66
|
+
color: "#FDBA8C",
|
|
67
|
+
data: [
|
|
68
|
+
{ x: "Mon", y: 232 },
|
|
69
|
+
{ x: "Tue", y: 113 },
|
|
70
|
+
{ x: "Wed", y: 341 },
|
|
71
|
+
{ x: "Thu", y: 224 },
|
|
72
|
+
{ x: "Fri", y: 522 },
|
|
73
|
+
{ x: "Sat", y: 411 },
|
|
74
|
+
{ x: "Sun", y: 243 },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const Bar = {
|
|
81
|
+
args: {
|
|
82
|
+
type: 'bar',
|
|
83
|
+
height: '500px',
|
|
84
|
+
options: {
|
|
85
|
+
tooltip: {
|
|
86
|
+
y: {
|
|
87
|
+
formatter: function (value) {
|
|
88
|
+
return "$" + value;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
series: [
|
|
94
|
+
{
|
|
95
|
+
name: "Income",
|
|
96
|
+
color: "#31C48D",
|
|
97
|
+
data: [1420, 1620, 1820, 1420, 1650, 2120],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "Expense",
|
|
101
|
+
data: [788, 810, 866, 788, 1100, 1200],
|
|
102
|
+
color: "#F05252",
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
export const Pie = {
|
|
108
|
+
args: {
|
|
109
|
+
type: 'pie',
|
|
110
|
+
height: '500px',
|
|
111
|
+
options: {
|
|
112
|
+
labels: ["Direct", "Organic search", "Referrals"],
|
|
113
|
+
yaxis: {
|
|
114
|
+
labels: {
|
|
115
|
+
formatter: function (value) {
|
|
116
|
+
return value + "%";
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
xaxis: {
|
|
121
|
+
labels: {
|
|
122
|
+
formatter: function (value) {
|
|
123
|
+
return value + "%";
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
series: [52.8, 26.8, 20.4],
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
export const Donut = {
|
|
132
|
+
args: {
|
|
133
|
+
type: 'donut',
|
|
134
|
+
height: '500px',
|
|
135
|
+
options: {
|
|
136
|
+
labels: ["Direct", "Sponsor", "Affiliate", "Email marketing"],
|
|
137
|
+
plotOptions: {
|
|
138
|
+
pie: {
|
|
139
|
+
donut: {
|
|
140
|
+
labels: {
|
|
141
|
+
total: {
|
|
142
|
+
label: "Unique visitors",
|
|
143
|
+
formatter: function (w) {
|
|
144
|
+
const sum = w.globals.seriesTotals.reduce((a, b) => {
|
|
145
|
+
return a + b;
|
|
146
|
+
}, 0);
|
|
147
|
+
return '$' + sum + 'k';
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
value: {
|
|
151
|
+
formatter: function (value) {
|
|
152
|
+
return value + "k";
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
yaxis: {
|
|
160
|
+
labels: {
|
|
161
|
+
formatter: function (value) {
|
|
162
|
+
return value + "k";
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
xaxis: {
|
|
167
|
+
labels: {
|
|
168
|
+
formatter: function (value) {
|
|
169
|
+
return value + "k";
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
series: [35.1, 23.5, 2.4, 5.4],
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
export const Radial = {
|
|
178
|
+
args: {
|
|
179
|
+
type: 'radial',
|
|
180
|
+
height: '500px',
|
|
181
|
+
options: {
|
|
182
|
+
labels: ["Done", "In progress", "To do"],
|
|
183
|
+
yaxis: {
|
|
184
|
+
labels: {
|
|
185
|
+
formatter: function (value) {
|
|
186
|
+
return value + '%';
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
series: [90, 85, 70],
|
|
192
|
+
},
|
|
193
|
+
};
|
|
28
194
|
//# sourceMappingURL=Chart.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.stories.js","sourceRoot":"","sources":["../../../src/components/chart/Chart.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qGAAqG;AACrG,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Chart.stories.js","sourceRoot":"","sources":["../../../src/components/chart/Chart.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qGAAqG;AACrG,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,8FAA8F;AAC9F,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO;QACf,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC;aACtH;SACF;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;gBAC1C,KAAK,EAAE,SAAS;aACjB;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;gBAC1C,KAAK,EAAE,SAAS;aACjB;YACD;gBACE,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,I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AAO,KAAK,GAAG,GAAG,CAAC;oBACrB,CAAC;iBACF;aACF;SACF;QACD,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;KACrB;CACF,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { InputProps } from '@nextui-org/react';
|
|
3
2
|
/**
|
|
4
3
|
* Primary UI component for selecting a color
|
|
5
4
|
*/
|
|
6
5
|
export interface ColorInputProps extends InputProps {
|
|
7
6
|
}
|
|
8
|
-
export declare const ColorInput:
|
|
7
|
+
export declare const ColorInput: ({ defaultValue, label, errorMessage, onValueChange, isInvalid, ...rest }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { Avatar, Input } from '../base';
|
|
4
4
|
import { withFragment } from '../../withFragment';
|
|
5
|
-
export const ColorInput = withFragment(
|
|
5
|
+
export const ColorInput = withFragment(({ defaultValue, label = 'Color', errorMessage = "Please enter a valid color in hex format e.g. #f3f or #ff33ff", onValueChange, isInvalid, ...rest }) => {
|
|
6
6
|
const [value, setValue] = useState(defaultValue || '#7d7d7d');
|
|
7
7
|
useEffect(() => onValueChange && onValueChange(value), [value, onValueChange]);
|
|
8
8
|
const validateHexColor = (value) => value.match(/^#(?:[0-9a-fA-F]{3}){1,2}$/i);
|
|
@@ -11,6 +11,11 @@ export const ColorInput = withFragment(forwardRef(({ defaultValue, label = 'Colo
|
|
|
11
11
|
return false;
|
|
12
12
|
return validateHexColor(value) && !isInvalid ? false : true;
|
|
13
13
|
}, [value, isInvalid]);
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const handleOnChange = (e) => {
|
|
15
|
+
if (rest.onChange)
|
|
16
|
+
rest.onChange(e);
|
|
17
|
+
setValue(e.currentTarget.value);
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(Input, { ...rest, label: label, type: "text", value: value, onValueChange: setValue, isInvalid: invalid, errorMessage: invalid && errorMessage, endContent: (_jsx(Avatar, { as: "button", size: "sm", showFallback: true, fallback: _jsx("input", { type: 'color', className: "w-full h-full opacity-0 cursor-pointer", onChange: handleOnChange }), style: { backgroundColor: value }, classNames: { base: 'shrink-0 self-center -mb-0.5', fallback: 'w-full h-full' } })) }));
|
|
20
|
+
}, 'colorInput');
|
|
16
21
|
//# sourceMappingURL=ColorInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorInput.js","sourceRoot":"","sources":["../../../src/components/color-input/ColorInput.tsx"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ColorInput.js","sourceRoot":"","sources":["../../../src/components/color-input/ColorInput.tsx"],"names":[],"mappings":";AACA,OAAO,EAAe,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,EACtC,YAAY,EACZ,KAAK,GAAG,OAAO,EACf,YAAY,GAAG,+DAA+D,EAC9E,aAAa,EACb,SAAS,EACT,GAAG,IAAI,EACS,EAAE,EAAE;IACpB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,SAAS,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE,CAAC,aAAa,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAE/E,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEv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id-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
|
+
});
|
|
24
|
+
export const Grid = ({ children, ...props }) => {
|
|
25
|
+
const { base } = grid(props);
|
|
26
|
+
return _jsx("div", { className: base(), children: children });
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=Grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../../src/components/grid/Grid.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAWvC,MAAM,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,gCAAgC;KACvC;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE;gBACF,IAAI,EAAE,aAAa;aACpB;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,4BAA4B;aACnC;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,4CAA4C;aACnD;SACF;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,IAAI;KACX;CACF,CAAC,CAAC;AAEH,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,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Grid } from "./Grid";
|
|
3
|
+
declare const meta: Meta<typeof Grid>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Small: Story;
|
|
7
|
+
export declare const Medium: Story;
|
|
8
|
+
export declare const Large: Story;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Grid } from "./Grid";
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "components/Grid",
|
|
6
|
+
component: Grid,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
11
|
+
export const Small = {
|
|
12
|
+
args: {
|
|
13
|
+
size: 'sm',
|
|
14
|
+
children: (_jsxs(_Fragment, { children: [_jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } })] })),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export const Medium = {
|
|
18
|
+
args: {
|
|
19
|
+
size: 'md',
|
|
20
|
+
children: (_jsxs(_Fragment, { children: [_jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } })] })),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const Large = {
|
|
24
|
+
args: {
|
|
25
|
+
size: 'lg',
|
|
26
|
+
children: (_jsxs(_Fragment, { children: [_jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } }), _jsx("div", { style: { backgroundColor: 'lightblue', height: '250px' } })] })),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=Grid.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.stories.js","sourceRoot":"","sources":["../../../src/components/grid/Grid.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,qGAAqG;AACrG,MAAM,IAAI,GAAsB;IAC9B,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,8FAA8F;AAC9F,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,CACR,8BACE,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,GAAQ,EACrE,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,GAAQ,EACrE,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,GAAQ,EACrE,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,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C"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonGroupProps } from '@nextui-org/react';
|
|
3
|
+
/**
|
|
4
|
+
* Primary UI component for selecting a color
|
|
5
|
+
*/
|
|
6
|
+
export interface MultiSwitchProps extends Omit<ButtonGroupProps, 'className'> {
|
|
7
|
+
defaultValue?: number;
|
|
8
|
+
onValueChange: (value: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const MultiSwitch: import("react").ForwardRefExoticComponent<Omit<MultiSwitchProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
3
|
+
import { Button, ButtonGroup } from '../base';
|
|
4
|
+
import { withFragment } from '../../withFragment';
|
|
5
|
+
import { IconCheck, IconSlash, IconX } from '@tabler/icons-react';
|
|
6
|
+
import { tv } from '@nextui-org/react';
|
|
7
|
+
const multiSwitch = tv({
|
|
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(), onClick: () => setValue(0), ...value === 0 ? { color: 'danger' } : {}, children: _jsx(IconX, { size: 20 }) }), _jsx(Button, { className: button(), onClick: () => setValue(1), ...value === 1 ? { color: 'default', variant: 'solid' } : {}, children: _jsx(IconSlash, { size: 20 }) }), _jsx(Button, { className: button(), onClick: () => setValue(2), ...value === 2 ? { color: 'success' } : {}, children: _jsx(IconCheck, { size: 20 }) })] })] }));
|
|
30
|
+
}), 'multiSwitch');
|
|
31
|
+
//# sourceMappingURL=MultiSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSwitch.js","sourceRoot":"","sources":["../../../src/components/multi-switch/MultiSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,C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,CAAC,EAAE,YAAE,KAAC,KAAK,IAAC,IAAI,EAAE,EAAE,GAAI,GAAS,EACjI,KAAC,MAAM,IAAC,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,YAAE,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,GAAI,GAAS,EACxJ,KAAC,MAAM,IAAC,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,YAAE,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,GAAI,GAAS,IAC1H,IACb,CACJ,CAAC;AACJ,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { MultiSwitch } from "./MultiSwitch";
|
|
3
|
+
declare const meta: Meta<typeof MultiSwitch>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Small: Story;
|
|
7
|
+
export declare const Medium: Story;
|
|
8
|
+
export declare const Large: Story;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MultiSwitch } from "./MultiSwitch";
|
|
2
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "components/MultiSwitch",
|
|
5
|
+
component: MultiSwitch,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
10
|
+
export const Small = {
|
|
11
|
+
args: {
|
|
12
|
+
onValueChange: console.log,
|
|
13
|
+
size: 'sm',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const Medium = {
|
|
17
|
+
args: {
|
|
18
|
+
onValueChange: console.log,
|
|
19
|
+
size: 'md',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const Large = {
|
|
23
|
+
args: {
|
|
24
|
+
onValueChange: console.log,
|
|
25
|
+
size: 'lg',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=MultiSwitch.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSwitch.stories.js","sourceRoot":"","sources":["../../../src/components/multi-switch/MultiSwitch.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qGAAqG;AACrG,MAAM,IAAI,GAA6B;IACrC,KAAK,EAAE,wBAAwB;IAC/B,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,8FAA8F;AAC9F,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE;QACJ,aAAa,EAAE,OAAO,CAAC,GAAG;QAC1B,IAAI,EAAE,IAAI;KACX;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAU;IAC3B,IAAI,EAAE;QACJ,aAAa,EAAE,OAAO,CAAC,GAAG;QAC1B,IAAI,EAAE,IAAI;KACX;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE;QACJ,aAAa,EAAE,OAAO,CAAC,GAAG;QAC1B,IAAI,EAAE,IAAI;KACX;CACF,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AccordionItemProps, AccordionProps, AutocompleteItemProps, AutocompleteProps, AutocompleteSectionProps, AvatarGroupProps, AvatarProps, BadgeProps,
|
|
2
|
+
import { AccordionItemProps, AccordionProps, AutocompleteItemProps, AutocompleteProps, AutocompleteSectionProps, AvatarGroupProps, AvatarProps, BadgeProps, BreadcrumbsProps, ButtonGroupProps, ButtonProps, CardProps, CheckboxGroupProps, CheckboxProps, ChipProps, CircularProgressProps, CodeProps, DividerProps, DropdownItemProps, DropdownMenuProps, DropdownProps, DropdownSectionProps, DropdownTriggerProps, HTMLNextUIProps, ImageProps, InputProps, KbdProps, LinkProps, ListboxItemProps, ListboxProps, ListboxSectionProps, ModalBodyProps, ModalContentProps, ModalFooterProps, ModalHeaderProps, ModalProps, NavbarBrandProps, NavbarContentProps, NavbarItemProps, NavbarMenuItemProps, NavbarMenuToggleProps, NavbarProps, PaginationCursorProps, PaginationItemProps, PaginationProps, PopoverContentProps, PopoverProps, PopoverTriggerProps, ProgressProps, RadioGroupProps, RadioProps, ScrollShadowProps, SelectItemProps, SelectProps, SelectSectionProps, SkeletonProps, SliderProps, SnippetProps, SpacerProps, SpinnerProps, SwitchProps, TabItemProps, TableBodyProps, TableCellProps, TableColumnProps, TableHeaderProps, TableProps, TabsProps, TextAreaProps, TooltipProps, UserProps } from "@nextui-org/react";
|
|
3
3
|
import { RowProps } from '@react-types/table';
|
|
4
|
-
import {
|
|
5
|
-
import { ChartProps } from "./components
|
|
4
|
+
import type { Props as ApexChartProps } from "react-apexcharts";
|
|
5
|
+
import { ChartProps, ColorInputProps, ColorSelectorProps, MultiSwitchProps } from "./components";
|
|
6
6
|
export type TableRowProps<T = object> = RowProps<T> & Omit<HTMLNextUIProps<"tr">, keyof RowProps<T>>;
|
|
7
7
|
export interface FragmentUIContext {
|
|
8
8
|
defaults: {
|
|
@@ -15,11 +15,11 @@ export interface FragmentUIContext {
|
|
|
15
15
|
autocompleteSection?: Partial<AutocompleteSectionProps>;
|
|
16
16
|
badge?: Partial<BadgeProps>;
|
|
17
17
|
button?: Partial<ButtonProps>;
|
|
18
|
+
buttonGroup?: Partial<ButtonGroupProps>;
|
|
18
19
|
breadcrumbs?: Partial<BreadcrumbsProps>;
|
|
19
|
-
breadcrumbItem?: Partial<BreadcrumbItemProps>;
|
|
20
20
|
card?: Partial<CardProps>;
|
|
21
21
|
chart?: Partial<{
|
|
22
|
-
[chartType in ChartProps['type']]: Partial<
|
|
22
|
+
[chartType in ChartProps['type']]: Partial<Pick<ApexChartProps, 'options' | 'series'>>;
|
|
23
23
|
}>;
|
|
24
24
|
checkbox?: Partial<CheckboxProps>;
|
|
25
25
|
checkboxGroup?: Partial<CheckboxGroupProps>;
|
|
@@ -46,11 +46,11 @@ export interface FragmentUIContext {
|
|
|
46
46
|
modalContent?: Partial<ModalContentProps>;
|
|
47
47
|
modalFooter?: Partial<ModalFooterProps>;
|
|
48
48
|
modalHeader?: Partial<ModalHeaderProps>;
|
|
49
|
+
multiSwitch?: Partial<MultiSwitchProps>;
|
|
49
50
|
navbar?: Partial<NavbarProps>;
|
|
50
51
|
navbarBrand?: Partial<NavbarBrandProps>;
|
|
51
52
|
navbarContent?: Partial<NavbarContentProps>;
|
|
52
53
|
navbarItem?: Partial<NavbarItemProps>;
|
|
53
|
-
navbarMenu?: Partial<NavbarMenuProps>;
|
|
54
54
|
navbarMenuItem?: Partial<NavbarMenuItemProps>;
|
|
55
55
|
navbarMenuToggle?: Partial<NavbarMenuToggleProps>;
|
|
56
56
|
pagination?: Partial<PaginationProps>;
|