@fragment-build/ui 2.2.0 → 2.2.1
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/components/base/Accordion.d.ts +2 -0
- package/components/base/Accordion.js +5 -0
- package/components/base/Accordion.js.map +1 -0
- package/components/base/Alert.d.ts +1 -0
- package/components/base/Alert.js +4 -0
- package/components/base/Alert.js.map +1 -0
- package/components/base/Autocomplete.d.ts +3 -0
- package/components/base/Autocomplete.js +6 -0
- package/components/base/Autocomplete.js.map +1 -0
- package/components/base/Avatar.d.ts +2 -0
- package/components/base/Avatar.js +5 -0
- package/components/base/Avatar.js.map +1 -0
- package/components/base/Badge.d.ts +1 -0
- package/components/base/Badge.js +4 -0
- package/components/base/Badge.js.map +1 -0
- package/components/base/Breadcrumbs.d.ts +2 -0
- package/components/base/Breadcrumbs.js +5 -0
- package/components/base/Breadcrumbs.js.map +1 -0
- package/components/base/Button.d.ts +2 -0
- package/components/base/Button.js +5 -0
- package/components/base/Button.js.map +1 -0
- package/components/base/Calendar.d.ts +1 -0
- package/components/base/Calendar.js +4 -0
- package/components/base/Calendar.js.map +1 -0
- package/components/base/Card.d.ts +2 -0
- package/components/base/Card.js +5 -0
- package/components/base/Card.js.map +1 -0
- package/components/base/Checkbox.d.ts +2 -0
- package/components/base/Checkbox.js +5 -0
- package/components/base/Checkbox.js.map +1 -0
- package/components/base/Chip.d.ts +1 -0
- package/components/base/Chip.js +4 -0
- package/components/base/Chip.js.map +1 -0
- package/components/base/CircularProgress.d.ts +1 -0
- package/components/base/CircularProgress.js +4 -0
- package/components/base/CircularProgress.js.map +1 -0
- package/components/base/Code.d.ts +1 -0
- package/components/base/Code.js +4 -0
- package/components/base/Code.js.map +1 -0
- package/components/base/DateInput.d.ts +1 -0
- package/components/base/DateInput.js +4 -0
- package/components/base/DateInput.js.map +1 -0
- package/components/base/DatePicker.d.ts +1 -0
- package/components/base/DatePicker.js +4 -0
- package/components/base/DatePicker.js.map +1 -0
- package/components/base/DateRangePicker.d.ts +1 -0
- package/components/base/DateRangePicker.js +4 -0
- package/components/base/DateRangePicker.js.map +1 -0
- package/components/base/Divider.d.ts +1 -0
- package/components/base/Divider.js +4 -0
- package/components/base/Divider.js.map +1 -0
- package/components/base/Drawer.d.ts +8 -0
- package/components/base/Drawer.js +8 -0
- package/components/base/Drawer.js.map +1 -0
- package/components/base/Dropdown.d.ts +11 -0
- package/components/base/Dropdown.js +8 -0
- package/components/base/Dropdown.js.map +1 -0
- package/components/base/Form.d.ts +0 -0
- package/components/base/Form.js +6 -0
- package/components/base/Form.js.map +1 -0
- package/components/base/Image.d.ts +1 -0
- package/components/base/Image.js +4 -0
- package/components/base/Image.js.map +1 -0
- package/components/base/Input.d.ts +1 -0
- package/components/base/Input.js +4 -0
- package/components/base/Input.js.map +1 -0
- package/components/base/InputOtp.d.ts +1 -0
- package/components/base/InputOtp.js +4 -0
- package/components/base/InputOtp.js.map +1 -0
- package/components/base/Kbd.d.ts +1 -0
- package/components/base/Kbd.js +4 -0
- package/components/base/Kbd.js.map +1 -0
- package/components/base/Link.d.ts +1 -0
- package/components/base/Link.js +4 -0
- package/components/base/Link.js.map +1 -0
- package/components/base/Listbox.d.ts +3 -0
- package/components/base/Listbox.js +6 -0
- package/components/base/Listbox.js.map +1 -0
- package/components/base/Modal.d.ts +8 -0
- package/components/base/Modal.js +8 -0
- package/components/base/Modal.js.map +1 -0
- package/components/base/Navbar.d.ts +7 -0
- package/components/base/Navbar.js +10 -0
- package/components/base/Navbar.js.map +1 -0
- package/components/base/NumberInput.d.ts +1 -0
- package/components/base/NumberInput.js +4 -0
- package/components/base/NumberInput.js.map +1 -0
- package/components/base/Pagination.d.ts +3 -0
- package/components/base/Pagination.js +6 -0
- package/components/base/Pagination.js.map +1 -0
- package/components/base/Popover.d.ts +234 -0
- package/components/base/Popover.js +6 -0
- package/components/base/Popover.js.map +1 -0
- package/components/base/Progress.d.ts +1 -0
- package/components/base/Progress.js +4 -0
- package/components/base/Progress.js.map +1 -0
- package/components/base/Radio.d.ts +2 -0
- package/components/base/Radio.js +5 -0
- package/components/base/Radio.js.map +1 -0
- package/components/base/RangeCalendar.d.ts +1 -0
- package/components/base/RangeCalendar.js +4 -0
- package/components/base/RangeCalendar.js.map +1 -0
- package/components/base/ScrollShadow.d.ts +1 -0
- package/components/base/ScrollShadow.js +4 -0
- package/components/base/ScrollShadow.js.map +1 -0
- package/components/base/Select.d.ts +3 -0
- package/components/base/Select.js +6 -0
- package/components/base/Select.js.map +1 -0
- package/components/base/Skeleton.d.ts +1 -0
- package/components/base/Skeleton.js +4 -0
- package/components/base/Skeleton.js.map +1 -0
- package/components/base/Slider.d.ts +1 -0
- package/components/base/Slider.js +4 -0
- package/components/base/Slider.js.map +1 -0
- package/components/base/Snippet.d.ts +1 -0
- package/components/base/Snippet.js +4 -0
- package/components/base/Snippet.js.map +1 -0
- package/components/base/Spacer.d.ts +1 -0
- package/components/base/Spacer.js +4 -0
- package/components/base/Spacer.js.map +1 -0
- package/components/base/Spinner.d.ts +1 -0
- package/components/base/Spinner.js +4 -0
- package/components/base/Spinner.js.map +1 -0
- package/components/base/Switch.d.ts +1 -0
- package/components/base/Switch.js +4 -0
- package/components/base/Switch.js.map +1 -0
- package/components/base/Table.d.ts +6 -0
- package/components/base/Table.js +9 -0
- package/components/base/Table.js.map +1 -0
- package/components/base/Tabs.d.ts +2 -0
- package/components/base/Tabs.js +5 -0
- package/components/base/Tabs.js.map +1 -0
- package/components/base/Textarea.d.ts +1 -0
- package/components/base/Textarea.js +4 -0
- package/components/base/Textarea.js.map +1 -0
- package/components/base/TimeInput.d.ts +1 -0
- package/components/base/TimeInput.js +4 -0
- package/components/base/TimeInput.js.map +1 -0
- package/components/base/Toast.d.ts +2 -0
- package/components/base/Toast.js +5 -0
- package/components/base/Toast.js.map +1 -0
- package/components/base/Tooltip.d.ts +1 -0
- package/components/base/Tooltip.js +4 -0
- package/components/base/Tooltip.js.map +1 -0
- package/components/base/User.d.ts +1 -0
- package/components/base/User.js +4 -0
- package/components/base/User.js.map +1 -0
- package/components/chart/Chart.d.ts +13 -0
- package/components/chart/Chart.js +18 -0
- package/components/chart/Chart.js.map +1 -0
- package/components/color-input/ColorInput.d.ts +8 -0
- package/components/color-input/ColorInput.js +24 -0
- package/components/color-input/ColorInput.js.map +1 -0
- package/components/color-selector/ColorSelector.d.ts +14 -0
- package/components/color-selector/ColorSelector.js +16 -0
- package/components/color-selector/ColorSelector.js.map +1 -0
- package/components/grid/Grid.d.ts +8 -0
- package/components/grid/Grid.js +28 -0
- package/components/grid/Grid.js.map +1 -0
- package/components/multi-switch/MultiSwitch.d.ts +9 -0
- package/components/multi-switch/MultiSwitch.js +31 -0
- package/components/multi-switch/MultiSwitch.js.map +1 -0
- package/components/theme-switch/ThemeSwitch.d.ts +6 -0
- package/components/theme-switch/ThemeSwitch.js +16 -0
- package/components/theme-switch/ThemeSwitch.js.map +1 -0
- package/constants.d.ts +12 -0
- package/constants.js +13 -0
- package/constants.js.map +1 -0
- package/context.d.ts +106 -0
- package/context.js +467 -0
- package/context.js.map +1 -0
- package/fragments/form/Form.d.ts +8 -0
- package/fragments/form/Form.js +18 -0
- package/fragments/form/Form.js.map +1 -0
- package/fragments/form/FormSection.d.ts +12 -0
- package/fragments/form/FormSection.js +38 -0
- package/fragments/form/FormSection.js.map +1 -0
- package/fragments/page/PageHeader.d.ts +10 -0
- package/fragments/page/PageHeader.js +14 -0
- package/fragments/page/PageHeader.js.map +1 -0
- package/fragments/shell/Shell.d.ts +9 -0
- package/fragments/shell/Shell.js +6 -0
- package/fragments/shell/Shell.js.map +1 -0
- package/fragments/sidebar/Sidebar.d.ts +49 -0
- package/fragments/sidebar/Sidebar.js +93 -0
- package/fragments/sidebar/Sidebar.js.map +1 -0
- package/fragments/sidebar/Sidebar.styles.d.ts +118 -0
- package/fragments/sidebar/Sidebar.styles.js +45 -0
- package/fragments/sidebar/Sidebar.styles.js.map +1 -0
- package/fragments/widget/Widget.d.ts +15 -0
- package/fragments/widget/Widget.js +310 -0
- package/fragments/widget/Widget.js.map +1 -0
- package/index.d.ts +65 -0
- package/index.js.map +1 -0
- package/package.json +1 -1
- package/provider.d.ts +7 -0
- package/provider.js +17 -0
- package/provider.js.map +1 -0
- package/tailwind.plugin.d.ts +3 -0
- package/tailwind.plugin.js +52 -0
- package/tailwind.plugin.js.map +1 -0
- package/withFragment.d.ts +2 -0
- package/withFragment.js +21 -0
- package/withFragment.js.map +1 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Avatar } from '../base/Avatar';
|
|
4
|
+
import { Input } from '../base/Input';
|
|
5
|
+
import { withFragment } from '../../withFragment';
|
|
6
|
+
;
|
|
7
|
+
export const ColorInput = withFragment(({ defaultValue, placeholderValue, label = 'Color', errorMessage = 'Please enter a valid color in hex format e.g. #f3f or #ff33ff', onValueChange, isInvalid, value: controlledValue, placeholder, ...rest }) => {
|
|
8
|
+
const [value, setValue] = useState(controlledValue || defaultValue);
|
|
9
|
+
useEffect(() => onValueChange && onValueChange(value || ''), [value, onValueChange]);
|
|
10
|
+
useEffect(() => setValue(controlledValue), [controlledValue]);
|
|
11
|
+
const validateHexColor = (value) => value.match(/^#(?:[0-9a-fA-F]{3}){1,2}$/i);
|
|
12
|
+
const invalid = useMemo(() => {
|
|
13
|
+
if (!value)
|
|
14
|
+
return false;
|
|
15
|
+
return validateHexColor(value) && !isInvalid ? false : true;
|
|
16
|
+
}, [value, isInvalid]);
|
|
17
|
+
const handleOnChange = (e) => {
|
|
18
|
+
if (rest.onChange)
|
|
19
|
+
rest.onChange(e);
|
|
20
|
+
setValue(e.currentTarget.value);
|
|
21
|
+
};
|
|
22
|
+
return (_jsx(Input, { ...rest, label: label, type: "text", value: value, onValueChange: setValue, isInvalid: invalid, errorMessage: invalid && errorMessage, placeholder: placeholder || placeholderValue, endContent: (_jsx(Avatar, { as: "button", size: "sm", showFallback: true, fallback: (_jsx("input", { type: "color", className: "w-full h-full opacity-0 cursor-pointer", value: placeholderValue && !value ? placeholderValue : value, onChange: handleOnChange })), style: { backgroundColor: value || placeholderValue }, classNames: { base: 'shrink-0 self-center -mb-0.5', fallback: 'w-full h-full' } })) }));
|
|
23
|
+
}, 'colorInput');
|
|
24
|
+
//# sourceMappingURL=ColorInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQjD,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAA8B,YAAY,CAAC,CAAC,EACjE,YAAY,EACZ,gBAAgB,EAChB,KAAK,GAAG,OAAO,EACf,YAAY,GAAG,+DAA+D,EAC9E,aAAa,EACb,SAAS,EACT,KAAK,EAAE,eAAe,EACtB,WAAW,EACX,GAAG,IAAI,EACS,EAAE,EAAE;IACpB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAoD,eAAe,IAAI,YAAY,CAAC,CAAC;IAEvH,SAAS,CAAC,GAAG,EAAE,CAAC,aAAa,IAAI,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAErF,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,6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CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AvatarProps } from '@heroui/avatar';
|
|
2
|
+
/**
|
|
3
|
+
* Primary UI component for selecting a color
|
|
4
|
+
*/
|
|
5
|
+
export interface ColorSelectorProps {
|
|
6
|
+
values: string[];
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
onValueChange: (color: string) => void;
|
|
10
|
+
color?: AvatarProps['color'];
|
|
11
|
+
size?: AvatarProps['size'];
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const ColorSelector: React.FC<ColorSelectorProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Avatar } from '../base/Avatar';
|
|
4
|
+
import { Button } from '../base/Button';
|
|
5
|
+
import { withFragment } from '../../withFragment';
|
|
6
|
+
export const ColorSelector = withFragment(({ values, value: controlledValue, defaultValue, onValueChange, icon, ...rest }) => {
|
|
7
|
+
const [value, setValue] = useState(defaultValue && values.includes(defaultValue) ? defaultValue : values[0]);
|
|
8
|
+
useEffect(() => onValueChange(value), [value, onValueChange]);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!controlledValue)
|
|
11
|
+
return;
|
|
12
|
+
setValue(controlledValue);
|
|
13
|
+
}, [controlledValue]);
|
|
14
|
+
return (_jsx("div", { className: "flex gap-3", children: values.map((color) => (_jsx(Button, { radius: "full", size: rest.size, isIconOnly: true, disableRipple: true, className: "overflow-visible", children: _jsx(Avatar, { showFallback: true, fallback: value === color && icon ? icon : _jsx(_Fragment, {}), style: { backgroundColor: color }, classNames: { base: 'shrink-0' }, isBordered: value === color, onClick: () => setValue(color), ...rest }) }))) }));
|
|
15
|
+
}, 'colorSelector');
|
|
16
|
+
//# sourceMappingURL=ColorSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
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,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAK,EAChD,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,EACjC,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAChC,UAAU,EAAE,KAAK,KAAK,KAAK,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAC1B,IAAI,GACR,GACK,CACV,CAAC,GACE,CACP,CAAC;AACJ,CAAC,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from 'tailwind-variants';
|
|
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
|
+
});
|
|
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,9 @@
|
|
|
1
|
+
import type { ButtonGroupProps } from '@heroui/button';
|
|
2
|
+
/**
|
|
3
|
+
* Primary UI component for selecting a color
|
|
4
|
+
*/
|
|
5
|
+
export interface MultiSwitchProps extends Omit<ButtonGroupProps, 'className'> {
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
onValueChange: (value: number) => void;
|
|
8
|
+
}
|
|
9
|
+
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/Button';
|
|
4
|
+
import { withFragment } from '../../withFragment';
|
|
5
|
+
import { IconCheck, IconSlash, IconX } from '@tabler/icons-react';
|
|
6
|
+
import { tv } from 'tailwind-variants';
|
|
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(), 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');
|
|
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,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO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AC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,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,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from 'next-themes';
|
|
3
|
+
import { IconMoon, IconSun } from '@tabler/icons-react';
|
|
4
|
+
import { Button } from '../base/Button';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
export const ThemeSwitch = (props) => {
|
|
7
|
+
const [mounted, setMounted] = useState(false);
|
|
8
|
+
const { theme, setTheme } = useTheme();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
setMounted(true);
|
|
11
|
+
}, []);
|
|
12
|
+
if (!mounted)
|
|
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 }) }));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=ThemeSwitch.js.map
|
|
@@ -0,0 +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,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,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,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAM,KAAK,YAClG,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/constants.d.ts
ADDED
package/constants.js
ADDED
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,IAAI;CACZ,CAAA"}
|
package/context.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { AccordionItemProps, AccordionProps, AlertProps, AutocompleteItemProps, AutocompleteProps, AutocompleteSectionProps, AvatarGroupProps, AvatarProps, BadgeProps, BreadcrumbsProps, ButtonGroupProps, ButtonProps, CalendarProps, CardProps, CheckboxGroupProps, CheckboxProps, ChipProps, CircularProgressProps, CodeProps, DateInputProps, DatePickerProps, DateRangePickerProps, DividerProps, DrawerBodyProps, DrawerContentProps, DrawerFooterProps, DrawerHeaderProps, DrawerProps, DropdownItemProps, DropdownMenuProps, DropdownProps, DropdownSectionProps, DropdownTriggerProps, ImageProps, InputOtpProps, InputProps, KbdProps, LinkProps, ListboxItemProps, ListboxProps, ListboxSectionProps, ModalBodyProps, ModalContentProps, ModalFooterProps, ModalHeaderProps, ModalProps, NavbarBrandProps, NavbarContentProps, NavbarItemProps, NavbarMenuItemProps, NavbarMenuToggleProps, NavbarProps, NumberInputProps, PaginationCursorProps, PaginationItemProps, PaginationProps, PopoverContentProps, PopoverProps, PopoverTriggerProps, ProgressProps, RadioGroupProps, RadioProps, RangeCalendarProps, ScrollShadowProps, SelectItemProps, SelectProps, SelectSectionProps, SkeletonProps, SliderProps, SnippetProps, SpacerProps, SpinnerProps, SwitchProps, TabItemProps, TableBodyProps, TableCellProps, TableColumnProps, TableHeaderProps, TableProps, TableRowProps, TabsProps, TextAreaProps, TimeInputProps, ToastProps, TooltipProps, UserProps } from '@heroui/react';
|
|
2
|
+
import type { Props as ApexChartProps } from 'react-apexcharts';
|
|
3
|
+
import type { ChartProps } from './components/chart/Chart';
|
|
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
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export declare const defaultContext: FragmentUIContext;
|
|
106
|
+
export declare const FragmentUIContext: import("react").Context<FragmentUIContext>;
|