@clicoh/orion-library 1.2.0-beta.11 → 1.2.0-beta.13
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/assets/css/expresivo.css +895 -0
- package/assets/mascotas/svg/bugi-mascota-01-alerta.svg +39 -0
- package/assets/mascotas/svg/bugi-mascota-02-investigando.svg +36 -0
- package/assets/mascotas/svg/bugi-mascota-05-sorprendido.svg +38 -0
- package/assets/mascotas/svg/oculus-mascota-01-feliz.svg +52 -0
- package/assets/mascotas/svg/oculus-mascota-02-investigando.svg +51 -0
- package/assets/mascotas/svg/oculus-mascota-03-dudando.svg +51 -0
- package/assets/mascotas/svg/oculus-mascota-04-analizando-documento.svg +53 -0
- package/assets/mascotas/svg/oculus-mascota-06-celebrando.svg +54 -0
- package/assets/mascotas/svg/oculus-mascota-07-buscando-rapido.svg +57 -0
- package/assets/mascotas/svg/oculus-mascota-08-satisfecho.svg +55 -0
- package/assets/mascotas/webp/fixi-mascota-01-feliz-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-02-investigando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-03-dudando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-04-reparando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-05-sorprendido-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-06-celebrando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-07-corriendo-sm.webp +0 -0
- package/dist/components/01-atoms/Button/Button.d.ts +18 -1
- package/dist/components/01-atoms/Button/Button.d.ts.map +1 -1
- package/dist/components/01-atoms/Button/Button.jsx +25 -5
- package/dist/components/01-atoms/Button/Button.jsx.map +1 -1
- package/dist/components/01-atoms/CodeBlock/CodeBlock.d.ts +56 -0
- package/dist/components/01-atoms/CodeBlock/CodeBlock.d.ts.map +1 -0
- package/dist/components/01-atoms/CodeBlock/CodeBlock.jsx +97 -0
- package/dist/components/01-atoms/CodeBlock/CodeBlock.jsx.map +1 -0
- package/dist/components/01-atoms/CodeBlock/index.d.ts +2 -0
- package/dist/components/01-atoms/CodeBlock/index.d.ts.map +1 -0
- package/dist/components/01-atoms/CodeBlock/index.js +2 -0
- package/dist/components/01-atoms/CodeBlock/index.js.map +1 -0
- package/dist/components/01-atoms/Heading/Heading.jsx +1 -1
- package/dist/components/01-atoms/Heading/Heading.jsx.map +1 -1
- package/dist/components/01-atoms/Input/Input.d.ts.map +1 -1
- package/dist/components/01-atoms/Input/Input.jsx +9 -7
- package/dist/components/01-atoms/Input/Input.jsx.map +1 -1
- package/dist/components/01-atoms/Input/utils/RenderErrorOrHelperText.d.ts.map +1 -1
- package/dist/components/01-atoms/Input/utils/RenderErrorOrHelperText.jsx +1 -1
- package/dist/components/01-atoms/Input/utils/RenderErrorOrHelperText.jsx.map +1 -1
- package/dist/components/01-atoms/Select/Select.d.ts.map +1 -1
- package/dist/components/01-atoms/Select/Select.jsx +7 -7
- package/dist/components/01-atoms/Select/Select.jsx.map +1 -1
- package/dist/components/01-atoms/Spinner/Spinner.d.ts +24 -3
- package/dist/components/01-atoms/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/01-atoms/Spinner/Spinner.jsx +30 -4
- package/dist/components/01-atoms/Spinner/Spinner.jsx.map +1 -1
- package/dist/components/01-atoms/Spinner/index.d.ts +1 -0
- package/dist/components/01-atoms/Spinner/index.d.ts.map +1 -1
- package/dist/components/01-atoms/Stat/Stat.d.ts +47 -0
- package/dist/components/01-atoms/Stat/Stat.d.ts.map +1 -0
- package/dist/components/01-atoms/Stat/Stat.jsx +64 -0
- package/dist/components/01-atoms/Stat/Stat.jsx.map +1 -0
- package/dist/components/01-atoms/Stat/index.d.ts +2 -0
- package/dist/components/01-atoms/Stat/index.d.ts.map +1 -0
- package/dist/components/01-atoms/Stat/index.js +2 -0
- package/dist/components/01-atoms/Stat/index.js.map +1 -0
- package/dist/components/01-atoms/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/01-atoms/Textarea/Textarea.jsx +3 -3
- package/dist/components/01-atoms/Textarea/Textarea.jsx.map +1 -1
- package/dist/components/01-atoms/index.d.ts +2 -0
- package/dist/components/01-atoms/index.d.ts.map +1 -1
- package/dist/components/01-atoms/index.js +2 -0
- package/dist/components/01-atoms/index.js.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.jsx +26 -3
- package/dist/components/02-molecules/Accordion/AccordionSection.jsx.map +1 -1
- package/dist/components/02-molecules/Card/Card.d.ts +74 -0
- package/dist/components/02-molecules/Card/Card.d.ts.map +1 -0
- package/dist/components/02-molecules/Card/Card.jsx +83 -0
- package/dist/components/02-molecules/Card/Card.jsx.map +1 -0
- package/dist/components/02-molecules/Card/index.d.ts +2 -0
- package/dist/components/02-molecules/Card/index.d.ts.map +1 -0
- package/dist/components/02-molecules/Card/index.js +2 -0
- package/dist/components/02-molecules/Card/index.js.map +1 -0
- package/dist/components/02-molecules/DatePicker/DatePicker.d.ts +37 -2
- package/dist/components/02-molecules/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/02-molecules/DatePicker/DatePicker.jsx +187 -32
- package/dist/components/02-molecules/DatePicker/DatePicker.jsx.map +1 -1
- package/dist/components/02-molecules/EmptyState/EmptyState.d.ts +52 -0
- package/dist/components/02-molecules/EmptyState/EmptyState.d.ts.map +1 -0
- package/dist/components/02-molecules/EmptyState/EmptyState.jsx +66 -0
- package/dist/components/02-molecules/EmptyState/EmptyState.jsx.map +1 -0
- package/dist/components/02-molecules/EmptyState/index.d.ts +2 -0
- package/dist/components/02-molecules/EmptyState/index.d.ts.map +1 -0
- package/dist/components/02-molecules/EmptyState/index.js +2 -0
- package/dist/components/02-molecules/EmptyState/index.js.map +1 -0
- package/dist/components/02-molecules/Filter/Filter.d.ts +7 -1
- package/dist/components/02-molecules/Filter/Filter.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/Filter.jsx +10 -7
- package/dist/components/02-molecules/Filter/Filter.jsx.map +1 -1
- package/dist/components/02-molecules/InlineMessage/InlineMessage.d.ts +15 -1
- package/dist/components/02-molecules/InlineMessage/InlineMessage.d.ts.map +1 -1
- package/dist/components/02-molecules/InlineMessage/InlineMessage.jsx +18 -3
- package/dist/components/02-molecules/InlineMessage/InlineMessage.jsx.map +1 -1
- package/dist/components/02-molecules/Menu/MenuItem.d.ts.map +1 -1
- package/dist/components/02-molecules/Menu/MenuItem.jsx +2 -2
- package/dist/components/02-molecules/Menu/MenuItem.jsx.map +1 -1
- package/dist/components/02-molecules/Menu/MenuList.d.ts.map +1 -1
- package/dist/components/02-molecules/Menu/MenuList.jsx +1 -1
- package/dist/components/02-molecules/Menu/MenuList.jsx.map +1 -1
- package/dist/components/02-molecules/Stepper/Stepper.d.ts +70 -0
- package/dist/components/02-molecules/Stepper/Stepper.d.ts.map +1 -0
- package/dist/components/02-molecules/Stepper/Stepper.jsx +204 -0
- package/dist/components/02-molecules/Stepper/Stepper.jsx.map +1 -0
- package/dist/components/02-molecules/Stepper/index.d.ts +2 -0
- package/dist/components/02-molecules/Stepper/index.d.ts.map +1 -0
- package/dist/components/02-molecules/Stepper/index.js +2 -0
- package/dist/components/02-molecules/Stepper/index.js.map +1 -0
- package/dist/components/02-molecules/Table/Table.d.ts +3 -1
- package/dist/components/02-molecules/Table/Table.d.ts.map +1 -1
- package/dist/components/02-molecules/Table/Table.jsx +6 -5
- package/dist/components/02-molecules/Table/Table.jsx.map +1 -1
- package/dist/components/02-molecules/Timeline/Timeline.d.ts +47 -0
- package/dist/components/02-molecules/Timeline/Timeline.d.ts.map +1 -0
- package/dist/components/02-molecules/Timeline/Timeline.jsx +65 -0
- package/dist/components/02-molecules/Timeline/Timeline.jsx.map +1 -0
- package/dist/components/02-molecules/Timeline/index.d.ts +2 -0
- package/dist/components/02-molecules/Timeline/index.d.ts.map +1 -0
- package/dist/components/02-molecules/Timeline/index.js +2 -0
- package/dist/components/02-molecules/Timeline/index.js.map +1 -0
- package/dist/components/02-molecules/index.d.ts +4 -0
- package/dist/components/02-molecules/index.d.ts.map +1 -1
- package/dist/components/02-molecules/index.js +4 -0
- package/dist/components/02-molecules/index.js.map +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.d.ts +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.jsx.map +1 -1
- package/dist/components/03-organisms/Header/Header.d.ts +3 -1
- package/dist/components/03-organisms/Header/Header.d.ts.map +1 -1
- package/dist/components/03-organisms/Header/Header.jsx +4 -5
- package/dist/components/03-organisms/Header/Header.jsx.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.d.ts +24 -4
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.d.ts.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx +31 -8
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.d.ts +6 -2
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.d.ts.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.jsx +7 -3
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.jsx.map +1 -1
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.d.ts +2 -0
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.d.ts.map +1 -1
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.jsx +2 -1
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.jsx.map +1 -1
- package/expresivo/ExpBubble/ExpBubble.d.ts +51 -0
- package/expresivo/ExpBubble/ExpBubble.d.ts.map +1 -0
- package/expresivo/ExpBubble/ExpBubble.jsx +74 -0
- package/expresivo/ExpBubble/ExpBubble.jsx.map +1 -0
- package/expresivo/ExpBubble/index.d.ts +3 -0
- package/expresivo/ExpBubble/index.d.ts.map +1 -0
- package/expresivo/ExpBubble/index.js +2 -0
- package/expresivo/ExpBubble/index.js.map +1 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.d.ts +37 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.d.ts.map +1 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.jsx +43 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.jsx.map +1 -0
- package/expresivo/ExpCollapseToggle/index.d.ts +3 -0
- package/expresivo/ExpCollapseToggle/index.d.ts.map +1 -0
- package/expresivo/ExpCollapseToggle/index.js +2 -0
- package/expresivo/ExpCollapseToggle/index.js.map +1 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.d.ts +26 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.d.ts.map +1 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.jsx +39 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.jsx.map +1 -0
- package/expresivo/ExpGrowBar/index.d.ts +3 -0
- package/expresivo/ExpGrowBar/index.d.ts.map +1 -0
- package/expresivo/ExpGrowBar/index.js +2 -0
- package/expresivo/ExpGrowBar/index.js.map +1 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.d.ts +65 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.d.ts.map +1 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.jsx +156 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.jsx.map +1 -0
- package/expresivo/ExpJourneyTrack/index.d.ts +3 -0
- package/expresivo/ExpJourneyTrack/index.d.ts.map +1 -0
- package/expresivo/ExpJourneyTrack/index.js +2 -0
- package/expresivo/ExpJourneyTrack/index.js.map +1 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.d.ts +49 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.d.ts.map +1 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.jsx +60 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.jsx.map +1 -0
- package/expresivo/ExpKeyButton/index.d.ts +3 -0
- package/expresivo/ExpKeyButton/index.d.ts.map +1 -0
- package/expresivo/ExpKeyButton/index.js +2 -0
- package/expresivo/ExpKeyButton/index.js.map +1 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.d.ts +29 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.d.ts.map +1 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.jsx +29 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.jsx.map +1 -0
- package/expresivo/ExpLensIcon/index.d.ts +3 -0
- package/expresivo/ExpLensIcon/index.d.ts.map +1 -0
- package/expresivo/ExpLensIcon/index.js +2 -0
- package/expresivo/ExpLensIcon/index.js.map +1 -0
- package/expresivo/ExpMascot/ExpMascot.d.ts +38 -0
- package/expresivo/ExpMascot/ExpMascot.d.ts.map +1 -0
- package/expresivo/ExpMascot/ExpMascot.jsx +41 -0
- package/expresivo/ExpMascot/ExpMascot.jsx.map +1 -0
- package/expresivo/ExpMascot/catalog.d.ts +12 -0
- package/expresivo/ExpMascot/catalog.d.ts.map +1 -0
- package/expresivo/ExpMascot/catalog.js +41 -0
- package/expresivo/ExpMascot/catalog.js.map +1 -0
- package/expresivo/ExpMascot/index.d.ts +4 -0
- package/expresivo/ExpMascot/index.d.ts.map +1 -0
- package/expresivo/ExpMascot/index.js +2 -0
- package/expresivo/ExpMascot/index.js.map +1 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.d.ts +29 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.d.ts.map +1 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.jsx +87 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.jsx.map +1 -0
- package/expresivo/ExpMedalBadge/index.d.ts +3 -0
- package/expresivo/ExpMedalBadge/index.d.ts.map +1 -0
- package/expresivo/ExpMedalBadge/index.js +2 -0
- package/expresivo/ExpMedalBadge/index.js.map +1 -0
- package/expresivo/ExpPillButton/ExpPillButton.d.ts +44 -0
- package/expresivo/ExpPillButton/ExpPillButton.d.ts.map +1 -0
- package/expresivo/ExpPillButton/ExpPillButton.jsx +75 -0
- package/expresivo/ExpPillButton/ExpPillButton.jsx.map +1 -0
- package/expresivo/ExpPillButton/index.d.ts +3 -0
- package/expresivo/ExpPillButton/index.d.ts.map +1 -0
- package/expresivo/ExpPillButton/index.js +2 -0
- package/expresivo/ExpPillButton/index.js.map +1 -0
- package/expresivo/ExpScope/ExpScope.d.ts +63 -0
- package/expresivo/ExpScope/ExpScope.d.ts.map +1 -0
- package/expresivo/ExpScope/ExpScope.jsx +67 -0
- package/expresivo/ExpScope/ExpScope.jsx.map +1 -0
- package/expresivo/ExpScope/index.d.ts +3 -0
- package/expresivo/ExpScope/index.d.ts.map +1 -0
- package/expresivo/ExpScope/index.js +2 -0
- package/expresivo/ExpScope/index.js.map +1 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.d.ts +35 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.d.ts.map +1 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.jsx +67 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.jsx.map +1 -0
- package/expresivo/ExpScoreRing/index.d.ts +3 -0
- package/expresivo/ExpScoreRing/index.d.ts.map +1 -0
- package/expresivo/ExpScoreRing/index.js +2 -0
- package/expresivo/ExpScoreRing/index.js.map +1 -0
- package/expresivo/index.d.ts +12 -0
- package/expresivo/index.d.ts.map +1 -0
- package/expresivo/index.js +12 -0
- package/expresivo/index.js.map +1 -0
- package/expresivo/shared/glyphs.d.ts +20 -0
- package/expresivo/shared/glyphs.d.ts.map +1 -0
- package/expresivo/shared/glyphs.jsx +60 -0
- package/expresivo/shared/glyphs.jsx.map +1 -0
- package/package.json +3 -2
|
@@ -14,6 +14,7 @@ import { dataUrl } from './dataUrl';
|
|
|
14
14
|
*
|
|
15
15
|
* @param {Object} props - The properties of the LoginTemplate component.
|
|
16
16
|
* @param {ReactNode} props.children - The content to be rendered inside the login template.
|
|
17
|
+
* @param {ReactNode} [props.logo=<Logo />] - Brand mark above the content. Replaces the clicOH logo, so `logoAriaLabel` no longer applies.
|
|
17
18
|
*
|
|
18
19
|
* @returns {ReactNode} The rendered LoginTemplate component.
|
|
19
20
|
*/
|
|
@@ -24,7 +25,7 @@ export function LoginTemplate(props) {
|
|
|
24
25
|
</div>
|
|
25
26
|
<main className="flex min-h-svh w-[460px] items-center justify-center bg-white text-black dark:bg-black dark:text-white">
|
|
26
27
|
<div className="flex flex-col items-center justify-center gap-4">
|
|
27
|
-
<Logo width={94} height={40} aria-label={props.logoAriaLabel}/>
|
|
28
|
+
{props.logo ?? (<Logo width={94} height={40} aria-label={props.logoAriaLabel}/>)}
|
|
28
29
|
{props.children}
|
|
29
30
|
</div>
|
|
30
31
|
</main>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginTemplate.jsx","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,EAAW,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"LoginTemplate.jsx","sourceRoot":"","sources":["../../../../src/components/04-templates/LoginTemplate/LoginTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,EAAW,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,CACL,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CACnB;MAAA,CAAC,GAAG,CAAC,SAAS,CAAC,oCAAoC,CACjD;QAAA,CAAC,KAAK,CACJ,GAAG,CAAC,CAAE,KAAK,CAAC,QAA4B,IAAI,QAAQ,CAAC,CACrD,GAAG,CAAC,EAAE,CACN,WAAW,CAAC,MAAM,CAClB,KAAK,CAAC,mCAAmC,CACzC,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,SAAS,CAAC,cAAc,CACxB,WAAW,CAAC,MAAM,CAClB,WAAW,CAAC,CAAC,OAAO,CAAC,EAEzB;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,IAAI,CAAC,SAAS,CAAC,wGAAwG,CACtH;QAAA,CAAC,GAAG,CAAC,SAAS,CAAC,iDAAiD,CAC9D;UAAA,CAAC,KAAK,CAAC,IAAI,IAAI,CACb,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,EAAG,CACjE,CACD;UAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type InlineMessageModifier } from '@clicoh/orion-library';
|
|
3
|
+
import type { ExpMascotName } from '../ExpMascot/catalog';
|
|
4
|
+
export type ExpBubbleTail = 'left' | 'right' | 'bottom';
|
|
5
|
+
export type ExpBubbleProps = {
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** Body text, under the title. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** Side the tail points to. With a `mascot`, the mascot sits on that side. */
|
|
10
|
+
tail?: ExpBubbleTail;
|
|
11
|
+
/** Sets the title larger, in the display font, when the scope uses `titles="playful"`. */
|
|
12
|
+
display?: boolean;
|
|
13
|
+
/** Short success note pinned under the text, such as a result. */
|
|
14
|
+
badge?: ReactNode;
|
|
15
|
+
mascot?: ExpMascotName;
|
|
16
|
+
mascotSize?: number;
|
|
17
|
+
/** Tone of the core `InlineMessage` rendered outside an `ExpScope`. */
|
|
18
|
+
fallbackModifier?: InlineMessageModifier;
|
|
19
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'title'>;
|
|
20
|
+
/**
|
|
21
|
+
* Speech bubble with a tail, optionally spoken by a mascot. Use it for a short
|
|
22
|
+
* remark from the product (an empty state, a tip, a result), never for errors
|
|
23
|
+
* that block the user.
|
|
24
|
+
*
|
|
25
|
+
* It is a polite live region (`role="status"`). Outside an `ExpScope` it falls
|
|
26
|
+
* back to the core `InlineMessage`, with the title and the text in one line.
|
|
27
|
+
*
|
|
28
|
+
* @component
|
|
29
|
+
* @example
|
|
30
|
+
* <ExpBubble title="Nothing to review" mascot="oculus-08-satisfecho">
|
|
31
|
+
* Every case has an answer.
|
|
32
|
+
* </ExpBubble>
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Above the mascot, with the title in the display font
|
|
36
|
+
* <ExpBubble tail="bottom" display title="Found it" mascot="fixi-06-celebrando" badge="Solved" />
|
|
37
|
+
*
|
|
38
|
+
* @param {Object} props - The properties of the ExpBubble component.
|
|
39
|
+
* @param {ReactNode} [props.title] - First line, in semibold.
|
|
40
|
+
* @param {ReactNode} [props.children] - Body text, under the title.
|
|
41
|
+
* @param {'left' | 'right' | 'bottom'} [props.tail='left'] - Side the tail points to, and the side of the mascot.
|
|
42
|
+
* @param {boolean} [props.display=false] - Larger title in the display font when the scope uses `titles="playful"`.
|
|
43
|
+
* @param {ReactNode} [props.badge] - Short success note under the text.
|
|
44
|
+
* @param {ExpMascotName} [props.mascot] - Mascot that speaks the bubble. Hidden when the scope hides mascots.
|
|
45
|
+
* @param {number} [props.mascotSize=64] - Mascot size, in pixels.
|
|
46
|
+
* @param {'info' | 'warning' | 'error' | 'success'} [props.fallbackModifier='info'] - Tone of the `InlineMessage` outside an `ExpScope`.
|
|
47
|
+
*
|
|
48
|
+
* @returns {ReactNode} The bubble, or an `InlineMessage` outside an `ExpScope`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function ExpBubble({ title, children, tail, display, badge, mascot, mascotSize, fallbackModifier, ...restProps }: ExpBubbleProps): ReactNode;
|
|
51
|
+
//# sourceMappingURL=ExpBubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpBubble.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpBubble/ExpBubble.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;AAclD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,IAAa,EACb,OAAe,EACf,KAAK,EACL,MAAM,EACN,UAAe,EACf,gBAAyB,EACzB,GAAG,SAAS,EACb,EAAE,cAAc,GAAG,SAAS,CAsE5B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { InlineMessage, } from '@clicoh/orion-library';
|
|
4
|
+
import { useExpScopeOptions } from '../ExpScope/ExpScope';
|
|
5
|
+
import { ExpMascot } from '../ExpMascot/ExpMascot';
|
|
6
|
+
const layoutMap = {
|
|
7
|
+
left: 'flex-row-reverse items-start',
|
|
8
|
+
right: 'flex-row items-start',
|
|
9
|
+
bottom: 'flex-col items-start',
|
|
10
|
+
};
|
|
11
|
+
const tailMap = {
|
|
12
|
+
left: '-left-1.5 top-[22px] border-t-0 border-r-0',
|
|
13
|
+
right: '-right-1.5 top-[22px] border-b-0 border-l-0',
|
|
14
|
+
bottom: '-bottom-1.5 left-7 border-t-0 border-l-0',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Speech bubble with a tail, optionally spoken by a mascot. Use it for a short
|
|
18
|
+
* remark from the product (an empty state, a tip, a result), never for errors
|
|
19
|
+
* that block the user.
|
|
20
|
+
*
|
|
21
|
+
* It is a polite live region (`role="status"`). Outside an `ExpScope` it falls
|
|
22
|
+
* back to the core `InlineMessage`, with the title and the text in one line.
|
|
23
|
+
*
|
|
24
|
+
* @component
|
|
25
|
+
* @example
|
|
26
|
+
* <ExpBubble title="Nothing to review" mascot="oculus-08-satisfecho">
|
|
27
|
+
* Every case has an answer.
|
|
28
|
+
* </ExpBubble>
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Above the mascot, with the title in the display font
|
|
32
|
+
* <ExpBubble tail="bottom" display title="Found it" mascot="fixi-06-celebrando" badge="Solved" />
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} props - The properties of the ExpBubble component.
|
|
35
|
+
* @param {ReactNode} [props.title] - First line, in semibold.
|
|
36
|
+
* @param {ReactNode} [props.children] - Body text, under the title.
|
|
37
|
+
* @param {'left' | 'right' | 'bottom'} [props.tail='left'] - Side the tail points to, and the side of the mascot.
|
|
38
|
+
* @param {boolean} [props.display=false] - Larger title in the display font when the scope uses `titles="playful"`.
|
|
39
|
+
* @param {ReactNode} [props.badge] - Short success note under the text.
|
|
40
|
+
* @param {ExpMascotName} [props.mascot] - Mascot that speaks the bubble. Hidden when the scope hides mascots.
|
|
41
|
+
* @param {number} [props.mascotSize=64] - Mascot size, in pixels.
|
|
42
|
+
* @param {'info' | 'warning' | 'error' | 'success'} [props.fallbackModifier='info'] - Tone of the `InlineMessage` outside an `ExpScope`.
|
|
43
|
+
*
|
|
44
|
+
* @returns {ReactNode} The bubble, or an `InlineMessage` outside an `ExpScope`.
|
|
45
|
+
*/
|
|
46
|
+
export function ExpBubble({ title, children, tail = 'left', display = false, badge, mascot, mascotSize = 64, fallbackModifier = 'info', ...restProps }) {
|
|
47
|
+
const options = useExpScopeOptions();
|
|
48
|
+
if (!options) {
|
|
49
|
+
return (<InlineMessage {...restProps} modifier={fallbackModifier}>
|
|
50
|
+
{!!title && <strong className="font-semibold">{title} </strong>}
|
|
51
|
+
{children}
|
|
52
|
+
{!!badge && <> · {badge}</>}
|
|
53
|
+
</InlineMessage>);
|
|
54
|
+
}
|
|
55
|
+
const playfulTitle = display && options.titles === 'playful';
|
|
56
|
+
return (<div role="status" {...restProps} className={clsx('inline-flex gap-3', layoutMap[tail], restProps.className)}>
|
|
57
|
+
<div className="border-gray-5 dark:border-gray-1 relative max-w-[280px] rounded-lg border bg-white px-4 py-3 shadow-[0_2px_3px_rgba(34,35,41,0.08)] dark:bg-black">
|
|
58
|
+
<span aria-hidden="true" className={clsx('border-gray-5 dark:border-gray-1 absolute size-2.5 rotate-45 border bg-white dark:bg-black', tailMap[tail])}/>
|
|
59
|
+
{!!title && (<p className={clsx('font-semibold text-black dark:text-white', playfulTitle
|
|
60
|
+
? 'font-(family-name:--exp-title-font) text-lg leading-6'
|
|
61
|
+
: 'text-sm leading-5')}>
|
|
62
|
+
{title}
|
|
63
|
+
</p>)}
|
|
64
|
+
{!!children && (<p className={clsx('text-gray-1 dark:text-gray-2 text-xs leading-[18px] text-pretty', !!title && 'mt-0.5')}>
|
|
65
|
+
{children}
|
|
66
|
+
</p>)}
|
|
67
|
+
{!!badge && (<span className="border-success text-success-strong dark:text-success mt-2 inline-flex rounded-full border px-2 py-px text-[11px] leading-4 font-semibold">
|
|
68
|
+
{badge}
|
|
69
|
+
</span>)}
|
|
70
|
+
</div>
|
|
71
|
+
{!!mascot && (<ExpMascot name={mascot} size={mascotSize} className={clsx(tail === 'bottom' && 'ml-2')}/>)}
|
|
72
|
+
</div>);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=ExpBubble.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpBubble.jsx","sourceRoot":"","sources":["../../src/expresivo/ExpBubble/ExpBubble.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,aAAa,GAEd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAqBnD,MAAM,SAAS,GAAkC;IAC/C,IAAI,EAAE,8BAA8B;IACpC,KAAK,EAAE,sBAAsB;IAC7B,MAAM,EAAE,sBAAsB;CAC/B,CAAC;AAEF,MAAM,OAAO,GAAkC;IAC7C,IAAI,EAAE,4CAA4C;IAClD,KAAK,EAAE,6CAA6C;IACpD,MAAM,EAAE,0CAA0C;CACnD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,KAAK,EACf,KAAK,EACL,MAAM,EACN,UA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,IAAI,CACb,CAAC,CAAC,CACA,SAAS,CAAC,CAAC,IAAI,CACb,iEAAiE,EACjE,CAAC,CAAC,KAAK,IAAI,QAAQ,CACpB,CAAC,CAEF;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,CAAC,CAAC,CACL,CACD;QAAA,CAAC,CAAC,CAAC,KAAK,IAAI,CACV,CAAC,IAAI,CAAC,SAAS,CAAC,0IAA0I,CACxJ;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,IAAI,CAAC,CACR,CACH;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,CAAC,CAAC,MAAM,IAAI,CACX,CAAC,SAAS,CACR,IAAI,CAAC,CAAC,MAAM,CAAC,CACb,IAAI,CAAC,CAAC,UAAU,CAAC,CACjB,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,CAAC,EAC7C,CACH,CACH;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpBubble/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expresivo/ExpBubble/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ExpCollapseToggleProps = {
|
|
3
|
+
collapsed: boolean;
|
|
4
|
+
onToggle: () => void;
|
|
5
|
+
/** Accessible name while collapsed, such as "Expand header". */
|
|
6
|
+
expandLabel: string;
|
|
7
|
+
/** Accessible name while expanded, such as "Collapse header". */
|
|
8
|
+
collapseLabel: string;
|
|
9
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick' | 'aria-label' | 'aria-expanded'>;
|
|
10
|
+
/**
|
|
11
|
+
* Round corner button that collapses or expands a section, such as a page
|
|
12
|
+
* header. While the section is expanded, a lavender ring pulses around it to
|
|
13
|
+
* invite the user to tuck it away; the chevron flips when collapsed.
|
|
14
|
+
*
|
|
15
|
+
* Pass `aria-controls` with the id of the section it toggles. Outside an
|
|
16
|
+
* `ExpScope` it falls back to the core `IconButton` with a chevron.
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
* @example
|
|
20
|
+
* <ExpCollapseToggle
|
|
21
|
+
* collapsed={collapsed}
|
|
22
|
+
* onToggle={() => setCollapsed(!collapsed)}
|
|
23
|
+
* expandLabel="Expand header"
|
|
24
|
+
* collapseLabel="Collapse header"
|
|
25
|
+
* aria-controls="case-header"
|
|
26
|
+
* />
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} props - The properties of the ExpCollapseToggle component.
|
|
29
|
+
* @param {boolean} props.collapsed - Whether the section is collapsed.
|
|
30
|
+
* @param {() => void} props.onToggle - Called on click.
|
|
31
|
+
* @param {string} props.expandLabel - Accessible name while collapsed.
|
|
32
|
+
* @param {string} props.collapseLabel - Accessible name while expanded.
|
|
33
|
+
*
|
|
34
|
+
* @returns {ReactNode} The toggle, or an `IconButton` outside an `ExpScope`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ExpCollapseToggle({ collapsed, onToggle, expandLabel, collapseLabel, ...restProps }: ExpCollapseToggleProps): ReactNode;
|
|
37
|
+
//# sourceMappingURL=ExpCollapseToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpCollapseToggle.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpCollapseToggle/ExpCollapseToggle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK7D,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,IAAI,CACN,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,eAAe,CACxD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,WAAW,EACX,aAAa,EACb,GAAG,SAAS,EACb,EAAE,sBAAsB,GAAG,SAAS,CA6CpC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { FiChevronDown, FiChevronUp } from 'react-icons/fi';
|
|
4
|
+
import { IconButton } from '@clicoh/orion-library';
|
|
5
|
+
import { useExpScope } from '../ExpScope/ExpScope';
|
|
6
|
+
/**
|
|
7
|
+
* Round corner button that collapses or expands a section, such as a page
|
|
8
|
+
* header. While the section is expanded, a lavender ring pulses around it to
|
|
9
|
+
* invite the user to tuck it away; the chevron flips when collapsed.
|
|
10
|
+
*
|
|
11
|
+
* Pass `aria-controls` with the id of the section it toggles. Outside an
|
|
12
|
+
* `ExpScope` it falls back to the core `IconButton` with a chevron.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* <ExpCollapseToggle
|
|
17
|
+
* collapsed={collapsed}
|
|
18
|
+
* onToggle={() => setCollapsed(!collapsed)}
|
|
19
|
+
* expandLabel="Expand header"
|
|
20
|
+
* collapseLabel="Collapse header"
|
|
21
|
+
* aria-controls="case-header"
|
|
22
|
+
* />
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} props - The properties of the ExpCollapseToggle component.
|
|
25
|
+
* @param {boolean} props.collapsed - Whether the section is collapsed.
|
|
26
|
+
* @param {() => void} props.onToggle - Called on click.
|
|
27
|
+
* @param {string} props.expandLabel - Accessible name while collapsed.
|
|
28
|
+
* @param {string} props.collapseLabel - Accessible name while expanded.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ReactNode} The toggle, or an `IconButton` outside an `ExpScope`.
|
|
31
|
+
*/
|
|
32
|
+
export function ExpCollapseToggle({ collapsed, onToggle, expandLabel, collapseLabel, ...restProps }) {
|
|
33
|
+
const inScope = useExpScope();
|
|
34
|
+
const label = collapsed ? expandLabel : collapseLabel;
|
|
35
|
+
if (!inScope) {
|
|
36
|
+
return (<IconButton {...restProps} icon={collapsed ? <FiChevronDown /> : <FiChevronUp />} label={label} aria-expanded={!collapsed} onClick={onToggle}/>);
|
|
37
|
+
}
|
|
38
|
+
return (<button type="button" {...restProps} aria-label={label} aria-expanded={!collapsed} onClick={onToggle} className={clsx('border-lavender-1 text-lavender hover:border-lavender focus-visible:ring-lavender relative flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full border bg-white transition-colors focus-visible:ring-2 focus-visible:outline-none', 'dark:border-lavender-dark-1 dark:text-lavender-dark dark:hover:border-lavender-dark dark:bg-black', restProps.className)}>
|
|
39
|
+
{!collapsed && (<span aria-hidden="true" className="exp-hint-pulse border-lavender dark:border-lavender-dark pointer-events-none absolute -inset-px rounded-full border-2"/>)}
|
|
40
|
+
<FiChevronUp aria-hidden="true" strokeWidth={2.4} className={clsx('size-4 transition-transform duration-260 ease-(--exp-ease-spring) motion-reduce:transition-none', collapsed && 'rotate-180')}/>
|
|
41
|
+
</button>);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ExpCollapseToggle.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpCollapseToggle.jsx","sourceRoot":"","sources":["../../src/expresivo/ExpCollapseToggle/ExpCollapseToggle.tsx"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,SAAS,CAAC,uHAAuH,EACjI,CACH,CACD;MAAA,CAAC,WAAW,CACV,WAAW,CAAC,MAAM,CAClB,WAAW,CAAC,CAAC,GAAG,CAAC,CACjB,SAAS,CAAC,CAAC,IAAI,CACb,iGAAiG,EACjG,SAAS,IAAI,YAAY,CAC1B,CAAC,EAEN;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpCollapseToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expresivo/ExpCollapseToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type ExpGrowBarProps = {
|
|
3
|
+
/** Progress between 0 and 100. */
|
|
4
|
+
value: number;
|
|
5
|
+
/** Accessible name of what the bar measures. */
|
|
6
|
+
ariaLabel: string;
|
|
7
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role'>;
|
|
8
|
+
/**
|
|
9
|
+
* Progress bar whose fill grows in the clicOH gradient when it mounts. For
|
|
10
|
+
* scores and shares shown at rest; for an operation that is still running,
|
|
11
|
+
* use the core `ProgressBar`.
|
|
12
|
+
*
|
|
13
|
+
* Outside an `ExpScope` it falls back to the core `ProgressBar`.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @example
|
|
17
|
+
* <ExpGrowBar value={57} ariaLabel="Share of cases solved" />
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} props - The properties of the ExpGrowBar component.
|
|
20
|
+
* @param {number} props.value - Progress between 0 and 100.
|
|
21
|
+
* @param {string} props.ariaLabel - Accessible name of what the bar measures.
|
|
22
|
+
*
|
|
23
|
+
* @returns {ReactNode} The bar, or a core `ProgressBar` outside an `ExpScope`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ExpGrowBar({ value, ariaLabel, ...restProps }: ExpGrowBarProps): ReactNode;
|
|
26
|
+
//# sourceMappingURL=ExpGrowBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpGrowBar.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpGrowBar/ExpGrowBar.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,eAAe,GAAG;IAC5B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC;AAI9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,GAAG,SAAS,EACb,EAAE,eAAe,GAAG,SAAS,CAiC7B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useEffect, useState, } from 'react';
|
|
4
|
+
import { ProgressBar } from '@clicoh/orion-library';
|
|
5
|
+
import { useExpScope } from '../ExpScope/ExpScope';
|
|
6
|
+
const clamp = (value) => Math.min(100, Math.max(0, value));
|
|
7
|
+
/**
|
|
8
|
+
* Progress bar whose fill grows in the clicOH gradient when it mounts. For
|
|
9
|
+
* scores and shares shown at rest; for an operation that is still running,
|
|
10
|
+
* use the core `ProgressBar`.
|
|
11
|
+
*
|
|
12
|
+
* Outside an `ExpScope` it falls back to the core `ProgressBar`.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* <ExpGrowBar value={57} ariaLabel="Share of cases solved" />
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} props - The properties of the ExpGrowBar component.
|
|
19
|
+
* @param {number} props.value - Progress between 0 and 100.
|
|
20
|
+
* @param {string} props.ariaLabel - Accessible name of what the bar measures.
|
|
21
|
+
*
|
|
22
|
+
* @returns {ReactNode} The bar, or a core `ProgressBar` outside an `ExpScope`.
|
|
23
|
+
*/
|
|
24
|
+
export function ExpGrowBar({ value, ariaLabel, ...restProps }) {
|
|
25
|
+
const inScope = useExpScope();
|
|
26
|
+
const [shown, setShown] = useState(0);
|
|
27
|
+
const percent = clamp(value);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const timer = setTimeout(() => setShown(percent), 60);
|
|
30
|
+
return () => clearTimeout(timer);
|
|
31
|
+
}, [percent]);
|
|
32
|
+
if (!inScope) {
|
|
33
|
+
return <ProgressBar {...restProps} value={percent} ariaLabel={ariaLabel}/>;
|
|
34
|
+
}
|
|
35
|
+
return (<div {...restProps} role="progressbar" aria-label={ariaLabel} aria-valuemin={0} aria-valuemax={100} aria-valuenow={percent} className={clsx('bg-gray-5 dark:bg-gray-dark-1 relative h-2 overflow-hidden rounded-full', restProps.className)}>
|
|
36
|
+
<span className="from-lavender to-violet absolute inset-y-0 left-0 rounded-full bg-linear-90 transition-[width] duration-900 ease-[cubic-bezier(.22,1,.36,1)] motion-reduce:transition-none" style={{ width: `${shown}%` }}/>
|
|
37
|
+
</div>);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ExpGrowBar.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpGrowBar.jsx","sourceRoot":"","sources":["../../src/expresivo/ExpGrowBar/ExpGrowBar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,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,CAAC,OAAO,CAAC,CACvB,SAAS,CAAC,CAAC,IAAI,CACb,yEAAyE,EACzE,SAAS,CAAC,SAAS,CACpB,CAAC,CAEF;MAAA,CAAC,IAAI,CACH,SAAS,CAAC,4KAA4K,CACtL,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC,EAElC;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpGrowBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expresivo/ExpGrowBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type StepperProps } from '@clicoh/orion-library';
|
|
3
|
+
import { type ExpMascotName } from '../ExpMascot';
|
|
4
|
+
export type ExpJourneyStage = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** Pose the mascot takes while this stage is current. */
|
|
8
|
+
mascot: ExpMascotName;
|
|
9
|
+
/** Short note shown under the label once the stage is reached. */
|
|
10
|
+
meta?: string;
|
|
11
|
+
/** Makes a reached stage clickable, to go back to it. */
|
|
12
|
+
onSelect?: () => void;
|
|
13
|
+
};
|
|
14
|
+
export type ExpJourneyStateLabels = Pick<StepperProps['stateLabels'], 'done' | 'current' | 'pending'>;
|
|
15
|
+
export type ExpJourneyTrackProps = {
|
|
16
|
+
/** Stages in order. */
|
|
17
|
+
stages: ExpJourneyStage[];
|
|
18
|
+
/** Index of the current stage. */
|
|
19
|
+
current: number;
|
|
20
|
+
/** Accessible name of the list. */
|
|
21
|
+
ariaLabel: string;
|
|
22
|
+
/** Words for each state, read by screen readers after every label. */
|
|
23
|
+
stateLabels: ExpJourneyStateLabels;
|
|
24
|
+
/** Width and height of the mascot, in pixels. */
|
|
25
|
+
mascotSize?: number;
|
|
26
|
+
/** Walks from the first stage to `current` once when it mounts. */
|
|
27
|
+
autoplay?: boolean;
|
|
28
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
29
|
+
/**
|
|
30
|
+
* Progress line with a mascot that travels to the current stage and takes
|
|
31
|
+
* that stage's pose. Reached stages get a check and the travelled part of
|
|
32
|
+
* the line fills with the clicOH gradient. Like the core `Stepper`, it only
|
|
33
|
+
* displays progress: the consumer owns `current`.
|
|
34
|
+
*
|
|
35
|
+
* The line and the mascot are decorative; the stages are an ordered list
|
|
36
|
+
* whose current item carries `aria-current="step"`.
|
|
37
|
+
*
|
|
38
|
+
* Outside an `ExpScope` it falls back to the core `Stepper`. When the scope
|
|
39
|
+
* hides mascots, the line renders without its traveller.
|
|
40
|
+
*
|
|
41
|
+
* @component
|
|
42
|
+
* @example
|
|
43
|
+
* <ExpJourneyTrack
|
|
44
|
+
* ariaLabel="Progress"
|
|
45
|
+
* stateLabels={{ done: 'done', current: 'in progress', pending: 'pending' }}
|
|
46
|
+
* current={1}
|
|
47
|
+
* stages={[
|
|
48
|
+
* { id: 'read', label: 'Read', mascot: 'oculus-04-analizando-documento' },
|
|
49
|
+
* { id: 'search', label: 'Search', mascot: 'oculus-07-buscando-rapido' },
|
|
50
|
+
* { id: 'answer', label: 'Answer', mascot: 'oculus-08-satisfecho' },
|
|
51
|
+
* ]}
|
|
52
|
+
* />
|
|
53
|
+
*
|
|
54
|
+
* @param {Object} props - The properties of the ExpJourneyTrack component.
|
|
55
|
+
* @param {ExpJourneyStage[]} props.stages - Stages in order, each with `id`, `label`, `mascot`, and optional `meta` and `onSelect`.
|
|
56
|
+
* @param {number} props.current - Index of the current stage.
|
|
57
|
+
* @param {string} props.ariaLabel - Accessible name of the list.
|
|
58
|
+
* @param {ExpJourneyStateLabels} props.stateLabels - Words for `done`, `current` and `pending`.
|
|
59
|
+
* @param {number} [props.mascotSize=88] - Width and height of the mascot, in pixels.
|
|
60
|
+
* @param {boolean} [props.autoplay=false] - Walks from the first stage to `current` once when it mounts. Off with reduced motion.
|
|
61
|
+
*
|
|
62
|
+
* @returns {ReactNode} The journey track, a core `Stepper` outside an `ExpScope`, or `null` without stages.
|
|
63
|
+
*/
|
|
64
|
+
export declare function ExpJourneyTrack({ stages, current, ariaLabel, stateLabels, mascotSize, autoplay, ...restProps }: ExpJourneyTrackProps): ReactNode;
|
|
65
|
+
//# sourceMappingURL=ExpJourneyTrack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpJourneyTrack.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpJourneyTrack/ExpJourneyTrack.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,EAAE,aAAa,CAAC;IACtB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,YAAY,CAAC,aAAa,CAAC,EAC3B,MAAM,GAAG,SAAS,GAAG,SAAS,CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,uBAAuB;IACvB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,WAAW,EAAE,qBAAqB,CAAC;IACnC,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;AA+BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAe,EACf,QAAgB,EAChB,GAAG,SAAS,EACb,EAAE,oBAAoB,GAAG,SAAS,CAsLlC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useEffect, useState, } from 'react';
|
|
4
|
+
import { FiCheck } from 'react-icons/fi';
|
|
5
|
+
import { Each, Show, Stepper } from '@clicoh/orion-library';
|
|
6
|
+
import { ExpMascot } from '../ExpMascot';
|
|
7
|
+
import { useExpScopeOptions } from '../ExpScope/ExpScope';
|
|
8
|
+
const STEP_MS = 1100;
|
|
9
|
+
const stateOf = (index, current) => {
|
|
10
|
+
if (index < current)
|
|
11
|
+
return 'done';
|
|
12
|
+
if (index === current)
|
|
13
|
+
return 'current';
|
|
14
|
+
return 'pending';
|
|
15
|
+
};
|
|
16
|
+
const dotMap = {
|
|
17
|
+
done: 'size-3.5 border-lavender bg-lavender dark:border-lavender-dark dark:bg-lavender-dark text-white',
|
|
18
|
+
current: 'size-[18px] border-lavender bg-white shadow-[0_0_0_5px_rgba(106,93,249,0.18)] dark:border-lavender-dark dark:bg-black',
|
|
19
|
+
pending: 'size-3.5 border-gray-4 bg-white dark:border-gray-1 dark:bg-black',
|
|
20
|
+
};
|
|
21
|
+
const labelMap = {
|
|
22
|
+
done: 'font-medium text-black dark:text-white',
|
|
23
|
+
current: 'font-semibold text-lavender dark:text-lavender-dark',
|
|
24
|
+
pending: 'font-medium text-gray-1 dark:text-gray-2',
|
|
25
|
+
};
|
|
26
|
+
const alignOf = (index, count) => {
|
|
27
|
+
if (index === 0)
|
|
28
|
+
return 'items-start text-left';
|
|
29
|
+
if (index === count - 1)
|
|
30
|
+
return 'items-end text-right';
|
|
31
|
+
return 'items-center text-center';
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Progress line with a mascot that travels to the current stage and takes
|
|
35
|
+
* that stage's pose. Reached stages get a check and the travelled part of
|
|
36
|
+
* the line fills with the clicOH gradient. Like the core `Stepper`, it only
|
|
37
|
+
* displays progress: the consumer owns `current`.
|
|
38
|
+
*
|
|
39
|
+
* The line and the mascot are decorative; the stages are an ordered list
|
|
40
|
+
* whose current item carries `aria-current="step"`.
|
|
41
|
+
*
|
|
42
|
+
* Outside an `ExpScope` it falls back to the core `Stepper`. When the scope
|
|
43
|
+
* hides mascots, the line renders without its traveller.
|
|
44
|
+
*
|
|
45
|
+
* @component
|
|
46
|
+
* @example
|
|
47
|
+
* <ExpJourneyTrack
|
|
48
|
+
* ariaLabel="Progress"
|
|
49
|
+
* stateLabels={{ done: 'done', current: 'in progress', pending: 'pending' }}
|
|
50
|
+
* current={1}
|
|
51
|
+
* stages={[
|
|
52
|
+
* { id: 'read', label: 'Read', mascot: 'oculus-04-analizando-documento' },
|
|
53
|
+
* { id: 'search', label: 'Search', mascot: 'oculus-07-buscando-rapido' },
|
|
54
|
+
* { id: 'answer', label: 'Answer', mascot: 'oculus-08-satisfecho' },
|
|
55
|
+
* ]}
|
|
56
|
+
* />
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} props - The properties of the ExpJourneyTrack component.
|
|
59
|
+
* @param {ExpJourneyStage[]} props.stages - Stages in order, each with `id`, `label`, `mascot`, and optional `meta` and `onSelect`.
|
|
60
|
+
* @param {number} props.current - Index of the current stage.
|
|
61
|
+
* @param {string} props.ariaLabel - Accessible name of the list.
|
|
62
|
+
* @param {ExpJourneyStateLabels} props.stateLabels - Words for `done`, `current` and `pending`.
|
|
63
|
+
* @param {number} [props.mascotSize=88] - Width and height of the mascot, in pixels.
|
|
64
|
+
* @param {boolean} [props.autoplay=false] - Walks from the first stage to `current` once when it mounts. Off with reduced motion.
|
|
65
|
+
*
|
|
66
|
+
* @returns {ReactNode} The journey track, a core `Stepper` outside an `ExpScope`, or `null` without stages.
|
|
67
|
+
*/
|
|
68
|
+
export function ExpJourneyTrack({ stages, current, ariaLabel, stateLabels, mascotSize = 88, autoplay = false, ...restProps }) {
|
|
69
|
+
const options = useExpScopeOptions();
|
|
70
|
+
const [step, setStep] = useState(autoplay ? 0 : current);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
73
|
+
if (!autoplay || reduceMotion) {
|
|
74
|
+
setStep(current);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
setStep(0);
|
|
78
|
+
let index = 0;
|
|
79
|
+
const timer = setInterval(() => {
|
|
80
|
+
index += 1;
|
|
81
|
+
setStep(Math.min(index, current));
|
|
82
|
+
if (index >= current)
|
|
83
|
+
clearInterval(timer);
|
|
84
|
+
}, STEP_MS);
|
|
85
|
+
return () => clearInterval(timer);
|
|
86
|
+
}, [autoplay, current, stages.length]);
|
|
87
|
+
if (stages.length === 0)
|
|
88
|
+
return null;
|
|
89
|
+
if (!options) {
|
|
90
|
+
return (<Stepper ariaLabel={ariaLabel} stateLabels={{ ...stateLabels, skipped: stateLabels.pending }} steps={stages.map((stage, index) => ({
|
|
91
|
+
id: stage.id,
|
|
92
|
+
label: stage.label,
|
|
93
|
+
state: stateOf(index, current),
|
|
94
|
+
}))}/>);
|
|
95
|
+
}
|
|
96
|
+
const showMascot = options.mascots === 'shown';
|
|
97
|
+
const lastIndex = Math.max(1, stages.length - 1);
|
|
98
|
+
const percent = (Math.min(step, lastIndex) / lastIndex) * 100;
|
|
99
|
+
const labelColumns = stages.length > 2
|
|
100
|
+
? `minmax(0, 1fr) repeat(${stages.length - 2}, minmax(0, 2fr)) minmax(0, 1fr)`
|
|
101
|
+
: `repeat(${stages.length}, minmax(0, 1fr))`;
|
|
102
|
+
return (<div {...restProps} className={clsx('relative', restProps.className)}>
|
|
103
|
+
<div aria-hidden="true" className="relative" style={{ paddingTop: showMascot ? mascotSize + 8 : 0 }}>
|
|
104
|
+
{showMascot && (<div className="exp-float absolute top-0 transition-[left] duration-900 ease-[cubic-bezier(.65,0,.35,1)] motion-reduce:transition-none" style={{
|
|
105
|
+
width: mascotSize,
|
|
106
|
+
height: mascotSize,
|
|
107
|
+
left: `clamp(0px, calc(${percent}% - ${mascotSize / 2}px), calc(100% - ${mascotSize}px))`,
|
|
108
|
+
}}>
|
|
109
|
+
<Each of={stages} render={(stage, index) => (<span key={stage.id} className={clsx('absolute inset-0 transition-[opacity,scale] delay-200 duration-300 motion-reduce:transition-none', index === step
|
|
110
|
+
? 'scale-100 opacity-100'
|
|
111
|
+
: 'scale-85 opacity-0')}>
|
|
112
|
+
<ExpMascot name={stage.mascot} size={mascotSize}/>
|
|
113
|
+
</span>)}/>
|
|
114
|
+
</div>)}
|
|
115
|
+
<div className="bg-gray-5 dark:bg-gray-dark-1 relative mx-1.5 h-1.5 rounded-full">
|
|
116
|
+
<span className="from-lavender to-violet absolute inset-y-0 left-0 rounded-full bg-linear-90 transition-[width] duration-900 ease-[cubic-bezier(.65,0,.35,1)] motion-reduce:transition-none" style={{ width: `${percent}%` }}/>
|
|
117
|
+
<Each of={stages} render={(stage, index) => {
|
|
118
|
+
const state = stateOf(index, step);
|
|
119
|
+
return (<span key={stage.id} className={clsx('absolute top-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border-2 transition-all duration-300', dotMap[state])} style={{ left: `${(index / lastIndex) * 100}%` }}>
|
|
120
|
+
{state === 'done' && (<FiCheck strokeWidth={4} className="size-2"/>)}
|
|
121
|
+
</span>);
|
|
122
|
+
}}/>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<ol aria-label={ariaLabel} className="mt-3.5 grid" style={{ gridTemplateColumns: labelColumns }}>
|
|
126
|
+
<Each of={stages} render={(stage, index) => {
|
|
127
|
+
const state = stateOf(index, current);
|
|
128
|
+
const isReached = index <= current;
|
|
129
|
+
const body = (<>
|
|
130
|
+
<span className={clsx('text-xs leading-4 transition-colors duration-300', labelMap[stateOf(index, step)])}>
|
|
131
|
+
{stage.label}
|
|
132
|
+
<span className="sr-only">, {stateLabels[state]}</span>
|
|
133
|
+
</span>
|
|
134
|
+
{!!stage.meta && (<span className={clsx('text-gray-1 dark:text-gray-2 text-[11px] leading-4 transition-opacity duration-300', index <= step ? 'opacity-100' : 'opacity-0')}>
|
|
135
|
+
{stage.meta}
|
|
136
|
+
</span>)}
|
|
137
|
+
</>);
|
|
138
|
+
return (<li key={stage.id} aria-current={state === 'current' ? 'step' : undefined} className="flex min-w-0">
|
|
139
|
+
<Show>
|
|
140
|
+
<Show.When isTrue={Boolean(stage.onSelect) && isReached}>
|
|
141
|
+
<button type="button" onClick={stage.onSelect} className={clsx('focus-visible:ring-lavender -mx-1.5 -my-1 flex w-full flex-col gap-0.5 rounded-lg px-1.5 py-1 focus-visible:ring-2 focus-visible:outline-none', alignOf(index, stages.length))}>
|
|
142
|
+
{body}
|
|
143
|
+
</button>
|
|
144
|
+
</Show.When>
|
|
145
|
+
<Show.Else>
|
|
146
|
+
<span className={clsx('flex w-full flex-col gap-0.5', alignOf(index, stages.length))}>
|
|
147
|
+
{body}
|
|
148
|
+
</span>
|
|
149
|
+
</Show.Else>
|
|
150
|
+
</Show>
|
|
151
|
+
</li>);
|
|
152
|
+
}}/>
|
|
153
|
+
</ol>
|
|
154
|
+
</div>);
|
|
155
|
+
}
|
|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