@firecms/ui 3.0.0-canary.133 → 3.0.0-canary.135

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.
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { TypographyProps, TypographyVariant } from "./Typography";
3
+ export type DialogContentProps = TypographyProps & {
4
+ children: React.ReactNode;
5
+ hidden?: boolean;
6
+ className?: string;
7
+ variant?: TypographyVariant;
8
+ };
9
+ export declare function DialogTitle({ children, hidden, className, variant, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,7 @@ interface SheetProps {
4
4
  open: boolean;
5
5
  title?: string;
6
6
  modal?: boolean;
7
+ includeBackgroundOverlay?: boolean;
7
8
  side?: "top" | "bottom" | "left" | "right";
8
9
  darkBackground?: boolean;
9
10
  transparent?: boolean;
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ export interface SliderProps {
3
+ className?: string;
4
+ name?: string;
5
+ disabled?: boolean;
6
+ orientation?: React.AriaAttributes["aria-orientation"];
7
+ dir?: "ltr" | "rtl";
8
+ min?: number;
9
+ max?: number;
10
+ step?: number;
11
+ minStepsBetweenThumbs?: number;
12
+ value?: number[];
13
+ defaultValue?: number[];
14
+ onValueChange?: (value: number[]) => void;
15
+ onValueCommit?: (value: number[]) => void;
16
+ inverted?: boolean;
17
+ form?: string;
18
+ size?: "small" | "regular";
19
+ }
20
+ declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
21
+ export { Slider };
@@ -1,5 +1,6 @@
1
1
  import React, { ReactEventHandler } from "react";
2
- export type TextProps<C extends React.ElementType> = {
2
+ export type TypographyVariant = keyof typeof typographyVariants;
3
+ export type TypographyProps<C extends React.ElementType = "span"> = {
3
4
  align?: "center" | "inherit" | "justify" | "left" | "right";
4
5
  children?: React.ReactNode;
5
6
  className?: string;
@@ -7,7 +8,7 @@ export type TextProps<C extends React.ElementType> = {
7
8
  gutterBottom?: boolean;
8
9
  noWrap?: boolean;
9
10
  paragraph?: boolean;
10
- variant?: keyof typeof defaultVariantMapping;
11
+ variant?: TypographyVariant;
11
12
  variantMapping?: {
12
13
  [key: string]: string;
13
14
  };
@@ -15,7 +16,7 @@ export type TextProps<C extends React.ElementType> = {
15
16
  onClick?: ReactEventHandler<HTMLElement>;
16
17
  style?: React.CSSProperties;
17
18
  } & React.ComponentPropsWithoutRef<C>;
18
- declare const defaultVariantMapping: {
19
+ declare const typographyVariants: {
19
20
  h1: string;
20
21
  h2: string;
21
22
  h3: string;
@@ -31,5 +32,5 @@ declare const defaultVariantMapping: {
31
32
  caption: string;
32
33
  button: string;
33
34
  };
34
- export declare function Typography<C extends React.ElementType>({ align, color, children, className, component, gutterBottom, noWrap, paragraph, variant, variantMapping, style, onClick, ...other }: TextProps<C>): import("react/jsx-runtime").JSX.Element;
35
+ export declare function Typography<C extends React.ElementType = "span">({ align, color, children, className, component, gutterBottom, noWrap, paragraph, variant, variantMapping, style, onClick, ...other }: TypographyProps<C>): import("react/jsx-runtime").JSX.Element;
35
36
  export {};
@@ -15,6 +15,7 @@ export * from "./DateTimeField";
15
15
  export * from "./Dialog";
16
16
  export * from "./DialogActions";
17
17
  export * from "./DialogContent";
18
+ export * from "./DialogTitle";
18
19
  export * from "./ExpandablePanel";
19
20
  export * from "./FileUpload";
20
21
  export * from "./IconButton";
@@ -31,6 +32,7 @@ export * from "./RadioGroup";
31
32
  export * from "./SearchBar";
32
33
  export * from "./Select";
33
34
  export * from "./Separator";
35
+ export * from "./Slider";
34
36
  export * from "./Sheet";
35
37
  export * from "./TextareaAutosize";
36
38
  export * from "./TextField";
package/dist/index.es.js CHANGED
@@ -10,6 +10,7 @@ import { registerLocale, setDefaultLocale } from "react-datepicker";
10
10
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
11
11
  import "material-icons/iconfont/filled.css";
12
12
  import * as DialogPrimitive from "@radix-ui/react-dialog";
13
+ import * as VisuallyHidden from "@radix-ui/react-visually-hidden";
13
14
  import { useDropzone } from "react-dropzone";
14
15
  import * as LabelPrimitive from "@radix-ui/react-label";
15
16
  import equal from "react-fast-compare";
@@ -21,8 +22,9 @@ import { Command } from "cmdk";
21
22
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
22
23
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
23
24
  import * as SelectPrimitive from "@radix-ui/react-select";
24
- import * as ReactDOM from "react-dom";
25
+ import * as SliderPrimitive from "@radix-ui/react-slider";
25
26
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
27
+ import * as ReactDOM from "react-dom";
26
28
  import * as TabsPrimitive from "@radix-ui/react-tabs";
27
29
  const focusedDisabled = "focus-visible:ring-0 focus-visible:ring-offset-0";
28
30
  const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-slate-100 focus:dark:bg-gray-800 focus:dark:bg-opacity-60";
@@ -31,9 +33,9 @@ const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-800 dark:b
31
33
  const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0";
32
34
  const fieldBackgroundDisabledMixin = "dark:bg-gray-800 bg-opacity-50 dark:bg-opacity-90";
33
35
  const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-gray-700 dark:hover:bg-opacity-40";
34
- const defaultBorderMixin = "border-gray-100 dark:border-gray-800 dark:border-opacity-80";
35
- const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-80 border-gray-100";
36
- const cardMixin = "bg-white border border-gray-100 dark:border-transparent rounded-md dark:bg-gray-950 dark:border-gray-800 dark:border-opacity-50 m-1 -p-1";
36
+ const defaultBorderMixin = "border-gray-200 border-opacity-40 dark:border-gray-700 dark:border-opacity-50";
37
+ const paperMixin = "bg-white rounded-md dark:bg-gray-950 border border-gray-200 border-opacity-40 dark:border-gray-700 dark:border-opacity-50";
38
+ const cardMixin = "bg-white border border-gray-200 border-opacity-40 dark:border-transparent rounded-md dark:bg-gray-950 dark:border-gray-700 dark:border-opacity-50 m-1 -p-1";
37
39
  const cardClickableMixin = "hover:bg-primary-bg dark:hover:bg-primary-bg hover:bg-opacity-20 dark:hover:bg-opacity-20 hover:ring-2 hover:ring-primary cursor-pointer";
38
40
  const cardSelectedMixin = "bg-primary-bg dark:bg-primary-bg bg-opacity-30 dark:bg-opacity-10 ring-1 ring-primary ring-opacity-75";
39
41
  function cls(...classes) {
@@ -13747,7 +13749,7 @@ const InputLabel = React.forwardRef(function InputLabel2(inProps, ref) {
13747
13749
  }
13748
13750
  );
13749
13751
  });
13750
- const defaultVariantMapping = {
13752
+ const typographyVariants = {
13751
13753
  h1: "h1",
13752
13754
  h2: "h2",
13753
13755
  h3: "h3",
@@ -13813,12 +13815,12 @@ function Typography({
13813
13815
  noWrap = false,
13814
13816
  paragraph = false,
13815
13817
  variant = "body1",
13816
- variantMapping = defaultVariantMapping,
13818
+ variantMapping = typographyVariants,
13817
13819
  style,
13818
13820
  onClick,
13819
13821
  ...other
13820
13822
  }) {
13821
- const Component = component || (paragraph ? "p" : variantMapping[variant] || defaultVariantMapping[variant]) || "span";
13823
+ const Component = component || (paragraph ? "p" : variantMapping[variant] || typographyVariants[variant]) || "span";
13822
13824
  const classes = cls(
13823
13825
  variantToClasses[variant],
13824
13826
  color ? colorToClasses[color] : "",
@@ -14934,6 +14936,27 @@ function DialogContent({
14934
14936
  }
14935
14937
  );
14936
14938
  }
14939
+ function DialogTitle({
14940
+ children,
14941
+ hidden,
14942
+ className,
14943
+ variant = "h4",
14944
+ ...props
14945
+ }) {
14946
+ const title = /* @__PURE__ */ jsx(DialogPrimitive.Title, { asChild: true, children: /* @__PURE__ */ jsx(
14947
+ Typography,
14948
+ {
14949
+ variant,
14950
+ className,
14951
+ ...props,
14952
+ children
14953
+ }
14954
+ ) });
14955
+ if (hidden) {
14956
+ return /* @__PURE__ */ jsx(VisuallyHidden.Root, { children: title });
14957
+ }
14958
+ return title;
14959
+ }
14937
14960
  function ExpandablePanel({
14938
14961
  title,
14939
14962
  children,
@@ -15008,7 +15031,7 @@ function ExpandablePanel({
15008
15031
  Collapsible.Trigger,
15009
15032
  {
15010
15033
  className: cls(
15011
- "rounded flex items-center justify-between w-full min-h-[52px]",
15034
+ "rounded-t flex items-center justify-between w-full min-h-[52px]",
15012
15035
  "hover:bg-slate-200 hover:bg-opacity-20 dark:hover:bg-gray-800 dark:hover:bg-opacity-20",
15013
15036
  invisible ? "border-b px-2" : "p-4",
15014
15037
  invisible && defaultBorderMixin,
@@ -16188,11 +16211,94 @@ function SelectGroup({
16188
16211
  children
16189
16212
  ] });
16190
16213
  }
16214
+ function SliderThumb(props) {
16215
+ return /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { open: props.hovered, children: [
16216
+ /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
16217
+ SliderPrimitive.Thumb,
16218
+ {
16219
+ className: cls(
16220
+ {
16221
+ "border-primary bg-primary hover:bg-primary-dark outline-none": !props.props.disabled,
16222
+ "border-slate-300 bg-slate-300 dark:border-gray-700 dark:bg-gray-700": props.props.disabled
16223
+ },
16224
+ props.classes,
16225
+ "focus-visible:ring-4 focus-visible:ring-primary focus-visible:ring-opacity-50",
16226
+ "hover:ring-4 hover:ring-primary hover:ring-opacity-25",
16227
+ "block rounded-full transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"
16228
+ )
16229
+ }
16230
+ ) }),
16231
+ /* @__PURE__ */ jsx(
16232
+ TooltipPrimitive.Content,
16233
+ {
16234
+ side: "top",
16235
+ sideOffset: 5,
16236
+ className: cls(
16237
+ "TooltipContent",
16238
+ "max-w-lg leading-relaxed",
16239
+ "z-50 rounded px-3 py-2 text-xs leading-none bg-slate-700 dark:bg-slate-800 bg-opacity-90 font-medium text-slate-50 shadow-2xl select-none duration-400 ease-in transform opacity-100"
16240
+ ),
16241
+ children: props.props.value?.[props.index]
16242
+ }
16243
+ )
16244
+ ] });
16245
+ }
16246
+ const Slider = React.forwardRef(({
16247
+ className,
16248
+ size = "regular",
16249
+ ...props
16250
+ }, ref) => {
16251
+ const [hovered, setHovered] = React.useState(false);
16252
+ const thumbSizeClasses = size === "small" ? "h-4 w-4" : "h-6 w-6";
16253
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(
16254
+ SliderPrimitive.Root,
16255
+ {
16256
+ ref,
16257
+ onMouseEnter: () => setHovered(true),
16258
+ onMouseLeave: () => setHovered(false),
16259
+ className: cls(
16260
+ "relative flex w-full touch-none select-none items-center",
16261
+ className
16262
+ ),
16263
+ ...props,
16264
+ children: [
16265
+ /* @__PURE__ */ jsx(
16266
+ SliderPrimitive.Track,
16267
+ {
16268
+ style: { height: size === "small" ? 4 : 8 },
16269
+ className: "relative w-full grow overflow-hidden rounded-full bg-slate-300 bg-opacity-40 dark:bg-gray-700 dark:bg-opacity-40",
16270
+ children: /* @__PURE__ */ jsx(
16271
+ SliderPrimitive.Range,
16272
+ {
16273
+ className: cls("absolute h-full", {
16274
+ "bg-primary": !props.disabled,
16275
+ "bg-slate-300 dark:bg-gray-700": props.disabled
16276
+ })
16277
+ }
16278
+ )
16279
+ }
16280
+ ),
16281
+ (props.value ?? [0]).map((_, index) => /* @__PURE__ */ jsx(
16282
+ SliderThumb,
16283
+ {
16284
+ index,
16285
+ props,
16286
+ hovered,
16287
+ classes: thumbSizeClasses
16288
+ },
16289
+ index
16290
+ ))
16291
+ ]
16292
+ }
16293
+ ) });
16294
+ });
16295
+ Slider.displayName = "Slider";
16191
16296
  const Sheet = ({
16192
16297
  children,
16193
16298
  side = "right",
16194
16299
  title,
16195
16300
  modal = true,
16301
+ includeBackgroundOverlay = true,
16196
16302
  open,
16197
16303
  onOpenChange,
16198
16304
  transparent,
@@ -16223,10 +16329,11 @@ const Sheet = ({
16223
16329
  DialogPrimitive.Root,
16224
16330
  {
16225
16331
  open: displayed || open,
16332
+ modal,
16226
16333
  onOpenChange,
16227
16334
  children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
16228
16335
  /* @__PURE__ */ jsx(DialogPrimitive.Title, { autoFocus: true, tabIndex: 0, children: title ?? "Sheet" }),
16229
- modal && /* @__PURE__ */ jsx(
16336
+ includeBackgroundOverlay && /* @__PURE__ */ jsx(
16230
16337
  DialogPrimitive.Overlay,
16231
16338
  {
16232
16339
  className: cls(
@@ -17926,6 +18033,7 @@ export {
17926
18033
  Dialog,
17927
18034
  DialogActions,
17928
18035
  DialogContent,
18036
+ DialogTitle,
17929
18037
  DialogsIcon,
17930
18038
  DialpadIcon,
17931
18039
  DiamondIcon,
@@ -19890,6 +19998,7 @@ export {
19890
19998
  SleepIcon,
19891
19999
  SleepScoreIcon,
19892
20000
  SlideLibraryIcon,
20001
+ Slider,
19893
20002
  SlidersIcon,
19894
20003
  SlideshowIcon,
19895
20004
  SlowMotionVideoIcon,