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