@civitai/blocks-react 0.12.0 → 0.12.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.
- package/README.md +1 -1
- package/dist/ui/Alert.d.ts +12 -2
- package/dist/ui/Alert.d.ts.map +1 -1
- package/dist/ui/Alert.js +8 -4
- package/dist/ui/Alert.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -274,7 +274,7 @@ export function App() {
|
|
|
274
274
|
| `TextInput` / `Textarea` | `label` / `description` / `error` / `required`, wired via `htmlFor` + `aria-describedby` + `aria-invalid`. `Textarea` takes `minRows`. |
|
|
275
275
|
| `Card` | themed surface; `withBorder`, `padding`, `radius`. |
|
|
276
276
|
| `Stack` / `Group` | vertical / horizontal flex; `gap`, `align`, `justify` (+ `Group` `wrap`). |
|
|
277
|
-
| `Alert` | `color` (`info`/`success`/`warning`/`error`), `title`, `withCloseButton` + `onClose
|
|
277
|
+
| `Alert` | `color` (`info`/`success`/`warning`/`error`), `title`, `withCloseButton` + `onClose`. ARIA role defaults by color — `error`/`warning` → `role="alert"` (assertive), `info`/`success` → `role="status"` (polite); pass `role` to override. |
|
|
278
278
|
| `Loader` | CSS-keyframe spinner; `size`, `color`; `role="status"`. |
|
|
279
279
|
| `Badge` | `variant`, `size`, `color`. |
|
|
280
280
|
| `Modal` | `opened` + `onClose`, `title`, `size`; `role="dialog"` + `aria-modal`, Escape- and overlay-click-to-close, focuses the panel on open and restores focus on close. |
|
package/dist/ui/Alert.d.ts
CHANGED
|
@@ -10,10 +10,20 @@ export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
10
10
|
onClose?: () => void;
|
|
11
11
|
/** Accessible label for the close button. Defaults to "Close alert". */
|
|
12
12
|
closeButtonLabel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* ARIA live-region role. Defaults by `color`: `error`/`warning` →
|
|
15
|
+
* `'alert'` (assertive, interrupts), `info`/`success` → `'status'`
|
|
16
|
+
* (polite). Set explicitly to override the color-derived default — an
|
|
17
|
+
* explicit value always wins.
|
|
18
|
+
*/
|
|
19
|
+
role?: React.AriaRole;
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
15
|
-
* A themed callout.
|
|
16
|
-
*
|
|
22
|
+
* A themed callout. Its ARIA role defaults by `color` —
|
|
23
|
+
* `error`/`warning` get `role="alert"` (assertive), `info`/`success`
|
|
24
|
+
* get `role="status"` (polite) so a static callout isn't announced
|
|
25
|
+
* interruptively. Pass `role` to override. Optional dismiss button
|
|
26
|
+
* calls `onClose`. Auto-themed via `useBlocksStyles()`.
|
|
17
27
|
*/
|
|
18
28
|
export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
29
|
//# sourceMappingURL=Alert.d.ts.map
|
package/dist/ui/Alert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/ui/Alert.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACrE,4CAA4C;IAC5C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/ui/Alert.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACrE,4CAA4C;IAC5C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,uGA0ChB,CAAC"}
|
package/dist/ui/Alert.js
CHANGED
|
@@ -2,11 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useBlocksStyles } from './styles.js';
|
|
4
4
|
/**
|
|
5
|
-
* A themed callout.
|
|
6
|
-
*
|
|
5
|
+
* A themed callout. Its ARIA role defaults by `color` —
|
|
6
|
+
* `error`/`warning` get `role="alert"` (assertive), `info`/`success`
|
|
7
|
+
* get `role="status"` (polite) so a static callout isn't announced
|
|
8
|
+
* interruptively. Pass `role` to override. Optional dismiss button
|
|
9
|
+
* calls `onClose`. Auto-themed via `useBlocksStyles()`.
|
|
7
10
|
*/
|
|
8
|
-
export const Alert = forwardRef(function Alert({ color = 'info', title, withCloseButton = false, onClose, closeButtonLabel = 'Close alert', children, ...rest }, ref) {
|
|
11
|
+
export const Alert = forwardRef(function Alert({ color = 'info', title, withCloseButton = false, onClose, closeButtonLabel = 'Close alert', role, children, ...rest }, ref) {
|
|
9
12
|
useBlocksStyles();
|
|
10
|
-
|
|
13
|
+
const resolvedRole = role ?? (color === 'error' || color === 'warning' ? 'alert' : 'status');
|
|
14
|
+
return (_jsxs("div", { ref: ref, ...rest, "data-civitai-ui": "alert", "data-color": color, role: resolvedRole, children: [_jsxs("div", { "data-civitai-ui-alert-body": true, children: [title != null ? (_jsx("div", { "data-civitai-ui-alert-title": true, children: title })) : null, children] }), withCloseButton ? (_jsx("button", { type: "button", "data-civitai-ui-alert-close": true, "aria-label": closeButtonLabel, onClick: () => onClose?.(), children: "\u00D7" })) : null] }));
|
|
11
15
|
});
|
|
12
16
|
//# sourceMappingURL=Alert.js.map
|
package/dist/ui/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/ui/Alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/ui/Alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAyB9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAA6B,SAAS,KAAK,CACxE,EACE,KAAK,GAAG,MAAM,EACd,KAAK,EACL,eAAe,GAAG,KAAK,EACvB,OAAO,EACP,gBAAgB,GAAG,aAAa,EAChC,IAAI,EACJ,QAAQ,EACR,GAAG,IAAI,EACR,EACD,GAAG;IAEH,eAAe,EAAE,CAAC;IAClB,MAAM,YAAY,GAChB,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1E,OAAO,CACL,eACE,GAAG,EAAE,GAAG,KACJ,IAAI,qBACQ,OAAO,gBACX,KAAK,EACjB,IAAI,EAAE,YAAY,aAElB,8DACG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CACf,6DAAkC,KAAK,GAAO,CAC/C,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,IACL,EACL,eAAe,CAAC,CAAC,CAAC,CACjB,iBACE,IAAI,EAAC,QAAQ,qDAED,gBAAgB,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,uBAGnB,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|