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