@olundot/ui 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @olundot/ui
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add the shared OLUN theme transition contract and theme helper API.
8
+
9
+ - `@olundot/tokens` now exposes a 300ms default theme transition token contract.
10
+ - `@olundot/ui` now exports `getOlunThemeState`, `setOlunTheme`, and `useOlunTheme` for synchronized light/dark theme controls.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - @olundot/tokens@0.10.0
16
+
3
17
  ## 0.4.0
4
18
 
5
19
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -9,11 +9,31 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
 
10
10
  declare function cn(...inputs: ClassValue[]): string;
11
11
 
12
+ type OlunTheme = "light" | "dark";
13
+ type OlunThemeDuration = "instant" | "fast" | "base" | "slow" | "slower" | "slowest";
14
+ interface OlunThemeState {
15
+ theme: OlunTheme;
16
+ resolvedTheme: OlunTheme;
17
+ storedTheme: OlunTheme | null;
18
+ source: "attribute" | "stored" | "system" | "default";
19
+ }
20
+ interface SetOlunThemeOptions {
21
+ duration?: OlunThemeDuration;
22
+ }
23
+ interface UseOlunThemeValue extends OlunThemeState {
24
+ mounted: boolean;
25
+ setTheme: (nextTheme: OlunTheme, options?: SetOlunThemeOptions) => void;
26
+ toggleTheme: (options?: SetOlunThemeOptions) => void;
27
+ }
28
+ declare function getOlunThemeState(): OlunThemeState;
29
+ declare function setOlunTheme(nextTheme: OlunTheme, options?: SetOlunThemeOptions): void;
30
+ declare function useOlunTheme(): UseOlunThemeValue;
31
+
12
32
  type SurfaceLevel = "surface" | "canvas" | "raised";
13
33
 
14
34
  declare const buttonVariants: (props?: ({
15
- variant?: "primary" | "secondary" | "destructive" | "outline" | "ghost" | "danger" | "emergency" | "subtle" | "default" | "link" | null | undefined;
16
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "default" | "icon" | "icon-xs" | null | undefined;
35
+ variant?: "default" | "primary" | "outline" | "ghost" | "danger" | "emergency" | "subtle" | "destructive" | "secondary" | "link" | null | undefined;
36
+ size?: "default" | "xs" | "sm" | "md" | "lg" | "xl" | "icon" | "icon-xs" | null | undefined;
17
37
  } & class_variance_authority_types.ClassProp) | undefined) => string;
18
38
  type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;
19
39
  type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;
@@ -34,7 +54,7 @@ type CopyButtonProps = Omit<ButtonProps, 'children' | 'leadingIcon' | 'loading'
34
54
  variant?: ButtonVariant;
35
55
  duration?: number;
36
56
  };
37
- declare const CopyButton: React.ForwardRefExoticComponent<Omit<ButtonProps, "variant" | "size" | "leadingIcon" | "trailingIcon" | "loading" | "children"> & {
57
+ declare const CopyButton: React.ForwardRefExoticComponent<Omit<ButtonProps, "size" | "variant" | "leadingIcon" | "trailingIcon" | "loading" | "children"> & {
38
58
  value: string;
39
59
  label?: React.ReactNode;
40
60
  copiedLabel?: React.ReactNode;
@@ -50,7 +70,7 @@ declare const inputVariants: (props?: ({
50
70
  surface?: SurfaceLevel | null | undefined;
51
71
  } & class_variance_authority_types.ClassProp) | undefined) => string;
52
72
  declare const inputMessageVariants: (props?: ({
53
- state?: "error" | "success" | "default" | null | undefined;
73
+ state?: "default" | "error" | "success" | null | undefined;
54
74
  size?: "sm" | "md" | "lg" | null | undefined;
55
75
  } & class_variance_authority_types.ClassProp) | undefined) => string;
56
76
  type InputState = NonNullable<VariantProps<typeof inputMessageVariants>["state"]>;
@@ -99,11 +119,11 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
99
119
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
100
120
 
101
121
  declare const fileUploadZoneVariants: (props?: ({
102
- size?: "compact" | "default" | null | undefined;
122
+ size?: "default" | "compact" | null | undefined;
103
123
  surface?: SurfaceLevel | null | undefined;
104
124
  } & class_variance_authority_types.ClassProp) | undefined) => string;
105
125
  declare const fileUploadIconVariants: (props?: ({
106
- size?: "compact" | "default" | null | undefined;
126
+ size?: "default" | "compact" | null | undefined;
107
127
  } & class_variance_authority_types.ClassProp) | undefined) => string;
108
128
  interface FileUploadZoneProps extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "onChange">, VariantProps<typeof fileUploadZoneVariants> {
109
129
  accept?: string;
@@ -122,10 +142,10 @@ interface FileUploadZoneProps extends Omit<React.LabelHTMLAttributes<HTMLLabelEl
122
142
  declare const FileUploadZone: React.ForwardRefExoticComponent<FileUploadZoneProps & React.RefAttributes<HTMLLabelElement>>;
123
143
 
124
144
  declare const alertVariants: (props?: ({
125
- variant?: "error" | "warning" | "info" | "success" | null | undefined;
145
+ variant?: "error" | "success" | "info" | "warning" | null | undefined;
126
146
  } & class_variance_authority_types.ClassProp) | undefined) => string;
127
147
  declare const inlineAlertVariants: (props?: ({
128
- variant?: "error" | "warning" | "info" | "success" | null | undefined;
148
+ variant?: "error" | "success" | "info" | "warning" | null | undefined;
129
149
  surface?: "filled" | "plain" | null | undefined;
130
150
  } & class_variance_authority_types.ClassProp) | undefined) => string;
131
151
  type AlertVariant = NonNullable<VariantProps<typeof alertVariants>['variant']>;
@@ -155,7 +175,7 @@ declare const textareaVariants: (props?: ({
155
175
  surface?: SurfaceLevel | null | undefined;
156
176
  } & class_variance_authority_types.ClassProp) | undefined) => string;
157
177
  declare const textareaMessageVariants: (props?: ({
158
- state?: "error" | "success" | "default" | null | undefined;
178
+ state?: "default" | "error" | "success" | null | undefined;
159
179
  } & class_variance_authority_types.ClassProp) | undefined) => string;
160
180
  type TextareaState = NonNullable<VariantProps<typeof textareaMessageVariants>["state"]>;
161
181
  /** Canonical size type (0.2.0+). Use `size` prop with these values. */
@@ -210,7 +230,7 @@ declare const selectVariants: (props?: ({
210
230
  surface?: SurfaceLevel | null | undefined;
211
231
  } & class_variance_authority_types.ClassProp) | undefined) => string;
212
232
  declare const selectMessageVariants: (props?: ({
213
- state?: "error" | "success" | "default" | null | undefined;
233
+ state?: "default" | "error" | "success" | null | undefined;
214
234
  size?: "sm" | "md" | "lg" | null | undefined;
215
235
  } & class_variance_authority_types.ClassProp) | undefined) => string;
216
236
  type SelectState = NonNullable<VariantProps<typeof selectMessageVariants>["state"]>;
@@ -834,8 +854,8 @@ declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProp
834
854
  declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<Popover$1.PopoverArrowProps & React.RefAttributes<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
835
855
 
836
856
  declare const badgeVariants: (props?: ({
837
- variant?: "brand" | "neutral" | "status" | "semantic" | "pill" | "vibrant" | null | undefined;
838
- tone?: "accent" | "warning" | "info" | "success" | "neutral" | "danger" | null | undefined;
857
+ variant?: "status" | "semantic" | "neutral" | "brand" | "pill" | "vibrant" | null | undefined;
858
+ tone?: "accent" | "danger" | "success" | "info" | "warning" | "neutral" | null | undefined;
839
859
  size?: "xs" | "sm" | "md" | null | undefined;
840
860
  } & class_variance_authority_types.ClassProp) | undefined) => string;
841
861
  declare const badgeDotVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
@@ -853,7 +873,7 @@ declare const twoTierBadgeVariants: (props?: ({
853
873
  } & class_variance_authority_types.ClassProp) | undefined) => string;
854
874
  declare const twoTierBadgeLineVariants: (props?: ({
855
875
  tier?: "primary" | "secondary" | null | undefined;
856
- intent?: "brand" | "muted" | "warning" | "success" | "neutral" | "danger" | null | undefined;
876
+ intent?: "danger" | "success" | "warning" | "neutral" | "brand" | "muted" | null | undefined;
857
877
  } & class_variance_authority_types.ClassProp) | undefined) => string;
858
878
  type TwoTierBadgeIntent = NonNullable<VariantProps<typeof twoTierBadgeLineVariants>["intent"]>;
859
879
  interface TwoTierBadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof twoTierBadgeVariants> {
@@ -867,7 +887,7 @@ interface TwoTierBadgeProps extends React.HTMLAttributes<HTMLDivElement>, Varian
867
887
  declare const TwoTierBadge: React.ForwardRefExoticComponent<TwoTierBadgeProps & React.RefAttributes<HTMLDivElement>>;
868
888
 
869
889
  declare const statusBadgeVariants: (props?: ({
870
- status?: "error" | "warning" | "info" | "success" | "active" | "pending" | "archived" | null | undefined;
890
+ status?: "error" | "success" | "info" | "warning" | "active" | "pending" | "archived" | null | undefined;
871
891
  size?: "xs" | "sm" | "md" | null | undefined;
872
892
  } & class_variance_authority_types.ClassProp) | undefined) => string;
873
893
  declare const statusBadgeDotVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
@@ -897,12 +917,12 @@ declare const NotificationBadge: React.ForwardRefExoticComponent<NotificationBad
897
917
 
898
918
  declare const chipVariants: (props?: ({
899
919
  variant?: "filter" | "choice" | "removable" | "status-filter" | null | undefined;
900
- tone?: "muted" | "accent" | "warning" | "success" | "neutral" | "danger" | null | undefined;
920
+ tone?: "accent" | "danger" | "success" | "warning" | "neutral" | "muted" | null | undefined;
901
921
  size?: "sm" | "md" | "lg" | null | undefined;
902
922
  pressed?: boolean | null | undefined;
903
923
  } & class_variance_authority_types.ClassProp) | undefined) => string;
904
924
  declare const chipCountVariants: (props?: ({
905
- tone?: "muted" | "accent" | "warning" | "success" | "neutral" | "danger" | null | undefined;
925
+ tone?: "accent" | "danger" | "success" | "warning" | "neutral" | "muted" | null | undefined;
906
926
  size?: "sm" | "md" | "lg" | null | undefined;
907
927
  } & class_variance_authority_types.ClassProp) | undefined) => string;
908
928
  type ChipVariant = NonNullable<VariantProps<typeof chipVariants>["variant"]>;
@@ -1096,7 +1116,7 @@ interface ActionFooterProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
1096
1116
  declare const ActionFooter: React.ForwardRefExoticComponent<ActionFooterProps & React.RefAttributes<HTMLDivElement>>;
1097
1117
 
1098
1118
  declare const toastVariants: (props?: ({
1099
- variant?: "error" | "warning" | "info" | "success" | "default" | null | undefined;
1119
+ variant?: "default" | "error" | "success" | "info" | "warning" | null | undefined;
1100
1120
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1101
1121
  declare const toastViewportVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
1102
1122
  type ToastVariant = NonNullable<VariantProps<typeof toastVariants>['variant']>;
@@ -1137,17 +1157,17 @@ interface ToastProviderProps extends React.HTMLAttributes<HTMLDivElement> {
1137
1157
  declare function ToastProvider({ children, maxToasts, className, ...props }: ToastProviderProps): react_jsx_runtime.JSX.Element;
1138
1158
 
1139
1159
  declare const otpFieldVariants: (props?: ({
1140
- size?: "compact" | "default" | null | undefined;
1160
+ size?: "default" | "compact" | null | undefined;
1141
1161
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1142
1162
  declare const otpFieldGroupVariants: (props?: ({
1143
- size?: "compact" | "default" | null | undefined;
1163
+ size?: "default" | "compact" | null | undefined;
1144
1164
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1145
1165
  declare const otpCellVariants: (props?: ({
1146
- size?: "compact" | "default" | null | undefined;
1166
+ size?: "default" | "compact" | null | undefined;
1147
1167
  surface?: SurfaceLevel | null | undefined;
1148
1168
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1149
1169
  declare const otpFieldMessageVariants: (props?: ({
1150
- state?: "error" | "default" | null | undefined;
1170
+ state?: "default" | "error" | null | undefined;
1151
1171
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1152
1172
  type OTPFieldSize = NonNullable<VariantProps<typeof otpCellVariants>["size"]>;
1153
1173
  interface OTPFieldProps extends Omit<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, "onChange" | "children" | "defaultValue" | "value">, VariantProps<typeof otpFieldVariants> {
@@ -1203,11 +1223,11 @@ declare const checkboxBoxVariants: (props?: ({
1203
1223
  size?: "sm" | "md" | null | undefined;
1204
1224
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1205
1225
  declare const checkboxGroupItemVariants: (props?: ({
1206
- appearance?: "card" | "plain" | null | undefined;
1226
+ appearance?: "plain" | "card" | null | undefined;
1207
1227
  density?: "compact" | "comfortable" | null | undefined;
1208
1228
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1209
1229
  declare const checkboxGroupBoxVariants: (props?: ({
1210
- appearance?: "card" | "plain" | null | undefined;
1230
+ appearance?: "plain" | "card" | null | undefined;
1211
1231
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1212
1232
  type CheckboxSize = NonNullable<VariantProps<typeof checkboxBoxVariants>["size"]>;
1213
1233
  type CheckboxCheckedState = React.ComponentProps<typeof Checkbox$1.Root>["checked"];
@@ -1232,7 +1252,7 @@ interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<typeof Check
1232
1252
  declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
1233
1253
 
1234
1254
  declare const checkboxGroupVariants: (props?: ({
1235
- appearance?: "card" | "plain" | null | undefined;
1255
+ appearance?: "plain" | "card" | null | undefined;
1236
1256
  orientation?: "horizontal" | "vertical" | null | undefined;
1237
1257
  columns?: "one" | "two" | "three" | null | undefined;
1238
1258
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -1253,16 +1273,16 @@ interface CheckboxGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
1253
1273
  declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>;
1254
1274
 
1255
1275
  declare const radioGroupVariants: (props?: ({
1256
- appearance?: "card" | "plain" | null | undefined;
1276
+ appearance?: "plain" | "card" | null | undefined;
1257
1277
  orientation?: "horizontal" | "vertical" | null | undefined;
1258
1278
  columns?: "one" | "two" | "three" | null | undefined;
1259
1279
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1260
1280
  declare const radioVariants: (props?: ({
1261
- appearance?: "card" | "plain" | null | undefined;
1281
+ appearance?: "plain" | "card" | null | undefined;
1262
1282
  density?: "compact" | "comfortable" | null | undefined;
1263
1283
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1264
1284
  declare const radioControlVariants: (props?: ({
1265
- appearance?: "card" | "plain" | null | undefined;
1285
+ appearance?: "plain" | "card" | null | undefined;
1266
1286
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1267
1287
  type RadioGroupAppearance = NonNullable<VariantProps<typeof radioGroupVariants>["appearance"]>;
1268
1288
  type RadioGroupColumns = NonNullable<VariantProps<typeof radioGroupVariants>["columns"]>;
@@ -1349,4 +1369,4 @@ interface OrganizationLogoProps extends Omit<SVGProps<SVGSVGElement>, "width" |
1349
1369
  }
1350
1370
  declare function OrganizationLogo({ organization, size, className, style, role, "aria-label": ariaLabel, "aria-hidden": ariaHidden, ...props }: OrganizationLogoProps): react_jsx_runtime.JSX.Element;
1351
1371
 
1352
- export { ActionFooter, type ActionFooterAction, type ActionFooterProps, type ActionFooterStatus, Alert, type AlertProps, type AlertVariant, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardProse, CardTitle, type CardVariant, type CardVariantOptions, Checkbox, type CheckboxCheckedState, CheckboxGroup, type CheckboxGroupAppearance, type CheckboxGroupColumns, CheckboxGroupContext, type CheckboxGroupContextValue, type CheckboxGroupDensity, type CheckboxGroupOrientation, type CheckboxGroupProps, type CheckboxProps, type CheckboxSize, Chip, type ChipProps, type ChipSize, type ChipTone, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, CopyButton, type CopyButtonProps, DataTable, type DataTableBulkAction, type DataTableColumn, type DataTableProps, type DataTableSort, DetailLayout, type DetailLayoutProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogRawContent, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, type EmptyStateTone, type EmptyStateVariantOptions, ErrorState, type ErrorStateProps, FileUploadZone, type FileUploadZoneProps, FilterToolbar, type FilterToolbarProps, FormField, type FormFieldProps, type FormFieldRenderProps, FormLayout, type FormLayoutProps, type FormLayoutSection, FormModal, type FormModalProps, IconButton, type IconButtonBadgeTone, type IconButtonProps, type IconButtonSize, type IconButtonVariant, InfoModal, type InfoModalProps, InlineAlert, type InlineAlertProps, Input, type InputProps, type InputSize, type InputSizeLegacy, type InputState, Label, type LabelProps, ModeToggle, type ModeToggleOption, type ModeToggleProps, NotificationBadge, type NotificationBadgePlacement, type NotificationBadgeProps, type NotificationBadgeSize, OTPField, type OTPFieldProps, type OTPFieldSize, OlunLogo, OlunSymbol, OrganizationLogo, type OrganizationLogoId, type OrganizationLogoProps, PageHeader, type PageHeaderProps, Pagination, type PaginationProps, type PaginationSize, PermissionContext, type PermissionEvaluator, type PermissionFallback, PermissionGuard, type PermissionGuardProps, PermissionProvider, type PermissionProviderProps, type PermissionScope, type PermissionState, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, Progress, type ProgressProps, type ProgressStatus, Radio, RadioGroup, type RadioGroupAppearance, type RadioGroupColumns, type RadioGroupDensity, type RadioGroupOrientation, type RadioGroupProps, type RadioProps, ScrollArea, ScrollBar, SearchField, type SearchFieldProps, type SearchFieldSize, Select, type SelectAppearance, type SelectOption, type SelectProps, type SelectSize, type SelectState, type SelectVariant, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetDrawer, type SheetDrawerProps, SheetFooter, SheetHeader, type SheetMotionConfig, type SheetMotionDuration, type SheetMotionEasing, type SheetMotionType, SheetTitle, SheetTrigger, Skeleton, type SkeletonProps, SkeletonRow, type SkeletonRowColumn, type SkeletonRowProps, SkeletonText, type SkeletonTextProps, Spinner, type SpinnerProps, StatusBadge, type StatusBadgeProps, type StatusBadgeStatus, type SurfaceLevel, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsProps, type TabsVariant, Textarea, type TextareaProps, type TextareaSize, type TextareaSizeLegacy, type TextareaState, ThemeFab, type ThemeFabProps, ThemeToggle, type ToastAction, type ToastItem, type ToastOptions, ToastProvider, ToastRoot, type ToastVariant, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoTierBadge, type TwoTierBadgeIntent, type TwoTierBadgeProps, WizardLayout, type WizardLayoutProps, type WizardStep, type WizardStepState, actionFooterStatusVariants, actionFooterVariants, alertVariants, badgeDotVariants, badgeVariants, buttonVariants, cardVariants, checkboxBoxVariants, checkboxFieldVariants, checkboxGroupBoxVariants, checkboxGroupItemVariants, checkboxGroupVariants, checkboxRootVariants, checkboxVariants, chipCountVariants, chipVariants, cn, dataTableRowVariants, dataTableVariants, emptyStateIconVariants, emptyStateVariants, errorStateVariants, evaluatePermission, fileUploadIconVariants, fileUploadZoneVariants, formFieldControlStackClassName, formFieldDescriptionClassName, formFieldErrorClassName, formFieldLabelClassName, formFieldRequiredClassName, formFieldVariants, getToastDuration, iconButtonBadgeVariants, iconButtonVariants, inlineAlertVariants, inputMessageVariants, inputVariants, limitToasts, modeToggleItemVariants, modeToggleVariants, notificationBadgeVariants, otpCellVariants, otpFieldGroupVariants, otpFieldMessageVariants, otpFieldVariants, paginationControlVariants, paginationVariants, radioControlVariants, radioGroupVariants, radioVariants, searchFieldInputVariants, searchFieldVariants, selectMessageVariants, selectVariants, skeletonVariants, spinnerVariants, statusBadgeDotVariants, statusBadgeVariants, tabsBadgeVariants, tabsListVariants, tabsRootVariants, tabsTriggerVariants, textareaMessageVariants, textareaVariants, toast, toastVariants, toastViewportVariants, twoTierBadgeLineVariants, twoTierBadgeVariants, usePermission };
1372
+ export { ActionFooter, type ActionFooterAction, type ActionFooterProps, type ActionFooterStatus, Alert, type AlertProps, type AlertVariant, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardProse, CardTitle, type CardVariant, type CardVariantOptions, Checkbox, type CheckboxCheckedState, CheckboxGroup, type CheckboxGroupAppearance, type CheckboxGroupColumns, CheckboxGroupContext, type CheckboxGroupContextValue, type CheckboxGroupDensity, type CheckboxGroupOrientation, type CheckboxGroupProps, type CheckboxProps, type CheckboxSize, Chip, type ChipProps, type ChipSize, type ChipTone, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, CopyButton, type CopyButtonProps, DataTable, type DataTableBulkAction, type DataTableColumn, type DataTableProps, type DataTableSort, DetailLayout, type DetailLayoutProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogRawContent, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, type EmptyStateTone, type EmptyStateVariantOptions, ErrorState, type ErrorStateProps, FileUploadZone, type FileUploadZoneProps, FilterToolbar, type FilterToolbarProps, FormField, type FormFieldProps, type FormFieldRenderProps, FormLayout, type FormLayoutProps, type FormLayoutSection, FormModal, type FormModalProps, IconButton, type IconButtonBadgeTone, type IconButtonProps, type IconButtonSize, type IconButtonVariant, InfoModal, type InfoModalProps, InlineAlert, type InlineAlertProps, Input, type InputProps, type InputSize, type InputSizeLegacy, type InputState, Label, type LabelProps, ModeToggle, type ModeToggleOption, type ModeToggleProps, NotificationBadge, type NotificationBadgePlacement, type NotificationBadgeProps, type NotificationBadgeSize, OTPField, type OTPFieldProps, type OTPFieldSize, OlunLogo, OlunSymbol, type OlunTheme, type OlunThemeDuration, type OlunThemeState, OrganizationLogo, type OrganizationLogoId, type OrganizationLogoProps, PageHeader, type PageHeaderProps, Pagination, type PaginationProps, type PaginationSize, PermissionContext, type PermissionEvaluator, type PermissionFallback, PermissionGuard, type PermissionGuardProps, PermissionProvider, type PermissionProviderProps, type PermissionScope, type PermissionState, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, Progress, type ProgressProps, type ProgressStatus, Radio, RadioGroup, type RadioGroupAppearance, type RadioGroupColumns, type RadioGroupDensity, type RadioGroupOrientation, type RadioGroupProps, type RadioProps, ScrollArea, ScrollBar, SearchField, type SearchFieldProps, type SearchFieldSize, Select, type SelectAppearance, type SelectOption, type SelectProps, type SelectSize, type SelectState, type SelectVariant, Separator, type SetOlunThemeOptions, Sheet, SheetClose, SheetContent, SheetDescription, SheetDrawer, type SheetDrawerProps, SheetFooter, SheetHeader, type SheetMotionConfig, type SheetMotionDuration, type SheetMotionEasing, type SheetMotionType, SheetTitle, SheetTrigger, Skeleton, type SkeletonProps, SkeletonRow, type SkeletonRowColumn, type SkeletonRowProps, SkeletonText, type SkeletonTextProps, Spinner, type SpinnerProps, StatusBadge, type StatusBadgeProps, type StatusBadgeStatus, type SurfaceLevel, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsProps, type TabsVariant, Textarea, type TextareaProps, type TextareaSize, type TextareaSizeLegacy, type TextareaState, ThemeFab, type ThemeFabProps, ThemeToggle, type ToastAction, type ToastItem, type ToastOptions, ToastProvider, ToastRoot, type ToastVariant, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoTierBadge, type TwoTierBadgeIntent, type TwoTierBadgeProps, type UseOlunThemeValue, WizardLayout, type WizardLayoutProps, type WizardStep, type WizardStepState, actionFooterStatusVariants, actionFooterVariants, alertVariants, badgeDotVariants, badgeVariants, buttonVariants, cardVariants, checkboxBoxVariants, checkboxFieldVariants, checkboxGroupBoxVariants, checkboxGroupItemVariants, checkboxGroupVariants, checkboxRootVariants, checkboxVariants, chipCountVariants, chipVariants, cn, dataTableRowVariants, dataTableVariants, emptyStateIconVariants, emptyStateVariants, errorStateVariants, evaluatePermission, fileUploadIconVariants, fileUploadZoneVariants, formFieldControlStackClassName, formFieldDescriptionClassName, formFieldErrorClassName, formFieldLabelClassName, formFieldRequiredClassName, formFieldVariants, getOlunThemeState, getToastDuration, iconButtonBadgeVariants, iconButtonVariants, inlineAlertVariants, inputMessageVariants, inputVariants, limitToasts, modeToggleItemVariants, modeToggleVariants, notificationBadgeVariants, otpCellVariants, otpFieldGroupVariants, otpFieldMessageVariants, otpFieldVariants, paginationControlVariants, paginationVariants, radioControlVariants, radioGroupVariants, radioVariants, searchFieldInputVariants, searchFieldVariants, selectMessageVariants, selectVariants, setOlunTheme, skeletonVariants, spinnerVariants, statusBadgeDotVariants, statusBadgeVariants, tabsBadgeVariants, tabsListVariants, tabsRootVariants, tabsTriggerVariants, textareaMessageVariants, textareaVariants, toast, toastVariants, toastViewportVariants, twoTierBadgeLineVariants, twoTierBadgeVariants, useOlunTheme, usePermission };
package/dist/index.js CHANGED
@@ -14,6 +14,165 @@ function cn(...inputs) {
14
14
  return twMerge(clsx(inputs));
15
15
  }
16
16
 
17
+ // src/lib/theme.ts
18
+ import { useCallback, useEffect, useState } from "react";
19
+ var STORAGE_KEY = "olun-theme";
20
+ var LEGACY_STORAGE_KEY = "olun-theme-mode";
21
+ var TRANSITION_ATTR = "olunThemeTransition";
22
+ var TRANSITION_DURATION_PROPERTY = "--olun-theme-transition-duration";
23
+ var durationMsByToken = {
24
+ instant: 0,
25
+ fast: 150,
26
+ base: 200,
27
+ slow: 300,
28
+ slower: 400,
29
+ slowest: 600
30
+ };
31
+ var transitionCleanupTimer;
32
+ var defaultThemeState = {
33
+ theme: "light",
34
+ resolvedTheme: "light",
35
+ storedTheme: null,
36
+ source: "default"
37
+ };
38
+ function isOlunTheme(value) {
39
+ return value === "light" || value === "dark";
40
+ }
41
+ function readStoredTheme() {
42
+ if (typeof window === "undefined") return null;
43
+ try {
44
+ const saved = window.localStorage.getItem(STORAGE_KEY);
45
+ if (isOlunTheme(saved)) return saved;
46
+ const legacy = window.localStorage.getItem(LEGACY_STORAGE_KEY);
47
+ return isOlunTheme(legacy) ? legacy : null;
48
+ } catch {
49
+ return null;
50
+ }
51
+ }
52
+ function resolveSystemTheme() {
53
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
54
+ return "light";
55
+ }
56
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
57
+ }
58
+ function getReducedMotionDurationMs(duration) {
59
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
60
+ return durationMsByToken.fast;
61
+ }
62
+ return durationMsByToken[duration];
63
+ }
64
+ function getOlunThemeState() {
65
+ if (typeof document !== "undefined") {
66
+ const attr = document.documentElement.getAttribute("data-theme");
67
+ if (isOlunTheme(attr)) {
68
+ return {
69
+ theme: attr,
70
+ resolvedTheme: attr,
71
+ storedTheme: readStoredTheme(),
72
+ source: "attribute"
73
+ };
74
+ }
75
+ }
76
+ const storedTheme = readStoredTheme();
77
+ if (storedTheme) {
78
+ return {
79
+ theme: storedTheme,
80
+ resolvedTheme: storedTheme,
81
+ storedTheme,
82
+ source: "stored"
83
+ };
84
+ }
85
+ if (typeof window !== "undefined") {
86
+ const systemTheme = resolveSystemTheme();
87
+ return {
88
+ theme: systemTheme,
89
+ resolvedTheme: systemTheme,
90
+ storedTheme: null,
91
+ source: "system"
92
+ };
93
+ }
94
+ return defaultThemeState;
95
+ }
96
+ function setOlunTheme(nextTheme, options = {}) {
97
+ if (typeof document === "undefined") return;
98
+ const duration = options.duration ?? "slow";
99
+ const root = document.documentElement;
100
+ if (transitionCleanupTimer !== void 0) {
101
+ window.clearTimeout(transitionCleanupTimer);
102
+ transitionCleanupTimer = void 0;
103
+ }
104
+ if (duration !== "instant") {
105
+ root.dataset[TRANSITION_ATTR] = "true";
106
+ root.style.setProperty(
107
+ TRANSITION_DURATION_PROPERTY,
108
+ `var(--duration-${duration})`
109
+ );
110
+ void root.offsetWidth;
111
+ }
112
+ root.setAttribute("data-theme", nextTheme);
113
+ root.setAttribute("data-theme-mode", nextTheme);
114
+ try {
115
+ window.localStorage.setItem(STORAGE_KEY, nextTheme);
116
+ window.localStorage.removeItem(LEGACY_STORAGE_KEY);
117
+ } catch {
118
+ }
119
+ if (duration !== "instant") {
120
+ const cleanupDelay = getReducedMotionDurationMs(duration) + 80;
121
+ transitionCleanupTimer = window.setTimeout(() => {
122
+ delete root.dataset[TRANSITION_ATTR];
123
+ root.style.removeProperty(TRANSITION_DURATION_PROPERTY);
124
+ transitionCleanupTimer = void 0;
125
+ }, cleanupDelay);
126
+ }
127
+ }
128
+ function useOlunTheme() {
129
+ const [state, setState] = useState(defaultThemeState);
130
+ const [mounted, setMounted] = useState(false);
131
+ useEffect(() => {
132
+ setMounted(true);
133
+ const sync = () => setState(getOlunThemeState());
134
+ sync();
135
+ const observer = new MutationObserver(sync);
136
+ observer.observe(document.documentElement, {
137
+ attributes: true,
138
+ attributeFilter: ["data-theme"]
139
+ });
140
+ const onStorage = (event) => {
141
+ if (event.key === STORAGE_KEY || event.key === LEGACY_STORAGE_KEY) sync();
142
+ };
143
+ window.addEventListener("storage", onStorage);
144
+ return () => {
145
+ observer.disconnect();
146
+ window.removeEventListener("storage", onStorage);
147
+ };
148
+ }, []);
149
+ const setTheme = useCallback(
150
+ (nextTheme, options) => {
151
+ setState((current) => ({
152
+ theme: nextTheme,
153
+ resolvedTheme: nextTheme,
154
+ storedTheme: nextTheme,
155
+ source: "attribute"
156
+ }));
157
+ setOlunTheme(nextTheme, options);
158
+ },
159
+ []
160
+ );
161
+ const toggleTheme = useCallback(
162
+ (options) => {
163
+ const nextTheme = state.resolvedTheme === "dark" ? "light" : "dark";
164
+ setTheme(nextTheme, options);
165
+ },
166
+ [setTheme, state.resolvedTheme]
167
+ );
168
+ return {
169
+ ...state,
170
+ mounted,
171
+ setTheme,
172
+ toggleTheme
173
+ };
174
+ }
175
+
17
176
  // src/components/ui/button.tsx
18
177
  import * as React from "react";
19
178
  import { cva } from "class-variance-authority";
@@ -7798,46 +7957,15 @@ function OlunLogo({
7798
7957
  }
7799
7958
 
7800
7959
  // src/components/branding/theme-toggle.tsx
7801
- import { useEffect as useEffect4, useState as useState13 } from "react";
7802
7960
  import { Sun, Moon } from "lucide-react";
7803
7961
  import { jsx as jsx52 } from "react/jsx-runtime";
7804
7962
  function ThemeToggle({ className }) {
7805
- const [theme, setTheme] = useState13("light");
7806
- useEffect4(() => {
7807
- const resolve = () => {
7808
- const attr = document.documentElement.getAttribute("data-theme");
7809
- if (attr === "light" || attr === "dark") return attr;
7810
- const stored = localStorage.getItem("olun-theme");
7811
- if (stored === "light" || stored === "dark") return stored;
7812
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
7813
- };
7814
- setTheme(resolve());
7815
- const sync = () => setTheme(resolve());
7816
- const observer = new MutationObserver(sync);
7817
- observer.observe(document.documentElement, {
7818
- attributes: true,
7819
- attributeFilter: ["data-theme"]
7820
- });
7821
- const onStorage = (e) => {
7822
- if (e.key === "olun-theme") sync();
7823
- };
7824
- window.addEventListener("storage", onStorage);
7825
- return () => {
7826
- observer.disconnect();
7827
- window.removeEventListener("storage", onStorage);
7828
- };
7829
- }, []);
7830
- function toggle() {
7831
- const next = theme === "dark" ? "light" : "dark";
7832
- setTheme(next);
7833
- document.documentElement.setAttribute("data-theme", next);
7834
- localStorage.setItem("olun-theme", next);
7835
- }
7836
- const Icon = theme === "dark" ? Moon : Sun;
7963
+ const { resolvedTheme, toggleTheme } = useOlunTheme();
7964
+ const Icon = resolvedTheme === "dark" ? Moon : Sun;
7837
7965
  return /* @__PURE__ */ jsx52(
7838
7966
  "button",
7839
7967
  {
7840
- onClick: toggle,
7968
+ onClick: () => toggleTheme(),
7841
7969
  className: cn(
7842
7970
  "inline-flex size-[36px] items-center justify-center rounded-sm",
7843
7971
  "text-text-secondary hover:bg-[var(--action-hover)] hover:text-foreground",
@@ -7845,54 +7973,21 @@ function ThemeToggle({ className }) {
7845
7973
  className
7846
7974
  ),
7847
7975
  "aria-label": "\uD14C\uB9C8 \uC804\uD658",
7848
- title: theme === "dark" ? "\uB77C\uC774\uD2B8 \uBAA8\uB4DC\uB85C" : "\uB2E4\uD06C \uBAA8\uB4DC\uB85C",
7976
+ title: resolvedTheme === "dark" ? "\uB77C\uC774\uD2B8 \uBAA8\uB4DC\uB85C" : "\uB2E4\uD06C \uBAA8\uB4DC\uB85C",
7849
7977
  children: /* @__PURE__ */ jsx52(Icon, { className: "size-[18px]", strokeWidth: 1.75 })
7850
7978
  }
7851
7979
  );
7852
7980
  }
7853
7981
 
7854
7982
  // src/components/branding/theme-fab.tsx
7855
- import { useEffect as useEffect5, useState as useState14 } from "react";
7856
7983
  import { Sun as Sun2, Moon as Moon2 } from "lucide-react";
7857
7984
  import { jsx as jsx53 } from "react/jsx-runtime";
7858
7985
  function ThemeFab({ variant = "square" } = {}) {
7859
- const [theme, setTheme] = useState14("light");
7860
- const [mounted, setMounted] = useState14(false);
7861
- useEffect5(() => {
7862
- setMounted(true);
7863
- const resolve = () => {
7864
- const attr = document.documentElement.getAttribute("data-theme");
7865
- if (attr === "light" || attr === "dark") return attr;
7866
- const stored = localStorage.getItem("olun-theme");
7867
- if (stored === "light" || stored === "dark") return stored;
7868
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
7869
- };
7870
- setTheme(resolve());
7871
- const sync = () => setTheme(resolve());
7872
- const observer = new MutationObserver(sync);
7873
- observer.observe(document.documentElement, {
7874
- attributes: true,
7875
- attributeFilter: ["data-theme"]
7876
- });
7877
- const onStorage = (e) => {
7878
- if (e.key === "olun-theme") sync();
7879
- };
7880
- window.addEventListener("storage", onStorage);
7881
- return () => {
7882
- observer.disconnect();
7883
- window.removeEventListener("storage", onStorage);
7884
- };
7885
- }, []);
7886
- function toggle() {
7887
- const next = theme === "dark" ? "light" : "dark";
7888
- setTheme(next);
7889
- document.documentElement.setAttribute("data-theme", next);
7890
- localStorage.setItem("olun-theme", next);
7891
- }
7986
+ const { mounted, resolvedTheme, toggleTheme } = useOlunTheme();
7892
7987
  if (!mounted) {
7893
7988
  return null;
7894
7989
  }
7895
- const Icon = theme === "dark" ? Moon2 : Sun2;
7990
+ const Icon = resolvedTheme === "dark" ? Moon2 : Sun2;
7896
7991
  const isCircle = variant === "circle";
7897
7992
  const baseStyle = {
7898
7993
  position: "fixed",
@@ -7929,10 +8024,10 @@ function ThemeFab({ variant = "square" } = {}) {
7929
8024
  return /* @__PURE__ */ jsx53(
7930
8025
  "button",
7931
8026
  {
7932
- onClick: toggle,
8027
+ onClick: () => toggleTheme(),
7933
8028
  "aria-label": "\uD14C\uB9C8 \uC804\uD658",
7934
- "aria-pressed": theme === "light",
7935
- title: theme === "dark" ? "\uB77C\uC774\uD2B8 \uBAA8\uB4DC\uB85C" : "\uB2E4\uD06C \uBAA8\uB4DC\uB85C",
8029
+ "aria-pressed": resolvedTheme === "light",
8030
+ title: resolvedTheme === "dark" ? "\uB77C\uC774\uD2B8 \uBAA8\uB4DC\uB85C" : "\uB2E4\uD06C \uBAA8\uB4DC\uB85C",
7936
8031
  className: "transition-colors motion-reduce:transition-none",
7937
8032
  style: { ...baseStyle, ...isCircle ? circleStyle : squareStyle },
7938
8033
  onMouseEnter: (e) => {
@@ -8160,6 +8255,7 @@ export {
8160
8255
  formFieldLabelClassName,
8161
8256
  formFieldRequiredClassName,
8162
8257
  formFieldVariants,
8258
+ getOlunThemeState,
8163
8259
  getToastDuration,
8164
8260
  iconButtonBadgeVariants,
8165
8261
  iconButtonVariants,
@@ -8183,6 +8279,7 @@ export {
8183
8279
  searchFieldVariants,
8184
8280
  selectMessageVariants,
8185
8281
  selectVariants,
8282
+ setOlunTheme,
8186
8283
  skeletonVariants,
8187
8284
  spinnerVariants,
8188
8285
  statusBadgeDotVariants,
@@ -8198,5 +8295,6 @@ export {
8198
8295
  toastViewportVariants,
8199
8296
  twoTierBadgeLineVariants,
8200
8297
  twoTierBadgeVariants,
8298
+ useOlunTheme,
8201
8299
  usePermission
8202
8300
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olundot/ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "OLUN. shared React UI components built on OLUN design tokens",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "homepage": "https://olun-design-system.vercel.app",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/armedical-dev/olun-design-system",
17
+ "url": "https://github.com/olundot/olun-design-system",
18
18
  "directory": "packages/ui"
19
19
  },
20
20
  "type": "module",
@@ -44,7 +44,7 @@
44
44
  "lucide-react": "^1.8.0",
45
45
  "radix-ui": "^1.4.3",
46
46
  "tailwind-merge": "^3.5.0",
47
- "@olundot/tokens": "^0.9.0"
47
+ "@olundot/tokens": "^0.10.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "react": ">=18",