@firecms/ui 3.0.0-canary.254 → 3.0.0-canary.256

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/ui",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.254",
4
+ "version": "3.0.0-canary.256",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -116,7 +116,7 @@
116
116
  "index.css",
117
117
  "tailwind.config.js"
118
118
  ],
119
- "gitHead": "c960d170205a0ce63c376f8626b38c143d7c9d29",
119
+ "gitHead": "a05357be19923c876c5a4dcb1fe1da37e2efc232",
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  }
@@ -41,7 +41,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
41
41
  }
42
42
  }}
43
43
  className={cls(
44
- size === "small" ? "w-[38px] h-[22px] min-w-[38px] min-h-[22px]" : "w-[42px] h-[26px] min-w-[42px] min-h-[26px]",
44
+ size === "smallest" ? "w-[34px] h-[18px] min-w-[34px] min-h-[18px]" : size === "small" ? "w-[38px] h-[22px] min-w-[38px] min-h-[22px]" : "w-[42px] h-[26px] min-w-[42px] min-h-[26px]",
45
45
  "outline-none rounded-full relative shadow-sm",
46
46
  value ? (disabled
47
47
  ? "bg-white bg-opacity-54 dark:bg-surface-accent-950 border-surface-accent-100 dark:border-surface-accent-700 ring-1 ring-surface-accent-200 dark:ring-surface-accent-700"
@@ -58,8 +58,10 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
58
58
  {
59
59
  "w-[21px] h-[10px]": size === "medium" || size === "large",
60
60
  "w-[19px] h-[8px]": size === "small",
61
+ "w-[16px] h-[6px]": size === "smallest",
61
62
  "translate-x-[10px]": size === "medium" || size === "large",
62
- "translate-x-[9px]": size === "small"
63
+ "translate-x-[9px]": size === "small",
64
+ "translate-x-[8px]": size === "smallest"
63
65
  }
64
66
  )}
65
67
  />}
@@ -72,8 +74,10 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
72
74
  {
73
75
  "w-[21px] h-[21px]": size === "medium" || size === "large",
74
76
  "w-[19px] h-[19px]": size === "small",
77
+ "w-[16px] h-[16px]": size === "smallest",
75
78
  [value ? "translate-x-[19px]" : "translate-x-[3px]"]: size === "medium" || size === "large",
76
- [value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "small"
79
+ [value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "small",
80
+ [value ? "translate-x-[16px]" : "translate-x-[1px]"]: size === "smallest"
77
81
  }
78
82
  )}
79
83
  />}
@@ -73,8 +73,8 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
73
73
  "min-h-[42px]": size === "medium",
74
74
  "min-h-[64px]": size === "large",
75
75
  },
76
- size === "small" ? "pl-2" : "pl-4",
77
- size === "small" ? "pr-4" : "pr-6",
76
+ size === "small" || size === "smallest" ? "pl-2" : "pl-4",
77
+ size === "small" || size === "smallest" ? "pr-4" : "pr-6",
78
78
  position === "end" ? "flex-row-reverse" : "flex-row",
79
79
  fullWidth ? "w-full" : "",
80
80
  className
@@ -103,7 +103,7 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
103
103
  <div className={cls(
104
104
  "flex-grow",
105
105
  position === "end" ? "mr-4" : "ml-4",
106
- size === "small" ? "text-sm" : "text-base"
106
+ size === "small" || size === "smallest" ? "text-sm" : "text-base"
107
107
  )}>
108
108
  {label}
109
109
  </div>
@@ -20,6 +20,10 @@ export type DialogProps = {
20
20
  onEscapeKeyDown?: (e: KeyboardEvent) => void;
21
21
  onPointerDownOutside?: (e: Event) => void;
22
22
  onInteractOutside?: (e: Event) => void;
23
+ /**
24
+ * If `true`, the dialog will not focus the first focusable element when opened.
25
+ */
26
+ disableInitialFocus?: boolean;
23
27
  };
24
28
 
25
29
  const widthClasses = {
@@ -52,7 +56,8 @@ export const Dialog = ({
52
56
  onOpenAutoFocus,
53
57
  onEscapeKeyDown,
54
58
  onPointerDownOutside,
55
- onInteractOutside
59
+ onInteractOutside,
60
+ disableInitialFocus = true
56
61
  }: DialogProps) => {
57
62
  const [displayed, setDisplayed] = useState(false);
58
63
 
@@ -89,7 +94,12 @@ export const Dialog = ({
89
94
 
90
95
  <DialogPrimitive.Content
91
96
  onEscapeKeyDown={onEscapeKeyDown}
92
- onOpenAutoFocus={onOpenAutoFocus}
97
+ onOpenAutoFocus={(e) => {
98
+ if (disableInitialFocus) {
99
+ e.preventDefault();
100
+ }
101
+ onOpenAutoFocus?.(e);
102
+ }}
93
103
  onPointerDownOutside={onPointerDownOutside}
94
104
  onInteractOutside={onInteractOutside}
95
105
  className={cls("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out")}
@@ -120,4 +130,3 @@ export const Dialog = ({
120
130
  </DialogPrimitive.Root>
121
131
  );
122
132
  };
123
-