@firecms/ui 3.0.0-canary.132 → 3.0.0-canary.134

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;
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren } from "react";
2
- export declare function ExpandablePanel({ title, children, invisible, expanded, onExpandedChange, initiallyExpanded, titleClassName, asField, className }: PropsWithChildren<{
2
+ export declare function ExpandablePanel({ title, children, invisible, expanded, onExpandedChange, initiallyExpanded, titleClassName, asField, className, innerClassName }: PropsWithChildren<{
3
3
  title: React.ReactNode;
4
4
  invisible?: boolean;
5
5
  initiallyExpanded?: boolean;
@@ -8,4 +8,5 @@ export declare function ExpandablePanel({ title, children, invisible, expanded,
8
8
  titleClassName?: string;
9
9
  asField?: boolean;
10
10
  className?: string;
11
+ innerClassName?: string;
11
12
  }>): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,7 @@ interface SheetProps {
3
3
  children: React.ReactNode;
4
4
  open: boolean;
5
5
  title?: string;
6
+ modal?: boolean;
6
7
  side?: "top" | "bottom" | "left" | "right";
7
8
  darkBackground?: boolean;
8
9
  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,
@@ -14943,7 +14966,8 @@ function ExpandablePanel({
14943
14966
  initiallyExpanded = true,
14944
14967
  titleClassName,
14945
14968
  asField,
14946
- className
14969
+ className,
14970
+ innerClassName
14947
14971
  }) {
14948
14972
  useInjectStyles("ExpandablePanel", `
14949
14973
  .CollapsibleContent {
@@ -14994,7 +15018,8 @@ function ExpandablePanel({
14994
15018
  className: cls(
14995
15019
  !invisible && defaultBorderMixin + " border",
14996
15020
  "rounded-md",
14997
- "w-full"
15021
+ "w-full",
15022
+ className
14998
15023
  ),
14999
15024
  open,
15000
15025
  onOpenChange: (updatedOpen) => {
@@ -15006,8 +15031,8 @@ function ExpandablePanel({
15006
15031
  Collapsible.Trigger,
15007
15032
  {
15008
15033
  className: cls(
15009
- "rounded flex items-center justify-between w-full min-h-[52px]",
15010
- "hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-20",
15034
+ "rounded-t flex items-center justify-between w-full min-h-[52px]",
15035
+ "hover:bg-slate-200 hover:bg-opacity-20 dark:hover:bg-gray-800 dark:hover:bg-opacity-20",
15011
15036
  invisible ? "border-b px-2" : "p-4",
15012
15037
  invisible && defaultBorderMixin,
15013
15038
  asField && fieldBackgroundMixin,
@@ -15026,7 +15051,7 @@ function ExpandablePanel({
15026
15051
  style: {
15027
15052
  overflow: allowOverflow ? "visible" : "hidden"
15028
15053
  },
15029
- children: /* @__PURE__ */ jsx("div", { className, children })
15054
+ children: /* @__PURE__ */ jsx("div", { className: innerClassName, children })
15030
15055
  }
15031
15056
  )
15032
15057
  ]
@@ -16186,10 +16211,93 @@ function SelectGroup({
16186
16211
  children
16187
16212
  ] });
16188
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 focus-visible:ring-4 focus-visible:ring-primary outline-none focus-visible:ring-opacity-50": !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:ring-8 focus:ring-primary focus:ring-opacity-75",
16226
+ "hover:ring-8 hover:ring-primary hover:ring-opacity-75",
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";
16189
16296
  const Sheet = ({
16190
16297
  children,
16191
16298
  side = "right",
16192
16299
  title,
16300
+ modal = true,
16193
16301
  open,
16194
16302
  onOpenChange,
16195
16303
  transparent,
@@ -16220,10 +16328,11 @@ const Sheet = ({
16220
16328
  DialogPrimitive.Root,
16221
16329
  {
16222
16330
  open: displayed || open,
16331
+ modal,
16223
16332
  onOpenChange,
16224
16333
  children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
16225
16334
  /* @__PURE__ */ jsx(DialogPrimitive.Title, { autoFocus: true, tabIndex: 0, children: title ?? "Sheet" }),
16226
- /* @__PURE__ */ jsx(
16335
+ modal && /* @__PURE__ */ jsx(
16227
16336
  DialogPrimitive.Overlay,
16228
16337
  {
16229
16338
  className: cls(
@@ -17923,6 +18032,7 @@ export {
17923
18032
  Dialog,
17924
18033
  DialogActions,
17925
18034
  DialogContent,
18035
+ DialogTitle,
17926
18036
  DialogsIcon,
17927
18037
  DialpadIcon,
17928
18038
  DiamondIcon,
@@ -19887,6 +19997,7 @@ export {
19887
19997
  SleepIcon,
19888
19998
  SleepScoreIcon,
19889
19999
  SlideLibraryIcon,
20000
+ Slider,
19890
20001
  SlidersIcon,
19891
20002
  SlideshowIcon,
19892
20003
  SlowMotionVideoIcon,