@datum-cloud/datum-ui 2.7.0 → 2.8.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.
@@ -1,7 +1,13 @@
1
- import { Switch as ShadcnSwitch } from '../../../_shadcn/ui/switch';
1
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
2
2
  import * as React from 'react';
3
- declare function Switch({ ref, className, ...props }: React.ComponentProps<typeof ShadcnSwitch> & {
4
- ref?: React.RefObject<React.ElementRef<typeof ShadcnSwitch> | null>;
3
+ /**
4
+ * Switch renders the Radix primitive directly rather than wrapping the shadcn
5
+ * one, because its state glyphs go inside the thumb. Building it here keeps the
6
+ * shadcn base untouched, so that base can be regenerated from upstream without
7
+ * losing anything of ours.
8
+ */
9
+ declare function Switch({ ref, className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
10
+ ref?: React.RefObject<React.ElementRef<typeof SwitchPrimitive.Root> | null>;
5
11
  }): React.JSX.Element;
6
12
  declare namespace Switch {
7
13
  var displayName: string;
@@ -1,3 +1,3 @@
1
- import { A as FormCheckbox, C as FormDialog, D as FormCustom, E as FormDatePicker, M as FormAutosearch, N as FormAutocomplete, O as FormCopyBox, S as FormError, T as FormDateTimePicker, _ as FormRadioGroup, a as useField, b as FormFieldArray, c as useWatchAll, d as FormTextarea, f as FormSwitch, g as FormRoot, h as FormSelectItem, i as useFieldContext, j as FormButton, k as FormCombobox, l as FormTransfer, m as FormSelect, n as useFormState, o as FormWhen, p as FormSubmit, r as useFormContext, s as useWatch, t as Form, u as FormTimePicker, v as FormRadioItem, w as FormDescription, x as FormField, y as FormInput } from "../form-BKxvdIKB.mjs";
1
+ import { A as FormCheckbox, C as FormDialog, D as FormCustom, E as FormDatePicker, M as FormAutosearch, N as FormAutocomplete, O as FormCopyBox, S as FormError, T as FormDateTimePicker, _ as FormRadioGroup, a as useField, b as FormFieldArray, c as useWatchAll, d as FormTextarea, f as FormSwitch, g as FormRoot, h as FormSelectItem, i as useFieldContext, j as FormButton, k as FormCombobox, l as FormTransfer, m as FormSelect, n as useFormState, o as FormWhen, p as FormSubmit, r as useFormContext, s as useWatch, t as Form, u as FormTimePicker, v as FormRadioItem, w as FormDescription, x as FormField, y as FormInput } from "../form-BGlPoZ1G.mjs";
2
2
  import { n as useAdapter, t as FormAdapterProvider } from "../adapter-context-h0jCVqGO.mjs";
3
3
  export { Form, FormAdapterProvider, FormAutocomplete, FormAutosearch, FormButton, FormCheckbox, FormCombobox, FormCopyBox, FormCustom, FormDatePicker, FormDateTimePicker, FormDescription, FormDialog, FormError, FormField, FormFieldArray, FormInput, FormRadioGroup, FormRadioItem, FormRoot, FormSelect, FormSelectItem, FormSubmit, FormSwitch, FormTextarea, FormTimePicker, FormTransfer, FormWhen, useAdapter, useField, useFieldContext, useFormContext, useFormState, useWatch, useWatchAll };
@@ -9,7 +9,7 @@ import { t as Label } from "./label-Bk6FXsju.mjs";
9
9
  import { n as RadioGroupItem, t as RadioGroup } from "./radio-group-LduBVTnh.mjs";
10
10
  import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-CQsG8Kju.mjs";
11
11
  import { t as Tooltip } from "./tooltip-DhbN1BDK.mjs";
12
- import { t as Switch } from "./switch-Z2pJMckf.mjs";
12
+ import { t as Switch } from "./switch-BaR-Vna4.mjs";
13
13
  import { t as Textarea } from "./textarea-B6YhjFVC.mjs";
14
14
  import { t as Autocomplete } from "./autocomplete-BxtzndxZ.mjs";
15
15
  import { Autosearch } from "./autosearch/index.mjs";
package/dist/index.mjs CHANGED
@@ -36,7 +36,7 @@ import { a as SelectLabel, c as SelectSeparator, i as SelectItem, l as SelectTri
36
36
  import { C as SidebarProvider, S as SidebarGroupLabel, _ as SidebarMenuSubButton, a as SidebarInput, b as SidebarGroupAction, c as SidebarSeparator, d as SidebarMenuAction, f as SidebarMenuBadge, g as SidebarMenuSub, h as SidebarMenuSkeleton, i as SidebarHeader, l as SidebarTrigger, m as SidebarMenuItem, n as SidebarContent, o as SidebarInset, p as SidebarMenuButton, r as SidebarFooter, s as SidebarRail, t as Sidebar, u as SidebarMenu, v as SidebarMenuSubItem, w as useSidebar, x as SidebarGroupContent, y as SidebarGroup } from "./sidebar-BeWEEu7P.mjs";
37
37
  import { t as Tooltip } from "./tooltip-DhbN1BDK.mjs";
38
38
  import { Skeleton } from "./skeleton/index.mjs";
39
- import { t as Switch } from "./switch-Z2pJMckf.mjs";
39
+ import { t as Switch } from "./switch-BaR-Vna4.mjs";
40
40
  import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./table/index.mjs";
41
41
  import { Tabs, TabsContent, TabsLinkTrigger, TabsList, TabsTrigger } from "./tabs/index.mjs";
42
42
  import { t as Textarea } from "./textarea-B6YhjFVC.mjs";
@@ -63,7 +63,7 @@ import { t as DateTimePicker } from "./date-time-picker-Bd7qSZVr.mjs";
63
63
  import { a as DropdownMenuItem, c as DropdownMenuRadioGroup, d as DropdownMenuShortcut, f as DropdownMenuSub, h as DropdownMenuTrigger, i as DropdownMenuGroup, l as DropdownMenuRadioItem, m as DropdownMenuSubTrigger, n as DropdownMenuCheckboxItem, o as DropdownMenuLabel, p as DropdownMenuSubContent, r as DropdownMenuContent, s as DropdownMenuPortal, t as DropdownMenu, u as DropdownMenuSeparator } from "./dropdown-Xvduih96.mjs";
64
64
  import { i as FileInputButton, n as DropzoneContent, r as DropzoneEmptyState, t as Dropzone } from "./dropzone-ihksfjN2.mjs";
65
65
  import { t as EmptyContent } from "./empty-content-CmuVcU0P.mjs";
66
- import { A as FormCheckbox, C as FormDialog, D as FormCustom, E as FormDatePicker, M as FormAutosearch, N as FormAutocomplete, O as FormCopyBox, S as FormError, T as FormDateTimePicker, _ as FormRadioGroup, a as useField, b as FormFieldArray, c as useWatchAll, d as FormTextarea, f as FormSwitch, g as FormRoot, h as FormSelectItem, i as useFieldContext, j as FormButton, k as FormCombobox, l as FormTransfer, m as FormSelect, n as useFormState, o as FormWhen, p as FormSubmit, r as useFormContext, s as useWatch, t as Form, u as FormTimePicker, v as FormRadioItem, w as FormDescription, x as FormField, y as FormInput } from "./form-BKxvdIKB.mjs";
66
+ import { A as FormCheckbox, C as FormDialog, D as FormCustom, E as FormDatePicker, M as FormAutosearch, N as FormAutocomplete, O as FormCopyBox, S as FormError, T as FormDateTimePicker, _ as FormRadioGroup, a as useField, b as FormFieldArray, c as useWatchAll, d as FormTextarea, f as FormSwitch, g as FormRoot, h as FormSelectItem, i as useFieldContext, j as FormButton, k as FormCombobox, l as FormTransfer, m as FormSelect, n as useFormState, o as FormWhen, p as FormSubmit, r as useFormContext, s as useWatch, t as Form, u as FormTimePicker, v as FormRadioItem, w as FormDescription, x as FormField, y as FormInput } from "./form-BGlPoZ1G.mjs";
67
67
  import { t as useCopyToClipboard } from "./use-copy-to-clipboard-DZDq_85T.mjs";
68
68
  import { n as useAdapter, t as FormAdapterProvider } from "./adapter-context-h0jCVqGO.mjs";
69
69
  import { InputWithAddons } from "./input-with-addons/index.mjs";
@@ -1,2 +1,2 @@
1
- import { t as Switch } from "../switch-Z2pJMckf.mjs";
1
+ import { t as Switch } from "../switch-BaR-Vna4.mjs";
2
2
  export { Switch };
@@ -0,0 +1,34 @@
1
+ import { t as cn } from "./utils-Bu32wN-x.mjs";
2
+ import { CheckIcon, XIcon } from "lucide-react";
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
6
+ //#region src/components/base/switch/switch.tsx
7
+ /**
8
+ * Switch renders the Radix primitive directly rather than wrapping the shadcn
9
+ * one, because its state glyphs go inside the thumb. Building it here keeps the
10
+ * shadcn base untouched, so that base can be regenerated from upstream without
11
+ * losing anything of ours.
12
+ */
13
+ function Switch({ ref, className, ...props }) {
14
+ return /* @__PURE__ */ jsx(SwitchPrimitive.Root, {
15
+ ref,
16
+ "data-slot": "switch",
17
+ className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-6 w-11 shrink-0 items-center rounded-full border border-transparent shadow-xs outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", "transition-[background-color,border-color,box-shadow] duration-[var(--duration-fast)] ease-out", className),
18
+ ...props,
19
+ children: /* @__PURE__ */ jsxs(SwitchPrimitive.Thumb, {
20
+ "data-slot": "switch-thumb",
21
+ className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground text-muted-foreground dark:data-[state=unchecked]:text-background dark:data-[state=checked]:text-primary group pointer-events-none flex size-5 items-center justify-center rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%+2px)] data-[state=unchecked]:translate-x-0"),
22
+ children: [/* @__PURE__ */ jsx(XIcon, {
23
+ "aria-hidden": true,
24
+ className: "size-3 group-data-[state=checked]:hidden"
25
+ }), /* @__PURE__ */ jsx(CheckIcon, {
26
+ "aria-hidden": true,
27
+ className: "hidden size-3 group-data-[state=checked]:block"
28
+ })]
29
+ })
30
+ });
31
+ }
32
+ Switch.displayName = "Switch";
33
+ //#endregion
34
+ export { Switch as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datum-cloud/datum-ui",
3
3
  "type": "module",
4
- "version": "2.7.0",
4
+ "version": "2.8.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "url": "https://github.com/datum-cloud/datum-ui"
@@ -1,28 +0,0 @@
1
- import { t as cn } from "./utils-Bu32wN-x.mjs";
2
- import "react";
3
- import { jsx } from "react/jsx-runtime";
4
- import * as SwitchPrimitive from "@radix-ui/react-switch";
5
- //#region ../shadcn/ui/switch.tsx
6
- function Switch$1({ className, ...props }) {
7
- return /* @__PURE__ */ jsx(SwitchPrimitive.Root, {
8
- "data-slot": "switch",
9
- className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
10
- ...props,
11
- children: /* @__PURE__ */ jsx(SwitchPrimitive.Thumb, {
12
- "data-slot": "switch-thumb",
13
- className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")
14
- })
15
- });
16
- }
17
- //#endregion
18
- //#region src/components/base/switch/switch.tsx
19
- function Switch({ ref, className, ...props }) {
20
- return /* @__PURE__ */ jsx(Switch$1, {
21
- ref,
22
- className: cn("transition-[background-color,border-color,box-shadow] duration-[var(--duration-fast)] ease-out", className),
23
- ...props
24
- });
25
- }
26
- Switch.displayName = "Switch";
27
- //#endregion
28
- export { Switch as t };