@flamingo-stack/openframe-frontend-core 0.0.697 → 0.0.698-2527.7764.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/dist/{chunk-F6U2H42L.cjs → chunk-2JRKNGJ4.cjs} +6 -1
- package/dist/chunk-2JRKNGJ4.cjs.map +1 -0
- package/dist/{chunk-WVDBRL2S.js → chunk-3I4UVWLL.js} +7 -7
- package/dist/{chunk-LNOXNCEC.js → chunk-3QOEL4WL.js} +4 -4
- package/dist/{chunk-FZFEIXGB.cjs → chunk-3Y6OCKKW.cjs} +98 -98
- package/dist/{chunk-FZFEIXGB.cjs.map → chunk-3Y6OCKKW.cjs.map} +1 -1
- package/dist/{chunk-N4G3C4B4.cjs → chunk-4QRN6FRY.cjs} +12 -12
- package/dist/{chunk-N4G3C4B4.cjs.map → chunk-4QRN6FRY.cjs.map} +1 -1
- package/dist/{chunk-NE4H4JJG.cjs → chunk-5EL4RXTH.cjs} +42 -42
- package/dist/{chunk-NE4H4JJG.cjs.map → chunk-5EL4RXTH.cjs.map} +1 -1
- package/dist/{chunk-6CDP6TGH.cjs → chunk-5TAHPP4S.cjs} +126 -27
- package/dist/chunk-5TAHPP4S.cjs.map +1 -0
- package/dist/{chunk-M3JA577H.js → chunk-6SN6IVLN.js} +3 -3
- package/dist/{chunk-J4VGVLQI.js → chunk-7SKHOYTF.js} +3 -3
- package/dist/{chunk-7MM6EDNA.cjs → chunk-7WUCZIT4.cjs} +55 -32
- package/dist/{chunk-7MM6EDNA.cjs.map → chunk-7WUCZIT4.cjs.map} +1 -1
- package/dist/{chunk-75CG72QX.cjs → chunk-A3S7VHTM.cjs} +33 -33
- package/dist/{chunk-75CG72QX.cjs.map → chunk-A3S7VHTM.cjs.map} +1 -1
- package/dist/{chunk-VSQVJHOS.js → chunk-AKVO7FP4.js} +2 -2
- package/dist/{chunk-T33ICOHD.cjs → chunk-AQLW7KV3.cjs} +29 -29
- package/dist/{chunk-T33ICOHD.cjs.map → chunk-AQLW7KV3.cjs.map} +1 -1
- package/dist/{chunk-J4MCVIXU.js → chunk-BNJBJTEK.js} +209 -110
- package/dist/chunk-BNJBJTEK.js.map +1 -0
- package/dist/{chunk-YCVDJX7Z.js → chunk-DBF7PGQR.js} +4 -4
- package/dist/{chunk-LZXZ3C6M.js → chunk-E47BI33A.js} +32 -9
- package/dist/chunk-E47BI33A.js.map +1 -0
- package/dist/{chunk-RQ3HFUKV.cjs → chunk-FEXS67IG.cjs} +8 -8
- package/dist/{chunk-RQ3HFUKV.cjs.map → chunk-FEXS67IG.cjs.map} +1 -1
- package/dist/{chunk-LEGNIETR.cjs → chunk-GPF5IV4F.cjs} +5 -5
- package/dist/{chunk-LEGNIETR.cjs.map → chunk-GPF5IV4F.cjs.map} +1 -1
- package/dist/{chunk-VE7HLTVQ.js → chunk-H45GRYL4.js} +2 -2
- package/dist/{chunk-QYFXRVH3.js → chunk-H7FCFGSD.js} +9 -9
- package/dist/{chunk-JU6SBF3C.cjs → chunk-HT7SU5UN.cjs} +7 -7
- package/dist/{chunk-JU6SBF3C.cjs.map → chunk-HT7SU5UN.cjs.map} +1 -1
- package/dist/{chunk-3V7O7J4S.cjs → chunk-IZ3B3YRO.cjs} +28 -28
- package/dist/{chunk-3V7O7J4S.cjs.map → chunk-IZ3B3YRO.cjs.map} +1 -1
- package/dist/{chunk-KLDCI3KF.cjs → chunk-JM7KIML2.cjs} +3 -3
- package/dist/{chunk-KLDCI3KF.cjs.map → chunk-JM7KIML2.cjs.map} +1 -1
- package/dist/{chunk-Y2MDXJB4.js → chunk-JZCCRN3K.js} +2 -2
- package/dist/{chunk-4HVWGYHI.js → chunk-LPLXCDNV.js} +6 -1
- package/dist/chunk-LPLXCDNV.js.map +1 -0
- package/dist/{chunk-LF4S37VU.js → chunk-NKKA4KY7.js} +5 -5
- package/dist/{chunk-RIDRAKQ5.cjs → chunk-OF6FE2KT.cjs} +15 -15
- package/dist/{chunk-RIDRAKQ5.cjs.map → chunk-OF6FE2KT.cjs.map} +1 -1
- package/dist/{chunk-QD4BVKAU.js → chunk-OKA4VKE6.js} +6 -6
- package/dist/{chunk-Z7A7FUWY.js → chunk-OM6WC5XG.js} +3 -3
- package/dist/{chunk-77XUG4Z4.js → chunk-OPXQ5E3G.js} +10 -10
- package/dist/{chunk-GRBZC5N3.js → chunk-PELIFROQ.js} +2 -2
- package/dist/{chunk-JBMFCHNT.js → chunk-PMXCBAC4.js} +2883 -2343
- package/dist/chunk-PMXCBAC4.js.map +1 -0
- package/dist/{chunk-PYNHPMDB.js → chunk-Q7PGQDD4.js} +5 -5
- package/dist/{chunk-EWQZ4BXD.cjs → chunk-QYTVHA6G.cjs} +7 -7
- package/dist/{chunk-EWQZ4BXD.cjs.map → chunk-QYTVHA6G.cjs.map} +1 -1
- package/dist/{chunk-H6SSHFMD.js → chunk-QZFJJRXE.js} +6 -6
- package/dist/{chunk-XRW5VZKH.cjs → chunk-SBBLGNXR.cjs} +14 -14
- package/dist/{chunk-XRW5VZKH.cjs.map → chunk-SBBLGNXR.cjs.map} +1 -1
- package/dist/{chunk-VCR3TW2H.cjs → chunk-TVMY3U3W.cjs} +8 -8
- package/dist/{chunk-VCR3TW2H.cjs.map → chunk-TVMY3U3W.cjs.map} +1 -1
- package/dist/{chunk-3S56I5MX.js → chunk-U7J7G5J7.js} +3 -3
- package/dist/{chunk-SG53SIJX.js → chunk-ULYQ4WFF.js} +6 -6
- package/dist/{chunk-CVMWOUAX.cjs → chunk-UTQLLMBP.cjs} +48 -48
- package/dist/{chunk-CVMWOUAX.cjs.map → chunk-UTQLLMBP.cjs.map} +1 -1
- package/dist/{chunk-5DBWXJBG.cjs → chunk-VVTWH4YS.cjs} +1529 -989
- package/dist/chunk-VVTWH4YS.cjs.map +1 -0
- package/dist/{chunk-5P2J7E5E.cjs → chunk-WC76QXUX.cjs} +3 -3
- package/dist/{chunk-5P2J7E5E.cjs.map → chunk-WC76QXUX.cjs.map} +1 -1
- package/dist/{chunk-2FK7BZIM.cjs → chunk-XFIHZS35.cjs} +18 -18
- package/dist/{chunk-2FK7BZIM.cjs.map → chunk-XFIHZS35.cjs.map} +1 -1
- package/dist/{chunk-OB3ZJ7GQ.js → chunk-XGB5EEFZ.js} +3 -3
- package/dist/{chunk-MFU3ALKM.cjs → chunk-YNAWEA3G.cjs} +232 -232
- package/dist/{chunk-MFU3ALKM.cjs.map → chunk-YNAWEA3G.cjs.map} +1 -1
- package/dist/{chunk-WADR7VIA.cjs → chunk-YWMEVCCZ.cjs} +70 -70
- package/dist/{chunk-WADR7VIA.cjs.map → chunk-YWMEVCCZ.cjs.map} +1 -1
- package/dist/components/announcement-bar.d.ts +1 -1
- package/dist/components/announcement-bar.d.ts.map +1 -1
- package/dist/components/calendar.cjs +4 -4
- package/dist/components/calendar.js +1 -1
- package/dist/components/case-studies/index.cjs +21 -21
- package/dist/components/case-studies/index.js +7 -7
- package/dist/components/chat/index.cjs +4 -4
- package/dist/components/chat/index.js +3 -3
- package/dist/components/contact/index.cjs +8 -8
- package/dist/components/contact/index.js +7 -7
- package/dist/components/docs/index.cjs +11 -11
- package/dist/components/docs/index.js +10 -10
- package/dist/components/embeds/index.cjs +8 -8
- package/dist/components/embeds/index.js +7 -7
- package/dist/components/faq/index.cjs +8 -8
- package/dist/components/faq/index.js +7 -7
- package/dist/components/features/conversation-card.d.ts +32 -0
- package/dist/components/features/conversation-card.d.ts.map +1 -0
- package/dist/components/features/index.cjs +9 -7
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/index.js +8 -6
- package/dist/components/help-center-pages/index.cjs +101 -101
- package/dist/components/help-center-pages/index.js +20 -20
- package/dist/components/index.cjs +133 -109
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +45 -21
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +59 -59
- package/dist/components/meeting-scheduler/index.js +8 -8
- package/dist/components/navigation/index.cjs +10 -10
- package/dist/components/navigation/index.js +9 -9
- package/dist/components/onboarding-guides/index.cjs +10 -10
- package/dist/components/onboarding-guides/index.js +9 -9
- package/dist/components/platform/ToolBadge.d.ts +17 -9
- package/dist/components/platform/ToolBadge.d.ts.map +1 -1
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/related-content/index.js +4 -4
- package/dist/components/tickets/index.cjs +12 -12
- package/dist/components/tickets/index.js +11 -11
- package/dist/components/ui/app-window-frame.d.ts +20 -0
- package/dist/components/ui/app-window-frame.d.ts.map +1 -0
- package/dist/components/ui/button/button-styles.d.ts +1 -0
- package/dist/components/ui/button/button-styles.d.ts.map +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/feature-card.d.ts +5 -0
- package/dist/components/ui/feature-card.d.ts.map +1 -1
- package/dist/components/ui/feature-list.d.ts +7 -1
- package/dist/components/ui/feature-list.d.ts.map +1 -1
- package/dist/components/ui/file-manager/index.cjs +11 -11
- package/dist/components/ui/file-manager/index.js +1 -1
- package/dist/components/ui/incident-feed.d.ts +49 -0
- package/dist/components/ui/incident-feed.d.ts.map +1 -0
- package/dist/components/ui/index.cjs +27 -7
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.ts +5 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +26 -6
- package/dist/components/ui/page-actions.d.ts +1 -1
- package/dist/components/ui/page-actions.d.ts.map +1 -1
- package/dist/components/ui/phone-frame.d.ts +60 -0
- package/dist/components/ui/phone-frame.d.ts.map +1 -0
- package/dist/components/ui/snap-carousel.d.ts +27 -0
- package/dist/components/ui/snap-carousel.d.ts.map +1 -0
- package/dist/components/ui/sticky-action-bar.d.ts +29 -0
- package/dist/components/ui/sticky-action-bar.d.ts.map +1 -0
- package/dist/components/ui/tab-navigation.d.ts +14 -1
- package/dist/components/ui/tab-navigation.d.ts.map +1 -1
- package/dist/hooks/index.cjs +12 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +11 -1
- package/dist/hooks/ui/index.d.ts +2 -0
- package/dist/hooks/ui/index.d.ts.map +1 -1
- package/dist/hooks/ui/use-in-view.d.ts +20 -0
- package/dist/hooks/ui/use-in-view.d.ts.map +1 -0
- package/dist/hooks/ui/use-prefers-reduced-motion.d.ts +13 -0
- package/dist/hooks/ui/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist/hooks/use-scenario-player.d.ts +45 -0
- package/dist/hooks/use-scenario-player.d.ts.map +1 -0
- package/dist/index.cjs +44 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -10
- package/dist/index.js.map +1 -1
- package/dist/types/announcement.cjs.map +1 -1
- package/dist/types/announcement.d.ts +21 -0
- package/dist/types/announcement.d.ts.map +1 -1
- package/dist/types/announcement.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/announcement-bar.tsx +7 -1
- package/src/components/features/conversation-card.tsx +93 -0
- package/src/components/features/index.ts +3 -0
- package/src/components/platform/ToolBadge.tsx +47 -13
- package/src/components/ui/__tests__/snap-carousel.test.tsx +116 -0
- package/src/components/ui/app-window-frame.tsx +41 -0
- package/src/components/ui/button/button-styles.ts +5 -0
- package/src/components/ui/button/button.tsx +1 -0
- package/src/components/ui/feature-card.tsx +16 -1
- package/src/components/ui/feature-list.tsx +23 -3
- package/src/components/ui/incident-feed.tsx +143 -0
- package/src/components/ui/index.ts +8 -0
- package/src/components/ui/page-actions.tsx +1 -1
- package/src/components/ui/phone-frame.tsx +166 -0
- package/src/components/ui/snap-carousel.tsx +186 -0
- package/src/components/ui/sticky-action-bar.tsx +81 -0
- package/src/components/ui/tab-navigation.tsx +63 -13
- package/src/hooks/__tests__/use-scenario-player.test.tsx +144 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/ui/index.ts +2 -0
- package/src/hooks/ui/use-in-view.ts +63 -0
- package/src/hooks/ui/use-prefers-reduced-motion.ts +22 -0
- package/src/hooks/use-scenario-player.ts +102 -0
- package/src/stories/DemoStage.stories.tsx +242 -0
- package/src/types/announcement.ts +21 -0
- package/dist/chunk-4HVWGYHI.js.map +0 -1
- package/dist/chunk-5DBWXJBG.cjs.map +0 -1
- package/dist/chunk-6CDP6TGH.cjs.map +0 -1
- package/dist/chunk-F6U2H42L.cjs.map +0 -1
- package/dist/chunk-J4MCVIXU.js.map +0 -1
- package/dist/chunk-JBMFCHNT.js.map +0 -1
- package/dist/chunk-LZXZ3C6M.js.map +0 -1
- /package/dist/{chunk-WVDBRL2S.js.map → chunk-3I4UVWLL.js.map} +0 -0
- /package/dist/{chunk-LNOXNCEC.js.map → chunk-3QOEL4WL.js.map} +0 -0
- /package/dist/{chunk-M3JA577H.js.map → chunk-6SN6IVLN.js.map} +0 -0
- /package/dist/{chunk-J4VGVLQI.js.map → chunk-7SKHOYTF.js.map} +0 -0
- /package/dist/{chunk-VSQVJHOS.js.map → chunk-AKVO7FP4.js.map} +0 -0
- /package/dist/{chunk-YCVDJX7Z.js.map → chunk-DBF7PGQR.js.map} +0 -0
- /package/dist/{chunk-VE7HLTVQ.js.map → chunk-H45GRYL4.js.map} +0 -0
- /package/dist/{chunk-QYFXRVH3.js.map → chunk-H7FCFGSD.js.map} +0 -0
- /package/dist/{chunk-Y2MDXJB4.js.map → chunk-JZCCRN3K.js.map} +0 -0
- /package/dist/{chunk-LF4S37VU.js.map → chunk-NKKA4KY7.js.map} +0 -0
- /package/dist/{chunk-QD4BVKAU.js.map → chunk-OKA4VKE6.js.map} +0 -0
- /package/dist/{chunk-Z7A7FUWY.js.map → chunk-OM6WC5XG.js.map} +0 -0
- /package/dist/{chunk-77XUG4Z4.js.map → chunk-OPXQ5E3G.js.map} +0 -0
- /package/dist/{chunk-GRBZC5N3.js.map → chunk-PELIFROQ.js.map} +0 -0
- /package/dist/{chunk-PYNHPMDB.js.map → chunk-Q7PGQDD4.js.map} +0 -0
- /package/dist/{chunk-H6SSHFMD.js.map → chunk-QZFJJRXE.js.map} +0 -0
- /package/dist/{chunk-3S56I5MX.js.map → chunk-U7J7G5J7.js.map} +0 -0
- /package/dist/{chunk-SG53SIJX.js.map → chunk-ULYQ4WFF.js.map} +0 -0
- /package/dist/{chunk-OB3ZJ7GQ.js.map → chunk-XGB5EEFZ.js.map} +0 -0
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Displays a tool type badge with icon for OpenFrame integrated tools.
|
|
5
5
|
* Used in tables to show tool sources like Fleet MDM, MeshCentral, etc.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <ToolBadge toolType="OPENFRAME_RMM" />
|
|
10
|
-
* <ToolBadge toolType="FLEET" />
|
|
11
|
-
* <ToolBadge toolType="MESHCENTRAL" />
|
|
12
|
-
* ```
|
|
13
6
|
*/
|
|
14
7
|
|
|
15
8
|
import type React from 'react';
|
|
@@ -21,20 +14,61 @@ import { ToolIcon } from '../tool-icon';
|
|
|
21
14
|
export type { ToolType } from '../../types/tool.types';
|
|
22
15
|
|
|
23
16
|
export interface ToolBadgeProps {
|
|
24
|
-
/**
|
|
25
|
-
toolType
|
|
17
|
+
/** A built-in tool: its label and grey mark come from the tool registry. */
|
|
18
|
+
toolType?: ToolType;
|
|
19
|
+
/** The text. Required without `toolType`; with it, replaces the registry label. */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** The mark. Required for a tool outside the registry; replaces the registry mark otherwise. */
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* `inline` (default): mark and label in the surrounding text (a table cell).
|
|
25
|
+
* `chip`: a 28px dark chip with a monochrome mark, for a row of "built on"
|
|
26
|
+
* badges on a card.
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'inline' | 'chip';
|
|
26
29
|
/** Additional CSS classes */
|
|
27
30
|
className?: string;
|
|
28
31
|
iconClassName?: string;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* One tool, named: a mark and a label. Pass a `toolType` for a tool the
|
|
36
|
+
* registry knows, or `label` + `icon` for one it does not (a connector or a
|
|
37
|
+
* package manager that is content, not a built-in tool).
|
|
38
|
+
*/
|
|
39
|
+
export const ToolBadge: React.FC<ToolBadgeProps> = ({
|
|
40
|
+
toolType,
|
|
41
|
+
label,
|
|
42
|
+
icon,
|
|
43
|
+
variant = 'inline',
|
|
44
|
+
className,
|
|
45
|
+
iconClassName,
|
|
46
|
+
}) => {
|
|
47
|
+
const text = label ?? (toolType ? getToolLabel(toolType) : '');
|
|
48
|
+
const mark = icon ?? (toolType ? <ToolIcon toolType={toolType} className={iconClassName} size={16} /> : null);
|
|
49
|
+
|
|
50
|
+
if (variant === 'chip') {
|
|
51
|
+
return (
|
|
52
|
+
<span
|
|
53
|
+
className={cn(
|
|
54
|
+
'inline-flex h-7 items-center gap-1.5 rounded-md border border-ods-border px-2 text-ods-text-secondary text-h6',
|
|
55
|
+
className,
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{mark && (
|
|
59
|
+
<span className="flex h-3.5 w-3.5 shrink-0 items-center justify-center [&_img]:h-full [&_img]:w-full [&_img]:object-contain [&_svg]:h-full [&_svg]:w-full">
|
|
60
|
+
{mark}
|
|
61
|
+
</span>
|
|
62
|
+
)}
|
|
63
|
+
{text && <span className="whitespace-nowrap">{text}</span>}
|
|
64
|
+
</span>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
33
67
|
|
|
34
68
|
return (
|
|
35
69
|
<div className={cn('flex items-center gap-1 text-ods-text-secondary', className)}>
|
|
36
|
-
|
|
37
|
-
<span className="text-ods-text-primary text-h4">{
|
|
70
|
+
{mark}
|
|
71
|
+
<span className="text-ods-text-primary text-h4">{text}</span>
|
|
38
72
|
</div>
|
|
39
73
|
);
|
|
40
74
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { SnapCarousel } from '../snap-carousel';
|
|
4
|
+
|
|
5
|
+
type IOCallback = (entries: Array<{ isIntersecting: boolean; intersectionRatio: number; target: Element }>) => void;
|
|
6
|
+
|
|
7
|
+
const ITEMS = ['one', 'two', 'three'];
|
|
8
|
+
const SLIDE_WIDTH = 300;
|
|
9
|
+
const STEP = SLIDE_WIDTH + 12;
|
|
10
|
+
|
|
11
|
+
describe('SnapCarousel', () => {
|
|
12
|
+
let callbacks: IOCallback[];
|
|
13
|
+
let scrolledTo: number[];
|
|
14
|
+
|
|
15
|
+
const setInView = (inView: boolean) =>
|
|
16
|
+
act(() => {
|
|
17
|
+
for (const cb of callbacks) {
|
|
18
|
+
cb([{ isIntersecting: inView, intersectionRatio: inView ? 1 : 0, target: document.body }]);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
vi.useFakeTimers();
|
|
24
|
+
callbacks = [];
|
|
25
|
+
scrolledTo = [];
|
|
26
|
+
vi.stubGlobal(
|
|
27
|
+
'IntersectionObserver',
|
|
28
|
+
class {
|
|
29
|
+
constructor(cb: IOCallback) {
|
|
30
|
+
callbacks.push(cb);
|
|
31
|
+
}
|
|
32
|
+
observe() {}
|
|
33
|
+
unobserve() {}
|
|
34
|
+
disconnect() {}
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
vi.stubGlobal('matchMedia', (query: string) => ({
|
|
38
|
+
matches: false,
|
|
39
|
+
media: query,
|
|
40
|
+
addEventListener() {},
|
|
41
|
+
removeEventListener() {},
|
|
42
|
+
}));
|
|
43
|
+
Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { configurable: true, get: () => SLIDE_WIDTH });
|
|
44
|
+
HTMLElement.prototype.scrollTo = function scrollTo(this: HTMLElement, options?: ScrollToOptions | number) {
|
|
45
|
+
const left = typeof options === 'object' ? (options.left ?? 0) : 0;
|
|
46
|
+
scrolledTo.push(left);
|
|
47
|
+
Object.defineProperty(this, 'scrollLeft', { configurable: true, value: left });
|
|
48
|
+
fireEvent.scroll(this);
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
afterEach(() => {
|
|
53
|
+
vi.useRealTimers();
|
|
54
|
+
vi.unstubAllGlobals();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const renderCarousel = () =>
|
|
58
|
+
render(<SnapCarousel items={ITEMS} label="Example requests" renderItem={item => <p>{item}</p>} />);
|
|
59
|
+
|
|
60
|
+
it('says where it is and disables the arrow at each end', () => {
|
|
61
|
+
renderCarousel();
|
|
62
|
+
expect(screen.getByText('1 / 3')).toBeTruthy();
|
|
63
|
+
expect(screen.getByLabelText<HTMLButtonElement>('Previous').disabled).toBe(true);
|
|
64
|
+
expect(screen.getByLabelText<HTMLButtonElement>('Next').disabled).toBe(false);
|
|
65
|
+
expect(screen.getByRole('group', { name: 'Example requests' }).getAttribute('aria-roledescription')).toBe(
|
|
66
|
+
'carousel',
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('advances every 5s only while it is in view, and wraps', () => {
|
|
71
|
+
renderCarousel();
|
|
72
|
+
act(() => {
|
|
73
|
+
vi.advanceTimersByTime(20_000);
|
|
74
|
+
});
|
|
75
|
+
expect(scrolledTo).toEqual([]);
|
|
76
|
+
|
|
77
|
+
setInView(true);
|
|
78
|
+
act(() => {
|
|
79
|
+
vi.advanceTimersByTime(5000);
|
|
80
|
+
});
|
|
81
|
+
expect(scrolledTo).toEqual([STEP]);
|
|
82
|
+
expect(screen.getByText('2 / 3')).toBeTruthy();
|
|
83
|
+
|
|
84
|
+
setInView(false);
|
|
85
|
+
act(() => {
|
|
86
|
+
vi.advanceTimersByTime(20_000);
|
|
87
|
+
});
|
|
88
|
+
expect(scrolledTo).toEqual([STEP]);
|
|
89
|
+
|
|
90
|
+
setInView(true);
|
|
91
|
+
act(() => {
|
|
92
|
+
vi.advanceTimersByTime(5000);
|
|
93
|
+
});
|
|
94
|
+
act(() => {
|
|
95
|
+
vi.advanceTimersByTime(5000);
|
|
96
|
+
});
|
|
97
|
+
expect(scrolledTo).toEqual([STEP, STEP * 2, 0]);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('stops for good once the visitor touches it', () => {
|
|
101
|
+
renderCarousel();
|
|
102
|
+
setInView(true);
|
|
103
|
+
fireEvent.pointerDown(screen.getByRole('group', { name: 'Example requests' }));
|
|
104
|
+
act(() => {
|
|
105
|
+
vi.advanceTimersByTime(60_000);
|
|
106
|
+
});
|
|
107
|
+
expect(scrolledTo).toEqual([]);
|
|
108
|
+
|
|
109
|
+
fireEvent.click(screen.getByLabelText('Next'));
|
|
110
|
+
expect(scrolledTo).toEqual([STEP]);
|
|
111
|
+
act(() => {
|
|
112
|
+
vi.advanceTimersByTime(60_000);
|
|
113
|
+
});
|
|
114
|
+
expect(scrolledTo).toEqual([STEP]);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
|
|
4
|
+
export interface AppWindowFrameProps {
|
|
5
|
+
/** Centered in the title bar. */
|
|
6
|
+
title?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** A bar pinned under the body (a status line, an action). */
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
/** The scrolling body between the title bar and the footer. */
|
|
12
|
+
bodyClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A desktop app window: title bar with three window dots and a centered
|
|
17
|
+
* title, a body, an optional footer bar. Decorative chrome for showing a
|
|
18
|
+
* product surface on a marketing page; the dots are not controls.
|
|
19
|
+
*
|
|
20
|
+
* The frame is a column, so give it a height and the body fills what is left.
|
|
21
|
+
*/
|
|
22
|
+
export function AppWindowFrame({ title, children, footer, className, bodyClassName }: AppWindowFrameProps) {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className={cn('flex min-w-0 flex-col overflow-hidden rounded-xl border border-ods-border bg-ods-card', className)}
|
|
26
|
+
>
|
|
27
|
+
<div className="relative flex h-10 shrink-0 items-center gap-2 border-b border-ods-border px-4" aria-hidden>
|
|
28
|
+
<span className="h-2.5 w-2.5 rounded-full bg-ods-border" />
|
|
29
|
+
<span className="h-2.5 w-2.5 rounded-full bg-ods-border" />
|
|
30
|
+
<span className="h-2.5 w-2.5 rounded-full bg-ods-border" />
|
|
31
|
+
{title && (
|
|
32
|
+
<span className="pointer-events-none absolute inset-x-0 truncate px-20 text-center text-ods-text-secondary text-h6">
|
|
33
|
+
{title}
|
|
34
|
+
</span>
|
|
35
|
+
)}
|
|
36
|
+
</div>
|
|
37
|
+
<div className={cn('flex min-h-0 flex-1 flex-col', bodyClassName)}>{children}</div>
|
|
38
|
+
{footer && <div className="shrink-0 border-t border-ods-border bg-ods-bg">{footer}</div>}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -14,6 +14,11 @@ export const buttonSurfaceClasses = {
|
|
|
14
14
|
'bg-ods-error text-ods-text-on-accent hover:bg-ods-error-hover active:bg-ods-error-active disabled:bg-ods-disabled aria-disabled:bg-ods-disabled',
|
|
15
15
|
warning:
|
|
16
16
|
'bg-ods-warning text-ods-text-on-accent hover:bg-ods-warning-hover active:bg-ods-warning-active disabled:bg-ods-disabled aria-disabled:bg-ods-disabled',
|
|
17
|
+
// The page's colours swapped: light on a dark theme, dark on a light one. A
|
|
18
|
+
// strong action that must NOT be the accent, for a surface that already
|
|
19
|
+
// holds the one accent call to action (an "Approve" inside a product demo).
|
|
20
|
+
inverted:
|
|
21
|
+
'bg-ods-text-primary text-ods-bg hover:bg-ods-text-secondary active:bg-ods-text-secondary disabled:bg-ods-disabled aria-disabled:bg-ods-disabled',
|
|
17
22
|
// A self-contained glyph (play badge, unmute glyph) that already carries its
|
|
18
23
|
// own scrim: no button surface at all, in any state. Distinct from
|
|
19
24
|
// `transparent`, whose hover/active fills would paint a rectangle behind the
|
|
@@ -30,6 +30,7 @@ const buttonVariants = cva(
|
|
|
30
30
|
transparent: buttonSurfaceClasses.transparent,
|
|
31
31
|
destructive: buttonSurfaceClasses.destructive,
|
|
32
32
|
warning: buttonSurfaceClasses.warning,
|
|
33
|
+
inverted: buttonSurfaceClasses.inverted,
|
|
33
34
|
glyph: buttonSurfaceClasses.glyph,
|
|
34
35
|
overlay: buttonSurfaceClasses.overlay,
|
|
35
36
|
link: buttonSurfaceClasses.link,
|
|
@@ -23,6 +23,11 @@ export interface FeatureCardItem {
|
|
|
23
23
|
colorScheme?: 'cyan' | 'pink' | 'yellow' | 'green' | 'purple' | 'default';
|
|
24
24
|
};
|
|
25
25
|
content: React.ReactNode; // Allow any content to be injected
|
|
26
|
+
/**
|
|
27
|
+
* Pinned to the bottom of the cell, under the content (a row of badges, a
|
|
28
|
+
* link). Cells in one row end on the same line however long their copy is.
|
|
29
|
+
*/
|
|
30
|
+
footer?: React.ReactNode;
|
|
26
31
|
// Card-level customization props
|
|
27
32
|
removeAllBorders?: boolean; // Remove all borders for this card
|
|
28
33
|
noBackground?: boolean; // Remove default background
|
|
@@ -187,7 +192,15 @@ export function FeatureCardGrid({
|
|
|
187
192
|
className={`${finalItemClassName}${finalBorderClasses} relative`}
|
|
188
193
|
style={item.customBackground ? { backgroundColor: item.customBackground } : undefined}
|
|
189
194
|
>
|
|
190
|
-
<div
|
|
195
|
+
<div
|
|
196
|
+
className={
|
|
197
|
+
!item.icon && !item.title
|
|
198
|
+
? 'flex h-full flex-col'
|
|
199
|
+
: item.footer
|
|
200
|
+
? 'flex h-full flex-col gap-6'
|
|
201
|
+
: 'space-y-6'
|
|
202
|
+
}
|
|
203
|
+
>
|
|
191
204
|
{item.icon && (
|
|
192
205
|
<div className="flex items-start justify-between">
|
|
193
206
|
<item.icon size={80} color={item.iconColor} />
|
|
@@ -252,6 +265,8 @@ export function FeatureCardGrid({
|
|
|
252
265
|
)}
|
|
253
266
|
|
|
254
267
|
{!item.media && item.content}
|
|
268
|
+
|
|
269
|
+
{item.footer && <div className="mt-auto">{item.footer}</div>}
|
|
255
270
|
</div>
|
|
256
271
|
</div>
|
|
257
272
|
);
|
|
@@ -19,18 +19,38 @@ export interface FeatureListProps {
|
|
|
19
19
|
* by its two-digit number (process steps).
|
|
20
20
|
*/
|
|
21
21
|
variant?: 'boxed' | 'numbered';
|
|
22
|
+
/**
|
|
23
|
+
* `numbered` only. The step being shown now: it stays at full strength and
|
|
24
|
+
* the others step back, so the list reads as "you are here" beside a timed
|
|
25
|
+
* demo. Omit for a plain list where every step is equal.
|
|
26
|
+
*/
|
|
27
|
+
activeIndex?: number;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
export function FeatureList({
|
|
30
|
+
export function FeatureList({
|
|
31
|
+
items,
|
|
32
|
+
className = '',
|
|
33
|
+
iconBoxSize = 72,
|
|
34
|
+
variant = 'boxed',
|
|
35
|
+
activeIndex,
|
|
36
|
+
}: FeatureListProps) {
|
|
25
37
|
if (variant === 'numbered') {
|
|
38
|
+
const dims = typeof activeIndex === 'number';
|
|
26
39
|
return (
|
|
27
40
|
<ol className={`flex flex-col ${className}`}>
|
|
28
41
|
{items.map((item, index) => (
|
|
29
42
|
<li
|
|
30
43
|
key={index}
|
|
31
|
-
|
|
44
|
+
aria-current={dims && index === activeIndex ? 'step' : undefined}
|
|
45
|
+
className={`grid grid-cols-[48px_minmax(0,1fr)] gap-[var(--spacing-system-m)] border-t border-ods-border py-[var(--spacing-system-l)] transition-opacity duration-200 last:border-b motion-reduce:transition-none ${
|
|
46
|
+
dims && index !== activeIndex ? 'opacity-55' : ''
|
|
47
|
+
}`}
|
|
32
48
|
>
|
|
33
|
-
<span
|
|
49
|
+
<span
|
|
50
|
+
className={`text-h5 ${dims && index === activeIndex ? 'text-ods-flamingo-pink' : 'text-ods-text-secondary'}`}
|
|
51
|
+
>
|
|
52
|
+
{String(index + 1).padStart(2, '0')}
|
|
53
|
+
</span>
|
|
34
54
|
<div className="flex min-w-0 flex-col gap-[var(--spacing-system-xxs)]">
|
|
35
55
|
<h3 className="text-ods-text-primary text-h3">{item.title}</h3>
|
|
36
56
|
<p className="text-ods-text-secondary text-h4">{item.description}</p>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { CheckCircleIcon } from '../icons-v2-generated/signs-and-symbols/check-circle-icon';
|
|
4
|
+
|
|
5
|
+
/** Where one incident stands. `waiting` is the only state that needs a person. */
|
|
6
|
+
export type IncidentStatus = 'working' | 'fixed' | 'waiting' | 'approved';
|
|
7
|
+
|
|
8
|
+
export interface IncidentStatusLineProps {
|
|
9
|
+
status: IncidentStatus;
|
|
10
|
+
/** The words for this status. The caller owns the copy. */
|
|
11
|
+
label: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* One status, said the same way everywhere: a pulsing dot while work is in
|
|
17
|
+
* flight, the warning colour when a person is needed, a success check once it
|
|
18
|
+
* is done (on its own or after an approval).
|
|
19
|
+
*/
|
|
20
|
+
export function IncidentStatusLine({ status, label, className }: IncidentStatusLineProps) {
|
|
21
|
+
return (
|
|
22
|
+
<span
|
|
23
|
+
className={cn(
|
|
24
|
+
'inline-flex items-center gap-1.5 whitespace-nowrap text-h6',
|
|
25
|
+
status === 'waiting' ? 'text-ods-warning' : 'text-ods-text-primary',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
{status === 'working' && (
|
|
30
|
+
<span
|
|
31
|
+
className="h-2 w-2 shrink-0 animate-pulse rounded-full bg-ods-flamingo-cyan motion-reduce:animate-none"
|
|
32
|
+
aria-hidden
|
|
33
|
+
/>
|
|
34
|
+
)}
|
|
35
|
+
{(status === 'fixed' || status === 'approved') && (
|
|
36
|
+
<CheckCircleIcon size={16} className="shrink-0 text-ods-success" aria-hidden />
|
|
37
|
+
)}
|
|
38
|
+
{label}
|
|
39
|
+
</span>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IncidentFeedItem {
|
|
44
|
+
id: string;
|
|
45
|
+
/** Where it was found, shown as a tag ("Patch logs"). */
|
|
46
|
+
source: string;
|
|
47
|
+
title: string;
|
|
48
|
+
/** One line under the title of the open item. */
|
|
49
|
+
detail?: string;
|
|
50
|
+
status: IncidentStatus;
|
|
51
|
+
/** A clock label on the collapsed row ("2:14 AM"). */
|
|
52
|
+
time?: string;
|
|
53
|
+
/** A person the incident is about, before the title. */
|
|
54
|
+
avatar?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface IncidentFeedProps {
|
|
58
|
+
/** Oldest first. The newest is open; earlier ones collapse to a row. */
|
|
59
|
+
items: readonly IncidentFeedItem[];
|
|
60
|
+
statusLabels: Record<IncidentStatus, string>;
|
|
61
|
+
/** Shown while there is nothing in the feed. */
|
|
62
|
+
emptyLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* `top`: the list grows downward (a wide window). `bottom`: the newest item
|
|
65
|
+
* sits at the bottom and older rows fade out at the top (a short card).
|
|
66
|
+
*/
|
|
67
|
+
anchor?: 'top' | 'bottom';
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function SourceTag({ children }: { children: ReactNode }) {
|
|
72
|
+
return (
|
|
73
|
+
<span className="inline-flex shrink-0 rounded-md border border-ods-border px-2 py-1 text-ods-text-secondary text-h5">
|
|
74
|
+
{children}
|
|
75
|
+
</span>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A feed of incidents an agent found and handled: the newest one is open
|
|
81
|
+
* (source tag, title, one line of detail, status); the ones before it collapse
|
|
82
|
+
* to a single row each. An item that is waiting on a person stays open even
|
|
83
|
+
* after newer ones arrive, because it is still the thing to look at.
|
|
84
|
+
*/
|
|
85
|
+
export function IncidentFeed({ items, statusLabels, emptyLabel, anchor = 'top', className }: IncidentFeedProps) {
|
|
86
|
+
const lastIndex = items.length - 1;
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
className={cn(
|
|
90
|
+
'flex min-h-0 flex-1 flex-col gap-3 overflow-hidden p-4 md:px-5',
|
|
91
|
+
anchor === 'bottom' && 'justify-end [mask-image:linear-gradient(180deg,transparent_0,#000_48px)]',
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
>
|
|
95
|
+
{items.length === 0 && emptyLabel && <p className="m-auto text-ods-text-secondary text-h4">{emptyLabel}</p>}
|
|
96
|
+
{items.map((item, index) => {
|
|
97
|
+
const open = index === lastIndex || item.status === 'waiting';
|
|
98
|
+
if (!open) {
|
|
99
|
+
return (
|
|
100
|
+
<div
|
|
101
|
+
key={item.id}
|
|
102
|
+
className="flex flex-col gap-2 rounded-md border border-ods-border bg-ods-bg px-3.5 py-2.5"
|
|
103
|
+
>
|
|
104
|
+
<div className="flex items-center justify-between gap-3">
|
|
105
|
+
<SourceTag>{item.source}</SourceTag>
|
|
106
|
+
{item.time && <span className="shrink-0 text-ods-text-secondary text-h6">{item.time}</span>}
|
|
107
|
+
</div>
|
|
108
|
+
<div className="flex items-center justify-between gap-3">
|
|
109
|
+
<span className="min-w-0 truncate text-ods-text-primary text-h4">{item.title}</span>
|
|
110
|
+
<IncidentStatusLine status={item.status} label={statusLabels[item.status]} />
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return (
|
|
116
|
+
<div
|
|
117
|
+
key={item.id}
|
|
118
|
+
className="flex flex-col gap-1.5 rounded-md border border-ods-border bg-ods-bg px-4 py-3.5 duration-300 animate-in fade-in motion-reduce:animate-none"
|
|
119
|
+
>
|
|
120
|
+
<div className="flex items-center justify-between gap-3">
|
|
121
|
+
<SourceTag>{item.source}</SourceTag>
|
|
122
|
+
{item.time && <span className="shrink-0 text-ods-text-secondary text-h6">{item.time}</span>}
|
|
123
|
+
</div>
|
|
124
|
+
<span className="flex items-start gap-2.5">
|
|
125
|
+
{item.avatar}
|
|
126
|
+
<span className="min-w-0 text-ods-text-primary text-h3">{item.title}</span>
|
|
127
|
+
</span>
|
|
128
|
+
{item.detail && (
|
|
129
|
+
<p
|
|
130
|
+
// Re-keyed on status so the line re-fades when the incident moves on.
|
|
131
|
+
key={item.status}
|
|
132
|
+
className="m-0 text-ods-text-secondary duration-300 animate-in fade-in text-h4 motion-reduce:animate-none"
|
|
133
|
+
>
|
|
134
|
+
{item.detail}
|
|
135
|
+
</p>
|
|
136
|
+
)}
|
|
137
|
+
<IncidentStatusLine status={item.status} label={statusLabels[item.status]} />
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
})}
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -228,6 +228,14 @@ export * from './filter-pill-row';
|
|
|
228
228
|
|
|
229
229
|
// Viewport-gated mounting for heavy previews (players, large images)
|
|
230
230
|
export { LazyMount, type LazyMountProps } from './lazy-mount';
|
|
231
|
+
|
|
232
|
+
// Product-demo stage primitives (marketing pages): window + phone chrome, the
|
|
233
|
+
// incident feed, the swipe carousel and the sticky call-to-action bar.
|
|
234
|
+
export * from './app-window-frame';
|
|
235
|
+
export * from './phone-frame';
|
|
236
|
+
export * from './incident-feed';
|
|
237
|
+
export * from './snap-carousel';
|
|
238
|
+
export * from './sticky-action-bar';
|
|
231
239
|
export { RequiredMark } from './required-mark';
|
|
232
240
|
export { IconTile } from './icon-tile';
|
|
233
241
|
export { PolicyLink } from './policy-link';
|
|
@@ -18,7 +18,7 @@ export type PageActionButton = {
|
|
|
18
18
|
onClick?: () => void;
|
|
19
19
|
icon?: React.ReactNode;
|
|
20
20
|
/** `overlay` and `glyph` are media chrome and `link` an inline text action; none is a page action, and SplitButton has no divider colour for them. */
|
|
21
|
-
variant?: Exclude<ButtonProps['variant'], 'overlay' | 'glyph' | 'link'>;
|
|
21
|
+
variant?: Exclude<ButtonProps['variant'], 'overlay' | 'glyph' | 'link' | 'inverted'>;
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
/**
|
|
24
24
|
* For SplitButton actions (when `iconAction` is set): disables only the main
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import { CheckCircleIcon } from '../icons-v2-generated/signs-and-symbols/check-circle-icon';
|
|
4
|
+
import { Button } from './button';
|
|
5
|
+
|
|
6
|
+
export interface PhoneFrameProps {
|
|
7
|
+
/** Lock-screen date line, e.g. "Thursday, October 1". */
|
|
8
|
+
dateLabel?: string;
|
|
9
|
+
/** Lock-screen clock, e.g. "5:09". */
|
|
10
|
+
timeLabel?: string;
|
|
11
|
+
/** The notification slot at the bottom of the lock screen. One at a time. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A phone lock screen: island, date, clock and one notification slot pinned
|
|
18
|
+
* to the bottom. Decorative chrome for showing what lands on a phone.
|
|
19
|
+
*
|
|
20
|
+
* It is sized by its class (default 236 x 480), never scaled, so the text
|
|
21
|
+
* inside stays the size the page set.
|
|
22
|
+
*/
|
|
23
|
+
export function PhoneFrame({ dateLabel, timeLabel, children, className }: PhoneFrameProps) {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
className={cn('h-[480px] w-[236px] shrink-0 rounded-[44px] border border-ods-border bg-black p-2.5', className)}
|
|
27
|
+
>
|
|
28
|
+
<div className="flex h-full flex-col items-center rounded-[36px] bg-ods-bg px-2.5 py-3.5">
|
|
29
|
+
<span className="h-6 w-20 rounded-full bg-black" aria-hidden />
|
|
30
|
+
{dateLabel && <span className="mt-4 text-ods-text-secondary text-h6">{dateLabel}</span>}
|
|
31
|
+
{timeLabel && (
|
|
32
|
+
<span className="mb-auto text-[56px] font-medium leading-[60px] tracking-tight text-ods-text-primary">
|
|
33
|
+
{timeLabel}
|
|
34
|
+
</span>
|
|
35
|
+
)}
|
|
36
|
+
<div className={cn('flex w-full flex-col gap-1.5', !timeLabel && 'mt-auto')}>{children}</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface PhoneNotificationProps {
|
|
43
|
+
/** Small brand mark before the app label. */
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
/** "Mingo · Needs you". */
|
|
46
|
+
appLabel: string;
|
|
47
|
+
/** "now". */
|
|
48
|
+
timeLabel?: string;
|
|
49
|
+
title: string;
|
|
50
|
+
body?: string;
|
|
51
|
+
/** Approve / Decline buttons, or the resolved line once it has been answered. */
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* One lock-screen notification. Remount it (change its `key`) to replay the
|
|
58
|
+
* drop-in; under reduced motion it simply appears.
|
|
59
|
+
*/
|
|
60
|
+
export function PhoneNotification({
|
|
61
|
+
icon,
|
|
62
|
+
appLabel,
|
|
63
|
+
timeLabel,
|
|
64
|
+
title,
|
|
65
|
+
body,
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
}: PhoneNotificationProps) {
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className={cn(
|
|
72
|
+
'rounded-[18px] border border-ods-border bg-ods-card p-3',
|
|
73
|
+
'duration-[420ms] animate-in fade-in slide-in-from-top-6 motion-reduce:animate-none',
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
<div className="flex items-center gap-2">
|
|
78
|
+
{icon && (
|
|
79
|
+
<span className="grid h-[22px] w-[22px] shrink-0 place-items-center overflow-hidden rounded-md">{icon}</span>
|
|
80
|
+
)}
|
|
81
|
+
<span className="min-w-0 flex-1 truncate uppercase text-ods-text-secondary text-h6">{appLabel}</span>
|
|
82
|
+
{timeLabel && <span className="shrink-0 text-ods-text-secondary text-h6">{timeLabel}</span>}
|
|
83
|
+
</div>
|
|
84
|
+
<div className="mt-1.5 flex flex-col gap-0.5">
|
|
85
|
+
<span className="font-bold text-ods-text-primary text-h6">{title}</span>
|
|
86
|
+
{body && <span className="text-ods-text-secondary text-h6">{body}</span>}
|
|
87
|
+
</div>
|
|
88
|
+
{children}
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface PhoneApprovalActionsProps {
|
|
94
|
+
approveLabel: string;
|
|
95
|
+
declineLabel: string;
|
|
96
|
+
onApprove?: () => void;
|
|
97
|
+
onDecline?: () => void;
|
|
98
|
+
/** Shows the approve button in its pressed state (a scripted demo's beat before the answer). */
|
|
99
|
+
approvePressed?: boolean;
|
|
100
|
+
/** Make the buttons real controls (a visitor may tap them). Scripted otherwise. */
|
|
101
|
+
interactive?: boolean;
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The Decline / Approve pair inside a phone notification, each 44px tall.
|
|
107
|
+
* Scripted by default (not focusable, no handlers fire); pass `interactive`
|
|
108
|
+
* to let the visitor answer it.
|
|
109
|
+
*/
|
|
110
|
+
export function PhoneApprovalActions({
|
|
111
|
+
approveLabel,
|
|
112
|
+
declineLabel,
|
|
113
|
+
onApprove,
|
|
114
|
+
onDecline,
|
|
115
|
+
approvePressed = false,
|
|
116
|
+
interactive = false,
|
|
117
|
+
className,
|
|
118
|
+
}: PhoneApprovalActionsProps) {
|
|
119
|
+
// Scripted (not interactive): the pair is a picture of buttons, so it is
|
|
120
|
+
// taken out of the tab order and hidden from assistive tech.
|
|
121
|
+
const scripted = interactive ? {} : { tabIndex: -1, 'aria-hidden': true as const };
|
|
122
|
+
return (
|
|
123
|
+
<div className={cn('mt-2 flex gap-2', className)}>
|
|
124
|
+
<Button
|
|
125
|
+
variant="outline"
|
|
126
|
+
font="regular"
|
|
127
|
+
className="flex-1"
|
|
128
|
+
onClick={interactive ? onDecline : undefined}
|
|
129
|
+
{...scripted}
|
|
130
|
+
>
|
|
131
|
+
{declineLabel}
|
|
132
|
+
</Button>
|
|
133
|
+
<Button
|
|
134
|
+
variant="inverted"
|
|
135
|
+
font="regular"
|
|
136
|
+
className="flex-1"
|
|
137
|
+
aria-pressed={interactive ? undefined : approvePressed}
|
|
138
|
+
data-pressed={approvePressed || undefined}
|
|
139
|
+
onClick={interactive ? onApprove : undefined}
|
|
140
|
+
{...scripted}
|
|
141
|
+
>
|
|
142
|
+
{approveLabel}
|
|
143
|
+
</Button>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface PhoneNotificationResultProps {
|
|
149
|
+
label: string;
|
|
150
|
+
className?: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** What a notification says once it was answered: a success check and one line. */
|
|
154
|
+
export function PhoneNotificationResult({ label, className }: PhoneNotificationResultProps) {
|
|
155
|
+
return (
|
|
156
|
+
<div
|
|
157
|
+
className={cn(
|
|
158
|
+
'mt-2 flex min-h-11 items-center gap-2 rounded-xl bg-ods-bg px-3 text-ods-text-primary duration-300 animate-in fade-in text-h6 motion-reduce:animate-none',
|
|
159
|
+
className,
|
|
160
|
+
)}
|
|
161
|
+
>
|
|
162
|
+
<CheckCircleIcon size={16} className="shrink-0 text-ods-success" aria-hidden />
|
|
163
|
+
{label}
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
}
|