@atelier-ui/react 0.2.36 → 0.2.38
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/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/lib/alert/atl-alert.js +1 -1
- package/src/lib/alert/atl-alert.js.map +1 -1
- package/src/lib/badge/atl-badge.js +1 -1
- package/src/lib/badge/atl-badge.js.map +1 -1
- package/src/lib/breadcrumbs/atl-breadcrumbs.css +6 -2
- package/src/lib/breadcrumbs/atl-breadcrumbs.d.ts.map +1 -1
- package/src/lib/breadcrumbs/atl-breadcrumbs.js +1 -1
- package/src/lib/breadcrumbs/atl-breadcrumbs.js.map +1 -1
- package/src/lib/card/atl-card.css +1 -0
- package/src/lib/chat/atl-chat.css +7 -0
- package/src/lib/chat/atl-chat.d.ts +11 -0
- package/src/lib/chat/atl-chat.d.ts.map +1 -1
- package/src/lib/chat/atl-chat.js +12 -1
- package/src/lib/chat/atl-chat.js.map +1 -1
- package/src/lib/stepper/atl-stepper.css +4 -1
- package/src/lib/stepper/atl-stepper.d.ts.map +1 -1
- package/src/lib/stepper/atl-stepper.js +20 -9
- package/src/lib/stepper/atl-stepper.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 0.2.38 (2026-09-07)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **card:** the header stated three of the title role's four axes ([c88a543](https://github.com/DominikPieper/atelier-ui/commit/c88a543))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Claude Opus 5 (1M context)
|
|
10
|
+
- Dominik Pieper @DominikPieper
|
|
11
|
+
|
|
12
|
+
## 0.2.37 (2026-09-06)
|
|
13
|
+
|
|
14
|
+
### 🩹 Fixes
|
|
15
|
+
|
|
16
|
+
- **a11y:** four role claims, and the fix that did not fix anything ([f6bc9cf](https://github.com/DominikPieper/atelier-ui/commit/f6bc9cf))
|
|
17
|
+
|
|
18
|
+
### ❤️ Thank You
|
|
19
|
+
|
|
20
|
+
- Claude Opus 5 (1M context)
|
|
21
|
+
- Dominik Pieper @DominikPieper
|
|
22
|
+
|
|
1
23
|
## 0.2.36 (2026-09-06)
|
|
2
24
|
|
|
3
25
|
This was a version bump only for react to align it with other projects, there were no code changes.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import './atl-alert.css';
|
|
3
3
|
import { AtlIcon } from '../icon/atl-icon';
|
|
4
4
|
/** Which AtlIcon each variant carries. Names, not glyphs: a glyph in a string map
|
|
5
|
-
* was the fifth way this library drew an icon, and the one check:
|
|
5
|
+
* was the fifth way this library drew an icon, and the one check:icon-duplication
|
|
6
6
|
* missed (ADR-0050). */
|
|
7
7
|
const VARIANT_ICON_NAMES = {
|
|
8
8
|
info: 'info',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-alert.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/alert/atl-alert.tsx"],"names":[],"mappings":";AAEA,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;wBAEwB;AACxB,MAAM,kBAAkB,GAAkD;IACxE,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AA6BF;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,GAAG,MAAM,EAChB,WAAW,GAAG,KAAK,EACnB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACO;IACd,MAAM,OAAO,GAAG,CAAC,WAAW,EAAE,WAAW,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzF,MAAM,QAAQ,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;IAExF,OAAO,CACL,eAAK,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,OAAO,eAAY,QAAQ,KAAM,IAAI,aACjE,gBAAM,SAAS,EAAC,SAAS,aACtB,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAC9B,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,EAAC,IAAI,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,IAAI,EAAC,IAAI,GAAG,CAClF,EACA,QAAQ,IACJ,EACN,WAAW,IAAI,CACd,iBACE,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,QAAQ,gBACF,SAAS,EACpB,OAAO,EAAE,WAAW,YAEpB,KAAC,OAAO,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,GAAG,GAC3B,CACV,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { HTMLAttributes, ReactNode } from 'react';\nimport type { AtlAlertSpec, AtlIconName } from '../spec';\nimport './atl-alert.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\n/** Which AtlIcon each variant carries. Names, not glyphs: a glyph in a string map\n * was the fifth way this library drew an icon, and the one check:
|
|
1
|
+
{"version":3,"file":"atl-alert.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/alert/atl-alert.tsx"],"names":[],"mappings":";AAEA,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;wBAEwB;AACxB,MAAM,kBAAkB,GAAkD;IACxE,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AA6BF;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,GAAG,MAAM,EAChB,WAAW,GAAG,KAAK,EACnB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACO;IACd,MAAM,OAAO,GAAG,CAAC,WAAW,EAAE,WAAW,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzF,MAAM,QAAQ,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;IAExF,OAAO,CACL,eAAK,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,OAAO,eAAY,QAAQ,KAAM,IAAI,aACjE,gBAAM,SAAS,EAAC,SAAS,aACtB,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAC9B,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,EAAC,IAAI,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,IAAI,EAAC,IAAI,GAAG,CAClF,EACA,QAAQ,IACJ,EACN,WAAW,IAAI,CACd,iBACE,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,QAAQ,gBACF,SAAS,EACpB,OAAO,EAAE,WAAW,YAEpB,KAAC,OAAO,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,GAAG,GAC3B,CACV,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { HTMLAttributes, ReactNode } from 'react';\nimport type { AtlAlertSpec, AtlIconName } from '../spec';\nimport './atl-alert.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\n/** Which AtlIcon each variant carries. Names, not glyphs: a glyph in a string map\n * was the fifth way this library drew an icon, and the one check:icon-duplication\n * missed (ADR-0050). */\nconst VARIANT_ICON_NAMES: Partial<Record<AtlAlertVariant, AtlIconName>> = {\n info: 'info',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n};\n\n\ntype AtlAlertVariant = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * Properties for the AtlAlert component.\n */\nexport interface AtlAlertProps\n extends HTMLAttributes<HTMLDivElement>,\n AtlAlertSpec {\n /**\n * The visual style variant of the alert.\n */\n variant?: AtlAlertVariant;\n /**\n * Whether the alert can be dismissed by the user.\n */\n dismissible?: boolean;\n /**\n * Callback triggered when the alert is dismissed.\n */\n onDismissed?: () => void;\n /**\n * The content to be rendered inside the alert.\n */\n children?: ReactNode;\n}\n\n/**\n * An alert component for displaying important messages.\n */\nexport function AtlAlert({\n variant = 'info',\n dismissible = false,\n onDismissed,\n children,\n className,\n ...rest\n}: AtlAlertProps) {\n const classes = ['atl-alert', `variant-${variant}`, className].filter(Boolean).join(' ');\n const ariaLive = variant === 'danger' || variant === 'warning' ? 'assertive' : 'polite';\n\n return (\n <div className={classes} role=\"alert\" aria-live={ariaLive} {...rest}>\n <span className=\"content\">\n {VARIANT_ICON_NAMES[variant] && (\n <AtlIcon className=\"variant-icon\" name={VARIANT_ICON_NAMES[variant]} size=\"sm\" />\n )}\n {children}\n </span>\n {dismissible && (\n <button\n className=\"dismiss\"\n type=\"button\"\n aria-label=\"Dismiss\"\n onClick={onDismissed}\n >\n <AtlIcon name=\"close\" size=\"sm\" />\n </button>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import './atl-badge.css';
|
|
3
3
|
import { AtlIcon } from '../icon/atl-icon';
|
|
4
4
|
/** Which AtlIcon each variant carries. Names, not glyphs: a glyph in a string map
|
|
5
|
-
* was the fifth way this library drew an icon, and the one check:
|
|
5
|
+
* was the fifth way this library drew an icon, and the one check:icon-duplication
|
|
6
6
|
* missed (ADR-0050). */
|
|
7
7
|
const VARIANT_ICON_NAMES = {
|
|
8
8
|
info: 'info',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-badge.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/badge/atl-badge.tsx"],"names":[],"mappings":";AAEA,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;wBAEwB;AACxB,MAAM,kBAAkB,GAAkD;IACxE,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAyBF;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACO;IACd,MAAM,OAAO,GAAG,CAAC,WAAW,EAAE,WAAW,OAAO,EAAE,EAAE,QAAQ,IAAI,EAAE,EAAE,SAAS,CAAC;SAC3E,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,CACL,gBAAM,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,QAAQ,KAAK,IAAI,aAC7C,QAAQ,IAAI,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,IAAI,GAAG,EAC1E,QAAQ,IACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { HTMLAttributes, ReactNode } from 'react';\nimport type { AtlBadgeSpec, AtlIconName } from '../spec';\nimport './atl-badge.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\n/** Which AtlIcon each variant carries. Names, not glyphs: a glyph in a string map\n * was the fifth way this library drew an icon, and the one check:
|
|
1
|
+
{"version":3,"file":"atl-badge.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/badge/atl-badge.tsx"],"names":[],"mappings":";AAEA,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;wBAEwB;AACxB,MAAM,kBAAkB,GAAkD;IACxE,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAyBF;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACO;IACd,MAAM,OAAO,GAAG,CAAC,WAAW,EAAE,WAAW,OAAO,EAAE,EAAE,QAAQ,IAAI,EAAE,EAAE,SAAS,CAAC;SAC3E,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,CACL,gBAAM,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,QAAQ,KAAK,IAAI,aAC7C,QAAQ,IAAI,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,IAAI,GAAG,EAC1E,QAAQ,IACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { HTMLAttributes, ReactNode } from 'react';\nimport type { AtlBadgeSpec, AtlIconName } from '../spec';\nimport './atl-badge.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\n/** Which AtlIcon each variant carries. Names, not glyphs: a glyph in a string map\n * was the fifth way this library drew an icon, and the one check:icon-duplication\n * missed (ADR-0050). */\nconst VARIANT_ICON_NAMES: Partial<Record<AtlBadgeVariant, AtlIconName>> = {\n info: 'info',\n success: 'success',\n warning: 'warning',\n danger: 'danger',\n};\n\n\ntype AtlBadgeVariant = 'default' | 'success' | 'warning' | 'danger' | 'info';\n\n/**\n * Properties for the AtlBadge component.\n */\nexport interface AtlBadgeProps\n extends HTMLAttributes<HTMLSpanElement>,\n AtlBadgeSpec {\n /**\n * The visual style variant of the badge.\n */\n variant?: AtlBadgeVariant;\n /**\n * The size of the badge.\n */\n size?: 'sm' | 'md';\n /**\n * The content to be rendered inside the badge.\n */\n children?: ReactNode;\n}\n\n/**\n * A badge component for displaying small amounts of information or status.\n */\nexport function AtlBadge({\n variant = 'default',\n size = 'md',\n children,\n className,\n ...rest\n}: AtlBadgeProps) {\n const classes = ['atl-badge', `variant-${variant}`, `size-${size}`, className]\n .filter(Boolean).join(' ');\n const iconName = VARIANT_ICON_NAMES[variant];\n return (\n <span className={classes} role=\"status\" {...rest}>\n {iconName && <AtlIcon className=\"variant-icon\" name={iconName} size=\"sm\" />}\n {children}\n </span>\n );\n}\n"]}
|
|
@@ -43,9 +43,13 @@
|
|
|
43
43
|
align-items: center;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/* Separator — chevron, CSS-generated
|
|
46
|
+
/* Separator — chevron, CSS-generated and decorative. The trailing `/ ''` is
|
|
47
|
+
the CSS Generated Content alt-text pair: an explicit empty alternative
|
|
48
|
+
text, which keeps the glyph out of the accessibility tree in Chromium,
|
|
49
|
+
Firefox and WebKit alike (verified; a bare `content: '…'` is NOT excluded
|
|
50
|
+
by default — it renders as its own accessible text node). See ADR-0100. */
|
|
47
51
|
.atl-breadcrumb-item::after {
|
|
48
|
-
content: var(--atl-separator, '›');
|
|
52
|
+
content: var(--atl-separator, '›') / '';
|
|
49
53
|
margin: 0 var(--ui-spacing-2);
|
|
50
54
|
color: var(--ui-color-border-hover);
|
|
51
55
|
font-size: var(--ui-font-size-md);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/breadcrumbs/atl-breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,oBAAoB,EAA0C,MAAM,OAAO,CAAC;AAEhH,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;A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xB"}
|
|
@@ -14,7 +14,7 @@ export function AtlBreadcrumbs({ children, separator = '/', className, style, ..
|
|
|
14
14
|
}
|
|
15
15
|
return child;
|
|
16
16
|
});
|
|
17
|
-
return (_jsx("nav", { className: classes, "aria-label": "Breadcrumb", style: { '--atl-separator': `'${separator}'`, ...style }, ...rest, children: _jsx("ol", { className: "breadcrumbs-list", children: enhancedChildren }) }));
|
|
17
|
+
return (_jsx("nav", { className: classes, "aria-label": "Breadcrumb", style: { '--atl-separator': `'${separator}'`, ...style }, ...rest, children: _jsx("ol", { role: "list", className: "breadcrumbs-list", children: enhancedChildren }) }));
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* An individual breadcrumb item.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-breadcrumbs.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/breadcrumbs/atl-breadcrumbs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmD,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGhH,OAAO,uBAAuB,CAAC;AAY/B;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,GAAG,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAuB;IAC1G,MAAM,OAAO,GAAG,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEzE,+CAA+C;IAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACvD,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7D,OAAO,YAAY,CAAC,KA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I,SAAS,GAAG,EAAE,GAAG,KAAK,EAAmB,KACrE,IAAI,YAOR,aAAI,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,kBAAkB,YACzC,gBAAgB,GACd,GACD,CACP,CAAC;AACJ,CAAC;AAsBD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACgB;IACvB,MAAM,OAAO,GAAG,CAAC,qBAAqB,EAAE,OAAO,IAAI,YAAY,EAAE,SAAS,CAAC;SACxE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,CACL,aAAI,SAAS,EAAE,OAAO,YACnB,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,YAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,iBAAiB,KAAK,IAAI,YAChD,QAAQ,GACP,CACL,CAAC,CAAC,CAAC,CACF,eACE,SAAS,EAAC,oBAAoB,kBAChB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,YAEzC,QAAQ,GACJ,CACR,GACE,CACN,CAAC;AACJ,CAAC","sourcesContent":["import { HTMLAttributes, ReactNode, AnchorHTMLAttributes, Children, isValidElement, cloneElement } from 'react';\nimport type { CSSProperties } from 'react';\nimport type { AtlBreadcrumbsSpec, AtlBreadcrumbItemSpec } from '../spec';\nimport './atl-breadcrumbs.css';\n\n/**\n * Properties for the AtlBreadcrumbs component.\n */\nexport interface AtlBreadcrumbsProps extends HTMLAttributes<HTMLElement>, AtlBreadcrumbsSpec {\n /**\n * The breadcrumb items to be rendered.\n */\n children?: ReactNode;\n}\n\n/**\n * A breadcrumbs component for displaying a navigation trail.\n */\nexport function AtlBreadcrumbs({ children, separator = '/', className, style, ...rest }: AtlBreadcrumbsProps) {\n const classes = ['atl-breadcrumbs', className].filter(Boolean).join(' ');\n\n // Automatically mark the last child as current\n const childArray = Children.toArray(children);\n const enhancedChildren = childArray.map((child, index) => {\n if (isValidElement(child) && index === childArray.length - 1) {\n return cloneElement(child, { current: true } as object);\n }\n return child;\n });\n\n return (\n <nav\n className={classes}\n aria-label=\"Breadcrumb\"\n style={{ '--atl-separator': `'${separator}'`, ...style } as CSSProperties}\n {...rest}\n >\n {/* eslint-disable-next-line jsx-a11y/no-redundant-roles -- role=\"list\" is\n NOT redundant here: .breadcrumbs-list sets list-style: none, and an\n unstyled-marker <ol>/<ul> with no explicit role is the documented\n Safari/VoiceOver case where the implicit list semantics can be\n dropped (ADR-0100). */}\n <ol role=\"list\" className=\"breadcrumbs-list\">\n {enhancedChildren}\n </ol>\n </nav>\n );\n}\n\n/**\n * Properties for the AtlBreadcrumbItem component.\n */\nexport interface AtlBreadcrumbItemProps\n extends AnchorHTMLAttributes<HTMLAnchorElement>,\n AtlBreadcrumbItemSpec {\n /**\n * The URL the breadcrumb points to.\n */\n href?: string;\n /**\n * Whether this is the current page.\n */\n current?: boolean;\n /**\n * The content to be rendered inside the breadcrumb item.\n */\n children?: ReactNode;\n}\n\n/**\n * An individual breadcrumb item.\n */\nexport function AtlBreadcrumbItem({\n href,\n current = false,\n children,\n className,\n ...rest\n}: AtlBreadcrumbItemProps) {\n const classes = ['atl-breadcrumb-item', current && 'is-current', className]\n .filter(Boolean)\n .join(' ');\n\n return (\n <li className={classes}>\n {href && !current ? (\n <a href={href} className=\"breadcrumb-link\" {...rest}>\n {children}\n </a>\n ) : (\n <span\n className=\"breadcrumb-current\"\n aria-current={current ? 'page' : undefined}\n >\n {children}\n </span>\n )}\n </li>\n );\n}\n"]}
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
display: block;
|
|
82
82
|
font-size: var(--ui-font-size-lg);
|
|
83
83
|
font-weight: var(--ui-font-weight-semibold);
|
|
84
|
+
line-height: var(--ui-line-height-tight);
|
|
84
85
|
color: var(--ui-color-text);
|
|
85
86
|
border-bottom: var(--ui-border-width) solid var(--ui-color-border);
|
|
86
87
|
letter-spacing: var(--ui-letter-spacing-tight);
|
|
@@ -228,6 +228,13 @@
|
|
|
228
228
|
background: var(--ui-color-surface);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
/* The role="list" wrapper the log's listitems need (a node has one role, so it
|
|
232
|
+
can't be the log root itself) — display:contents keeps it invisible to the
|
|
233
|
+
flex/gap layout above, so the messages still lay out as if it were absent. */
|
|
234
|
+
.atl-chat-messages .messages-list {
|
|
235
|
+
display: contents;
|
|
236
|
+
}
|
|
237
|
+
|
|
231
238
|
/* ═══════════════════════════════════════════════════════════════════════════ */
|
|
232
239
|
/* SUB-COMPONENT: message bubble */
|
|
233
240
|
/* ═══════════════════════════════════════════════════════════════════════════ */
|
|
@@ -32,6 +32,17 @@ export declare function AtlChatHeader({ children, className, ...rest }: HTMLAttr
|
|
|
32
32
|
* `AtlChatSuggestion` children inside. Auto-scrolls to the bottom whenever
|
|
33
33
|
* children are added or content changes — important for streaming responses
|
|
34
34
|
* where new tokens are appended live.
|
|
35
|
+
*
|
|
36
|
+
* Renders `role="log"` (named, `aria-label="Conversation"`) with
|
|
37
|
+
* `aria-live="polite"` on the root — the live region that announces new
|
|
38
|
+
* messages without interrupting whatever the user is doing. `log` is not
|
|
39
|
+
* `list`: an element carries exactly one role, so the projected
|
|
40
|
+
* `AtlChatMessage` `listitem`s get their required list parent from a second,
|
|
41
|
+
* nested element (`.messages-list`, `role="list"`) rather than from the log
|
|
42
|
+
* root itself. That wrapper is `display: contents` so it never affects the
|
|
43
|
+
* flex/gap layout of the messages — verified (Chromium, Firefox, WebKit): the
|
|
44
|
+
* gap between messages is unchanged, and Chromium's native accessibility tree
|
|
45
|
+
* shows `log "Conversation" > list "Messages" > listitem, listitem`.
|
|
35
46
|
*/
|
|
36
47
|
export declare function AtlChatMessages({ children, className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
37
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-chat.d.ts","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/chat/atl-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,SAAS,EACT,sBAAsB,EAOvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,gBAAgB,CAAC;AAiBxB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sBAAsB;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,oCAAoC;IACpC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAkB,EAClB,MAAe,EACf,IAAY,EACZ,YAAY,EACZ,QAAQ,GACT,EAAE,YAAY,+BAuHd;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,cAAc,CAAC,+BAmBhC;AAED
|
|
1
|
+
{"version":3,"file":"atl-chat.d.ts","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/chat/atl-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,SAAS,EACT,sBAAsB,EAOvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,gBAAgB,CAAC;AAiBxB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sBAAsB;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,oCAAoC;IAC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AAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,IAAI,EACJ,UAAU,EACV,SAAS,GACV,EAAE,sBAAsB,+BAexB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,aAAa,EACb,MAAM,EACN,MAAM,EACN,WAAW,EACX,SAAuC,EACvC,GAAG,IAAI,EACR,EAAE,iBAAiB,+BAuEnB"}
|
package/src/lib/chat/atl-chat.js
CHANGED
|
@@ -101,6 +101,17 @@ export function AtlChatHeader({ children, className, ...rest }) {
|
|
|
101
101
|
* `AtlChatSuggestion` children inside. Auto-scrolls to the bottom whenever
|
|
102
102
|
* children are added or content changes — important for streaming responses
|
|
103
103
|
* where new tokens are appended live.
|
|
104
|
+
*
|
|
105
|
+
* Renders `role="log"` (named, `aria-label="Conversation"`) with
|
|
106
|
+
* `aria-live="polite"` on the root — the live region that announces new
|
|
107
|
+
* messages without interrupting whatever the user is doing. `log` is not
|
|
108
|
+
* `list`: an element carries exactly one role, so the projected
|
|
109
|
+
* `AtlChatMessage` `listitem`s get their required list parent from a second,
|
|
110
|
+
* nested element (`.messages-list`, `role="list"`) rather than from the log
|
|
111
|
+
* root itself. That wrapper is `display: contents` so it never affects the
|
|
112
|
+
* flex/gap layout of the messages — verified (Chromium, Firefox, WebKit): the
|
|
113
|
+
* gap between messages is unchanged, and Chromium's native accessibility tree
|
|
114
|
+
* shows `log "Conversation" > list "Messages" > listitem, listitem`.
|
|
104
115
|
*/
|
|
105
116
|
export function AtlChatMessages({ children, className, ...rest }) {
|
|
106
117
|
const ref = useRef(null);
|
|
@@ -114,7 +125,7 @@ export function AtlChatMessages({ children, className, ...rest }) {
|
|
|
114
125
|
observer.observe(el, { childList: true, subtree: true, characterData: true });
|
|
115
126
|
return () => observer.disconnect();
|
|
116
127
|
}, []);
|
|
117
|
-
return (_jsx("div", { ref: ref, className: ['atl-chat-messages', className].filter(Boolean).join(' '), ...rest, children: children }));
|
|
128
|
+
return (_jsx("div", { ref: ref, role: "log", "aria-live": "polite", "aria-label": "Conversation", className: ['atl-chat-messages', className].filter(Boolean).join(' '), ...rest, children: _jsx("div", { className: "messages-list", role: "list", "aria-label": "Messages", children: children }) }));
|
|
118
129
|
}
|
|
119
130
|
export function AtlChatMessage({ role = 'assistant', failed = false, children, className, ...rest }) {
|
|
120
131
|
const classes = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-chat.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/chat/atl-chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAOL,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAMf,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C,MAAM,WAAW,GAAG,aAAa,CAAmB;IAClD,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;IACtB,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS;CACxB,CAAC,CAAC;AAiBH;;;;;GA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AAC;IACjB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,CAAmC,EAAE,EAAE;QAC3D,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,CAAqC,EAAE,EAAE;QAC9D,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACrC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,gBAAgB,aAC7B,mBACE,SAAS,EAAC,OAAO,EACjB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,oBAAoB,EACjC,QAAQ,EAAE,WAAW,gBACT,SAAS,EACrB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,KACpB,IAAI,GACR,EACD,WAAW,CAAC,CAAC,CAAC,CACb,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,mCAAmC,EAC7C,OAAO,EAAE,MAAM,qBAGR,CACV,CAAC,CAAC,CAAC,CACF,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,oCAAoC,EAC9C,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EACzB,OAAO,EAAE,QAAQ,qBAGV,CACV,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n ChangeEvent,\n HTMLAttributes,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n TextareaHTMLAttributes,\n createContext,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type {\n AtlChatMessageRole,\n AtlChatStatus,\n AtlChatVariant,\n} from '../spec';\nimport './atl-chat.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\ninterface ChatContextValue {\n headerId: string;\n status: AtlChatStatus;\n close: () => void;\n toggle: () => void;\n}\n\nconst ChatContext = createContext<ChatContextValue>({\n headerId: '',\n status: 'idle',\n close: () => undefined,\n toggle: () => undefined,\n});\n\n/**\n * Properties for the AtlChat component.\n */\nexport interface AtlChatProps {\n /** Layout variant. */\n variant?: AtlChatVariant;\n /** Connection / response status. */\n status?: AtlChatStatus;\n /** Whether the chat is open (drawer / popup variants). */\n open?: boolean;\n /** Callback when open state should change. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\n/**\n * AI assistant surface. Three layout variants share the same content slots:\n * `drawer` (slide-in panel), `popup` (floating bubble + window), `inline`\n * (embedded card). Compose with `AtlChatHeader`, `AtlChatMessages`,\n * `AtlChatMessage`, `AtlChatTyping`, `AtlChatSuggestion`, `AtlChatInput`.\n */\nexport function AtlChat({\n variant = 'drawer',\n status = 'idle',\n open = false,\n onOpenChange,\n children,\n}: AtlChatProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const headerId = useId();\n const triggerElRef = useRef<Element | null>(null);\n\n useEffect(() => {\n if (variant !== 'drawer') return;\n const dialog = dialogRef.current;\n if (!dialog) return;\n if (open) {\n triggerElRef.current = document.activeElement;\n if (!dialog.open) dialog.showModal();\n } else {\n if (dialog.open) dialog.close();\n (triggerElRef.current as HTMLElement | null)?.focus();\n triggerElRef.current = null;\n }\n }, [open, variant]);\n\n // Auto-focus the input on open for drawer / popup. Inline keeps user focus.\n const hostRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!open) return;\n if (variant === 'inline') return;\n const host = hostRef.current;\n if (!host) return;\n requestAnimationFrame(() => {\n host.querySelector<HTMLTextAreaElement>('textarea')?.focus();\n });\n }, [open, variant]);\n\n useEffect(() => {\n if (variant !== 'drawer') return;\n const dialog = dialogRef.current;\n if (!dialog) return;\n const onClose = () => onOpenChange?.(false);\n const onCancel = (e: Event) => {\n e.preventDefault();\n onOpenChange?.(false);\n };\n dialog.addEventListener('close', onClose);\n dialog.addEventListener('cancel', onCancel);\n return () => {\n dialog.removeEventListener('close', onClose);\n dialog.removeEventListener('cancel', onCancel);\n };\n }, [onOpenChange, variant]);\n\n const handleBackdropClick = (e: MouseEvent<HTMLDialogElement>) => {\n if (e.target === dialogRef.current) onOpenChange?.(false);\n };\n\n const hostClass = [\n 'atl-chat',\n `variant-${variant}`,\n `status-${status}`,\n open && 'is-open',\n ]\n .filter(Boolean)\n .join(' ');\n\n const ctx: ChatContextValue = {\n headerId,\n status,\n close: () => onOpenChange?.(false),\n toggle: () => onOpenChange?.(!open),\n };\n\n return (\n <ChatContext.Provider value={ctx}>\n <div ref={hostRef} className={hostClass}>\n {variant === 'drawer' && (\n <dialog\n ref={dialogRef}\n aria-labelledby={headerId}\n aria-modal=\"true\"\n onClick={handleBackdropClick}\n >\n <div\n className=\"surface drawer-surface\"\n onClick={(e) => e.stopPropagation()}\n >\n {children}\n </div>\n </dialog>\n )}\n {variant === 'popup' && (\n <>\n {open && (\n <div\n className=\"surface popup-surface\"\n role=\"dialog\"\n aria-labelledby={headerId}\n >\n {children}\n </div>\n )}\n <button\n type=\"button\"\n className=\"fab-bubble\"\n aria-label={open ? 'Close AI assistant' : 'Open AI assistant'}\n aria-expanded={open}\n onClick={() => onOpenChange?.(!open)}\n >\n <span aria-hidden=\"true\">AI</span>\n </button>\n </>\n )}\n {variant === 'inline' && (\n <section\n className=\"surface inline-surface\"\n aria-labelledby={headerId}\n >\n {children}\n </section>\n )}\n </div>\n </ChatContext.Provider>\n );\n}\n\n/**\n * Header slot for `AtlChat`. Holds the title block; the close button\n * is rendered automatically (hidden on the inline variant via CSS).\n */\nexport function AtlChatHeader({\n children,\n className,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) {\n const ctx = useContext(ChatContext);\n return (\n <div\n id={ctx.headerId}\n className={['atl-chat-header', className].filter(Boolean).join(' ')}\n {...rest}\n >\n <div className=\"title-block\">{children}</div>\n <button\n type=\"button\"\n className=\"close-btn\"\n aria-label=\"Close chat\"\n onClick={ctx.close}\n >\n <AtlIcon name=\"close\" size=\"sm\" />\n </button>\n </div>\n );\n}\n\n/**\n * Scrollable message list. Project `AtlChatMessage`, `AtlChatTyping`, or\n * `AtlChatSuggestion` children inside. Auto-scrolls to the bottom whenever\n * children are added or content changes — important for streaming responses\n * where new tokens are appended live.\n */\nexport function AtlChatMessages({\n children,\n className,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) {\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const stickToBottom = () => { el.scrollTop = el.scrollHeight; };\n stickToBottom();\n const observer = new MutationObserver(stickToBottom);\n observer.observe(el, { childList: true, subtree: true, characterData: true });\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={ref}\n className={['atl-chat-messages', className].filter(Boolean).join(' ')}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\n/**\n * A single chat message. Role drives bubble alignment and color.\n */\nexport interface AtlChatMessageProps extends HTMLAttributes<HTMLDivElement> {\n /** Sender of the message. */\n role?: AtlChatMessageRole;\n /** Marks the message as failed (red dashed border). */\n failed?: boolean;\n}\n\nexport function AtlChatMessage({\n role = 'assistant',\n failed = false,\n children,\n className,\n ...rest\n}: AtlChatMessageProps) {\n const classes = [\n 'atl-chat-message',\n `role-${role}`,\n failed && 'is-failed',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div role=\"listitem\" className={classes} {...rest}>\n {children}\n </div>\n );\n}\n\n/**\n * Typing indicator (three animated dots).\n *\n * Two display modes:\n * - **Standalone bubble** (default) — render at the end of the message\n * list to show \"the assistant is starting to respond\".\n * - **Inline cursor** (`inline`) — render as the LAST child INSIDE the\n * currently-streaming `AtlChatMessage` so the dots read as a typing\n * caret at the end of the partial text.\n */\nexport interface AtlChatTypingProps extends HTMLAttributes<HTMLDivElement> {\n /** When true, renders as an inline cursor without bubble chrome. */\n inline?: boolean;\n}\n\nexport function AtlChatTyping({\n inline = false,\n className,\n ...rest\n}: AtlChatTypingProps) {\n const classes = [\n 'atl-chat-typing',\n inline && 'is-inline',\n className,\n ].filter(Boolean).join(' ');\n return (\n <div role=\"status\" aria-live=\"polite\" className={classes} {...rest}>\n <span className=\"dot\" />\n <span className=\"dot\" />\n <span className=\"dot\" />\n <span className=\"sr-only\">Assistant is typing</span>\n </div>\n );\n}\n\n/**\n * Tappable suggestion chip used in the empty state to seed a conversation.\n */\nexport interface AtlChatSuggestionProps {\n /** Primary label of the suggestion. */\n label: string;\n /** Optional secondary hint text. */\n hint?: string;\n /** Fires the label string when activated. */\n onSelected?: (label: string) => void;\n className?: string;\n}\n\nexport function AtlChatSuggestion({\n label,\n hint,\n onSelected,\n className,\n}: AtlChatSuggestionProps) {\n return (\n <div\n className={['atl-chat-suggestion', className].filter(Boolean).join(' ')}\n >\n <button\n type=\"button\"\n className=\"chip\"\n onClick={() => onSelected?.(label)}\n >\n <span className=\"chip-label\">{label}</span>\n {hint && <span className=\"chip-hint\">{hint}</span>}\n </button>\n </div>\n );\n}\n\n/**\n * Composable input footer for `AtlChat`. Wraps a textarea and emits\n * `onSend` (or `onStop` when the chat status is `'streaming'`).\n *\n * The action button automatically switches between primary \"Send\" and\n * danger \"Stop\" based on the parent chat's status.\n */\nexport interface AtlChatInputProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> {\n value?: string;\n onValueChange?: (value: string) => void;\n onSend?: (text: string) => void;\n onStop?: () => void;\n /** Accessible label for the input field. */\n ariaLabel?: string;\n}\n\nexport function AtlChatInput({\n value,\n onValueChange,\n onSend,\n onStop,\n placeholder,\n ariaLabel = 'Message your AI assistant',\n ...rest\n}: AtlChatInputProps) {\n const ctx = useContext(ChatContext);\n const isStreaming = ctx.status === 'streaming';\n const [internal, setInternal] = useState('');\n const isControlled = value !== undefined;\n const current = isControlled ? value : internal;\n\n const setCurrent = (next: string) => {\n if (!isControlled) setInternal(next);\n onValueChange?.(next);\n };\n\n const effectivePlaceholder =\n placeholder ??\n (isStreaming\n ? 'Waiting for response…'\n : ctx.status === 'error'\n ? 'Try again…'\n : 'Message your AI assistant…');\n\n const emitSend = () => {\n const text = current.trim();\n if (!text || isStreaming) return;\n onSend?.(text);\n setCurrent('');\n };\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n setCurrent(e.target.value);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n emitSend();\n }\n };\n\n return (\n <div className=\"atl-chat-input\">\n <textarea\n className=\"field\"\n rows={1}\n value={current}\n placeholder={effectivePlaceholder}\n disabled={isStreaming}\n aria-label={ariaLabel}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n {isStreaming ? (\n <button\n type=\"button\"\n className=\"action-btn variant-danger size-md\"\n onClick={onStop}\n >\n Stop\n </button>\n ) : (\n <button\n type=\"button\"\n className=\"action-btn variant-primary size-md\"\n disabled={!current.trim()}\n onClick={emitSend}\n >\n Send\n </button>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"atl-chat.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/chat/atl-chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAOL,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAMf,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C,MAAM,WAAW,GAAG,aAAa,CAAmB;IAClD,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;IACtB,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS;CACxB,CAAC,CAAC;AAiBH;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,OAAO,GAAG,QAAQ,EAClB,MAAM,GAAG,MAAM,EACf,IAAI,GAAG,KAAK,EACZ,Y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AU,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,CAAmC,EAAE,EAAE;QAC3D,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,CAAqC,EAAE,EAAE;QAC9D,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACrC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,gBAAgB,aAC7B,mBACE,SAAS,EAAC,OAAO,EACjB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,oBAAoB,EACjC,QAAQ,EAAE,WAAW,gBACT,SAAS,EACrB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,KACpB,IAAI,GACR,EACD,WAAW,CAAC,CAAC,CAAC,CACb,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,mCAAmC,EAC7C,OAAO,EAAE,MAAM,qBAGR,CACV,CAAC,CAAC,CAAC,CACF,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,oCAAoC,EAC9C,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EACzB,OAAO,EAAE,QAAQ,qBAGV,CACV,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n ChangeEvent,\n HTMLAttributes,\n KeyboardEvent,\n MouseEvent,\n ReactNode,\n TextareaHTMLAttributes,\n createContext,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type {\n AtlChatMessageRole,\n AtlChatStatus,\n AtlChatVariant,\n} from '../spec';\nimport './atl-chat.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\ninterface ChatContextValue {\n headerId: string;\n status: AtlChatStatus;\n close: () => void;\n toggle: () => void;\n}\n\nconst ChatContext = createContext<ChatContextValue>({\n headerId: '',\n status: 'idle',\n close: () => undefined,\n toggle: () => undefined,\n});\n\n/**\n * Properties for the AtlChat component.\n */\nexport interface AtlChatProps {\n /** Layout variant. */\n variant?: AtlChatVariant;\n /** Connection / response status. */\n status?: AtlChatStatus;\n /** Whether the chat is open (drawer / popup variants). */\n open?: boolean;\n /** Callback when open state should change. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\n/**\n * AI assistant surface. Three layout variants share the same content slots:\n * `drawer` (slide-in panel), `popup` (floating bubble + window), `inline`\n * (embedded card). Compose with `AtlChatHeader`, `AtlChatMessages`,\n * `AtlChatMessage`, `AtlChatTyping`, `AtlChatSuggestion`, `AtlChatInput`.\n */\nexport function AtlChat({\n variant = 'drawer',\n status = 'idle',\n open = false,\n onOpenChange,\n children,\n}: AtlChatProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const headerId = useId();\n const triggerElRef = useRef<Element | null>(null);\n\n useEffect(() => {\n if (variant !== 'drawer') return;\n const dialog = dialogRef.current;\n if (!dialog) return;\n if (open) {\n triggerElRef.current = document.activeElement;\n if (!dialog.open) dialog.showModal();\n } else {\n if (dialog.open) dialog.close();\n (triggerElRef.current as HTMLElement | null)?.focus();\n triggerElRef.current = null;\n }\n }, [open, variant]);\n\n // Auto-focus the input on open for drawer / popup. Inline keeps user focus.\n const hostRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (!open) return;\n if (variant === 'inline') return;\n const host = hostRef.current;\n if (!host) return;\n requestAnimationFrame(() => {\n host.querySelector<HTMLTextAreaElement>('textarea')?.focus();\n });\n }, [open, variant]);\n\n useEffect(() => {\n if (variant !== 'drawer') return;\n const dialog = dialogRef.current;\n if (!dialog) return;\n const onClose = () => onOpenChange?.(false);\n const onCancel = (e: Event) => {\n e.preventDefault();\n onOpenChange?.(false);\n };\n dialog.addEventListener('close', onClose);\n dialog.addEventListener('cancel', onCancel);\n return () => {\n dialog.removeEventListener('close', onClose);\n dialog.removeEventListener('cancel', onCancel);\n };\n }, [onOpenChange, variant]);\n\n const handleBackdropClick = (e: MouseEvent<HTMLDialogElement>) => {\n if (e.target === dialogRef.current) onOpenChange?.(false);\n };\n\n const hostClass = [\n 'atl-chat',\n `variant-${variant}`,\n `status-${status}`,\n open && 'is-open',\n ]\n .filter(Boolean)\n .join(' ');\n\n const ctx: ChatContextValue = {\n headerId,\n status,\n close: () => onOpenChange?.(false),\n toggle: () => onOpenChange?.(!open),\n };\n\n return (\n <ChatContext.Provider value={ctx}>\n <div ref={hostRef} className={hostClass}>\n {variant === 'drawer' && (\n <dialog\n ref={dialogRef}\n aria-labelledby={headerId}\n aria-modal=\"true\"\n onClick={handleBackdropClick}\n >\n <div\n className=\"surface drawer-surface\"\n onClick={(e) => e.stopPropagation()}\n >\n {children}\n </div>\n </dialog>\n )}\n {variant === 'popup' && (\n <>\n {open && (\n <div\n className=\"surface popup-surface\"\n role=\"dialog\"\n aria-labelledby={headerId}\n >\n {children}\n </div>\n )}\n <button\n type=\"button\"\n className=\"fab-bubble\"\n aria-label={open ? 'Close AI assistant' : 'Open AI assistant'}\n aria-expanded={open}\n onClick={() => onOpenChange?.(!open)}\n >\n <span aria-hidden=\"true\">AI</span>\n </button>\n </>\n )}\n {variant === 'inline' && (\n <section\n className=\"surface inline-surface\"\n aria-labelledby={headerId}\n >\n {children}\n </section>\n )}\n </div>\n </ChatContext.Provider>\n );\n}\n\n/**\n * Header slot for `AtlChat`. Holds the title block; the close button\n * is rendered automatically (hidden on the inline variant via CSS).\n */\nexport function AtlChatHeader({\n children,\n className,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) {\n const ctx = useContext(ChatContext);\n return (\n <div\n id={ctx.headerId}\n className={['atl-chat-header', className].filter(Boolean).join(' ')}\n {...rest}\n >\n <div className=\"title-block\">{children}</div>\n <button\n type=\"button\"\n className=\"close-btn\"\n aria-label=\"Close chat\"\n onClick={ctx.close}\n >\n <AtlIcon name=\"close\" size=\"sm\" />\n </button>\n </div>\n );\n}\n\n/**\n * Scrollable message list. Project `AtlChatMessage`, `AtlChatTyping`, or\n * `AtlChatSuggestion` children inside. Auto-scrolls to the bottom whenever\n * children are added or content changes — important for streaming responses\n * where new tokens are appended live.\n *\n * Renders `role=\"log\"` (named, `aria-label=\"Conversation\"`) with\n * `aria-live=\"polite\"` on the root — the live region that announces new\n * messages without interrupting whatever the user is doing. `log` is not\n * `list`: an element carries exactly one role, so the projected\n * `AtlChatMessage` `listitem`s get their required list parent from a second,\n * nested element (`.messages-list`, `role=\"list\"`) rather than from the log\n * root itself. That wrapper is `display: contents` so it never affects the\n * flex/gap layout of the messages — verified (Chromium, Firefox, WebKit): the\n * gap between messages is unchanged, and Chromium's native accessibility tree\n * shows `log \"Conversation\" > list \"Messages\" > listitem, listitem`.\n */\nexport function AtlChatMessages({\n children,\n className,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) {\n const ref = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const stickToBottom = () => { el.scrollTop = el.scrollHeight; };\n stickToBottom();\n const observer = new MutationObserver(stickToBottom);\n observer.observe(el, { childList: true, subtree: true, characterData: true });\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={ref}\n role=\"log\"\n aria-live=\"polite\"\n aria-label=\"Conversation\"\n className={['atl-chat-messages', className].filter(Boolean).join(' ')}\n {...rest}\n >\n <div className=\"messages-list\" role=\"list\" aria-label=\"Messages\">\n {children}\n </div>\n </div>\n );\n}\n\n/**\n * A single chat message. Role drives bubble alignment and color.\n */\nexport interface AtlChatMessageProps extends HTMLAttributes<HTMLDivElement> {\n /** Sender of the message. */\n role?: AtlChatMessageRole;\n /** Marks the message as failed (red dashed border). */\n failed?: boolean;\n}\n\nexport function AtlChatMessage({\n role = 'assistant',\n failed = false,\n children,\n className,\n ...rest\n}: AtlChatMessageProps) {\n const classes = [\n 'atl-chat-message',\n `role-${role}`,\n failed && 'is-failed',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div role=\"listitem\" className={classes} {...rest}>\n {children}\n </div>\n );\n}\n\n/**\n * Typing indicator (three animated dots).\n *\n * Two display modes:\n * - **Standalone bubble** (default) — render at the end of the message\n * list to show \"the assistant is starting to respond\".\n * - **Inline cursor** (`inline`) — render as the LAST child INSIDE the\n * currently-streaming `AtlChatMessage` so the dots read as a typing\n * caret at the end of the partial text.\n */\nexport interface AtlChatTypingProps extends HTMLAttributes<HTMLDivElement> {\n /** When true, renders as an inline cursor without bubble chrome. */\n inline?: boolean;\n}\n\nexport function AtlChatTyping({\n inline = false,\n className,\n ...rest\n}: AtlChatTypingProps) {\n const classes = [\n 'atl-chat-typing',\n inline && 'is-inline',\n className,\n ].filter(Boolean).join(' ');\n return (\n <div role=\"status\" aria-live=\"polite\" className={classes} {...rest}>\n <span className=\"dot\" />\n <span className=\"dot\" />\n <span className=\"dot\" />\n <span className=\"sr-only\">Assistant is typing</span>\n </div>\n );\n}\n\n/**\n * Tappable suggestion chip used in the empty state to seed a conversation.\n */\nexport interface AtlChatSuggestionProps {\n /** Primary label of the suggestion. */\n label: string;\n /** Optional secondary hint text. */\n hint?: string;\n /** Fires the label string when activated. */\n onSelected?: (label: string) => void;\n className?: string;\n}\n\nexport function AtlChatSuggestion({\n label,\n hint,\n onSelected,\n className,\n}: AtlChatSuggestionProps) {\n return (\n <div\n className={['atl-chat-suggestion', className].filter(Boolean).join(' ')}\n >\n <button\n type=\"button\"\n className=\"chip\"\n onClick={() => onSelected?.(label)}\n >\n <span className=\"chip-label\">{label}</span>\n {hint && <span className=\"chip-hint\">{hint}</span>}\n </button>\n </div>\n );\n}\n\n/**\n * Composable input footer for `AtlChat`. Wraps a textarea and emits\n * `onSend` (or `onStop` when the chat status is `'streaming'`).\n *\n * The action button automatically switches between primary \"Send\" and\n * danger \"Stop\" based on the parent chat's status.\n */\nexport interface AtlChatInputProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> {\n value?: string;\n onValueChange?: (value: string) => void;\n onSend?: (text: string) => void;\n onStop?: () => void;\n /** Accessible label for the input field. */\n ariaLabel?: string;\n}\n\nexport function AtlChatInput({\n value,\n onValueChange,\n onSend,\n onStop,\n placeholder,\n ariaLabel = 'Message your AI assistant',\n ...rest\n}: AtlChatInputProps) {\n const ctx = useContext(ChatContext);\n const isStreaming = ctx.status === 'streaming';\n const [internal, setInternal] = useState('');\n const isControlled = value !== undefined;\n const current = isControlled ? value : internal;\n\n const setCurrent = (next: string) => {\n if (!isControlled) setInternal(next);\n onValueChange?.(next);\n };\n\n const effectivePlaceholder =\n placeholder ??\n (isStreaming\n ? 'Waiting for response…'\n : ctx.status === 'error'\n ? 'Try again…'\n : 'Message your AI assistant…');\n\n const emitSend = () => {\n const text = current.trim();\n if (!text || isStreaming) return;\n onSend?.(text);\n setCurrent('');\n };\n\n const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {\n setCurrent(e.target.value);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n emitSend();\n }\n };\n\n return (\n <div className=\"atl-chat-input\">\n <textarea\n className=\"field\"\n rows={1}\n value={current}\n placeholder={effectivePlaceholder}\n disabled={isStreaming}\n aria-label={ariaLabel}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...rest}\n />\n {isStreaming ? (\n <button\n type=\"button\"\n className=\"action-btn variant-danger size-md\"\n onClick={onStop}\n >\n Stop\n </button>\n ) : (\n <button\n type=\"button\"\n className=\"action-btn variant-primary size-md\"\n disabled={!current.trim()}\n onClick={emitSend}\n >\n Send\n </button>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
.stepper-header {
|
|
28
28
|
display: flex;
|
|
29
29
|
align-items: center;
|
|
30
|
+
list-style: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
/* ─── Step item ─── */
|
|
@@ -116,7 +119,7 @@
|
|
|
116
119
|
margin-top: var(--ui-spacing-6);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
.stepper-content [
|
|
122
|
+
.stepper-content .step-panel[hidden] {
|
|
120
123
|
display: none;
|
|
121
124
|
}
|
|
122
125
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-stepper.d.ts","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/stepper/atl-stepper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,cAAc,EAKf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,mBAAmB,CAAC;AAG3B,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAYD,0DAA0D;AAC1D,wBAAgB,aAAa,wBAE5B;AAED,MAAM,WAAW,eACf,SAAQ,cAAc,CAAC,cAAc,CAAC,EACpC,cAAc;IAChB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,kBA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ACpC,cAAc;IAChB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,0BAA0B;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,EACzB,UAAU,EAAE,YAAY,EACxB,kBAAkB,EAClB,WAA0B,EAC1B,MAAc,EACd,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,eAAe,+BAwJjB;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,aAEjD;yBAFe,OAAO"}
|
|
@@ -41,16 +41,27 @@ export function AtlStepper({ activeStep: externalStep, onActiveStepChange, orien
|
|
|
41
41
|
}),
|
|
42
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
43
|
[children]);
|
|
44
|
+
// Whether step `i` can be activated right now: not itself disabled, and — in
|
|
45
|
+
// linear mode — either at/behind the active step, or ahead of it with every
|
|
46
|
+
// step before it completed or optional. Drives both goTo()'s guard and the
|
|
47
|
+
// header button's native `disabled` state, so an unreachable step is also
|
|
48
|
+
// not focusable — no roving-tabindex bookkeeping needed, since the header is
|
|
49
|
+
// a list, not a tab widget.
|
|
50
|
+
const isReachable = (i) => {
|
|
51
|
+
const step = steps[i];
|
|
52
|
+
if (!step || step.disabled)
|
|
53
|
+
return false;
|
|
54
|
+
if (!linear)
|
|
55
|
+
return true;
|
|
56
|
+
if (i <= activeStep)
|
|
57
|
+
return true;
|
|
58
|
+
return steps.slice(0, i).every((s) => s.completed || s.optional);
|
|
59
|
+
};
|
|
44
60
|
const goTo = (i) => {
|
|
45
61
|
if (i < 0 || i >= steps.length)
|
|
46
62
|
return;
|
|
47
|
-
if (
|
|
63
|
+
if (!isReachable(i))
|
|
48
64
|
return;
|
|
49
|
-
if (linear && i > activeStep) {
|
|
50
|
-
const canAdvance = steps.slice(0, i).every((s) => s.completed || s.optional);
|
|
51
|
-
if (!canAdvance)
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
65
|
setStep(i);
|
|
55
66
|
};
|
|
56
67
|
const next = () => goTo(activeStep + 1);
|
|
@@ -68,7 +79,7 @@ export function AtlStepper({ activeStep: externalStep, onActiveStepChange, orien
|
|
|
68
79
|
.join(' ');
|
|
69
80
|
const stepPanels = childArray.filter((c) => isValidElement(c) &&
|
|
70
81
|
c.type.displayName === 'AtlStep');
|
|
71
|
-
return (_jsx(StepperContext.Provider, { value: { activeStep, setActiveStep: setStep, steps, linear, next, prev, goTo }, children: _jsxs("div", { className: classes, ...rest, children: [_jsx("
|
|
82
|
+
return (_jsx(StepperContext.Provider, { value: { activeStep, setActiveStep: setStep, steps, linear, next, prev, goTo }, children: _jsxs("div", { className: classes, ...rest, children: [_jsx("ol", { className: "stepper-header", role: "list", "aria-label": "Progress", children: steps.map((step, i) => {
|
|
72
83
|
const isActive = activeStep === i;
|
|
73
84
|
const isCompleted = step.completed && !isActive;
|
|
74
85
|
const itemClass = [
|
|
@@ -80,12 +91,12 @@ export function AtlStepper({ activeStep: externalStep, onActiveStepChange, orien
|
|
|
80
91
|
]
|
|
81
92
|
.filter(Boolean)
|
|
82
93
|
.join(' ');
|
|
83
|
-
return (_jsxs(Fragment, { children: [_jsxs("
|
|
94
|
+
return (_jsxs(Fragment, { children: [_jsxs("li", { className: itemClass, children: [_jsx("button", { type: "button", id: `atl-step-${i}`, className: "step-circle", "aria-label": step.label, "aria-current": isActive ? 'step' : undefined, disabled: !isReachable(i), onClick: () => goTo(i), children: step.completed && !step.error ? (_jsx(AtlIcon, { name: "check", size: "sm" })) : step.error ? (_jsx(AtlIcon, { name: "close", size: "sm" })) : (i + 1) }), _jsxs("div", { className: "step-text", children: [_jsx("span", { className: "step-label", children: step.label }), step.description && (_jsx("span", { className: "step-description", children: step.description })), step.optional && !step.completed && (_jsx("span", { className: "step-optional", children: "Optional" }))] })] }), i < steps.length - 1 && (_jsx("li", { "aria-hidden": "true", className: ['step-connector', (activeStep > i || step.completed) && 'is-active']
|
|
84
95
|
.filter(Boolean)
|
|
85
96
|
.join(' ') }))] }, i));
|
|
86
97
|
}) }), _jsx("div", { className: "stepper-content", children: stepPanels.map((panel, i) => {
|
|
87
98
|
const element = panel;
|
|
88
|
-
return (_jsx("div", {
|
|
99
|
+
return (_jsx("div", { role: "region", className: "step-panel", "aria-labelledby": `atl-step-${i}`, hidden: i !== activeStep, children: element.props.children }, i));
|
|
89
100
|
}) })] }) }));
|
|
90
101
|
}
|
|
91
102
|
export function AtlStep({ children }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atl-stepper.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/stepper/atl-stepper.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,UAAU,EACV,QAAQ,EAGR,QAAQ,EACR,cAAc,EACd,OAAO,GAER,MAAM,OAAO,CAAC;AAEf,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAqB3C,MAAM,cAAc,GAAG,aAAa,CAAsB;IACxD,U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YAC7B,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;wBAC3B,MAAM,OAAO,GAAG,KAAmC,CAAC;wBACpD,OAAO,CACL,cAEE,EAAE,EAAE,kBAAkB,CAAC,EAAE,EACzB,IAAI,EAAC,UAAU,qBACE,YAAY,CAAC,EAAE,EAChC,QAAQ,EAAE,CAAC,EACX,MAAM,EAAE,CAAC,KAAK,UAAU,YAEvB,OAAO,CAAC,KAAK,CAAC,QAAQ,IAPlB,CAAC,CAQF,CACP,CAAC;oBACJ,CAAC,CAAC,GACE,IACF,GACkB,CAC3B,CAAC;AACJ,CAAC;AAkBD,MAAM,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAgB;IAChD,OAAO,QAAQ,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["import {\n Fragment,\n createContext,\n useContext,\n useState,\n ReactNode,\n HTMLAttributes,\n Children,\n isValidElement,\n useMemo,\n ReactElement,\n} from 'react';\nimport type { AtlStepperSpec, AtlStepSpec } from '../spec';\nimport './atl-stepper.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\ninterface StepInfo {\n label: string;\n description?: string;\n completed: boolean;\n error: boolean;\n optional: boolean;\n disabled: boolean;\n}\n\ninterface StepperContextValue {\n activeStep: number;\n setActiveStep: (i: number) => void;\n steps: StepInfo[];\n linear: boolean;\n next(): void;\n prev(): void;\n goTo(i: number): void;\n}\n\nconst StepperContext = createContext<StepperContextValue>({\n activeStep: 0,\n setActiveStep: () => undefined,\n steps: [],\n linear: false,\n next: () => undefined,\n prev: () => undefined,\n goTo: () => undefined,\n});\n\n/** Access stepper navigation from within step content. */\nexport function useAtlStepper() {\n return useContext(StepperContext);\n}\n\nexport interface AtlStepperProps\n extends HTMLAttributes<HTMLDivElement>,\n AtlStepperSpec {\n /** Currently active step index. */\n activeStep?: number;\n /** Callback when the active step changes. */\n onActiveStepChange?: (index: number) => void;\n /** Layout orientation. */\n orientation?: 'horizontal' | 'vertical';\n /** Restrict forward navigation until previous steps are completed. */\n linear?: boolean;\n children?: ReactNode;\n}\n\nexport function AtlStepper({\n activeStep: externalStep,\n onActiveStepChange,\n orientation = 'horizontal',\n linear = false,\n children,\n className,\n ...rest\n}: AtlStepperProps) {\n const [internalStep, setInternalStep] = useState(externalStep ?? 0);\n const isControlled = externalStep !== undefined;\n const activeStep = isControlled ? externalStep : internalStep;\n\n const setStep = (i: number) => {\n if (!isControlled) setInternalStep(i);\n onActiveStepChange?.(i);\n };\n\n const childArray = Children.toArray(children);\n const steps: StepInfo[] = useMemo(\n () =>\n childArray\n .filter(\n (c) =>\n isValidElement(c) &&\n (c.type as { displayName?: string }).displayName === 'AtlStep'\n )\n .map((c) => {\n const element = c as ReactElement<AtlStepProps>;\n return {\n label: element.props.label ?? '',\n description: element.props.description,\n completed: element.props.completed ?? false,\n error: element.props.error ?? false,\n optional: element.props.optional ?? false,\n disabled: element.props.disabled ?? false,\n };\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [children]\n );\n\n const goTo = (i: number) => {\n if (i < 0 || i >= steps.length) return;\n if (steps[i]?.disabled) return;\n if (linear && i > activeStep) {\n const canAdvance = steps.slice(0, i).every((s) => s.completed || s.optional);\n if (!canAdvance) return;\n }\n setStep(i);\n };\n\n const next = () => goTo(activeStep + 1);\n const prev = () => {\n const p = activeStep - 1;\n if (p >= 0 && !steps[p]?.disabled) setStep(p);\n };\n\n const classes = [\n 'atl-stepper',\n `orientation-${orientation}`,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const stepPanels = childArray.filter(\n (c) =>\n isValidElement(c) &&\n (c.type as { displayName?: string }).displayName === 'AtlStep'\n );\n\n return (\n <StepperContext.Provider value={{ activeStep, setActiveStep: setStep, steps, linear, next, prev, goTo }}>\n <div className={classes} {...rest}>\n <div className=\"stepper-header\" role=\"tablist\">\n {steps.map((step, i) => {\n const isActive = activeStep === i;\n const isCompleted = step.completed && !isActive;\n const itemClass = [\n 'step-item',\n isActive && 'is-active',\n isCompleted && 'is-completed',\n step.error && 'is-error',\n step.disabled && 'is-disabled',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <Fragment key={i}>\n <div className={itemClass}>\n <button\n type=\"button\"\n role=\"tab\"\n id={`atl-step-${i}`}\n className=\"step-circle\"\n aria-label={step.label}\n aria-selected={isActive}\n aria-controls={`atl-step-panel-${i}`}\n aria-disabled={step.disabled || undefined}\n tabIndex={isActive ? 0 : -1}\n disabled={step.disabled}\n onClick={() => goTo(i)}\n >\n {step.completed && !step.error ? (\n <AtlIcon name=\"check\" size=\"sm\" />\n ) : step.error ? (\n <AtlIcon name=\"close\" size=\"sm\" />\n ) : (\n i + 1\n )}\n </button>\n <div className=\"step-text\">\n <span className=\"step-label\">{step.label}</span>\n {step.description && (\n <span className=\"step-description\">{step.description}</span>\n )}\n {step.optional && !step.completed && (\n <span className=\"step-optional\">Optional</span>\n )}\n </div>\n </div>\n {i < steps.length - 1 && (\n <div\n className={['step-connector', (activeStep > i || step.completed) && 'is-active']\n .filter(Boolean)\n .join(' ')}\n />\n )}\n </Fragment>\n );\n })}\n </div>\n <div className=\"stepper-content\">\n {stepPanels.map((panel, i) => {\n const element = panel as ReactElement<AtlStepProps>;\n return (\n <div\n key={i}\n id={`atl-step-panel-${i}`}\n role=\"tabpanel\"\n aria-labelledby={`atl-step-${i}`}\n tabIndex={0}\n hidden={i !== activeStep}\n >\n {element.props.children}\n </div>\n );\n })}\n </div>\n </div>\n </StepperContext.Provider>\n );\n}\n\nexport interface AtlStepProps extends AtlStepSpec {\n /** Text displayed on the step indicator. Required. */\n label: string;\n /** Optional subtitle. */\n description?: string;\n /** Mark as completed (shows checkmark). */\n completed?: boolean;\n /** Mark as errored (shows X). */\n error?: boolean;\n /** Mark as optional. */\n optional?: boolean;\n /** Whether the step is disabled. */\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport function AtlStep({ children }: AtlStepProps) {\n return children;\n}\nAtlStep.displayName = 'AtlStep';\n"]}
|
|
1
|
+
{"version":3,"file":"atl-stepper.js","sourceRoot":"","sources":["../../../../../../libs/react/src/lib/stepper/atl-stepper.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,UAAU,EACV,QAAQ,EAGR,QAAQ,EACR,cAAc,EACd,OAAO,GAER,MAAM,OAAO,CAAC;AAEf,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAqB3C,MAAM,cAAc,GAAG,aAAa,CAAsB;IACxD,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS;IAC9B,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;CACtB,CAAC,CAAC;AAEH,0DAA0D;AAC1D,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC;AAgBD,MAAM,UAAU,UAAU,CAAC,EACzB,UAAU,EAAE,YAAY,EACxB,kBAAkB,EAClB,WAAW,GAAG,YAAY,EAC1B,MAAM,GAAG,KAAK,EACd,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACS;IAChB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,YAAY,KAAK,SAAS,CAAC;IAChD,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;IAE9D,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE;QAC5B,IAAI,CAAC,YAAY;YAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QACtC,kBAAkB,EAAE,CAA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,CAAC,WAAW,IAAI,CACnB,eAAM,SAAS,EAAC,kBAAkB,YAAE,IAAI,CAAC,WAAW,GAAQ,CAC7D,EACA,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CACnC,eAAM,SAAS,EAAC,eAAe,yBAAgB,CAChD,IACG,IACH,EACJ,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CACvB,4BACc,MAAM,EAClB,SAAS,EAAE,CAAC,gBAAgB,EAAE,CAAC,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC;yCAC7E,MAAM,CAAC,OAAO,CAAC;yCACf,IAAI,CAAC,GAAG,CAAC,GACZ,CACH,KApCY,CAAC,CAqCL,CACZ,CAAC;oBACJ,CAAC,CAAC,GACC,EACL,cAAK,SAAS,EAAC,iBAAiB,YAC7B,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;wBAC3B,MAAM,OAAO,GAAG,KAAmC,CAAC;wBACpD,OAAO,CACL,cAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,YAAY,qBACL,YAAY,CAAC,EAAE,EAChC,MAAM,EAAE,CAAC,KAAK,UAAU,YAEvB,OAAO,CAAC,KAAK,CAAC,QAAQ,IANlB,CAAC,CAOF,CACP,CAAC;oBACJ,CAAC,CAAC,GACE,IACF,GACkB,CAC3B,CAAC;AACJ,CAAC;AAkBD,MAAM,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAgB;IAChD,OAAO,QAAQ,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["import {\n Fragment,\n createContext,\n useContext,\n useState,\n ReactNode,\n HTMLAttributes,\n Children,\n isValidElement,\n useMemo,\n ReactElement,\n} from 'react';\nimport type { AtlStepperSpec, AtlStepSpec } from '../spec';\nimport './atl-stepper.css';\nimport { AtlIcon } from '../icon/atl-icon';\n\ninterface StepInfo {\n label: string;\n description?: string;\n completed: boolean;\n error: boolean;\n optional: boolean;\n disabled: boolean;\n}\n\ninterface StepperContextValue {\n activeStep: number;\n setActiveStep: (i: number) => void;\n steps: StepInfo[];\n linear: boolean;\n next(): void;\n prev(): void;\n goTo(i: number): void;\n}\n\nconst StepperContext = createContext<StepperContextValue>({\n activeStep: 0,\n setActiveStep: () => undefined,\n steps: [],\n linear: false,\n next: () => undefined,\n prev: () => undefined,\n goTo: () => undefined,\n});\n\n/** Access stepper navigation from within step content. */\nexport function useAtlStepper() {\n return useContext(StepperContext);\n}\n\nexport interface AtlStepperProps\n extends HTMLAttributes<HTMLDivElement>,\n AtlStepperSpec {\n /** Currently active step index. */\n activeStep?: number;\n /** Callback when the active step changes. */\n onActiveStepChange?: (index: number) => void;\n /** Layout orientation. */\n orientation?: 'horizontal' | 'vertical';\n /** Restrict forward navigation until previous steps are completed. */\n linear?: boolean;\n children?: ReactNode;\n}\n\nexport function AtlStepper({\n activeStep: externalStep,\n onActiveStepChange,\n orientation = 'horizontal',\n linear = false,\n children,\n className,\n ...rest\n}: AtlStepperProps) {\n const [internalStep, setInternalStep] = useState(externalStep ?? 0);\n const isControlled = externalStep !== undefined;\n const activeStep = isControlled ? externalStep : internalStep;\n\n const setStep = (i: number) => {\n if (!isControlled) setInternalStep(i);\n onActiveStepChange?.(i);\n };\n\n const childArray = Children.toArray(children);\n const steps: StepInfo[] = useMemo(\n () =>\n childArray\n .filter(\n (c) =>\n isValidElement(c) &&\n (c.type as { displayName?: string }).displayName === 'AtlStep'\n )\n .map((c) => {\n const element = c as ReactElement<AtlStepProps>;\n return {\n label: element.props.label ?? '',\n description: element.props.description,\n completed: element.props.completed ?? false,\n error: element.props.error ?? false,\n optional: element.props.optional ?? false,\n disabled: element.props.disabled ?? false,\n };\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [children]\n );\n\n // Whether step `i` can be activated right now: not itself disabled, and — in\n // linear mode — either at/behind the active step, or ahead of it with every\n // step before it completed or optional. Drives both goTo()'s guard and the\n // header button's native `disabled` state, so an unreachable step is also\n // not focusable — no roving-tabindex bookkeeping needed, since the header is\n // a list, not a tab widget.\n const isReachable = (i: number) => {\n const step = steps[i];\n if (!step || step.disabled) return false;\n if (!linear) return true;\n if (i <= activeStep) return true;\n return steps.slice(0, i).every((s) => s.completed || s.optional);\n };\n\n const goTo = (i: number) => {\n if (i < 0 || i >= steps.length) return;\n if (!isReachable(i)) return;\n setStep(i);\n };\n\n const next = () => goTo(activeStep + 1);\n const prev = () => {\n const p = activeStep - 1;\n if (p >= 0 && !steps[p]?.disabled) setStep(p);\n };\n\n const classes = [\n 'atl-stepper',\n `orientation-${orientation}`,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const stepPanels = childArray.filter(\n (c) =>\n isValidElement(c) &&\n (c.type as { displayName?: string }).displayName === 'AtlStep'\n );\n\n return (\n <StepperContext.Provider value={{ activeStep, setActiveStep: setStep, steps, linear, next, prev, goTo }}>\n <div className={classes} {...rest}>\n <ol className=\"stepper-header\" role=\"list\" aria-label=\"Progress\">\n {steps.map((step, i) => {\n const isActive = activeStep === i;\n const isCompleted = step.completed && !isActive;\n const itemClass = [\n 'step-item',\n isActive && 'is-active',\n isCompleted && 'is-completed',\n step.error && 'is-error',\n step.disabled && 'is-disabled',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <Fragment key={i}>\n <li className={itemClass}>\n <button\n type=\"button\"\n id={`atl-step-${i}`}\n className=\"step-circle\"\n aria-label={step.label}\n aria-current={isActive ? 'step' : undefined}\n disabled={!isReachable(i)}\n onClick={() => goTo(i)}\n >\n {step.completed && !step.error ? (\n <AtlIcon name=\"check\" size=\"sm\" />\n ) : step.error ? (\n <AtlIcon name=\"close\" size=\"sm\" />\n ) : (\n i + 1\n )}\n </button>\n <div className=\"step-text\">\n <span className=\"step-label\">{step.label}</span>\n {step.description && (\n <span className=\"step-description\">{step.description}</span>\n )}\n {step.optional && !step.completed && (\n <span className=\"step-optional\">Optional</span>\n )}\n </div>\n </li>\n {i < steps.length - 1 && (\n <li\n aria-hidden=\"true\"\n className={['step-connector', (activeStep > i || step.completed) && 'is-active']\n .filter(Boolean)\n .join(' ')}\n />\n )}\n </Fragment>\n );\n })}\n </ol>\n <div className=\"stepper-content\">\n {stepPanels.map((panel, i) => {\n const element = panel as ReactElement<AtlStepProps>;\n return (\n <div\n key={i}\n role=\"region\"\n className=\"step-panel\"\n aria-labelledby={`atl-step-${i}`}\n hidden={i !== activeStep}\n >\n {element.props.children}\n </div>\n );\n })}\n </div>\n </div>\n </StepperContext.Provider>\n );\n}\n\nexport interface AtlStepProps extends AtlStepSpec {\n /** Text displayed on the step indicator. Required. */\n label: string;\n /** Optional subtitle. */\n description?: string;\n /** Mark as completed (shows checkmark). */\n completed?: boolean;\n /** Mark as errored (shows X). */\n error?: boolean;\n /** Mark as optional. */\n optional?: boolean;\n /** Whether the step is disabled. */\n disabled?: boolean;\n children?: ReactNode;\n}\n\nexport function AtlStep({ children }: AtlStepProps) {\n return children;\n}\nAtlStep.displayName = 'AtlStep';\n"]}
|