@pixpilot/shadcn-ui 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AbsoluteFill.cjs +24 -1
- package/dist/AbsoluteFill.js +21 -1
- package/dist/Alert.cjs +82 -1
- package/dist/Alert.js +77 -1
- package/dist/Button.cjs +84 -1
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +79 -1
- package/dist/CloseButtonAbsolute.cjs +20 -1
- package/dist/CloseButtonAbsolute.js +16 -1
- package/dist/CloseButtonRounded.cjs +22 -1
- package/dist/CloseButtonRounded.js +17 -1
- package/dist/Combobox.cjs +53 -1
- package/dist/Combobox.js +48 -1
- package/dist/CommandOptionList.cjs +29 -1
- package/dist/CommandOptionList.js +25 -1
- package/dist/ContentCard.cjs +27 -1
- package/dist/ContentCard.d.cts +1 -1
- package/dist/ContentCard.js +23 -1
- package/dist/DatePicker.cjs +38 -1
- package/dist/DatePicker.d.cts +1 -1
- package/dist/DatePicker.js +33 -1
- package/dist/LoadingOverlay.cjs +65 -1
- package/dist/LoadingOverlay.js +60 -1
- package/dist/Select.cjs +27 -1
- package/dist/Select.d.cts +1 -1
- package/dist/Select.js +23 -1
- package/dist/Slider.cjs +19 -1
- package/dist/Slider.js +15 -1
- package/dist/ThemeToggle.cjs +98 -1
- package/dist/ThemeToggle.js +94 -1
- package/dist/_virtual/rolldown_runtime.cjs +25 -1
- package/dist/confirmation-dialog/ConfirmationDialog.cjs +46 -1
- package/dist/confirmation-dialog/ConfirmationDialog.d.cts +1 -0
- package/dist/confirmation-dialog/ConfirmationDialog.js +42 -1
- package/dist/confirmation-dialog/DialogProvider.cjs +16 -1
- package/dist/confirmation-dialog/DialogProvider.js +12 -1
- package/dist/confirmation-dialog/confirmation-dialogs.cjs +14 -1
- package/dist/confirmation-dialog/confirmation-dialogs.js +12 -1
- package/dist/confirmation-dialog/index.cjs +6 -1
- package/dist/confirmation-dialog/index.js +6 -1
- package/dist/file-upload/FileUpload.cjs +68 -1
- package/dist/file-upload/FileUpload.d.ts +2 -2
- package/dist/file-upload/FileUpload.js +63 -1
- package/dist/file-upload/FileUploadItems.cjs +36 -1
- package/dist/file-upload/FileUploadItems.js +32 -1
- package/dist/file-upload/FileUploadListItem.cjs +88 -1
- package/dist/file-upload/FileUploadListItem.js +82 -1
- package/dist/file-upload/hooks/index.cjs +3 -1
- package/dist/file-upload/hooks/index.d.cts +2 -0
- package/dist/file-upload/hooks/index.js +3 -1
- package/dist/file-upload/hooks/use-file-error.cjs +15 -1
- package/dist/file-upload/hooks/use-file-error.js +13 -1
- package/dist/file-upload/hooks/use-file-upload-progress-callbacks.cjs +34 -1
- package/dist/file-upload/hooks/use-file-upload-progress-callbacks.d.cts +1 -0
- package/dist/file-upload/hooks/use-file-upload-progress-callbacks.js +31 -1
- package/dist/file-upload/hooks/use-file-upload-store.cjs +77 -1
- package/dist/file-upload/hooks/use-file-upload-store.d.cts +2 -0
- package/dist/file-upload/hooks/use-file-upload-store.js +75 -1
- package/dist/file-upload/index.cjs +5 -1
- package/dist/file-upload/index.d.cts +2 -1
- package/dist/file-upload/index.js +5 -1
- package/dist/file-upload/utils/create-placeholder-file.cjs +11 -1
- package/dist/file-upload/utils/create-placeholder-file.js +10 -1
- package/dist/file-upload/utils/get-file-key.cjs +8 -1
- package/dist/file-upload/utils/get-file-key.d.cts +1 -0
- package/dist/file-upload/utils/get-file-key.js +7 -1
- package/dist/file-upload/utils/get-file-meta.cjs +23 -1
- package/dist/file-upload/utils/get-file-meta.d.cts +1 -0
- package/dist/file-upload/utils/get-file-meta.js +21 -1
- package/dist/file-upload/utils/index.d.cts +4 -0
- package/dist/file-upload/utils/is-file-equal.cjs +9 -1
- package/dist/file-upload/utils/is-file-equal.d.cts +1 -0
- package/dist/file-upload/utils/is-file-equal.js +8 -1
- package/dist/file-upload/utils/merge-file-metadata.cjs +26 -1
- package/dist/file-upload/utils/merge-file-metadata.d.cts +1 -0
- package/dist/file-upload/utils/merge-file-metadata.js +26 -1
- package/dist/file-upload-inline/FileUploadInline.cjs +71 -1
- package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
- package/dist/file-upload-inline/FileUploadInline.js +66 -1
- package/dist/file-upload-inline/FileUploadInlineItem.cjs +94 -1
- package/dist/file-upload-inline/FileUploadInlineItem.js +88 -1
- package/dist/file-upload-inline/defaults.cjs +11 -1
- package/dist/file-upload-inline/defaults.js +10 -1
- package/dist/file-upload-inline/index.cjs +1 -1
- package/dist/file-upload-inline/index.js +1 -1
- package/dist/file-upload-inline/utils.cjs +36 -1
- package/dist/file-upload-inline/utils.js +34 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-media-query.cjs +9 -1
- package/dist/hooks/use-media-query.js +7 -1
- package/dist/icon-selector/IconPicker.cjs +93 -1
- package/dist/icon-selector/IconPicker.d.cts +0 -1
- package/dist/icon-selector/IconPicker.d.ts +0 -1
- package/dist/icon-selector/IconPicker.js +88 -1
- package/dist/icon-selector/constants.cjs +6 -1
- package/dist/icon-selector/constants.js +5 -0
- package/dist/icon-selector/icon-picker-container.cjs +35 -1
- package/dist/icon-selector/icon-picker-container.js +32 -1
- package/dist/icon-selector/icon-picker-content.cjs +146 -1
- package/dist/icon-selector/icon-picker-content.js +141 -1
- package/dist/icon-selector/index.cjs +1 -1
- package/dist/icon-selector/index.d.cts +2 -2
- package/dist/icon-selector/index.d.ts +2 -2
- package/dist/icon-selector/index.js +1 -1
- package/dist/icon-selector/use-async-providers.cjs +69 -1
- package/dist/icon-selector/use-async-providers.js +67 -1
- package/dist/icon-selector/utils/is-valid-provider.cjs +11 -1
- package/dist/icon-selector/utils/is-valid-provider.js +10 -1
- package/dist/icon-selector/virtualized-icon-grid.cjs +137 -1
- package/dist/icon-selector/virtualized-icon-grid.js +132 -1
- package/dist/index.cjs +76 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -1
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.cjs +18 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.cjs +1894 -0
- package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +1893 -0
- package/dist/packages/shadcn/src/lib/utils.cjs +10 -1
- package/dist/packages/shadcn/src/lib/utils.js +10 -1
- package/dist/pagination/Pagination.cjs +156 -1
- package/dist/pagination/Pagination.js +151 -1
- package/dist/pagination/index.cjs +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/rich-text-editor/RichTextEditor.cjs +132 -1
- package/dist/rich-text-editor/RichTextEditor.js +126 -1
- package/dist/rich-text-editor/index.cjs +1 -1
- package/dist/rich-text-editor/index.js +1 -1
- package/dist/rich-text-editor/predefined-toolbar-options.cjs +84 -1
- package/dist/rich-text-editor/predefined-toolbar-options.js +81 -1
- package/dist/spinner/index.cjs +1 -1
- package/dist/spinner/index.js +1 -1
- package/dist/spinner/spinner.cjs +73 -6
- package/dist/spinner/spinner.js +70 -6
- package/dist/spinner/styles.cjs +24 -12
- package/dist/spinner/styles.js +23 -12
- package/dist/tags-input.cjs +226 -1
- package/dist/tags-input.js +222 -1
- package/dist/theme-provider/ThemeProvider.cjs +27 -1
- package/dist/theme-provider/ThemeProvider.js +23 -1
- package/dist/theme-provider/index.cjs +4 -1
- package/dist/theme-provider/index.js +4 -1
- package/dist/toast/AlertToast.cjs +36 -1
- package/dist/toast/AlertToast.js +31 -1
- package/dist/toast/index.cjs +1 -1
- package/dist/toast/index.js +1 -1
- package/dist/toast/toast.cjs +75 -1
- package/dist/toast/toast.js +66 -1
- package/package.json +2 -2
- package/dist/_virtual/rolldown_runtime.js +0 -1
- package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.js +0 -1
- package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -1
- package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js +0 -1
- package/dist/packages/shadcn/src/components/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.js +0 -1
- package/dist/packages/shadcn/src/components/ui/alert-dialog.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/alert-dialog.js +0 -1
- package/dist/packages/shadcn/src/components/ui/alert.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/alert.js +0 -1
- package/dist/packages/shadcn/src/components/ui/avatar.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/avatar.js +0 -1
- package/dist/packages/shadcn/src/components/ui/badge.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/badge.js +0 -1
- package/dist/packages/shadcn/src/components/ui/button.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/button.js +0 -1
- package/dist/packages/shadcn/src/components/ui/calendar.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/calendar.js +0 -1
- package/dist/packages/shadcn/src/components/ui/card.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/card.js +0 -1
- package/dist/packages/shadcn/src/components/ui/checkbox.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/checkbox.js +0 -1
- package/dist/packages/shadcn/src/components/ui/command.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/command.js +0 -1
- package/dist/packages/shadcn/src/components/ui/dialog.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/dialog.js +0 -1
- package/dist/packages/shadcn/src/components/ui/dropdown-menu.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/dropdown-menu.js +0 -1
- package/dist/packages/shadcn/src/components/ui/file-upload.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/file-upload.js +0 -1
- package/dist/packages/shadcn/src/components/ui/form.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/form.js +0 -1
- package/dist/packages/shadcn/src/components/ui/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/input.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/input.js +0 -1
- package/dist/packages/shadcn/src/components/ui/label.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/label.js +0 -1
- package/dist/packages/shadcn/src/components/ui/pagination.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/pagination.js +0 -1
- package/dist/packages/shadcn/src/components/ui/popover.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/popover.js +0 -1
- package/dist/packages/shadcn/src/components/ui/radio-group.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/radio-group.js +0 -1
- package/dist/packages/shadcn/src/components/ui/select.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/select.js +0 -1
- package/dist/packages/shadcn/src/components/ui/separator.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/separator.js +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/sheet.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/sheet.js +0 -1
- package/dist/packages/shadcn/src/components/ui/slider.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/slider.js +0 -1
- package/dist/packages/shadcn/src/components/ui/switch.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/switch.js +0 -1
- package/dist/packages/shadcn/src/components/ui/tabs.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/tabs.js +0 -1
- package/dist/packages/shadcn/src/components/ui/textarea.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/textarea.js +0 -1
- package/dist/packages/shadcn/src/components/ui/tooltip.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/tooltip.js +0 -1
- package/dist/packages/shadcn/src/lib/index.cjs +0 -1
- package/dist/packages/shadcn/src/lib/index.js +0 -1
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { CommandEmpty, CommandGroup, CommandItem, CommandList, cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { Check } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/CommandOptionList.tsx
|
|
9
|
+
const CommandOptionList = (props) => {
|
|
10
|
+
const { options, value, onChange, emptyText = "No option found." } = props;
|
|
11
|
+
return /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }), /* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx(CommandItem, {
|
|
12
|
+
value: option.value,
|
|
13
|
+
onSelect: (currentValue) => {
|
|
14
|
+
onChange?.(currentValue === value ? "" : currentValue);
|
|
15
|
+
},
|
|
16
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: "w-full flex items-center justify-between",
|
|
18
|
+
children: [option.label, /* @__PURE__ */ jsx(Check, { className: cn("mr-2 h-4 w-4", value === option.value ? "opacity-100" : "opacity-0") })]
|
|
19
|
+
})
|
|
20
|
+
}, option.value)) })] });
|
|
21
|
+
};
|
|
22
|
+
CommandOptionList.displayName = "CommandOptionList";
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CommandOptionList };
|
package/dist/ContentCard.cjs
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
8
|
+
|
|
9
|
+
//#region src/ContentCard.tsx
|
|
10
|
+
function ContentCard(props) {
|
|
11
|
+
const { title, children, className, marginBottom,...other } = props;
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Card, {
|
|
13
|
+
className: (0, __pixpilot_shadcn.cn)("py-4 sm:py-5", { "mb-2 sm:mb-4": marginBottom }, className),
|
|
14
|
+
...other,
|
|
15
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CardContent, {
|
|
16
|
+
className: (0, __pixpilot_shadcn.cn)("px-4 sm:px-6"),
|
|
17
|
+
children: [title != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
18
|
+
className: (0, __pixpilot_shadcn.cn)("text-xl font-semibold", "mb-1 sm:mb-2"),
|
|
19
|
+
children: title
|
|
20
|
+
}), children]
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
ContentCard.displayName = "ContentBox";
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.ContentCard = ContentCard;
|
package/dist/ContentCard.d.cts
CHANGED
package/dist/ContentCard.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
import{Card
|
|
1
|
+
import { Card, CardContent, cn } from "@pixpilot/shadcn";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/ContentCard.tsx
|
|
6
|
+
function ContentCard(props) {
|
|
7
|
+
const { title, children, className, marginBottom,...other } = props;
|
|
8
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
9
|
+
className: cn("py-4 sm:py-5", { "mb-2 sm:mb-4": marginBottom }, className),
|
|
10
|
+
...other,
|
|
11
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
12
|
+
className: cn("px-4 sm:px-6"),
|
|
13
|
+
children: [title != null && /* @__PURE__ */ jsx("h2", {
|
|
14
|
+
className: cn("text-xl font-semibold", "mb-1 sm:mb-2"),
|
|
15
|
+
children: title
|
|
16
|
+
}), children]
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
ContentCard.displayName = "ContentBox";
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ContentCard };
|
package/dist/DatePicker.cjs
CHANGED
|
@@ -1 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
13
|
+
|
|
14
|
+
//#region src/DatePicker.tsx
|
|
15
|
+
function DatePicker(props) {
|
|
16
|
+
const { value, onChange, placeholder = "Pick a date",...calendarProps } = props;
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Popover, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverTrigger, {
|
|
18
|
+
asChild: true,
|
|
19
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Button, {
|
|
20
|
+
variant: "outline",
|
|
21
|
+
className: (0, __pixpilot_shadcn.cn)("w-full justify-start text-left font-normal", !value && "text-muted-foreground"),
|
|
22
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4" }), value ? value.toLocaleDateString() : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: placeholder })]
|
|
23
|
+
})
|
|
24
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverContent, {
|
|
25
|
+
className: "w-auto p-0",
|
|
26
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Calendar, {
|
|
27
|
+
mode: "single",
|
|
28
|
+
selected: value,
|
|
29
|
+
onSelect: onChange,
|
|
30
|
+
initialFocus: true,
|
|
31
|
+
...calendarProps
|
|
32
|
+
})
|
|
33
|
+
})] });
|
|
34
|
+
}
|
|
35
|
+
DatePicker.displayName = "DatePicker";
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.DatePicker = DatePicker;
|
package/dist/DatePicker.d.cts
CHANGED
package/dist/DatePicker.js
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { Button, Calendar, Popover, PopoverContent, PopoverTrigger, cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { CalendarIcon } from "lucide-react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/DatePicker.tsx
|
|
10
|
+
function DatePicker(props) {
|
|
11
|
+
const { value, onChange, placeholder = "Pick a date",...calendarProps } = props;
|
|
12
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
13
|
+
asChild: true,
|
|
14
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
15
|
+
variant: "outline",
|
|
16
|
+
className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground"),
|
|
17
|
+
children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }), value ? value.toLocaleDateString() : /* @__PURE__ */ jsx("span", { children: placeholder })]
|
|
18
|
+
})
|
|
19
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
20
|
+
className: "w-auto p-0",
|
|
21
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
22
|
+
mode: "single",
|
|
23
|
+
selected: value,
|
|
24
|
+
onSelect: onChange,
|
|
25
|
+
initialFocus: true,
|
|
26
|
+
...calendarProps
|
|
27
|
+
})
|
|
28
|
+
})] });
|
|
29
|
+
}
|
|
30
|
+
DatePicker.displayName = "DatePicker";
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DatePicker };
|
package/dist/LoadingOverlay.cjs
CHANGED
|
@@ -1 +1,65 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
13
|
+
|
|
14
|
+
//#region src/LoadingOverlay.tsx
|
|
15
|
+
const DEFAULT_DELAY = 0;
|
|
16
|
+
const FADE_DURATION = 300;
|
|
17
|
+
const LoadingOverlay = (props) => {
|
|
18
|
+
const { backdrop = true, placement = "center", loading, delay = DEFAULT_DELAY, message } = props;
|
|
19
|
+
const [mounted, setMounted] = (0, react.useState)(false);
|
|
20
|
+
const [visible, setVisible] = (0, react.useState)(false);
|
|
21
|
+
(0, react.useEffect)(() => {
|
|
22
|
+
let timeoutId;
|
|
23
|
+
if (loading) timeoutId = setTimeout(() => {
|
|
24
|
+
setMounted(true);
|
|
25
|
+
requestAnimationFrame(() => {
|
|
26
|
+
requestAnimationFrame(() => {
|
|
27
|
+
setVisible(true);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}, delay);
|
|
31
|
+
else {
|
|
32
|
+
setVisible(false);
|
|
33
|
+
timeoutId = setTimeout(() => {
|
|
34
|
+
setMounted(false);
|
|
35
|
+
}, mounted ? FADE_DURATION : 0);
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
clearTimeout(timeoutId);
|
|
39
|
+
};
|
|
40
|
+
}, [
|
|
41
|
+
loading,
|
|
42
|
+
delay,
|
|
43
|
+
mounted
|
|
44
|
+
]);
|
|
45
|
+
const positionClass = {
|
|
46
|
+
top: "items-start pt-[50px]",
|
|
47
|
+
center: "items-center",
|
|
48
|
+
bottom: "items-end pb-[50px]"
|
|
49
|
+
}[placement];
|
|
50
|
+
if (!mounted) return null;
|
|
51
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
52
|
+
className: (0, __pixpilot_shadcn.cn)("fixed inset-0 z-[9999] flex justify-center transition-opacity", positionClass, backdrop ? "bg-black/50" : "pointer-events-none", visible ? "opacity-100" : "opacity-0"),
|
|
53
|
+
style: { transitionDuration: `${FADE_DURATION}ms` },
|
|
54
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
55
|
+
className: "flex flex-col items-center",
|
|
56
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "text-foreground h-10 w-10 animate-spin" }), message != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
className: "mt-2 text-foreground",
|
|
58
|
+
children: message
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.LoadingOverlay = LoadingOverlay;
|
package/dist/LoadingOverlay.js
CHANGED
|
@@ -1 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { Loader2 } from "lucide-react";
|
|
6
|
+
import React, { useEffect, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/LoadingOverlay.tsx
|
|
10
|
+
const DEFAULT_DELAY = 0;
|
|
11
|
+
const FADE_DURATION = 300;
|
|
12
|
+
const LoadingOverlay = (props) => {
|
|
13
|
+
const { backdrop = true, placement = "center", loading, delay = DEFAULT_DELAY, message } = props;
|
|
14
|
+
const [mounted, setMounted] = useState(false);
|
|
15
|
+
const [visible, setVisible] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
let timeoutId;
|
|
18
|
+
if (loading) timeoutId = setTimeout(() => {
|
|
19
|
+
setMounted(true);
|
|
20
|
+
requestAnimationFrame(() => {
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
setVisible(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}, delay);
|
|
26
|
+
else {
|
|
27
|
+
setVisible(false);
|
|
28
|
+
timeoutId = setTimeout(() => {
|
|
29
|
+
setMounted(false);
|
|
30
|
+
}, mounted ? FADE_DURATION : 0);
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
loading,
|
|
37
|
+
delay,
|
|
38
|
+
mounted
|
|
39
|
+
]);
|
|
40
|
+
const positionClass = {
|
|
41
|
+
top: "items-start pt-[50px]",
|
|
42
|
+
center: "items-center",
|
|
43
|
+
bottom: "items-end pb-[50px]"
|
|
44
|
+
}[placement];
|
|
45
|
+
if (!mounted) return null;
|
|
46
|
+
return /* @__PURE__ */ jsx("div", {
|
|
47
|
+
className: cn("fixed inset-0 z-[9999] flex justify-center transition-opacity", positionClass, backdrop ? "bg-black/50" : "pointer-events-none", visible ? "opacity-100" : "opacity-0"),
|
|
48
|
+
style: { transitionDuration: `${FADE_DURATION}ms` },
|
|
49
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "flex flex-col items-center",
|
|
51
|
+
children: [/* @__PURE__ */ jsx(Loader2, { className: "text-foreground h-10 w-10 animate-spin" }), message != null && /* @__PURE__ */ jsx("div", {
|
|
52
|
+
className: "mt-2 text-foreground",
|
|
53
|
+
children: message
|
|
54
|
+
})]
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { LoadingOverlay };
|
package/dist/Select.cjs
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
8
|
+
|
|
9
|
+
//#region src/Select.tsx
|
|
10
|
+
function Select(props) {
|
|
11
|
+
const { options, value = "", onChange, placeholder,...restProps } = props;
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Select, {
|
|
13
|
+
value,
|
|
14
|
+
onValueChange: onChange,
|
|
15
|
+
...restProps,
|
|
16
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectTrigger, {
|
|
17
|
+
className: "w-full",
|
|
18
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectValue, { placeholder })
|
|
19
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectContent, { children: options?.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectItem, {
|
|
20
|
+
value: String(option.value),
|
|
21
|
+
children: option.label
|
|
22
|
+
}, option.value)) })]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.Select = Select;
|
package/dist/Select.d.cts
CHANGED
package/dist/Select.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
import{Select
|
|
1
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@pixpilot/shadcn";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/Select.tsx
|
|
6
|
+
function Select$1(props) {
|
|
7
|
+
const { options, value = "", onChange, placeholder,...restProps } = props;
|
|
8
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
9
|
+
value,
|
|
10
|
+
onValueChange: onChange,
|
|
11
|
+
...restProps,
|
|
12
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
13
|
+
className: "w-full",
|
|
14
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
|
|
15
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
16
|
+
value: String(option.value),
|
|
17
|
+
children: option.label
|
|
18
|
+
}, option.value)) })]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Select$1 as Select };
|
package/dist/Slider.cjs
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
8
|
+
|
|
9
|
+
//#region src/Slider.tsx
|
|
10
|
+
const Slider = (props) => {
|
|
11
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Slider, {
|
|
12
|
+
...props,
|
|
13
|
+
className: (0, __pixpilot_shadcn.cn)("py-2", props.className)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Slider.displayName = "Slider";
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.Slider = Slider;
|
package/dist/Slider.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import{Slider
|
|
1
|
+
import { Slider, cn } from "@pixpilot/shadcn";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/Slider.tsx
|
|
6
|
+
const Slider$1 = (props) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Slider, {
|
|
8
|
+
...props,
|
|
9
|
+
className: cn("py-2", props.className)
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Slider$1.displayName = "Slider";
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Slider$1 as Slider };
|
package/dist/ThemeToggle.cjs
CHANGED
|
@@ -1 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
9
|
+
let next_themes = require("next-themes");
|
|
10
|
+
next_themes = require_rolldown_runtime.__toESM(next_themes);
|
|
11
|
+
|
|
12
|
+
//#region src/ThemeToggle.tsx
|
|
13
|
+
function SunIcon() {
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
15
|
+
className: "h-5 w-5",
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round",
|
|
23
|
+
strokeWidth: 2,
|
|
24
|
+
d: "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function MoonIcon() {
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
30
|
+
className: "h-5 w-5",
|
|
31
|
+
fill: "none",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round",
|
|
38
|
+
strokeWidth: 2,
|
|
39
|
+
d: "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function SystemIcon() {
|
|
44
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
45
|
+
className: "h-5 w-5",
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "currentColor",
|
|
48
|
+
viewBox: "0 0 24 24",
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
50
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
strokeLinejoin: "round",
|
|
53
|
+
strokeWidth: 2,
|
|
54
|
+
d: "M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function ThemeToggle() {
|
|
59
|
+
const [mounted, setMounted] = (0, react.useState)(false);
|
|
60
|
+
const { theme, setTheme } = (0, next_themes.useTheme)();
|
|
61
|
+
(0, react.useEffect)(() => {
|
|
62
|
+
const timer = setTimeout(() => {
|
|
63
|
+
setMounted(true);
|
|
64
|
+
}, 0);
|
|
65
|
+
return () => {
|
|
66
|
+
clearTimeout(timer);
|
|
67
|
+
};
|
|
68
|
+
}, []);
|
|
69
|
+
if (!mounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
70
|
+
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700",
|
|
71
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600" })
|
|
72
|
+
});
|
|
73
|
+
const toggleTheme = () => {
|
|
74
|
+
if (theme === "light") setTheme("dark");
|
|
75
|
+
else if (theme === "dark") setTheme("system");
|
|
76
|
+
else setTheme("light");
|
|
77
|
+
};
|
|
78
|
+
const getIcon = () => {
|
|
79
|
+
if (theme === "light") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoonIcon, {});
|
|
80
|
+
if (theme === "dark") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemIcon, {});
|
|
81
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SunIcon, {});
|
|
82
|
+
};
|
|
83
|
+
const getTitle = () => {
|
|
84
|
+
if (theme === "light") return "Switch to Dark mode";
|
|
85
|
+
if (theme === "dark") return "Switch to System mode";
|
|
86
|
+
return "Switch to Light mode";
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
89
|
+
onClick: toggleTheme,
|
|
90
|
+
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800",
|
|
91
|
+
title: getTitle(),
|
|
92
|
+
type: "button",
|
|
93
|
+
children: getIcon()
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
exports.ThemeToggle = ThemeToggle;
|
package/dist/ThemeToggle.js
CHANGED
|
@@ -1 +1,94 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import React, { useEffect, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useTheme } from "next-themes";
|
|
7
|
+
|
|
8
|
+
//#region src/ThemeToggle.tsx
|
|
9
|
+
function SunIcon() {
|
|
10
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
11
|
+
className: "h-5 w-5",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
strokeWidth: 2,
|
|
20
|
+
d: "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function MoonIcon() {
|
|
25
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
26
|
+
className: "h-5 w-5",
|
|
27
|
+
fill: "none",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
viewBox: "0 0 24 24",
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round",
|
|
34
|
+
strokeWidth: 2,
|
|
35
|
+
d: "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function SystemIcon() {
|
|
40
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
41
|
+
className: "h-5 w-5",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
46
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round",
|
|
49
|
+
strokeWidth: 2,
|
|
50
|
+
d: "M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function ThemeToggle() {
|
|
55
|
+
const [mounted, setMounted] = useState(false);
|
|
56
|
+
const { theme, setTheme } = useTheme();
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const timer = setTimeout(() => {
|
|
59
|
+
setMounted(true);
|
|
60
|
+
}, 0);
|
|
61
|
+
return () => {
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
};
|
|
64
|
+
}, []);
|
|
65
|
+
if (!mounted) return /* @__PURE__ */ jsx("div", {
|
|
66
|
+
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700",
|
|
67
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600" })
|
|
68
|
+
});
|
|
69
|
+
const toggleTheme = () => {
|
|
70
|
+
if (theme === "light") setTheme("dark");
|
|
71
|
+
else if (theme === "dark") setTheme("system");
|
|
72
|
+
else setTheme("light");
|
|
73
|
+
};
|
|
74
|
+
const getIcon = () => {
|
|
75
|
+
if (theme === "light") return /* @__PURE__ */ jsx(MoonIcon, {});
|
|
76
|
+
if (theme === "dark") return /* @__PURE__ */ jsx(SystemIcon, {});
|
|
77
|
+
return /* @__PURE__ */ jsx(SunIcon, {});
|
|
78
|
+
};
|
|
79
|
+
const getTitle = () => {
|
|
80
|
+
if (theme === "light") return "Switch to Dark mode";
|
|
81
|
+
if (theme === "dark") return "Switch to System mode";
|
|
82
|
+
return "Switch to Light mode";
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ jsx("button", {
|
|
85
|
+
onClick: toggleTheme,
|
|
86
|
+
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800",
|
|
87
|
+
title: getTitle(),
|
|
88
|
+
type: "button",
|
|
89
|
+
children: getIcon()
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { ThemeToggle };
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
exports.__toESM = __toESM;
|