@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
|
@@ -657,15 +657,12 @@ var Tooltip = {
|
|
|
657
657
|
};
|
|
658
658
|
|
|
659
659
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
660
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex,
|
|
660
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
661
661
|
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
662
|
-
const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
side: tooltipSide
|
|
662
|
+
const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, zIndex && {
|
|
663
|
+
style: {
|
|
664
|
+
zIndex
|
|
665
|
+
}
|
|
669
666
|
}, props.label, /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null));
|
|
670
667
|
return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
|
|
671
668
|
open: triggerTooltipOpen,
|
|
@@ -1671,7 +1668,7 @@ var Switch = /* @__PURE__ */ forwardRef16(({ __inputScope, checked: propsChecked
|
|
|
1671
1668
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1672
1669
|
return /* @__PURE__ */ React22.createElement("input", {
|
|
1673
1670
|
type: "checkbox",
|
|
1674
|
-
className: "
|
|
1671
|
+
className: "ch-checkbox--switch ch-focus-ring",
|
|
1675
1672
|
checked,
|
|
1676
1673
|
onChange: (event) => {
|
|
1677
1674
|
onCheckedChange(event.target.checked);
|
|
@@ -2160,62 +2157,68 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2160
2157
|
};
|
|
2161
2158
|
var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
2162
2159
|
resizing: false,
|
|
2163
|
-
|
|
2164
|
-
|
|
2160
|
+
navigationSidebarOpen: false,
|
|
2161
|
+
setNavigationSidebarOpen: (nextOpen) => {
|
|
2165
2162
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2166
2163
|
F: __dxlog_file,
|
|
2167
|
-
L:
|
|
2164
|
+
L: 79,
|
|
2168
2165
|
S: void 0,
|
|
2169
2166
|
C: (f, a) => f(...a)
|
|
2170
2167
|
});
|
|
2171
2168
|
},
|
|
2172
|
-
|
|
2173
|
-
|
|
2169
|
+
complementarySidebarOpen: false,
|
|
2170
|
+
setComplementarySidebarOpen: (nextOpen) => {
|
|
2174
2171
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2175
2172
|
F: __dxlog_file,
|
|
2176
|
-
L:
|
|
2173
|
+
L: 84,
|
|
2177
2174
|
S: void 0,
|
|
2178
2175
|
C: (f, a) => f(...a)
|
|
2179
2176
|
});
|
|
2180
2177
|
}
|
|
2181
2178
|
});
|
|
2182
2179
|
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
2183
|
-
const {
|
|
2180
|
+
const { setNavigationSidebarOpen, navigationSidebarOpen, setComplementarySidebarOpen, complementarySidebarOpen } = useMainContext(consumerName);
|
|
2184
2181
|
return {
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
toggleNavigationSidebar: useCallback7(() =>
|
|
2188
|
-
|
|
2189
|
-
|
|
2182
|
+
navigationSidebarOpen,
|
|
2183
|
+
setNavigationSidebarOpen,
|
|
2184
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(!navigationSidebarOpen), [
|
|
2185
|
+
navigationSidebarOpen,
|
|
2186
|
+
setNavigationSidebarOpen
|
|
2190
2187
|
]),
|
|
2191
|
-
openNavigationSidebar: useCallback7(() =>
|
|
2192
|
-
|
|
2193
|
-
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
2194
|
-
complementarySidebarState,
|
|
2195
|
-
setComplementarySidebarState,
|
|
2196
|
-
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2197
|
-
complementarySidebarState,
|
|
2198
|
-
setComplementarySidebarState
|
|
2188
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(true), [
|
|
2189
|
+
setNavigationSidebarOpen
|
|
2199
2190
|
]),
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2191
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(false), [
|
|
2192
|
+
setNavigationSidebarOpen
|
|
2193
|
+
]),
|
|
2194
|
+
complementarySidebarOpen,
|
|
2195
|
+
setComplementarySidebarOpen,
|
|
2196
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(!complementarySidebarOpen), [
|
|
2197
|
+
complementarySidebarOpen,
|
|
2198
|
+
setComplementarySidebarOpen
|
|
2199
|
+
]),
|
|
2200
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(true), [
|
|
2201
|
+
setComplementarySidebarOpen
|
|
2202
|
+
]),
|
|
2203
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(false), [
|
|
2204
|
+
setComplementarySidebarOpen
|
|
2205
|
+
])
|
|
2203
2206
|
};
|
|
2204
2207
|
};
|
|
2205
2208
|
var resizeDebounce = 3e3;
|
|
2206
|
-
var MainRoot = ({
|
|
2209
|
+
var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavigationSidebarOpen, onNavigationSidebarOpenChange, complementarySidebarOpen: propsComplementarySidebarOpen, defaultComplementarySidebarOpen, onComplementarySidebarOpenChange, children, ...props }) => {
|
|
2207
2210
|
const [isLg] = useMediaQuery("lg", {
|
|
2208
2211
|
ssr: false
|
|
2209
2212
|
});
|
|
2210
|
-
const [
|
|
2211
|
-
prop:
|
|
2212
|
-
defaultProp:
|
|
2213
|
-
onChange:
|
|
2213
|
+
const [navigationSidebarOpen = isLg, setNavigationSidebarOpen] = useControllableState4({
|
|
2214
|
+
prop: propsNavigationSidebarOpen,
|
|
2215
|
+
defaultProp: defaultNavigationSidebarOpen,
|
|
2216
|
+
onChange: onNavigationSidebarOpenChange
|
|
2214
2217
|
});
|
|
2215
|
-
const [
|
|
2216
|
-
prop:
|
|
2217
|
-
defaultProp:
|
|
2218
|
-
onChange:
|
|
2218
|
+
const [complementarySidebarOpen = false, setComplementarySidebarOpen] = useControllableState4({
|
|
2219
|
+
prop: propsComplementarySidebarOpen,
|
|
2220
|
+
defaultProp: defaultComplementarySidebarOpen,
|
|
2221
|
+
onChange: onComplementarySidebarOpenChange
|
|
2219
2222
|
});
|
|
2220
2223
|
const [resizing, setResizing] = useState8(false);
|
|
2221
2224
|
const resizeInterval = useRef2(null);
|
|
@@ -2237,10 +2240,10 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2237
2240
|
]);
|
|
2238
2241
|
return /* @__PURE__ */ React28.createElement(MainProvider, {
|
|
2239
2242
|
...props,
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2243
|
+
navigationSidebarOpen,
|
|
2244
|
+
setNavigationSidebarOpen,
|
|
2245
|
+
complementarySidebarOpen,
|
|
2246
|
+
setComplementarySidebarOpen,
|
|
2244
2247
|
resizing
|
|
2245
2248
|
}, children);
|
|
2246
2249
|
};
|
|
@@ -2248,7 +2251,7 @@ MainRoot.displayName = MAIN_ROOT_NAME;
|
|
|
2248
2251
|
var handleOpenAutoFocus = (event) => {
|
|
2249
2252
|
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2250
2253
|
};
|
|
2251
|
-
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus,
|
|
2254
|
+
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus, open, resizing, setOpen, side, ...props }, forwardedRef) => {
|
|
2252
2255
|
const [isLg] = useMediaQuery("lg", {
|
|
2253
2256
|
ssr: false
|
|
2254
2257
|
});
|
|
@@ -2256,7 +2259,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2256
2259
|
const ref = useForwardedRef(forwardedRef);
|
|
2257
2260
|
const noopRef = useRef2(null);
|
|
2258
2261
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2259
|
-
onDismiss: () =>
|
|
2262
|
+
onDismiss: () => setOpen(false)
|
|
2260
2263
|
});
|
|
2261
2264
|
const handleKeyDown = useCallback7((event) => {
|
|
2262
2265
|
if (event.key === "Escape") {
|
|
@@ -2268,7 +2271,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2268
2271
|
]);
|
|
2269
2272
|
const Root5 = isLg ? Primitive9.div : DialogContent2;
|
|
2270
2273
|
return /* @__PURE__ */ React28.createElement(DialogRoot2, {
|
|
2271
|
-
open
|
|
2274
|
+
open,
|
|
2272
2275
|
modal: false
|
|
2273
2276
|
}, /* @__PURE__ */ React28.createElement(Root5, {
|
|
2274
2277
|
...!isLg && {
|
|
@@ -2278,24 +2281,24 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2278
2281
|
},
|
|
2279
2282
|
...props,
|
|
2280
2283
|
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2281
|
-
"data-state":
|
|
2284
|
+
"data-state": open ? "open" : "closed",
|
|
2282
2285
|
"data-resizing": resizing ? "true" : "false",
|
|
2283
2286
|
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2284
2287
|
onKeyDown: handleKeyDown,
|
|
2285
|
-
|
|
2288
|
+
...!open && {
|
|
2286
2289
|
inert: "true"
|
|
2287
2290
|
},
|
|
2288
2291
|
ref
|
|
2289
2292
|
}, children));
|
|
2290
2293
|
});
|
|
2291
2294
|
var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2292
|
-
const {
|
|
2295
|
+
const { navigationSidebarOpen, setNavigationSidebarOpen, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2293
2296
|
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2294
2297
|
return /* @__PURE__ */ React28.createElement(MainSidebar, {
|
|
2295
2298
|
...mover,
|
|
2296
2299
|
...props,
|
|
2297
|
-
|
|
2298
|
-
|
|
2300
|
+
open: navigationSidebarOpen,
|
|
2301
|
+
setOpen: setNavigationSidebarOpen,
|
|
2299
2302
|
resizing,
|
|
2300
2303
|
side: "inline-start",
|
|
2301
2304
|
ref: forwardedRef
|
|
@@ -2303,13 +2306,13 @@ var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) =
|
|
|
2303
2306
|
});
|
|
2304
2307
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2305
2308
|
var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2306
|
-
const {
|
|
2309
|
+
const { complementarySidebarOpen, setComplementarySidebarOpen, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2307
2310
|
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2308
2311
|
return /* @__PURE__ */ React28.createElement(MainSidebar, {
|
|
2309
2312
|
...mover,
|
|
2310
2313
|
...props,
|
|
2311
|
-
|
|
2312
|
-
|
|
2314
|
+
open: complementarySidebarOpen,
|
|
2315
|
+
setOpen: setComplementarySidebarOpen,
|
|
2313
2316
|
resizing,
|
|
2314
2317
|
side: "inline-end",
|
|
2315
2318
|
ref: forwardedRef
|
|
@@ -2317,7 +2320,7 @@ var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef
|
|
|
2317
2320
|
});
|
|
2318
2321
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2319
2322
|
var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2320
|
-
const {
|
|
2323
|
+
const { navigationSidebarOpen, complementarySidebarOpen } = useMainContext(MAIN_NAME);
|
|
2321
2324
|
const { tx } = useThemeContext();
|
|
2322
2325
|
const Root5 = asChild ? Slot10 : role ? "div" : "main";
|
|
2323
2326
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
@@ -2327,8 +2330,8 @@ var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, h
|
|
|
2327
2330
|
...mover
|
|
2328
2331
|
},
|
|
2329
2332
|
...props,
|
|
2330
|
-
"data-sidebar-inline-start-state":
|
|
2331
|
-
"data-sidebar-inline-end-state":
|
|
2333
|
+
"data-sidebar-inline-start-state": navigationSidebarOpen ? "open" : "closed",
|
|
2334
|
+
"data-sidebar-inline-end-state": complementarySidebarOpen ? "open" : "closed",
|
|
2332
2335
|
className: tx("main.content", "main", {
|
|
2333
2336
|
bounce,
|
|
2334
2337
|
handlesFocus
|
|
@@ -2341,20 +2344,20 @@ var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwar
|
|
|
2341
2344
|
const [isLg] = useMediaQuery("lg", {
|
|
2342
2345
|
ssr: false
|
|
2343
2346
|
});
|
|
2344
|
-
const {
|
|
2347
|
+
const { navigationSidebarOpen, setNavigationSidebarOpen, complementarySidebarOpen, setComplementarySidebarOpen } = useMainContext(MAIN_NAME);
|
|
2345
2348
|
const { tx } = useThemeContext();
|
|
2346
2349
|
return /* @__PURE__ */ React28.createElement("div", {
|
|
2347
2350
|
onClick: () => {
|
|
2348
|
-
|
|
2349
|
-
|
|
2351
|
+
setNavigationSidebarOpen(false);
|
|
2352
|
+
setComplementarySidebarOpen(false);
|
|
2350
2353
|
},
|
|
2351
2354
|
...props,
|
|
2352
2355
|
className: tx("main.overlay", "main__overlay", {
|
|
2353
2356
|
isLg,
|
|
2354
|
-
inlineStartSidebarOpen:
|
|
2355
|
-
inlineEndSidebarOpen:
|
|
2357
|
+
inlineStartSidebarOpen: navigationSidebarOpen,
|
|
2358
|
+
inlineEndSidebarOpen: complementarySidebarOpen
|
|
2356
2359
|
}, classNames),
|
|
2357
|
-
"data-state":
|
|
2360
|
+
"data-state": navigationSidebarOpen || complementarySidebarOpen ? "open" : "closed",
|
|
2358
2361
|
"aria-hidden": "true",
|
|
2359
2362
|
ref: forwardedRef
|
|
2360
2363
|
});
|
|
@@ -2979,15 +2982,14 @@ var Separator4 = /* @__PURE__ */ forwardRef26(({ classNames, orientation = "hori
|
|
|
2979
2982
|
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2980
2983
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2981
2984
|
import React35, { forwardRef as forwardRef27 } from "react";
|
|
2982
|
-
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette
|
|
2985
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette, classNames, ...props }, forwardedRef) => {
|
|
2983
2986
|
const { tx } = useThemeContext();
|
|
2984
2987
|
const Root5 = asChild ? Slot13 : Primitive12.span;
|
|
2985
2988
|
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2986
2989
|
...props,
|
|
2987
|
-
className: tx("tag.root", "
|
|
2990
|
+
className: tx("tag.root", "tag", {
|
|
2988
2991
|
palette
|
|
2989
2992
|
}, classNames),
|
|
2990
|
-
"data-hue": palette,
|
|
2991
2993
|
ref: forwardedRef
|
|
2992
2994
|
});
|
|
2993
2995
|
});
|
|
@@ -3228,7 +3230,6 @@ export {
|
|
|
3228
3230
|
useDropdownMenuContext,
|
|
3229
3231
|
useDropdownMenuMenuScope,
|
|
3230
3232
|
useElevationContext,
|
|
3231
|
-
useLandmarkMover,
|
|
3232
3233
|
useListContext,
|
|
3233
3234
|
useListItemContext,
|
|
3234
3235
|
useMainContext,
|