@mszczygiel-projects/ui-core-react 1.0.0-alpha.0 → 1.0.0-alpha.1

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.
@@ -1,6 +1,6 @@
1
- import { type DialogProps as SharedDialogProps, type DialogSize, type OverlayCloseReason, type OverlayOpenChangeDetails as SharedOpenChangeDetails } from '@mszczygiel-projects/ui-core-shared/dialog';
1
+ import { type DialogPresentation, type DialogProps as SharedDialogProps, type DialogSize, type OverlayCloseReason, type OverlayOpenChangeDetails as SharedOpenChangeDetails } from '@mszczygiel-projects/ui-core-shared/dialog';
2
2
  import { type ComponentPropsWithRef, type ReactNode } from 'react';
3
- export type { DialogSize, OverlayCloseReason };
3
+ export type { DialogPresentation, DialogSize, OverlayCloseReason };
4
4
  /** What asked a modal to close, with the native event before React wraps it. */
5
5
  export type OverlayOpenChangeDetails = SharedOpenChangeDetails<Event>;
6
6
  /** The props of Dialog. Other attributes and the ref go to the native dialog element. */
@@ -28,9 +28,9 @@ export interface DialogProps extends SharedDialogProps, Omit<ComponentPropsWithR
28
28
  * to the element of the content marked with `data-autofocus`, else to its first focusable
29
29
  * element, and returns where it was when the dialog closes. Escape, a press on the backdrop
30
30
  * (except for an alert), the close button, a form with `method="dialog"` and a drag down of a
31
- * sheet ask it to close through `onOpenChange`. Below the breakpoint it rises from the bottom of
32
- * the window as a sheet. The heading names the dialog, and the description describes it; without
31
+ * sheet ask it to close through `onOpenChange`. In automatic presentation it becomes a sheet
32
+ * below the breakpoint. The heading names the dialog, and the description describes it; without
33
33
  * a heading, `label` or `aria-label` names it. The ref is the native dialog: open and close it
34
34
  * through `open`, never with its methods.
35
35
  */
36
- export declare function Dialog({ open, defaultOpen, onOpenChange, size, alert, heading, description, label, hideCloseButton, closeLabel, dragToDismiss, children, footer, className, ref, 'aria-label': ariaLabel, ...rest }: DialogProps): import("react").JSX.Element;
36
+ export declare function Dialog({ open, defaultOpen, onOpenChange, size, presentation, alert, heading, description, label, hideCloseButton, closeLabel, dragToDismiss, children, footer, className, ref, 'aria-label': ariaLabel, ...rest }: DialogProps): import("react").JSX.Element;
@@ -20,12 +20,12 @@ const { options } = dialogSpec;
20
20
  * to the element of the content marked with `data-autofocus`, else to its first focusable
21
21
  * element, and returns where it was when the dialog closes. Escape, a press on the backdrop
22
22
  * (except for an alert), the close button, a form with `method="dialog"` and a drag down of a
23
- * sheet ask it to close through `onOpenChange`. Below the breakpoint it rises from the bottom of
24
- * the window as a sheet. The heading names the dialog, and the description describes it; without
23
+ * sheet ask it to close through `onOpenChange`. In automatic presentation it becomes a sheet
24
+ * below the breakpoint. The heading names the dialog, and the description describes it; without
25
25
  * a heading, `label` or `aria-label` names it. The ref is the native dialog: open and close it
26
26
  * through `open`, never with its methods.
27
27
  */
28
- export function Dialog({ open, defaultOpen = false, onOpenChange, size = 'medium', alert = false, heading, description, label, hideCloseButton = false, closeLabel, dragToDismiss = false, children, footer, className, ref, 'aria-label': ariaLabel, ...rest }) {
28
+ export function Dialog({ open, defaultOpen = false, onOpenChange, size = 'medium', presentation = 'auto', alert = false, heading, description, label, hideCloseButton = false, closeLabel, dragToDismiss = false, children, footer, className, ref, 'aria-label': ariaLabel, ...rest }) {
29
29
  const { labels } = useUiCoreConfig();
30
30
  const id = useId();
31
31
  const headingId = `${id}-heading`;
@@ -39,6 +39,9 @@ export function Dialog({ open, defaultOpen = false, onOpenChange, size = 'medium
39
39
  const [dragging, setDragging] = useState(false);
40
40
  const [edges, setEdges] = useState({ fromStart: false, toEnd: true });
41
41
  const resolvedSize = oneOf(size, options.size.options, options.size.default);
42
+ const resolvedPresentation = resolvedSize === 'fullscreen'
43
+ ? options.presentation.default
44
+ : oneOf(presentation, options.presentation.options, options.presentation.default);
42
45
  const hasHeading = heading !== undefined && heading !== '';
43
46
  const hasDescription = description !== undefined && description !== '';
44
47
  const hasFooter = rendersContent(footer);
@@ -87,7 +90,7 @@ export function Dialog({ open, defaultOpen = false, onOpenChange, size = 'medium
87
90
  return (_jsxs("dialog", { ref: (node) => {
88
91
  dialogRef.current = node;
89
92
  return setRef(ref, node);
90
- }, className: classNames('ui-overlay', 'ui-overlay--dialog', 'ui-dialog', 'ui-dialog__base', `ui-dialog--${resolvedSize}`, edges.fromStart && 'ui-dialog--scrolled-from-start', !edges.toEnd && 'ui-dialog--scrolled-before-end', dragging && 'ui-overlay--dragging', className), role: alert ? 'alertdialog' : undefined, tabIndex: -1, "aria-labelledby": hasHeading && ariaLabel === undefined ? headingId : undefined, "aria-label": ariaLabel ?? (hasHeading ? undefined : label), "aria-describedby": hasDescription ? descriptionId : undefined, ...rest, children: [dragToDismiss && (_jsx("div", { ref: grabberRef, className: "ui-overlay__grabber ui-dialog__grabber", "aria-hidden": "true" })), _jsxs("div", { ref: headerRef, className: "ui-overlay__header ui-dialog__header", hidden: !hasHeading && !hasDescription && hideCloseButton, children: [_jsxs("div", { className: "ui-dialog__titles", children: [_jsx("h2", { id: headingId, className: "ui-dialog__heading", hidden: !hasHeading, children: heading }), _jsx("p", { id: descriptionId, className: "ui-dialog__description", hidden: !hasDescription, children: description })] }), !hideCloseButton && (_jsx(IconButton, { ref: closeRef, className: "ui-dialog__close", variant: "ghost", size: "small", label: closeLabel ?? labels.dialog.close, icon: _jsx("span", { dangerouslySetInnerHTML: { __html: iconClose } }), onClick: (event) => {
93
+ }, className: classNames('ui-overlay', 'ui-overlay--dialog', 'ui-dialog', 'ui-dialog__base', `ui-dialog--${resolvedSize}`, `ui-dialog--presentation-${resolvedPresentation}`, edges.fromStart && 'ui-dialog--scrolled-from-start', !edges.toEnd && 'ui-dialog--scrolled-before-end', dragging && 'ui-overlay--dragging', className), role: alert ? 'alertdialog' : undefined, tabIndex: -1, "aria-labelledby": hasHeading && ariaLabel === undefined ? headingId : undefined, "aria-label": ariaLabel ?? (hasHeading ? undefined : label), "aria-describedby": hasDescription ? descriptionId : undefined, ...rest, children: [dragToDismiss && (_jsx("div", { ref: grabberRef, className: "ui-overlay__grabber ui-dialog__grabber", "aria-hidden": "true" })), _jsxs("div", { ref: headerRef, className: "ui-overlay__header ui-dialog__header", hidden: !hasHeading && !hasDescription && hideCloseButton, children: [_jsxs("div", { className: "ui-dialog__titles", children: [_jsx("h2", { id: headingId, className: "ui-dialog__heading", hidden: !hasHeading, children: heading }), _jsx("p", { id: descriptionId, className: "ui-dialog__description", hidden: !hasDescription, children: description })] }), !hideCloseButton && (_jsx(IconButton, { ref: closeRef, className: "ui-dialog__close", variant: "ghost", size: "small", label: closeLabel ?? labels.dialog.close, icon: _jsx("span", { dangerouslySetInnerHTML: { __html: iconClose } }), onClick: (event) => {
91
94
  requestClose('close-button', event.nativeEvent);
92
95
  } }))] }), _jsx("div", { ref: bodyRef, className: "ui-overlay__body ui-dialog__body", onScroll: measureEdges, children: children }), _jsx("div", { ref: footerRef, className: "ui-dialog__footer", hidden: !hasFooter, children: footer })] }));
93
96
  }
package/dist/index.d.ts CHANGED
@@ -10,12 +10,13 @@ export { Chip, type ChipProps } from './chip/Chip.tsx';
10
10
  export { Combobox, type ComboboxProps } from './combobox/Combobox.tsx';
11
11
  export { DateField, type DateFieldProps, type DateFieldValueChangeDetails, } from './date-field/DateField.tsx';
12
12
  export { DateTimeField, type DateTimeFieldProps } from './date-time-field/DateTimeField.tsx';
13
- export { Dialog, type DialogProps, type DialogSize, type OverlayCloseReason, type OverlayOpenChangeDetails, } from './dialog/Dialog.tsx';
13
+ export { Dialog, type DialogPresentation, type DialogProps, type DialogSize, type OverlayCloseReason, type OverlayOpenChangeDetails, } from './dialog/Dialog.tsx';
14
14
  export { Drawer, type DrawerPlacement, type DrawerProps } from './drawer/Drawer.tsx';
15
15
  export { FileInputField, type FileInputFieldChangeReason, type FileInputFieldProps, type FileInputFieldRejectDetails, type FileInputFieldRejection, type FileInputFieldSize, type FileInputFieldState, type FileInputFieldValueChangeDetails, type FileInputFieldVariant, } from './file-input-field/FileInputField.tsx';
16
16
  export { IconButton, type IconButtonProps, type IconButtonShape, type IconButtonSize, type IconButtonType, type IconButtonVariant, } from './icon-button/IconButton.tsx';
17
17
  export { LinkButton, type LinkButtonProps, type LinkButtonRenderProps, type LinkButtonShape, type LinkButtonSize, type LinkButtonVariant, } from './link-button/LinkButton.tsx';
18
18
  export { Listbox, type ListboxGroup, type ListboxOption, type ListboxProps, type ListboxSize, type ListboxValue, type ListboxValueChangeDetails, } from './listbox/Listbox.tsx';
19
+ export { type CustomLoaderProps, defineReactLoader } from './loader/define-react-loader.ts';
19
20
  export { Loader, type LoaderProps, type LoaderSize } from './loader/Loader.tsx';
20
21
  export { Menu, type MenuActionDetails, type MenuAlign, type MenuGroup, type MenuItem, type MenuItems, type MenuOpenChangeDetails, type MenuPlacement, type MenuProps, type MenuSize, } from './menu/Menu.tsx';
21
22
  export { Notification, type NotificationProps } from './notification/Notification.tsx';
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ export { FileInputField, } from "./file-input-field/FileInputField.js";
16
16
  export { IconButton, } from "./icon-button/IconButton.js";
17
17
  export { LinkButton, } from "./link-button/LinkButton.js";
18
18
  export { Listbox, } from "./listbox/Listbox.js";
19
+ export { defineReactLoader } from "./loader/define-react-loader.js";
19
20
  export { Loader } from "./loader/Loader.js";
20
21
  export { Menu, } from "./menu/Menu.js";
21
22
  export { Notification } from "./notification/Notification.js";
@@ -27,7 +27,7 @@ export class Overlay {
27
27
  return;
28
28
  }
29
29
  if (!dialog.open) {
30
- dialog.showModal();
30
+ showModal(dialog, this.options.content());
31
31
  }
32
32
  lockPage(this);
33
33
  this.events = new AbortController();
@@ -84,13 +84,12 @@ export class Overlay {
84
84
  */
85
85
  focusContent(dialog) {
86
86
  const content = this.options.content();
87
- const marked = content.flatMap((root) => [
88
- ...(root.matches(AUTOFOCUS) ? [root] : []),
89
- ...root.querySelectorAll(AUTOFOCUS),
90
- ]);
87
+ const marked = content.flatMap((root) => [...autofocusElements(root)]);
88
+ const preferred = marked.filter((element) => element.hasAttribute('data-autofocus'));
89
+ const native = marked.filter((element) => !element.hasAttribute('data-autofocus'));
91
90
  // A marked element takes the focus outside the order of Tab too, such as a paragraph with
92
91
  // `tabindex="-1"` to read first.
93
- for (const candidate of marked) {
92
+ for (const candidate of [...preferred, ...native]) {
94
93
  if (tryFocus(candidate, true)) {
95
94
  return;
96
95
  }
@@ -226,6 +225,56 @@ function submittedValue(form, submitter, pressed) {
226
225
  const value = custom === undefined ? undefined : Reflect.get(custom, 'value');
227
226
  return typeof value === 'string' ? value : '';
228
227
  }
228
+ /** The marked elements in rendered order, including slots and open shadow roots. */
229
+ function* autofocusElements(root) {
230
+ if (root instanceof HTMLElement && root.matches(AUTOFOCUS)) {
231
+ yield root;
232
+ }
233
+ const children = root instanceof HTMLSlotElement
234
+ ? root.assignedElements({ flatten: true })
235
+ : (root.shadowRoot ?? root).children;
236
+ for (const child of children) {
237
+ yield* autofocusElements(child);
238
+ }
239
+ }
240
+ /** Gives the browser the preferred targets during native opening, then restores author markup. */
241
+ function showModal(dialog, content) {
242
+ const preferred = new Set(content
243
+ .flatMap((root) => [...autofocusElements(root)])
244
+ .filter((element) => element.hasAttribute('data-autofocus')));
245
+ if (preferred.size === 0) {
246
+ dialog.showModal();
247
+ return;
248
+ }
249
+ const changed = new Map();
250
+ try {
251
+ // An earlier native autofocus would otherwise beat a preferred target and can open the keyboard.
252
+ for (const element of autofocusElements(dialog)) {
253
+ const native = element.getAttribute('autofocus');
254
+ if (native !== null && !preferred.has(element)) {
255
+ changed.set(element, native);
256
+ element.removeAttribute('autofocus');
257
+ }
258
+ }
259
+ for (const element of preferred) {
260
+ if (!element.hasAttribute('autofocus')) {
261
+ changed.set(element, null);
262
+ element.setAttribute('autofocus', '');
263
+ }
264
+ }
265
+ dialog.showModal();
266
+ }
267
+ finally {
268
+ for (const [element, native] of changed) {
269
+ if (native === null) {
270
+ element.removeAttribute('autofocus');
271
+ }
272
+ else {
273
+ element.setAttribute('autofocus', native);
274
+ }
275
+ }
276
+ }
277
+ }
229
278
  /** A root of the content and every element inside it, in the order of the document. */
230
279
  function descendants(root) {
231
280
  return [root, ...root.querySelectorAll('*')];
@@ -1,5 +1,5 @@
1
1
  import { type LoaderProps as SharedLoaderProps, type LoaderSize } from '@mszczygiel-projects/ui-core-shared/loader';
2
- import type { ComponentPropsWithRef } from 'react';
2
+ import { type ComponentPropsWithRef } from 'react';
3
3
  export type { LoaderSize };
4
4
  /** The props of {@link Loader}. Other attributes of a `span` go to its root element. */
5
5
  export interface LoaderProps extends SharedLoaderProps, Omit<ComponentPropsWithRef<'span'>, keyof SharedLoaderProps | 'children'> {
@@ -1,13 +1,25 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { getReducedMotionStore } from '@mszczygiel-projects/ui-core-foundations/motion-preference';
3
4
  import { loader, } from '@mszczygiel-projects/ui-core-shared/loader';
4
5
  import { oneOf } from '@mszczygiel-projects/ui-core-shared/one-of';
6
+ import { useSyncExternalStore } from 'react';
5
7
  import { classNames } from "../internal/class-names.js";
6
8
  import { useUiCoreConfig } from "../internal/use-ui-core-config.js";
7
- /** The markup of each look of a loader, chosen by `loaderVariant` in the configuration. */
8
- const looks = {
9
- spinner: () => _jsx("span", { className: "ui-loader__indicator" }),
10
- };
9
+ import { reactLoaderPresentation } from "./define-react-loader.js";
10
+ const browserReducedMotion = () => getReducedMotionStore(window).getSnapshot();
11
+ const serverReducedMotion = () => undefined;
12
+ const subscribeToReducedMotion = (listener) => getReducedMotionStore(window).subscribe(listener);
13
+ function CustomIndicator({ presentation, size, }) {
14
+ // The server and first hydration render use the spinner until the preference is known.
15
+ const reducedMotion = useSyncExternalStore(subscribeToReducedMotion, browserReducedMotion, serverReducedMotion);
16
+ const Visual = reducedMotion === undefined
17
+ ? undefined
18
+ : reducedMotion
19
+ ? presentation.reducedMotion
20
+ : presentation.component;
21
+ return Visual === undefined ? (_jsx("span", { className: "ui-loader__indicator ui-loader__indicator--fallback" })) : (_jsx("span", { "aria-hidden": "true", inert: true, className: "ui-loader__indicator ui-loader__indicator--custom", children: _jsx(Visual, { size: size }) }));
22
+ }
11
23
  /**
12
24
  * Shows that content is loading or that an action is in progress.
13
25
  *
@@ -15,7 +27,9 @@ const looks = {
15
27
  * as a prop wins over it, and so do the other attributes of the root element. It draws the look
16
28
  * that `loaderVariant` of `configureUiCore` chooses.
17
29
  */
18
- export function Loader({ size = 'medium', label, className, ...rest }) {
19
- const { labels, loaderVariant } = useUiCoreConfig();
20
- return (_jsx("span", { role: "progressbar", "aria-label": label ?? labels.loader.label, className: classNames('ui-loader', `ui-loader--${oneOf(size, loader.options.size.options, loader.options.size.default)}`, className), ...rest, children: looks[loaderVariant]() }));
30
+ export function Loader({ size, label, className, ...rest }) {
31
+ const { labels, loader: customLoader } = useUiCoreConfig();
32
+ const visualSize = oneOf(size, loader.options.size.options, loader.options.size.default);
33
+ const presentation = reactLoaderPresentation(customLoader);
34
+ return (_jsx("span", { role: "progressbar", "aria-label": label ?? labels.loader.label, className: classNames('ui-loader', `ui-loader--${visualSize}`, className), ...rest, children: presentation === undefined ? (_jsx("span", { className: "ui-loader__indicator" })) : (_jsx(CustomIndicator, { presentation: presentation, size: visualSize })) }));
21
35
  }
@@ -0,0 +1,13 @@
1
+ import type { LoaderPresentation, LoaderVariantDefinition } from '@mszczygiel-projects/ui-core-foundations/config';
2
+ import type { LoaderSize } from '@mszczygiel-projects/ui-core-shared/loader';
3
+ import type { ComponentType } from 'react';
4
+ /** The token-based size given to a custom React loader. */
5
+ export interface CustomLoaderProps {
6
+ readonly size: LoaderSize;
7
+ }
8
+ type ReactLoader = ComponentType<CustomLoaderProps>;
9
+ /** Defines a decorative React visual and its optional static counterpart for reduced motion. */
10
+ export declare function defineReactLoader(component: ReactLoader, reducedMotion?: ReactLoader): LoaderVariantDefinition;
11
+ /** Recovers the typed presentation stored by the React adapter. */
12
+ export declare function reactLoaderPresentation(definition: LoaderVariantDefinition | undefined): LoaderPresentation<ReactLoader> | undefined;
13
+ export {};
@@ -0,0 +1,9 @@
1
+ const ADAPTER_KEY = Symbol.for('ui-core.loader.react');
2
+ /** Defines a decorative React visual and its optional static counterpart for reduced motion. */
3
+ export function defineReactLoader(component, reducedMotion) {
4
+ return { [ADAPTER_KEY]: { component, reducedMotion } };
5
+ }
6
+ /** Recovers the typed presentation stored by the React adapter. */
7
+ export function reactLoaderPresentation(definition) {
8
+ return definition?.[ADAPTER_KEY];
9
+ }
package/dist/styles.css CHANGED
@@ -448,7 +448,6 @@
448
448
  }
449
449
 
450
450
  :is(.ui-button__leading-icon, .ui-button__trailing-icon) > * {
451
- display: inline-flex;
452
451
  inline-size: 100%;
453
452
  block-size: 100%;
454
453
  }
@@ -1062,7 +1061,7 @@ button.ui-chip__control::after {
1062
1061
  border: var(--date-field-panel-border-width) solid var(--color-date-field-panel-border);
1063
1062
  border-radius: var(--date-field-panel-radius);
1064
1063
  background: var(--color-date-field-panel-background);
1065
- box-shadow: var(--date-field-panel-shadow);
1064
+ box-shadow: var(--date-field-panel-shadow) var(--color-date-field-panel-shadow);
1066
1065
  color: inherit;
1067
1066
  }
1068
1067
 
@@ -1094,7 +1093,7 @@ button.ui-chip__control::after {
1094
1093
  border: var(--date-field-panel-border-width) solid var(--color-date-field-panel-border);
1095
1094
  border-radius: var(--date-field-panel-radius);
1096
1095
  background: var(--color-date-field-panel-background);
1097
- box-shadow: var(--date-field-panel-shadow);
1096
+ box-shadow: var(--date-field-panel-shadow) var(--color-date-field-panel-shadow);
1098
1097
  color: inherit;
1099
1098
  }
1100
1099
 
@@ -1122,13 +1121,29 @@ button.ui-chip__control::after {
1122
1121
  --_margin: var(--dialog-margin);
1123
1122
  --_radius: var(--dialog-radius);
1124
1123
 
1125
- inline-size: var(--_max-width);
1126
- max-inline-size: calc(100% - 2 * var(--_margin));
1127
- max-block-size: calc(100% - 2 * var(--_margin));
1128
- margin: auto;
1124
+ /* Only one layout contributes values. The empty var() fallback survives CSS minification. */
1125
+ --_empty-layout: initial;
1126
+ --_centered-layout: initial;
1127
+ --_sheet-layout: var(--_empty-layout,);
1128
+ --_enter-from: var(--_centered-layout, 0 0) var(--_sheet-layout, 0 100%);
1129
+
1130
+ inline-size: var(--_centered-layout, var(--_max-width)) var(--_sheet-layout, 100%);
1131
+ max-inline-size: var(--_centered-layout, calc(100% - 2 * var(--_margin)))
1132
+ var(--_sheet-layout, 100%);
1133
+ max-block-size: var(--_centered-layout, calc(100% - 2 * var(--_margin)))
1134
+ var(--_sheet-layout, calc(100% - var(--_margin)));
1135
+ margin-block: var(--_centered-layout, auto) var(--_sheet-layout, auto 0);
1136
+ margin-inline: var(--_centered-layout, auto) var(--_sheet-layout, 0);
1129
1137
  padding-block: var(--_padding-stack);
1130
- border-width: var(--_border-width);
1131
- border-radius: var(--_radius);
1138
+ border-block-start-width: var(--_border-width);
1139
+ border-block-end-width: var(--_centered-layout, var(--_border-width)) var(--_sheet-layout, 0);
1140
+ border-inline-width: var(--_centered-layout, var(--_border-width)) var(--_sheet-layout, 0);
1141
+ border-start-start-radius: var(--_centered-layout, var(--_radius))
1142
+ var(--_sheet-layout, var(--dialog-sheet-radius));
1143
+ border-start-end-radius: var(--_centered-layout, var(--_radius))
1144
+ var(--_sheet-layout, var(--dialog-sheet-radius));
1145
+ border-end-start-radius: var(--_centered-layout, var(--_radius)) var(--_sheet-layout, 0);
1146
+ border-end-end-radius: var(--_centered-layout, var(--_radius)) var(--_sheet-layout, 0);
1132
1147
  }
1133
1148
 
1134
1149
  .ui-dialog.ui-dialog--small {
@@ -1140,6 +1155,9 @@ button.ui-chip__control::after {
1140
1155
  }
1141
1156
 
1142
1157
  .ui-dialog.ui-dialog--fullscreen {
1158
+ --_enter-from: 0 0;
1159
+
1160
+ margin: auto;
1143
1161
  inline-size: 100%;
1144
1162
  block-size: 100%;
1145
1163
  max-inline-size: 100%;
@@ -1191,7 +1209,7 @@ button.ui-chip__control::after {
1191
1209
  .ui-dialog__footer {
1192
1210
  display: flex;
1193
1211
  flex: none;
1194
- flex-wrap: wrap;
1212
+ flex-flow: var(--_centered-layout, row) var(--_sheet-layout, column-reverse) wrap;
1195
1213
  justify-content: flex-end;
1196
1214
  gap: var(--dialog-footer-gap);
1197
1215
  padding-inline: var(--_padding-inline);
@@ -1223,33 +1241,34 @@ button.ui-chip__control::after {
1223
1241
  display: none;
1224
1242
  }
1225
1243
 
1226
- /* Below the breakpoint, the dialog rises from the bottom of the window as a sheet. */
1227
- @media (width < 64rem) {
1228
- .ui-dialog.ui-dialog__base:not(.ui-dialog--fullscreen) {
1229
- --_enter-from: 0 100%;
1244
+ .ui-dialog .ui-dialog__grabber ~ .ui-dialog__header {
1245
+ touch-action: var(--_centered-layout, auto) var(--_sheet-layout, none);
1246
+ }
1230
1247
 
1231
- inline-size: 100%;
1232
- max-inline-size: 100%;
1233
- max-block-size: calc(100% - var(--_margin));
1234
- margin-block: auto 0;
1235
- margin-inline: 0;
1236
- border-block-end-width: 0;
1237
- border-inline-width: 0;
1238
- border-start-start-radius: var(--dialog-sheet-radius);
1239
- border-start-end-radius: var(--dialog-sheet-radius);
1240
- border-end-start-radius: 0;
1241
- border-end-end-radius: 0;
1242
- }
1248
+ .ui-dialog--fullscreen .ui-dialog__grabber ~ .ui-dialog__header {
1249
+ touch-action: auto;
1250
+ }
1243
1251
 
1244
- .ui-dialog.ui-dialog__base:not(.ui-dialog--fullscreen) .ui-dialog__grabber {
1245
- display: block;
1246
- }
1252
+ .ui-dialog:not(.ui-dialog--fullscreen) .ui-dialog__grabber {
1253
+ display: var(--_centered-layout, none) var(--_sheet-layout, block);
1254
+ }
1247
1255
 
1248
- .ui-dialog__footer {
1249
- flex-direction: column-reverse;
1256
+ .ui-dialog--presentation-sheet .ui-dialog__footer > * {
1257
+ inline-size: 100%;
1258
+ }
1259
+
1260
+ .ui-dialog.ui-dialog__base.ui-dialog--presentation-sheet {
1261
+ --_centered-layout: var(--_empty-layout,);
1262
+ --_sheet-layout: initial;
1263
+ }
1264
+
1265
+ @media (width < 64rem) {
1266
+ .ui-dialog.ui-dialog__base.ui-dialog--presentation-auto {
1267
+ --_centered-layout: var(--_empty-layout,);
1268
+ --_sheet-layout: initial;
1250
1269
  }
1251
1270
 
1252
- .ui-dialog__footer > * {
1271
+ .ui-dialog--presentation-auto .ui-dialog__footer > * {
1253
1272
  inline-size: 100%;
1254
1273
  }
1255
1274
  }
@@ -1712,7 +1731,6 @@ button.ui-chip__control::after {
1712
1731
  }
1713
1732
 
1714
1733
  .ui-icon-button__icon > * {
1715
- display: inline-flex;
1716
1734
  inline-size: var(--_icon-size);
1717
1735
  block-size: var(--_icon-size);
1718
1736
  }
@@ -1741,6 +1759,20 @@ button.ui-chip__control::after {
1741
1759
  * `ui-action--disabled` where its element has no native disabled state.
1742
1760
  */
1743
1761
 
1762
+ /* An icon wrapper can contain artwork with a size of its own. */
1763
+ :is(
1764
+ .ui-button__leading-icon,
1765
+ .ui-button__trailing-icon,
1766
+ .ui-icon-button__icon,
1767
+ .ui-link-button__leading-icon,
1768
+ .ui-link-button__trailing-icon
1769
+ )
1770
+ > * {
1771
+ display: inline-flex;
1772
+ align-items: center;
1773
+ justify-content: center;
1774
+ }
1775
+
1744
1776
  .ui-action {
1745
1777
  --_font-size: var(--button-font-size);
1746
1778
  --_line-height: var(--button-line-height);
@@ -2899,7 +2931,7 @@ button.ui-chip__control::after {
2899
2931
  border: var(--listbox-border-width) solid var(--color-listbox-border);
2900
2932
  border-radius: var(--listbox-radius);
2901
2933
  background: var(--color-listbox-background);
2902
- box-shadow: var(--listbox-popup-shadow);
2934
+ box-shadow: var(--listbox-popup-shadow) var(--color-listbox-popup-shadow);
2903
2935
  color: var(--color-listbox-option-text-default);
2904
2936
  }
2905
2937
 
@@ -2972,6 +3004,19 @@ button.ui-chip__control::after {
2972
3004
 
2973
3005
  .ui-overlay::backdrop {
2974
3006
  background: var(--_backdrop);
3007
+
3008
+ /* stylelint-disable-next-line plugin/use-baseline -- the backdrop keeps its color without the filter */
3009
+ backdrop-filter: blur(var(--overlay-backdrop-blur));
3010
+ }
3011
+
3012
+ /* stylelint-disable-next-line plugin/use-baseline -- older browsers use the blur declaration above */
3013
+ @supports (backdrop-filter: if(style(--overlay-backdrop-blur = 0): none; else: none)) {
3014
+ .ui-overlay::backdrop {
3015
+ /* stylelint-disable-next-line plugin/use-baseline -- older browsers use the blur declaration above */
3016
+ backdrop-filter: if(
3017
+ style(--overlay-backdrop-blur = 0): none; else: blur(var(--overlay-backdrop-blur))
3018
+ );
3019
+ }
2975
3020
  }
2976
3021
 
2977
3022
  .ui-overlay--dialog {
@@ -3082,7 +3127,6 @@ button.ui-chip__control::after {
3082
3127
  }
3083
3128
 
3084
3129
  :is(.ui-link-button__leading-icon, .ui-link-button__trailing-icon) > * {
3085
- display: inline-flex;
3086
3130
  inline-size: 100%;
3087
3131
  block-size: 100%;
3088
3132
  }
@@ -3104,6 +3148,10 @@ button.ui-chip__control::after {
3104
3148
  font-family: var(--control-font-family);
3105
3149
  }
3106
3150
 
3151
+ .ui-listbox__base {
3152
+ box-shadow: var(--listbox-popup-shadow) var(--color-listbox-popup-shadow);
3153
+ }
3154
+
3107
3155
  .ui-listbox--error {
3108
3156
  --_label: var(--color-control-outline-label-error);
3109
3157
  --_hint: var(--color-control-outline-hint-error);
@@ -3199,6 +3247,14 @@ button.ui-chip__control::after {
3199
3247
  animation: ui-loader-spin var(--duration-700) var(--ease-linear) infinite;
3200
3248
  }
3201
3249
 
3250
+ .ui-loader__indicator--custom {
3251
+ display: grid;
3252
+ place-items: center;
3253
+ font-size: var(--_size);
3254
+ border: 0;
3255
+ animation: none;
3256
+ }
3257
+
3202
3258
  @keyframes ui-loader-spin {
3203
3259
  to {
3204
3260
  transform: rotate(1turn);
@@ -3210,6 +3266,11 @@ button.ui-chip__control::after {
3210
3266
  .ui-loader__indicator {
3211
3267
  animation: ui-loader-fade calc(var(--duration-1000) * 2) var(--ease-in-out) infinite;
3212
3268
  }
3269
+
3270
+ .ui-loader__indicator--custom,
3271
+ .ui-loader__indicator--fallback {
3272
+ animation: none;
3273
+ }
3213
3274
  }
3214
3275
 
3215
3276
  @keyframes ui-loader-fade {
@@ -3251,7 +3312,7 @@ button.ui-chip__control::after {
3251
3312
  border-radius: var(--menu-radius);
3252
3313
  outline: none;
3253
3314
  background: var(--color-menu-background);
3254
- box-shadow: var(--menu-popup-shadow);
3315
+ box-shadow: var(--menu-popup-shadow) var(--color-menu-popup-shadow);
3255
3316
  color: var(--color-menu-item-text-default);
3256
3317
  font-family: var(--control-font-family);
3257
3318
  font-size: var(--_font-size);
@@ -3798,7 +3859,7 @@ button.ui-chip__control::after {
3798
3859
  border: var(--_border-width) solid var(--_border-color);
3799
3860
  border-radius: var(--popover-radius);
3800
3861
  background: var(--color-popover-background);
3801
- box-shadow: var(--popover-shadow);
3862
+ box-shadow: var(--popover-shadow) var(--color-popover-shadow);
3802
3863
  color: inherit;
3803
3864
  }
3804
3865
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mszczygiel-projects/ui-core-react",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "The React components of UI Core Library, safe for server rendering.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -35,9 +35,9 @@
35
35
  "dependencies": {
36
36
  "@floating-ui/dom": "1.8.0",
37
37
  "imask": "7.6.1",
38
- "@mszczygiel-projects/ui-core-foundations": "^1.0.0-alpha.0",
39
- "@mszczygiel-projects/ui-core-icons": "^1.0.0-alpha.0",
40
- "@mszczygiel-projects/ui-core-shared": "^1.0.0-alpha.0"
38
+ "@mszczygiel-projects/ui-core-icons": "^1.0.0-alpha.1",
39
+ "@mszczygiel-projects/ui-core-shared": "^1.0.0-alpha.1",
40
+ "@mszczygiel-projects/ui-core-foundations": "^1.0.0-alpha.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@figma/code-connect": "2.0.2",