@dxos/react-ui 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
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/dist/lib/browser/index.mjs +70 -69
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +70 -70
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +70 -69
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +9 -5
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +2 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +0 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +22 -35
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +6 -2
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +5 -12
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +1 -13
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/util/ThemedClassName.d.ts +1 -1
- package/dist/types/src/util/ThemedClassName.d.ts.map +1 -1
- package/package.json +42 -42
- package/src/components/Avatars/Avatar.tsx +6 -3
- package/src/components/Buttons/IconButton.tsx +3 -4
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Main/Main.tsx +72 -78
- package/src/components/Tag/Tag.stories.tsx +31 -20
- package/src/components/Tag/Tag.tsx +6 -15
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -13
- package/src/util/ThemedClassName.ts +1 -1
package/dist/lib/node/index.cjs
CHANGED
|
@@ -87,7 +87,6 @@ __export(node_exports, {
|
|
|
87
87
|
useDropdownMenuContext: () => useDropdownMenuContext,
|
|
88
88
|
useDropdownMenuMenuScope: () => useDropdownMenuMenuScope,
|
|
89
89
|
useElevationContext: () => useElevationContext,
|
|
90
|
-
useLandmarkMover: () => useLandmarkMover,
|
|
91
90
|
useListContext: () => import_react_list.useListContext,
|
|
92
91
|
useListItemContext: () => import_react_list.useListItemContext,
|
|
93
92
|
useMainContext: () => useMainContext,
|
|
@@ -806,15 +805,12 @@ var Tooltip = {
|
|
|
806
805
|
Arrow: TooltipArrow,
|
|
807
806
|
Content: TooltipContent
|
|
808
807
|
};
|
|
809
|
-
var IconOnlyButton = /* @__PURE__ */ (0, import_react16.forwardRef)(({ tooltipPortal = true, tooltipZIndex: zIndex,
|
|
808
|
+
var IconOnlyButton = /* @__PURE__ */ (0, import_react16.forwardRef)(({ tooltipPortal = true, tooltipZIndex: zIndex, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
810
809
|
const [triggerTooltipOpen, setTriggerTooltipOpen] = (0, import_react16.useState)(false);
|
|
811
|
-
const content = /* @__PURE__ */ import_react16.default.createElement(Tooltip.Content, {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
},
|
|
817
|
-
side: tooltipSide
|
|
810
|
+
const content = /* @__PURE__ */ import_react16.default.createElement(Tooltip.Content, zIndex && {
|
|
811
|
+
style: {
|
|
812
|
+
zIndex
|
|
813
|
+
}
|
|
818
814
|
}, props.label, /* @__PURE__ */ import_react16.default.createElement(Tooltip.Arrow, null));
|
|
819
815
|
return /* @__PURE__ */ import_react16.default.createElement(Tooltip.Root, {
|
|
820
816
|
open: triggerTooltipOpen,
|
|
@@ -1753,7 +1749,7 @@ var Switch = /* @__PURE__ */ (0, import_react30.forwardRef)(({ __inputScope, che
|
|
|
1753
1749
|
const { id, validationValence, descriptionId, errorMessageId } = (0, import_react_input.useInputContext)(import_react_input.INPUT_NAME, __inputScope);
|
|
1754
1750
|
return /* @__PURE__ */ import_react30.default.createElement("input", {
|
|
1755
1751
|
type: "checkbox",
|
|
1756
|
-
className: "
|
|
1752
|
+
className: "ch-checkbox--switch ch-focus-ring",
|
|
1757
1753
|
checked,
|
|
1758
1754
|
onChange: (event) => {
|
|
1759
1755
|
onCheckedChange(event.target.checked);
|
|
@@ -2199,62 +2195,68 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2199
2195
|
};
|
|
2200
2196
|
var [MainProvider, useMainContext] = (0, import_react_context7.createContext)(MAIN_NAME, {
|
|
2201
2197
|
resizing: false,
|
|
2202
|
-
|
|
2203
|
-
|
|
2198
|
+
navigationSidebarOpen: false,
|
|
2199
|
+
setNavigationSidebarOpen: (nextOpen) => {
|
|
2204
2200
|
import_log.log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2205
2201
|
F: __dxlog_file,
|
|
2206
|
-
L:
|
|
2202
|
+
L: 79,
|
|
2207
2203
|
S: void 0,
|
|
2208
2204
|
C: (f, a) => f(...a)
|
|
2209
2205
|
});
|
|
2210
2206
|
},
|
|
2211
|
-
|
|
2212
|
-
|
|
2207
|
+
complementarySidebarOpen: false,
|
|
2208
|
+
setComplementarySidebarOpen: (nextOpen) => {
|
|
2213
2209
|
import_log.log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2214
2210
|
F: __dxlog_file,
|
|
2215
|
-
L:
|
|
2211
|
+
L: 84,
|
|
2216
2212
|
S: void 0,
|
|
2217
2213
|
C: (f, a) => f(...a)
|
|
2218
2214
|
});
|
|
2219
2215
|
}
|
|
2220
2216
|
});
|
|
2221
2217
|
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
2222
|
-
const {
|
|
2218
|
+
const { setNavigationSidebarOpen, navigationSidebarOpen, setComplementarySidebarOpen, complementarySidebarOpen } = useMainContext(consumerName);
|
|
2223
2219
|
return {
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
toggleNavigationSidebar: (0, import_react37.useCallback)(() =>
|
|
2227
|
-
|
|
2228
|
-
|
|
2220
|
+
navigationSidebarOpen,
|
|
2221
|
+
setNavigationSidebarOpen,
|
|
2222
|
+
toggleNavigationSidebar: (0, import_react37.useCallback)(() => setNavigationSidebarOpen(!navigationSidebarOpen), [
|
|
2223
|
+
navigationSidebarOpen,
|
|
2224
|
+
setNavigationSidebarOpen
|
|
2229
2225
|
]),
|
|
2230
|
-
openNavigationSidebar: (0, import_react37.useCallback)(() =>
|
|
2231
|
-
|
|
2232
|
-
closeNavigationSidebar: (0, import_react37.useCallback)(() => setNavigationSidebarState("closed"), []),
|
|
2233
|
-
complementarySidebarState,
|
|
2234
|
-
setComplementarySidebarState,
|
|
2235
|
-
toggleComplementarySidebar: (0, import_react37.useCallback)(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2236
|
-
complementarySidebarState,
|
|
2237
|
-
setComplementarySidebarState
|
|
2226
|
+
openNavigationSidebar: (0, import_react37.useCallback)(() => setNavigationSidebarOpen(true), [
|
|
2227
|
+
setNavigationSidebarOpen
|
|
2238
2228
|
]),
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2229
|
+
closeNavigationSidebar: (0, import_react37.useCallback)(() => setNavigationSidebarOpen(false), [
|
|
2230
|
+
setNavigationSidebarOpen
|
|
2231
|
+
]),
|
|
2232
|
+
complementarySidebarOpen,
|
|
2233
|
+
setComplementarySidebarOpen,
|
|
2234
|
+
toggleComplementarySidebar: (0, import_react37.useCallback)(() => setComplementarySidebarOpen(!complementarySidebarOpen), [
|
|
2235
|
+
complementarySidebarOpen,
|
|
2236
|
+
setComplementarySidebarOpen
|
|
2237
|
+
]),
|
|
2238
|
+
openComplementarySidebar: (0, import_react37.useCallback)(() => setComplementarySidebarOpen(true), [
|
|
2239
|
+
setComplementarySidebarOpen
|
|
2240
|
+
]),
|
|
2241
|
+
closeComplementarySidebar: (0, import_react37.useCallback)(() => setComplementarySidebarOpen(false), [
|
|
2242
|
+
setComplementarySidebarOpen
|
|
2243
|
+
])
|
|
2242
2244
|
};
|
|
2243
2245
|
};
|
|
2244
2246
|
var resizeDebounce = 3e3;
|
|
2245
|
-
var MainRoot = ({
|
|
2247
|
+
var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavigationSidebarOpen, onNavigationSidebarOpenChange, complementarySidebarOpen: propsComplementarySidebarOpen, defaultComplementarySidebarOpen, onComplementarySidebarOpenChange, children, ...props }) => {
|
|
2246
2248
|
const [isLg] = (0, import_react_hooks5.useMediaQuery)("lg", {
|
|
2247
2249
|
ssr: false
|
|
2248
2250
|
});
|
|
2249
|
-
const [
|
|
2250
|
-
prop:
|
|
2251
|
-
defaultProp:
|
|
2252
|
-
onChange:
|
|
2251
|
+
const [navigationSidebarOpen = isLg, setNavigationSidebarOpen] = (0, import_react_use_controllable_state4.useControllableState)({
|
|
2252
|
+
prop: propsNavigationSidebarOpen,
|
|
2253
|
+
defaultProp: defaultNavigationSidebarOpen,
|
|
2254
|
+
onChange: onNavigationSidebarOpenChange
|
|
2253
2255
|
});
|
|
2254
|
-
const [
|
|
2255
|
-
prop:
|
|
2256
|
-
defaultProp:
|
|
2257
|
-
onChange:
|
|
2256
|
+
const [complementarySidebarOpen = false, setComplementarySidebarOpen] = (0, import_react_use_controllable_state4.useControllableState)({
|
|
2257
|
+
prop: propsComplementarySidebarOpen,
|
|
2258
|
+
defaultProp: defaultComplementarySidebarOpen,
|
|
2259
|
+
onChange: onComplementarySidebarOpenChange
|
|
2258
2260
|
});
|
|
2259
2261
|
const [resizing, setResizing] = (0, import_react37.useState)(false);
|
|
2260
2262
|
const resizeInterval = (0, import_react37.useRef)(null);
|
|
@@ -2276,10 +2278,10 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2276
2278
|
]);
|
|
2277
2279
|
return /* @__PURE__ */ import_react37.default.createElement(MainProvider, {
|
|
2278
2280
|
...props,
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2281
|
+
navigationSidebarOpen,
|
|
2282
|
+
setNavigationSidebarOpen,
|
|
2283
|
+
complementarySidebarOpen,
|
|
2284
|
+
setComplementarySidebarOpen,
|
|
2283
2285
|
resizing
|
|
2284
2286
|
}, children);
|
|
2285
2287
|
};
|
|
@@ -2287,7 +2289,7 @@ MainRoot.displayName = MAIN_ROOT_NAME;
|
|
|
2287
2289
|
var handleOpenAutoFocus = (event) => {
|
|
2288
2290
|
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2289
2291
|
};
|
|
2290
|
-
var MainSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)(({ classNames, children, swipeToDismiss, onOpenAutoFocus,
|
|
2292
|
+
var MainSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)(({ classNames, children, swipeToDismiss, onOpenAutoFocus, open, resizing, setOpen, side, ...props }, forwardedRef) => {
|
|
2291
2293
|
const [isLg] = (0, import_react_hooks5.useMediaQuery)("lg", {
|
|
2292
2294
|
ssr: false
|
|
2293
2295
|
});
|
|
@@ -2295,7 +2297,7 @@ var MainSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)(({ classNames,
|
|
|
2295
2297
|
const ref = (0, import_react_hooks5.useForwardedRef)(forwardedRef);
|
|
2296
2298
|
const noopRef = (0, import_react37.useRef)(null);
|
|
2297
2299
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2298
|
-
onDismiss: () =>
|
|
2300
|
+
onDismiss: () => setOpen(false)
|
|
2299
2301
|
});
|
|
2300
2302
|
const handleKeyDown = (0, import_react37.useCallback)((event) => {
|
|
2301
2303
|
if (event.key === "Escape") {
|
|
@@ -2307,7 +2309,7 @@ var MainSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)(({ classNames,
|
|
|
2307
2309
|
]);
|
|
2308
2310
|
const Root5 = isLg ? import_react_primitive9.Primitive.div : import_react_dialog2.DialogContent;
|
|
2309
2311
|
return /* @__PURE__ */ import_react37.default.createElement(import_react_dialog2.Root, {
|
|
2310
|
-
open
|
|
2312
|
+
open,
|
|
2311
2313
|
modal: false
|
|
2312
2314
|
}, /* @__PURE__ */ import_react37.default.createElement(Root5, {
|
|
2313
2315
|
...!isLg && {
|
|
@@ -2317,24 +2319,24 @@ var MainSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)(({ classNames,
|
|
|
2317
2319
|
},
|
|
2318
2320
|
...props,
|
|
2319
2321
|
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2320
|
-
"data-state":
|
|
2322
|
+
"data-state": open ? "open" : "closed",
|
|
2321
2323
|
"data-resizing": resizing ? "true" : "false",
|
|
2322
2324
|
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2323
2325
|
onKeyDown: handleKeyDown,
|
|
2324
|
-
|
|
2326
|
+
...!open && {
|
|
2325
2327
|
inert: "true"
|
|
2326
2328
|
},
|
|
2327
2329
|
ref
|
|
2328
2330
|
}, children));
|
|
2329
2331
|
});
|
|
2330
2332
|
var MainNavigationSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)((props, forwardedRef) => {
|
|
2331
|
-
const {
|
|
2333
|
+
const { navigationSidebarOpen, setNavigationSidebarOpen, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2332
2334
|
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2333
2335
|
return /* @__PURE__ */ import_react37.default.createElement(MainSidebar, {
|
|
2334
2336
|
...mover,
|
|
2335
2337
|
...props,
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
+
open: navigationSidebarOpen,
|
|
2339
|
+
setOpen: setNavigationSidebarOpen,
|
|
2338
2340
|
resizing,
|
|
2339
2341
|
side: "inline-start",
|
|
2340
2342
|
ref: forwardedRef
|
|
@@ -2342,13 +2344,13 @@ var MainNavigationSidebar = /* @__PURE__ */ (0, import_react37.forwardRef)((prop
|
|
|
2342
2344
|
});
|
|
2343
2345
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2344
2346
|
var MainComplementarySidebar = /* @__PURE__ */ (0, import_react37.forwardRef)((props, forwardedRef) => {
|
|
2345
|
-
const {
|
|
2347
|
+
const { complementarySidebarOpen, setComplementarySidebarOpen, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2346
2348
|
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2347
2349
|
return /* @__PURE__ */ import_react37.default.createElement(MainSidebar, {
|
|
2348
2350
|
...mover,
|
|
2349
2351
|
...props,
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
+
open: complementarySidebarOpen,
|
|
2353
|
+
setOpen: setComplementarySidebarOpen,
|
|
2352
2354
|
resizing,
|
|
2353
2355
|
side: "inline-end",
|
|
2354
2356
|
ref: forwardedRef
|
|
@@ -2356,7 +2358,7 @@ var MainComplementarySidebar = /* @__PURE__ */ (0, import_react37.forwardRef)((p
|
|
|
2356
2358
|
});
|
|
2357
2359
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2358
2360
|
var MainContent = /* @__PURE__ */ (0, import_react37.forwardRef)(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2359
|
-
const {
|
|
2361
|
+
const { navigationSidebarOpen, complementarySidebarOpen } = useMainContext(MAIN_NAME);
|
|
2360
2362
|
const { tx } = useThemeContext();
|
|
2361
2363
|
const Root5 = asChild ? import_react_slot10.Slot : role ? "div" : "main";
|
|
2362
2364
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
@@ -2366,8 +2368,8 @@ var MainContent = /* @__PURE__ */ (0, import_react37.forwardRef)(({ asChild, cla
|
|
|
2366
2368
|
...mover
|
|
2367
2369
|
},
|
|
2368
2370
|
...props,
|
|
2369
|
-
"data-sidebar-inline-start-state":
|
|
2370
|
-
"data-sidebar-inline-end-state":
|
|
2371
|
+
"data-sidebar-inline-start-state": navigationSidebarOpen ? "open" : "closed",
|
|
2372
|
+
"data-sidebar-inline-end-state": complementarySidebarOpen ? "open" : "closed",
|
|
2371
2373
|
className: tx("main.content", "main", {
|
|
2372
2374
|
bounce,
|
|
2373
2375
|
handlesFocus
|
|
@@ -2380,20 +2382,20 @@ var MainOverlay = /* @__PURE__ */ (0, import_react37.forwardRef)(({ classNames,
|
|
|
2380
2382
|
const [isLg] = (0, import_react_hooks5.useMediaQuery)("lg", {
|
|
2381
2383
|
ssr: false
|
|
2382
2384
|
});
|
|
2383
|
-
const {
|
|
2385
|
+
const { navigationSidebarOpen, setNavigationSidebarOpen, complementarySidebarOpen, setComplementarySidebarOpen } = useMainContext(MAIN_NAME);
|
|
2384
2386
|
const { tx } = useThemeContext();
|
|
2385
2387
|
return /* @__PURE__ */ import_react37.default.createElement("div", {
|
|
2386
2388
|
onClick: () => {
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
+
setNavigationSidebarOpen(false);
|
|
2390
|
+
setComplementarySidebarOpen(false);
|
|
2389
2391
|
},
|
|
2390
2392
|
...props,
|
|
2391
2393
|
className: tx("main.overlay", "main__overlay", {
|
|
2392
2394
|
isLg,
|
|
2393
|
-
inlineStartSidebarOpen:
|
|
2394
|
-
inlineEndSidebarOpen:
|
|
2395
|
+
inlineStartSidebarOpen: navigationSidebarOpen,
|
|
2396
|
+
inlineEndSidebarOpen: complementarySidebarOpen
|
|
2395
2397
|
}, classNames),
|
|
2396
|
-
"data-state":
|
|
2398
|
+
"data-state": navigationSidebarOpen || complementarySidebarOpen ? "open" : "closed",
|
|
2397
2399
|
"aria-hidden": "true",
|
|
2398
2400
|
ref: forwardedRef
|
|
2399
2401
|
});
|
|
@@ -2971,15 +2973,14 @@ var Separator4 = /* @__PURE__ */ (0, import_react45.forwardRef)(({ classNames, o
|
|
|
2971
2973
|
ref: forwardedRef
|
|
2972
2974
|
});
|
|
2973
2975
|
});
|
|
2974
|
-
var Tag = /* @__PURE__ */ (0, import_react46.forwardRef)(({ asChild, palette
|
|
2976
|
+
var Tag = /* @__PURE__ */ (0, import_react46.forwardRef)(({ asChild, palette, classNames, ...props }, forwardedRef) => {
|
|
2975
2977
|
const { tx } = useThemeContext();
|
|
2976
2978
|
const Root5 = asChild ? import_react_slot13.Slot : import_react_primitive12.Primitive.span;
|
|
2977
2979
|
return /* @__PURE__ */ import_react46.default.createElement(Root5, {
|
|
2978
2980
|
...props,
|
|
2979
|
-
className: tx("tag.root", "
|
|
2981
|
+
className: tx("tag.root", "tag", {
|
|
2980
2982
|
palette
|
|
2981
2983
|
}, classNames),
|
|
2982
|
-
"data-hue": palette,
|
|
2983
2984
|
ref: forwardedRef
|
|
2984
2985
|
});
|
|
2985
2986
|
});
|
|
@@ -3211,7 +3212,6 @@ var Toolbar = {
|
|
|
3211
3212
|
useDropdownMenuContext,
|
|
3212
3213
|
useDropdownMenuMenuScope,
|
|
3213
3214
|
useElevationContext,
|
|
3214
|
-
useLandmarkMover,
|
|
3215
3215
|
useListContext,
|
|
3216
3216
|
useListItemContext,
|
|
3217
3217
|
useMainContext,
|