themelia-react-ui 1.0.0 → 1.0.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/CHANGELOG.md +53 -1
- package/README.md +39 -6
- package/dist/{accordion-BRWh3BM1.js → accordion-B-5Focs8.js} +2 -2
- package/dist/{accordion-BRWh3BM1.js.map → accordion-B-5Focs8.js.map} +1 -1
- package/dist/{affordance-geometry.generated-DXl-Zb3Z.js → affordance-geometry.generated-D8Jcfb0G.js} +10 -1
- package/dist/affordance-geometry.generated-D8Jcfb0G.js.map +1 -0
- package/dist/{ai-artifact-DkOArd3-.js → ai-artifact-B5tPpXnS.js} +5 -5
- package/dist/{ai-artifact-DkOArd3-.js.map → ai-artifact-B5tPpXnS.js.map} +1 -1
- package/dist/{app-shell-BH_bGcE2.js → app-shell-at8Kt4l_.js} +3 -3
- package/dist/{app-shell-BH_bGcE2.js.map → app-shell-at8Kt4l_.js.map} +1 -1
- package/dist/{attachment-DsLgNHXt.js → attachment-BO2R47wn.js} +2 -2
- package/dist/{attachment-DsLgNHXt.js.map → attachment-BO2R47wn.js.map} +1 -1
- package/dist/{auth-BDB1V_2q.js → auth-OFwWSAap.js} +4 -4
- package/dist/{auth-BDB1V_2q.js.map → auth-OFwWSAap.js.map} +1 -1
- package/dist/{avatar-CsnWaYmt.js → avatar-Bpzty83c.js} +73 -68
- package/dist/avatar-Bpzty83c.js.map +1 -0
- package/dist/base/accordion.js +1 -1
- package/dist/base/attachment.js +1 -1
- package/dist/base/avatar.js +1 -1
- package/dist/base/cards.js +2 -2
- package/dist/base/cascader.js +6 -6
- package/dist/base/choice-inputs.js +3 -2
- package/dist/base/code-block.js +1 -1
- package/dist/base/combobox.js +1 -1
- package/dist/base/command.js +1 -1
- package/dist/base/date-pickers.js +2 -2
- package/dist/base/display.js +1 -1
- package/dist/base/feedback.js +4 -3
- package/dist/base/forms-numeric.js +1 -1
- package/dist/base/forms.js +2 -2
- package/dist/base/inline-edit.js +236 -0
- package/dist/base/inline-edit.js.map +1 -0
- package/dist/base/media-gallery.js +1 -1
- package/dist/base/navigation.js +3 -3
- package/dist/base/popover-menu.js +1 -1
- package/dist/base/popover.js +1 -1
- package/dist/base/repeaters.js +4 -4
- package/dist/base/sheet.js +1 -1
- package/dist/base/sidebar.js +1 -1
- package/dist/base/signature-pad.js +3 -3
- package/dist/base/skeleton.js +1 -1
- package/dist/base/spinner.js +1 -1
- package/dist/base/structure.js +1 -1
- package/dist/base/text-inputs.js +2 -2
- package/dist/base/tree.js +1 -1
- package/dist/base/upload-queue.js +1 -1
- package/dist/base/upload.js +3 -3
- package/dist/base/value-inputs.js +1 -1
- package/dist/blocks/admin.js +6 -6
- package/dist/blocks/ai.js +6 -6
- package/dist/blocks/analytics/usage-card.js +3 -0
- package/dist/blocks/analytics.js +361 -360
- package/dist/blocks/analytics.js.map +1 -1
- package/dist/blocks/collaboration.js +1 -1
- package/dist/blocks/commerce/receipt.js +1 -1
- package/dist/blocks/commerce.js +15 -15
- package/dist/blocks/data-display.js +1 -1
- package/dist/blocks/onboarding.js +3 -3
- package/dist/blocks/planning.js +311 -0
- package/dist/blocks/planning.js.map +1 -0
- package/dist/blocks/timelines.js +1 -1
- package/dist/{cards-BMB0laLG.js → cards-Cum56XOF.js} +3 -3
- package/dist/{cards-BMB0laLG.js.map → cards-Cum56XOF.js.map} +1 -1
- package/dist/checkbox-BavDRjF7.js +34 -0
- package/dist/checkbox-BavDRjF7.js.map +1 -0
- package/dist/{choice-inputs-CavA-SGV.js → choice-inputs-CC7XqPQO.js} +166 -191
- package/dist/choice-inputs-CC7XqPQO.js.map +1 -0
- package/dist/{code-block-DIlqzoiD.js → code-block-xHKbAJDj.js} +2 -2
- package/dist/{code-block-DIlqzoiD.js.map → code-block-xHKbAJDj.js.map} +1 -1
- package/dist/{combobox-HDftpzxt.js → combobox-DEbdr-3u.js} +2 -2
- package/dist/{combobox-HDftpzxt.js.map → combobox-DEbdr-3u.js.map} +1 -1
- package/dist/{combobox-CHD750do.js → combobox-xv3yJbzl.js} +7 -7
- package/dist/{combobox-CHD750do.js.map → combobox-xv3yJbzl.js.map} +1 -1
- package/dist/{command-D0kWBZfd.js → command-C0xe7u9B.js} +2 -2
- package/dist/{command-D0kWBZfd.js.map → command-C0xe7u9B.js.map} +1 -1
- package/dist/{comments-CvYeglMS.js → comments-DviPLnwy.js} +8 -8
- package/dist/{comments-CvYeglMS.js.map → comments-DviPLnwy.js.map} +1 -1
- package/dist/components/base/cards/smart-card.types.d.ts +2 -0
- package/dist/components/base/inline-edit/index.d.ts +2 -0
- package/dist/components/base/inline-edit/inline-edit.d.ts +81 -0
- package/dist/components/base/inline-edit/inline-edit.recipes.d.ts +6 -0
- package/dist/components/base/structure/structure.recipes.d.ts +6 -0
- package/dist/components/blocks/analytics/index.d.ts +1 -0
- package/dist/components/blocks/analytics/usage-card/index.d.ts +3 -0
- package/dist/components/blocks/analytics/usage-card/types.d.ts +52 -0
- package/dist/components/blocks/analytics/usage-card/usage-card.d.ts +6 -0
- package/dist/components/blocks/analytics/usage-card/usage-card.data.d.ts +19 -0
- package/dist/components/blocks/analytics/usage-card/usage-card.strings.d.ts +22 -0
- package/dist/components/blocks/planning/index.d.ts +3 -0
- package/dist/components/blocks/planning/task-card.d.ts +3 -0
- package/dist/components/blocks/planning/task-card.strings.d.ts +15 -0
- package/dist/components/blocks/planning/task-card.types.d.ts +66 -0
- package/dist/{containers-CPNyNo1_.js → containers-6s-ucRQQ.js} +3 -2
- package/dist/containers-6s-ucRQQ.js.map +1 -0
- package/dist/{data-display-b3d1TfL4.js → data-display-cWIRdeaf.js} +8 -8
- package/dist/{data-display-b3d1TfL4.js.map → data-display-cWIRdeaf.js.map} +1 -1
- package/dist/{date-picker-DI6kPNof.js → date-picker-CA6ogMQB.js} +5 -5
- package/dist/{date-picker-DI6kPNof.js.map → date-picker-CA6ogMQB.js.map} +1 -1
- package/dist/{date-pickers-ByP6Cv2z.js → date-pickers-BPIKLdsD.js} +4 -4
- package/dist/{date-pickers-ByP6Cv2z.js.map → date-pickers-BPIKLdsD.js.map} +1 -1
- package/dist/{display-ByI5tkqy.js → display-CFM5myut.js} +3 -3
- package/dist/{display-ByI5tkqy.js.map → display-CFM5myut.js.map} +1 -1
- package/dist/features/activities.js +4 -4
- package/dist/features/ai-chat.js +4 -4
- package/dist/features/async-preview.js +4 -4
- package/dist/features/combobox.js +1 -1
- package/dist/features/comments.js +1 -1
- package/dist/features/data-view.js +5 -5
- package/dist/features/email-composer.js +11 -11
- package/dist/features/event-calendar.js +2 -2
- package/dist/features/event-calendar.js.map +1 -1
- package/dist/features/filters.js +1 -1
- package/dist/features/global-search.js +6 -6
- package/dist/features/map.js +3 -3
- package/dist/features/media-library.js +8 -8
- package/dist/features/mentions.js +1 -1
- package/dist/features/overlays.js +1 -1
- package/dist/features/products.js +43 -42
- package/dist/features/products.js.map +1 -1
- package/dist/features/questionnaire.js +107 -106
- package/dist/features/questionnaire.js.map +1 -1
- package/dist/features/resource-assignment.js +5 -5
- package/dist/features/resource.js +7 -7
- package/dist/features/rich-text-editor.js +1 -1
- package/dist/features/schema-form.js +11 -11
- package/dist/features/schema-form.js.map +1 -1
- package/dist/features/suggestions.js +2 -2
- package/dist/features/sync.js +2 -2
- package/dist/features/table.js +1 -1
- package/dist/features/theme-tweaker.js +11 -11
- package/dist/feedback-DWUkgEjR.js +233 -0
- package/dist/feedback-DWUkgEjR.js.map +1 -0
- package/dist/{field-affordance-recipes-CHdUtn2Z.js → field-affordance-recipes-IjzPrCTw.js} +2 -2
- package/dist/{field-affordance-recipes-CHdUtn2Z.js.map → field-affordance-recipes-IjzPrCTw.js.map} +1 -1
- package/dist/{filters-qtrcv1hf.js → filters-BhsUtsxW.js} +9 -9
- package/dist/{filters-qtrcv1hf.js.map → filters-BhsUtsxW.js.map} +1 -1
- package/dist/{form-field-C6W-y2hR.js → form-field-Bn7ZH1rA.js} +2 -2
- package/dist/{form-field-C6W-y2hR.js.map → form-field-Bn7ZH1rA.js.map} +1 -1
- package/dist/{form-sizing-39NohSqn.js → form-sizing-BWs70_a2.js} +4 -3
- package/dist/{form-sizing-39NohSqn.js.map → form-sizing-BWs70_a2.js.map} +1 -1
- package/dist/{forms-BF-HSbff.js → forms-B7pzS25o.js} +5 -5
- package/dist/{forms-BF-HSbff.js.map → forms-B7pzS25o.js.map} +1 -1
- package/dist/{forms-numeric-Y15Bg5Nr.js → forms-numeric-BUBxELBv.js} +18 -18
- package/dist/{forms-numeric-Y15Bg5Nr.js.map → forms-numeric-BUBxELBv.js.map} +1 -1
- package/dist/{header-B8ex54cY.js → header-C59QZyxV.js} +6 -6
- package/dist/{header-B8ex54cY.js.map → header-C59QZyxV.js.map} +1 -1
- package/dist/{hooks-D6UBVzf2.js → hooks-CM1Vp9Pe.js} +2 -2
- package/dist/{hooks-D6UBVzf2.js.map → hooks-CM1Vp9Pe.js.map} +1 -1
- package/dist/{input-DMorJiTI.js → input-WwYQZJzG.js} +3 -3
- package/dist/{input-DMorJiTI.js.map → input-WwYQZJzG.js.map} +1 -1
- package/dist/layout/app-shell.js +1 -1
- package/dist/layout/auth.js +1 -1
- package/dist/layout/containers.js +1 -1
- package/dist/layout/header.js +1 -1
- package/dist/layout/hooks.js +1 -1
- package/dist/layout/navigation.js +1 -1
- package/dist/layout/page.js +1 -1
- package/dist/layout/settings.js +1 -1
- package/dist/layout/sidebar.js +2 -2
- package/dist/layout/workspace.js +1 -1
- package/dist/layout.js +10 -10
- package/dist/lib/affordance-geometry.generated.d.ts +9 -0
- package/dist/{media-gallery-Ca4YmvBi.js → media-gallery-DhDRgnVZ.js} +2 -2
- package/dist/{media-gallery-Ca4YmvBi.js.map → media-gallery-DhDRgnVZ.js.map} +1 -1
- package/dist/{mentions-CRio8mTm.js → mentions-B8Ko-fhS.js} +4 -4
- package/dist/{mentions-CRio8mTm.js.map → mentions-B8Ko-fhS.js.map} +1 -1
- package/dist/{message-B5-6LeYl.js → message-COsdEvXT.js} +2 -2
- package/dist/{message-B5-6LeYl.js.map → message-COsdEvXT.js.map} +1 -1
- package/dist/{navigation-DqEITuD2.js → navigation-BUIn2Qxx.js} +2 -2
- package/dist/{navigation-DqEITuD2.js.map → navigation-BUIn2Qxx.js.map} +1 -1
- package/dist/{navigation-BTrEb5u4.js → navigation-DBEu4POU.js} +3 -3
- package/dist/{navigation-BTrEb5u4.js.map → navigation-DBEu4POU.js.map} +1 -1
- package/dist/{navigation-row-recipes-BFpvGPGE.js → navigation-row-recipes-GVh11KiT.js} +2 -2
- package/dist/{navigation-row-recipes-BFpvGPGE.js.map → navigation-row-recipes-GVh11KiT.js.map} +1 -1
- package/dist/{overlays-DBqV0J_V.js → overlays-B11wZka6.js} +4 -4
- package/dist/{overlays-DBqV0J_V.js.map → overlays-B11wZka6.js.map} +1 -1
- package/dist/{page-BMBGjJY8.js → page-BV6ioQg3.js} +5 -5
- package/dist/{page-BMBGjJY8.js.map → page-BV6ioQg3.js.map} +1 -1
- package/dist/{page-header-BH41wCyY.js → page-header-DQRa0jug.js} +2 -2
- package/dist/{page-header-BH41wCyY.js.map → page-header-DQRa0jug.js.map} +1 -1
- package/dist/{popover-TInGXsjg.js → popover-CoLDEg19.js} +2 -2
- package/dist/{popover-TInGXsjg.js.map → popover-CoLDEg19.js.map} +1 -1
- package/dist/{popover-menu-BzqXqE72.js → popover-menu-GLIQTJTx.js} +4 -4
- package/dist/{popover-menu-BzqXqE72.js.map → popover-menu-GLIQTJTx.js.map} +1 -1
- package/dist/progress-BOe8l_FZ.js +168 -0
- package/dist/progress-BOe8l_FZ.js.map +1 -0
- package/dist/{receipt-DYWTQGEc.js → receipt-BM8xsGFy.js} +3 -3
- package/dist/{receipt-DYWTQGEc.js.map → receipt-BM8xsGFy.js.map} +1 -1
- package/dist/{rich-text-editor-BZSJchAF.js → rich-text-editor-CoVrTiSv.js} +2 -2
- package/dist/{rich-text-editor-BZSJchAF.js.map → rich-text-editor-CoVrTiSv.js.map} +1 -1
- package/dist/services/actions.js +1 -1
- package/dist/{settings-D9f_wdIC.js → settings-BnCyyPOJ.js} +3 -3
- package/dist/{settings-D9f_wdIC.js.map → settings-BnCyyPOJ.js.map} +1 -1
- package/dist/{sheet-vOUloJ4O.js → sheet-B-q914Ad.js} +2 -2
- package/dist/{sheet-vOUloJ4O.js.map → sheet-B-q914Ad.js.map} +1 -1
- package/dist/{sidebar-C3UKkbC5.js → sidebar-C_2p3Tfj.js} +6 -6
- package/dist/{sidebar-C3UKkbC5.js.map → sidebar-C_2p3Tfj.js.map} +1 -1
- package/dist/{sidebar-CNBKFDRW.js → sidebar-DPR7fmqN.js} +4 -4
- package/dist/{sidebar-CNBKFDRW.js.map → sidebar-DPR7fmqN.js.map} +1 -1
- package/dist/{skeleton-BvRhK8y-.js → skeleton-CmT1ppqb.js} +2 -2
- package/dist/{skeleton-BvRhK8y-.js.map → skeleton-CmT1ppqb.js.map} +1 -1
- package/dist/{smart-card-B5FcKODh.js → smart-card-CYLn46e6.js} +119 -118
- package/dist/smart-card-CYLn46e6.js.map +1 -0
- package/dist/{spinner-JtlFJ7Nc.js → spinner-BY9HbUEh.js} +2 -2
- package/dist/{spinner-JtlFJ7Nc.js.map → spinner-BY9HbUEh.js.map} +1 -1
- package/dist/{structure-BvW4vG4H.js → structure-MvKVq-oL.js} +13 -13
- package/dist/{structure-BvW4vG4H.js.map → structure-MvKVq-oL.js.map} +1 -1
- package/dist/{structure.recipes-DjqnBpwz.js → structure.recipes-Bqhf9oIh.js} +2 -2
- package/dist/structure.recipes-Bqhf9oIh.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/{table-ghtAQ-JJ.js → table-BS39xnlq.js} +6 -6
- package/dist/{table-ghtAQ-JJ.js.map → table-BS39xnlq.js.map} +1 -1
- package/dist/{tabs-DY09eoZg.js → tabs-B5cNMWiP.js} +2 -2
- package/dist/{tabs-DY09eoZg.js.map → tabs-B5cNMWiP.js.map} +1 -1
- package/dist/{text-inputs-BhOcedTo.js → text-inputs-Dh9XGyiS.js} +4 -4
- package/dist/{text-inputs-BhOcedTo.js.map → text-inputs-Dh9XGyiS.js.map} +1 -1
- package/dist/{timelines-CnZ2S_Gr.js → timelines-B9ICkQcV.js} +2 -2
- package/dist/{timelines-CnZ2S_Gr.js.map → timelines-B9ICkQcV.js.map} +1 -1
- package/dist/{tree-COD9BGdU.js → tree-BdWSaoFT.js} +2 -2
- package/dist/{tree-COD9BGdU.js.map → tree-BdWSaoFT.js.map} +1 -1
- package/dist/{upload-DIzw1dx1.js → upload-D8Za5x_c.js} +4 -4
- package/dist/{upload-DIzw1dx1.js.map → upload-D8Za5x_c.js.map} +1 -1
- package/dist/{upload-queue-xRJ3qDmd.js → upload-queue-hIIYBLS7.js} +3 -3
- package/dist/{upload-queue-xRJ3qDmd.js.map → upload-queue-hIIYBLS7.js.map} +1 -1
- package/dist/usage-card-DnmnJ58D.js +458 -0
- package/dist/usage-card-DnmnJ58D.js.map +1 -0
- package/dist/{value-inputs-Co1fu-xv.js → value-inputs-DX2dbxjj.js} +7 -7
- package/dist/{value-inputs-Co1fu-xv.js.map → value-inputs-DX2dbxjj.js.map} +1 -1
- package/dist/{workspace-Cbqz4FzN.js → workspace-C1PZmk8L.js} +4 -4
- package/dist/{workspace-Cbqz4FzN.js.map → workspace-C1PZmk8L.js.map} +1 -1
- package/docs/consumer-skill/SKILL.md +120 -17
- package/docs/consumer-skill/examples/detail.tsx +7 -8
- package/docs/consumer-skill/examples/manifest.json +14 -0
- package/docs/consumer-skill/examples/planning-usage-edit.tsx +29 -0
- package/docs/consumer-skill/examples/scoped-directory.tsx +77 -0
- package/docs/consumer-skill/references/composition.md +103 -0
- package/docs/consumer-skill/references/design-contract.md +4 -3
- package/docs/consumer-skill/references/discovery.md +17 -0
- package/docs/consumer-skill/references/installation.md +20 -3
- package/docs/consumer-skill/references/integration.md +12 -0
- package/docs/consumer-skill/references/public-api.json +452 -229
- package/docs/consumer-skill/references/review.md +74 -0
- package/docs/consumer-skill/references/tokens.json +1 -1
- package/docs/consumer-skill/references/workflows.md +97 -1
- package/docs/consumer-skill/scripts/check-composition.mjs +31 -0
- package/docs/consumer-skill/scripts/composition-policy.mjs +155 -0
- package/docs/consumer-skill/scripts/discovery.mjs +6 -1
- package/docs/consumer-skill/scripts/surface-policy.mjs +22 -0
- package/package.json +24 -3
- package/dist/affordance-geometry.generated-DXl-Zb3Z.js.map +0 -1
- package/dist/avatar-CsnWaYmt.js.map +0 -1
- package/dist/choice-inputs-CavA-SGV.js.map +0 -1
- package/dist/containers-CPNyNo1_.js.map +0 -1
- package/dist/feedback-a9j9J-9A.js +0 -391
- package/dist/feedback-a9j9J-9A.js.map +0 -1
- package/dist/smart-card-B5FcKODh.js.map +0 -1
- package/dist/structure.recipes-DjqnBpwz.js.map +0 -1
|
@@ -3,12 +3,13 @@ import { useStrings as e } from "../lib/strings.js";
|
|
|
3
3
|
import { t } from "../utils-C2EKeIw3.js";
|
|
4
4
|
import { n } from "../buttons-Co6GavvM.js";
|
|
5
5
|
import { a as r, i, n as a } from "../typography-Cv8MT-82.js";
|
|
6
|
-
import { t as o } from "../structure-
|
|
7
|
-
import {
|
|
8
|
-
import { t as c } from "../input-
|
|
9
|
-
import { d as l } from "../text-inputs-
|
|
10
|
-
import { t as u } from "../form-field-
|
|
11
|
-
import { c as d,
|
|
6
|
+
import { t as o } from "../structure-MvKVq-oL.js";
|
|
7
|
+
import { t as s } from "../progress-BOe8l_FZ.js";
|
|
8
|
+
import { t as c } from "../input-WwYQZJzG.js";
|
|
9
|
+
import { d as l } from "../text-inputs-Dh9XGyiS.js";
|
|
10
|
+
import { t as u } from "../form-field-Bn7ZH1rA.js";
|
|
11
|
+
import { c as d, r as f } from "../choice-inputs-CC7XqPQO.js";
|
|
12
|
+
import { t as p } from "../checkbox-BavDRjF7.js";
|
|
12
13
|
import { forwardRef as m, useEffect as h, useId as g, useRef as _, useState as v } from "react";
|
|
13
14
|
import { Fragment as ee, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
14
15
|
//#region src/components/features/questionnaire/questionnaire-control.tsx
|
|
@@ -43,7 +44,7 @@ function te({ question: e, answer: t, disabled: n, error: i, labelId: s, descrip
|
|
|
43
44
|
placeholder: e.placeholder,
|
|
44
45
|
value: typeof t == "string" ? t : "",
|
|
45
46
|
onChange: (e) => m(e.target.value)
|
|
46
|
-
}) : e.type === "select" ? /* @__PURE__ */ y(
|
|
47
|
+
}) : e.type === "select" ? /* @__PURE__ */ y(d, {
|
|
47
48
|
...g,
|
|
48
49
|
options: e.options,
|
|
49
50
|
value: typeof t == "string" ? t : null,
|
|
@@ -52,7 +53,7 @@ function te({ question: e, answer: t, disabled: n, error: i, labelId: s, descrip
|
|
|
52
53
|
"aria-labelledby": s,
|
|
53
54
|
"aria-describedby": u,
|
|
54
55
|
className: "questionnaire--choices m-0 min-w-0 border-0 p-0",
|
|
55
|
-
children: /* @__PURE__ */ y(
|
|
56
|
+
children: /* @__PURE__ */ y(f, {
|
|
56
57
|
options: e.options,
|
|
57
58
|
value: typeof t == "string" ? t : "",
|
|
58
59
|
disabled: n,
|
|
@@ -67,25 +68,25 @@ function te({ question: e, answer: t, disabled: n, error: i, labelId: s, descrip
|
|
|
67
68
|
children: /* @__PURE__ */ y(o, {
|
|
68
69
|
gap: "sm",
|
|
69
70
|
children: e.options.map((e, c) => {
|
|
70
|
-
let l = Array.isArray(t) ? t : [],
|
|
71
|
+
let l = Array.isArray(t) ? t : [], d = `${s}-option-${c}`;
|
|
71
72
|
return /* @__PURE__ */ b(o, {
|
|
72
73
|
direction: "horizontal",
|
|
73
74
|
align: "start",
|
|
74
75
|
gap: "sm",
|
|
75
|
-
children: [/* @__PURE__ */ y(
|
|
76
|
-
id:
|
|
76
|
+
children: [/* @__PURE__ */ y(p, {
|
|
77
|
+
id: d,
|
|
77
78
|
disabled: n || e.disabled,
|
|
78
79
|
"aria-invalid": !!i || void 0,
|
|
79
|
-
"aria-describedby": [u, e.description ? `${
|
|
80
|
+
"aria-describedby": [u, e.description ? `${d}-description` : void 0].filter(Boolean).join(" ") || void 0,
|
|
80
81
|
checked: l.includes(e.value),
|
|
81
82
|
onCheckedChange: (t) => m(t ? [...l, e.value] : l.filter((t) => t !== e.value))
|
|
82
83
|
}), /* @__PURE__ */ b(o, {
|
|
83
84
|
gap: "dense",
|
|
84
85
|
children: [/* @__PURE__ */ y(a, {
|
|
85
|
-
htmlFor:
|
|
86
|
+
htmlFor: d,
|
|
86
87
|
children: e.label
|
|
87
88
|
}), e.description && /* @__PURE__ */ y(r, {
|
|
88
|
-
id: `${
|
|
89
|
+
id: `${d}-description`,
|
|
89
90
|
size: "xs",
|
|
90
91
|
type: "secondary",
|
|
91
92
|
children: e.description
|
|
@@ -98,7 +99,7 @@ function te({ question: e, answer: t, disabled: n, error: i, labelId: s, descrip
|
|
|
98
99
|
direction: "horizontal",
|
|
99
100
|
align: "center",
|
|
100
101
|
gap: "sm",
|
|
101
|
-
children: [/* @__PURE__ */ y(
|
|
102
|
+
children: [/* @__PURE__ */ y(p, {
|
|
102
103
|
...g,
|
|
103
104
|
"aria-labelledby": void 0,
|
|
104
105
|
id: `${s}-checkbox`,
|
|
@@ -112,7 +113,7 @@ function te({ question: e, answer: t, disabled: n, error: i, labelId: s, descrip
|
|
|
112
113
|
}
|
|
113
114
|
//#endregion
|
|
114
115
|
//#region src/components/features/questionnaire/questionnaire.types.ts
|
|
115
|
-
var
|
|
116
|
+
var ne = {
|
|
116
117
|
previous: "Previous",
|
|
117
118
|
next: "Next",
|
|
118
119
|
submit: "Submit answers",
|
|
@@ -131,15 +132,15 @@ var x = {
|
|
|
131
132
|
};
|
|
132
133
|
//#endregion
|
|
133
134
|
//#region src/components/features/questionnaire/questionnaire.utils.ts
|
|
134
|
-
function
|
|
135
|
+
function x(e, t) {
|
|
135
136
|
return e.filter((e) => !e.when || e.when(t));
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function S(e, t) {
|
|
138
139
|
return Object.hasOwn(e, t) ? e[t] : void 0;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function C(e, t, n) {
|
|
141
142
|
if (e.disabled) return;
|
|
142
|
-
let r =
|
|
143
|
+
let r = S(t, e.id), i = r === void 0 || typeof r == "string" && !r.trim() || Array.isArray(r) && r.length === 0;
|
|
143
144
|
if (e.required && (i || e.type === "boolean" && r !== !0)) return n.required;
|
|
144
145
|
if (r !== void 0) {
|
|
145
146
|
if ((e.type === "text" || e.type === "textarea") && typeof r != "string" || e.type === "boolean" && typeof r != "boolean") return n.invalidFormat;
|
|
@@ -162,127 +163,127 @@ function w(e, t, n) {
|
|
|
162
163
|
let a = e.validate?.(r, t);
|
|
163
164
|
return typeof a == "string" && a.length > 0 ? a : void 0;
|
|
164
165
|
}
|
|
165
|
-
function
|
|
166
|
-
return Object.fromEntries(
|
|
167
|
-
let n =
|
|
166
|
+
function re(e, t) {
|
|
167
|
+
return Object.fromEntries(x(e, t).filter((e) => !e.disabled).map((e) => {
|
|
168
|
+
let n = S(t, e.id);
|
|
168
169
|
return [e.id, Array.isArray(n) ? [...n] : n];
|
|
169
170
|
}));
|
|
170
171
|
}
|
|
171
172
|
//#endregion
|
|
172
173
|
//#region src/components/features/questionnaire/questionnaire.tsx
|
|
173
|
-
var
|
|
174
|
-
let { questions: l, value: d, defaultValue: f = {}, onValueChange: p, questionId: m, defaultQuestionId:
|
|
175
|
-
|
|
176
|
-
let
|
|
177
|
-
clearTimeout(
|
|
174
|
+
var ie = {}, w = m(function(a, c) {
|
|
175
|
+
let { questions: l, value: d, defaultValue: f = {}, onValueChange: p, questionId: m, defaultQuestionId: w, onQuestionChange: ae, disabled: T = !1, onSubmit: oe, onComplete: se, onError: ce, formatSubmitError: le, headerSlot: ue, emptySlot: de, completionSlot: fe, strings: pe, className: me, onReset: he, ...ge } = a, E = Object.prototype.hasOwnProperty.call(a, "value"), D = Object.prototype.hasOwnProperty.call(a, "questionId"), [_e, ve] = v(f), O = E ? d ?? ie : _e, k = _(O);
|
|
176
|
+
k.current = O;
|
|
177
|
+
let A = x(l, O), [ye, j] = v(w ?? A[0]?.id), be = D ? m : ye, M = A.find((e) => e.id === be) ?? A[0], N = M ? A.indexOf(M) : 0, [P, F] = v({}), [I, L] = v(), [R, z] = v(!1), [B, V] = v(!1), H = _(null), U = _(void 0), W = _(!0), G = _(null), K = e(ne, pe), q = g(), J = `${q}-title`, xe = `${q}-description`, Y = R || T, X = () => {
|
|
178
|
+
clearTimeout(U.current), U.current = void 0;
|
|
178
179
|
}, Z = () => {
|
|
179
|
-
|
|
180
|
+
H.current?.abort(), H.current = null, z(!1);
|
|
180
181
|
}, Q = (e) => {
|
|
181
|
-
|
|
182
|
+
D || j(e), ae?.(e);
|
|
182
183
|
}, Se = (e) => {
|
|
183
|
-
if (!
|
|
184
|
+
if (!M || M.disabled || Y) return;
|
|
184
185
|
let t = {
|
|
185
|
-
...
|
|
186
|
-
[
|
|
186
|
+
...k.current,
|
|
187
|
+
[M.id]: e
|
|
187
188
|
};
|
|
188
|
-
|
|
189
|
+
E || (k.current = t, ve(t)), p?.(t), F((e) => ({
|
|
189
190
|
...e,
|
|
190
|
-
[
|
|
191
|
-
})),
|
|
191
|
+
[M.id]: void 0
|
|
192
|
+
})), L(void 0), V(!1);
|
|
192
193
|
};
|
|
193
194
|
h(() => {
|
|
194
|
-
|
|
195
|
-
}, [
|
|
196
|
-
X(), Z(),
|
|
195
|
+
G.current?.focus();
|
|
196
|
+
}, [M?.id, B]), h(() => {
|
|
197
|
+
X(), Z(), F({}), L(void 0), V(!1);
|
|
197
198
|
}, [
|
|
198
|
-
|
|
199
|
+
O,
|
|
199
200
|
l,
|
|
200
|
-
|
|
201
|
-
]), h(() => (
|
|
202
|
-
|
|
201
|
+
T
|
|
202
|
+
]), h(() => (W.current = !0, () => {
|
|
203
|
+
W.current = !1, X(), H.current?.abort(), H.current = null;
|
|
203
204
|
}), []);
|
|
204
205
|
let Ce = () => {
|
|
205
|
-
if (!
|
|
206
|
-
let e =
|
|
207
|
-
if (
|
|
206
|
+
if (!M || Y) return;
|
|
207
|
+
let e = C(M, k.current, K);
|
|
208
|
+
if (F((t) => ({
|
|
208
209
|
...t,
|
|
209
|
-
[
|
|
210
|
+
[M.id]: e
|
|
210
211
|
})), e) {
|
|
211
|
-
|
|
212
|
+
G.current?.focus();
|
|
212
213
|
return;
|
|
213
214
|
}
|
|
214
|
-
|
|
215
|
+
A[N + 1] && Q(A[N + 1].id);
|
|
215
216
|
}, we = async () => {
|
|
216
|
-
if (
|
|
217
|
-
let e = Object.fromEntries(
|
|
218
|
-
|
|
219
|
-
let t =
|
|
217
|
+
if (H.current || T || !A.length) return;
|
|
218
|
+
let e = Object.fromEntries(A.map((e) => [e.id, C(e, k.current, K)]));
|
|
219
|
+
F(e);
|
|
220
|
+
let t = A.find((t) => e[t.id]);
|
|
220
221
|
if (t) {
|
|
221
|
-
Q(t.id),
|
|
222
|
+
Q(t.id), G.current?.focus();
|
|
222
223
|
return;
|
|
223
224
|
}
|
|
224
225
|
let n = new AbortController();
|
|
225
|
-
|
|
226
|
-
let r =
|
|
226
|
+
H.current = n, L(void 0), z(!0);
|
|
227
|
+
let r = re(l, k.current);
|
|
227
228
|
try {
|
|
228
|
-
if (await
|
|
229
|
-
|
|
229
|
+
if (await oe?.(r, { signal: n.signal }), H.current !== n || n.signal.aborted) return;
|
|
230
|
+
V(!0), se?.(r);
|
|
230
231
|
} catch (e) {
|
|
231
|
-
if (
|
|
232
|
-
|
|
232
|
+
if (H.current !== n || n.signal.aborted) return;
|
|
233
|
+
L(le?.(e) ?? K.submitError), ce?.(e);
|
|
233
234
|
} finally {
|
|
234
|
-
|
|
235
|
+
H.current === n && (H.current = null, z(!1));
|
|
235
236
|
}
|
|
236
|
-
}, $ =
|
|
237
|
+
}, $ = M && Object.hasOwn(P, M.id) ? P[M.id] : void 0, Te = M && ($ || M.description);
|
|
237
238
|
return /* @__PURE__ */ y("form", {
|
|
238
|
-
...
|
|
239
|
+
...ge,
|
|
239
240
|
ref: c,
|
|
240
241
|
noValidate: !0,
|
|
241
|
-
"aria-busy":
|
|
242
|
-
className: t("questionnaire--component min-w-0",
|
|
242
|
+
"aria-busy": R || void 0,
|
|
243
|
+
className: t("questionnaire--component min-w-0", me),
|
|
243
244
|
onSubmit: (e) => {
|
|
244
|
-
e.preventDefault(),
|
|
245
|
+
e.preventDefault(), N < A.length - 1 ? Ce() : we();
|
|
245
246
|
},
|
|
246
247
|
onReset: (e) => {
|
|
247
|
-
|
|
248
|
+
he?.(e);
|
|
248
249
|
let t = e.nativeEvent;
|
|
249
|
-
X(),
|
|
250
|
-
if (
|
|
251
|
-
Z(),
|
|
252
|
-
let e =
|
|
253
|
-
n ? Q(n.id) :
|
|
250
|
+
X(), U.current = setTimeout(() => {
|
|
251
|
+
if (U.current = void 0, !W.current || t.defaultPrevented || T) return;
|
|
252
|
+
Z(), E || (k.current = f, ve(f)), p?.(f), F({}), L(void 0), V(!1);
|
|
253
|
+
let e = x(l, f), n = e.find((e) => e.id === w) ?? e[0];
|
|
254
|
+
n ? Q(n.id) : D || j(void 0);
|
|
254
255
|
}, 0);
|
|
255
256
|
},
|
|
256
257
|
children: /* @__PURE__ */ b(o, {
|
|
257
258
|
gap: "lg",
|
|
258
|
-
children: [
|
|
259
|
+
children: [ue, M ? B ? fe ?? /* @__PURE__ */ b(o, {
|
|
259
260
|
gap: "sm",
|
|
260
261
|
children: [/* @__PURE__ */ y(r, {
|
|
261
262
|
role: "status",
|
|
262
|
-
children:
|
|
263
|
+
children: K.submitted
|
|
263
264
|
}), /* @__PURE__ */ y(n, {
|
|
264
|
-
disabled:
|
|
265
|
+
disabled: T,
|
|
265
266
|
type: "button",
|
|
266
267
|
buttonStyle: "outline",
|
|
267
268
|
onClick: () => {
|
|
268
|
-
|
|
269
|
+
V(!1), A[0] && Q(A[0].id);
|
|
269
270
|
},
|
|
270
|
-
children:
|
|
271
|
+
children: K.editAnswers
|
|
271
272
|
})]
|
|
272
273
|
}) : /* @__PURE__ */ b(ee, { children: [
|
|
273
274
|
/* @__PURE__ */ y(s, {
|
|
274
|
-
value:
|
|
275
|
-
max:
|
|
276
|
-
label:
|
|
275
|
+
value: N + 1,
|
|
276
|
+
max: A.length,
|
|
277
|
+
label: K.progress,
|
|
277
278
|
valueSlot: /* @__PURE__ */ y(r, {
|
|
278
279
|
size: "xs",
|
|
279
280
|
type: "secondary",
|
|
280
281
|
"aria-live": "polite",
|
|
281
|
-
children:
|
|
282
|
+
children: K.step(N + 1, A.length)
|
|
282
283
|
})
|
|
283
284
|
}),
|
|
284
285
|
/* @__PURE__ */ b(o, {
|
|
285
|
-
ref:
|
|
286
|
+
ref: G,
|
|
286
287
|
gap: "normal",
|
|
287
288
|
tabIndex: -1,
|
|
288
289
|
role: "group",
|
|
@@ -291,33 +292,33 @@ var re = {}, T = m(function(a, c) {
|
|
|
291
292
|
children: [/* @__PURE__ */ y(i, {
|
|
292
293
|
id: J,
|
|
293
294
|
tag: "h3",
|
|
294
|
-
children:
|
|
295
|
+
children: M.title
|
|
295
296
|
}), /* @__PURE__ */ y(u, {
|
|
296
|
-
required:
|
|
297
|
+
required: M.required,
|
|
297
298
|
error: $,
|
|
298
|
-
hint:
|
|
299
|
+
hint: M.description,
|
|
299
300
|
supportingTextId: xe,
|
|
300
301
|
children: /* @__PURE__ */ y(te, {
|
|
301
|
-
question:
|
|
302
|
-
answer:
|
|
303
|
-
answers:
|
|
304
|
-
disabled: Y || !!
|
|
302
|
+
question: M,
|
|
303
|
+
answer: S(O, M.id),
|
|
304
|
+
answers: O,
|
|
305
|
+
disabled: Y || !!M.disabled,
|
|
305
306
|
error: $,
|
|
306
307
|
labelId: J,
|
|
307
308
|
descriptionId: Te ? xe : void 0,
|
|
308
309
|
onAnswerChange: Se
|
|
309
|
-
},
|
|
310
|
+
}, M.id)
|
|
310
311
|
})]
|
|
311
312
|
}),
|
|
312
|
-
|
|
313
|
+
I && /* @__PURE__ */ y(r, {
|
|
313
314
|
role: "alert",
|
|
314
315
|
type: "error",
|
|
315
|
-
children:
|
|
316
|
+
children: I
|
|
316
317
|
}),
|
|
317
|
-
|
|
318
|
+
R && /* @__PURE__ */ y(r, {
|
|
318
319
|
role: "status",
|
|
319
320
|
type: "secondary",
|
|
320
|
-
children:
|
|
321
|
+
children: K.submitting
|
|
321
322
|
}),
|
|
322
323
|
/* @__PURE__ */ b(o, {
|
|
323
324
|
direction: "horizontal",
|
|
@@ -327,39 +328,39 @@ var re = {}, T = m(function(a, c) {
|
|
|
327
328
|
/* @__PURE__ */ y(n, {
|
|
328
329
|
type: "button",
|
|
329
330
|
buttonStyle: "outline",
|
|
330
|
-
disabled: Y ||
|
|
331
|
+
disabled: Y || N === 0,
|
|
331
332
|
onClick: () => {
|
|
332
|
-
|
|
333
|
+
L(void 0), Q(A[N - 1].id);
|
|
333
334
|
},
|
|
334
|
-
children:
|
|
335
|
+
children: K.previous
|
|
335
336
|
}),
|
|
336
|
-
|
|
337
|
+
N < A.length - 1 ? /* @__PURE__ */ y(n, {
|
|
337
338
|
type: "button",
|
|
338
339
|
disabled: Y,
|
|
339
340
|
onClick: Ce,
|
|
340
|
-
children:
|
|
341
|
+
children: K.next
|
|
341
342
|
}) : /* @__PURE__ */ y(n, {
|
|
342
343
|
type: "submit",
|
|
343
344
|
disabled: Y,
|
|
344
|
-
children:
|
|
345
|
+
children: I ? K.retry : K.submit
|
|
345
346
|
}),
|
|
346
|
-
|
|
347
|
+
R && /* @__PURE__ */ y(n, {
|
|
347
348
|
type: "button",
|
|
348
349
|
buttonStyle: "outline",
|
|
349
|
-
disabled:
|
|
350
|
+
disabled: T,
|
|
350
351
|
onClick: Z,
|
|
351
|
-
children:
|
|
352
|
+
children: K.cancel
|
|
352
353
|
})
|
|
353
354
|
]
|
|
354
355
|
})
|
|
355
|
-
] }) :
|
|
356
|
+
] }) : de ?? /* @__PURE__ */ y(r, {
|
|
356
357
|
type: "secondary",
|
|
357
|
-
children:
|
|
358
|
+
children: K.empty
|
|
358
359
|
})]
|
|
359
360
|
})
|
|
360
361
|
});
|
|
361
362
|
});
|
|
362
363
|
//#endregion
|
|
363
|
-
export {
|
|
364
|
+
export { w as Questionnaire, ne as defaultQuestionnaireStrings };
|
|
364
365
|
|
|
365
366
|
//# sourceMappingURL=questionnaire.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaire.js","names":["_Fragment","Text","Label","Stack","Progress","Input","Textarea","FormField","Checkbox","Select","CardRadioGroup","Fragment$1","QuestionnaireControl","context","common","error","labelId","descriptionId","question","answer","onAnswerChange","event","values","optionId","index","disabled","option","checked","entry","defaultQuestionnaireStrings","current","total","getVisibleQuestions","questions","answers","getQuestionnaireAnswer","id","validateQuestion","value","empty","strings","selected","url","result","getSubmissionAnswers","emptyAnswers","Questionnaire","forwardRef","controlledValue","stringsProp","formProps","props","controlled","stepControlled","internalValue","setInternalValue","useState","defaultValue","answersRef","useRef","visible","internalId","setInternalId","defaultQuestionId","requestedId","questionId","position","errors","setErrors","submitError","setSubmitError","busy","setBusy","completed","setCompleted","submission","resetTimer","mounted","stageRef","useStrings","useId","locked","cancelReset","cancel","goTo","nextId","onQuestionChange","setAnswer","next","onValueChange","previous","useEffect","advance","submit","validation","firstInvalid","controller","snapshot","onSubmit","onComplete","formatSubmitError","onError","currentError","description","cn","className","nativeEvent","initialVisible","initialQuestion","headerSlot","completionSlot","Button","Heading","emptySlot"],"sources":["../../src/components/features/questionnaire/questionnaire-control.tsx","../../src/components/features/questionnaire/questionnaire.types.ts","../../src/components/features/questionnaire/questionnaire.utils.ts","../../src/components/features/questionnaire/questionnaire.tsx"],"sourcesContent":["import { CardRadioGroup, Checkbox, Select } from '../../base/choice-inputs';\nimport { Input, Textarea } from '../../base/text-inputs';\nimport { Stack } from '../../base/structure';\nimport { Label, Text } from '../../typography';\nimport type { QuestionnaireQuestionContext } from './questionnaire.types';\n\n/** All interactive behavior remains with public Base UI-backed field owners. */\nexport function QuestionnaireControl({ question, answer, disabled, error, labelId, descriptionId, onAnswerChange, ...context }: QuestionnaireQuestionContext) {\n\tconst common = { disabled, invalid: Boolean(error), 'aria-labelledby': labelId, 'aria-describedby': descriptionId, required: question.required };\n\tif (question.type === 'custom') return question.render({ ...context, question, answer, disabled, error, labelId, descriptionId, onAnswerChange });\n\tif (question.type === 'text') return <Input {...common} type={question.inputType ?? 'text'} maxLength={question.maxLength} placeholder={question.placeholder} value={typeof answer === 'string' ? answer : ''} onChange={(event) => onAnswerChange(event.target.value)} />;\n\tif (question.type === 'textarea') return <Textarea {...common} rows={question.rows ?? 4} maxLength={question.maxLength} placeholder={question.placeholder} value={typeof answer === 'string' ? answer : ''} onChange={(event) => onAnswerChange(event.target.value)} />;\n\tif (question.type === 'select') return <Select {...common} options={question.options} value={typeof answer === 'string' ? answer : null} onValueChange={onAnswerChange} />;\n\tif (question.type === 'single') return <fieldset aria-labelledby={labelId} aria-describedby={descriptionId} className=\"questionnaire--choices m-0 min-w-0 border-0 p-0\"><CardRadioGroup options={question.options} value={typeof answer === 'string' ? answer : ''} disabled={disabled} invalid={Boolean(error)} onValueChange={onAnswerChange} columns={1} /></fieldset>;\n\tif (question.type === 'multiple') return <fieldset aria-labelledby={labelId} aria-describedby={descriptionId} className=\"questionnaire--choices m-0 min-w-0 border-0 p-0\"><Stack gap=\"sm\">{question.options.map((option, index) => {\n\t\tconst values = Array.isArray(answer) ? answer : [];\n\t\tconst optionId = `${labelId}-option-${index}`;\n\t\treturn <Stack key={option.value} direction=\"horizontal\" align=\"start\" gap=\"sm\">\n\t\t\t<Checkbox id={optionId} disabled={disabled || option.disabled} aria-invalid={Boolean(error) || undefined} aria-describedby={[descriptionId, option.description ? `${optionId}-description` : undefined].filter(Boolean).join(' ') || undefined} checked={values.includes(option.value)} onCheckedChange={(checked) => onAnswerChange(checked ? [...values, option.value] : values.filter((entry) => entry !== option.value))} />\n\t\t\t<Stack gap=\"dense\"><Label htmlFor={optionId}>{option.label}</Label>{option.description && <Text id={`${optionId}-description`} size=\"xs\" type=\"secondary\">{option.description}</Text>}</Stack>\n\t\t</Stack>;\n\t})}</Stack></fieldset>;\n\tif (question.type === 'boolean') return <Stack direction=\"horizontal\" align=\"center\" gap=\"sm\"><Checkbox {...common} aria-labelledby={undefined} id={`${labelId}-checkbox`} checked={answer === true} onCheckedChange={(checked) => onAnswerChange(checked)} /><Label htmlFor={`${labelId}-checkbox`}>{question.label ?? question.title}</Label></Stack>;\n\treturn null;\n}\n","import type { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport type { StringsProp } from '../../../lib/strings';\n\nexport type QuestionnaireAnswer = string | string[] | boolean | undefined;\nexport type QuestionnaireAnswers = Record<string, QuestionnaireAnswer>;\nexport interface QuestionnaireOption { value: string; label: string; description?: string; disabled?: boolean }\nexport interface QuestionnaireQuestionBase {\n\t/** Unique stable key, used to retain answers across conditional visibility changes. */\n\tid: string;\n\ttitle: string;\n\tdescription?: string;\n\trequired?: boolean;\n\tdisabled?: boolean;\n\t/** Hidden answers are retained for editing, but excluded from validation/submission. */\n\twhen?: (answers: QuestionnaireAnswers) => boolean;\n\t/** Return an error message, or undefined/true for a valid answer. */\n\tvalidate?: (answer: QuestionnaireAnswer, answers: QuestionnaireAnswers) => string | true | undefined;\n}\nexport interface QuestionnaireTextQuestion extends QuestionnaireQuestionBase {\n\ttype: 'text' | 'textarea';\n\tplaceholder?: string;\n\t/** Native text input type. */\n\tinputType?: 'text' | 'email' | 'url' | 'tel';\n\trows?: number;\n\tmaxLength?: number;\n}\nexport interface QuestionnaireChoiceQuestion extends QuestionnaireQuestionBase {\n\ttype: 'single' | 'multiple' | 'select';\n\toptions: QuestionnaireOption[];\n}\nexport interface QuestionnaireBooleanQuestion extends QuestionnaireQuestionBase { type: 'boolean'; label?: string }\nexport interface QuestionnaireCustomQuestion extends QuestionnaireQuestionBase {\n\ttype: 'custom';\n\trender: (context: QuestionnaireQuestionContext) => ReactNode;\n}\nexport type QuestionnaireQuestion = QuestionnaireTextQuestion | QuestionnaireChoiceQuestion | QuestionnaireBooleanQuestion | QuestionnaireCustomQuestion;\nexport interface QuestionnaireQuestionContext {\n\tquestion: QuestionnaireQuestion;\n\tanswer: QuestionnaireAnswer;\n\tanswers: QuestionnaireAnswers;\n\tdisabled: boolean;\n\terror?: string;\n\t/** Connect custom controls to the visible title and description/error. */\n\tlabelId: string;\n\tdescriptionId?: string;\n\tonAnswerChange: (answer: QuestionnaireAnswer) => void;\n}\nexport interface QuestionnaireSubmitContext { signal: AbortSignal }\nexport interface QuestionnaireStrings {\n\tprevious: string; next: string; submit: string; retry: string; cancel: string;\n\tsubmitting: string; submitted: string; editAnswers: string; empty: string;\n\trequired: string; invalidChoice: string; invalidFormat: string; progress: string;\n\tstep: (current: number, total: number) => string;\n\tsubmitError: string;\n}\nexport const defaultQuestionnaireStrings: QuestionnaireStrings = {\n\tprevious: 'Previous', next: 'Next', submit: 'Submit answers', retry: 'Try again', cancel: 'Cancel submission',\n\tsubmitting: 'Submitting answers…', submitted: 'Your answers have been submitted.', editAnswers: 'Edit answers',\n\tempty: 'There are no questions to answer.', required: 'Please answer this question.', invalidChoice: 'Choose an available option.',\n\tinvalidFormat: 'Enter a valid answer.', progress: 'Questionnaire progress', step: (current, total) => `Question ${current} of ${total}`,\n\tsubmitError: 'Answers could not be submitted. Please try again.',\n};\nexport interface QuestionnaireProps extends Omit<ComponentPropsWithoutRef<'form'>, 'children' | 'onSubmit' | 'defaultValue' | 'onChange'> {\n\tquestions: readonly QuestionnaireQuestion[];\n\t/** Controlled answers. */\n\tvalue?: QuestionnaireAnswers;\n\t/** Initial answers for uncontrolled use. */\n\tdefaultValue?: QuestionnaireAnswers;\n\tonValueChange?: (answers: QuestionnaireAnswers) => void;\n\t/** Controlled active question key. */\n\tquestionId?: string;\n\tdefaultQuestionId?: string;\n\tonQuestionChange?: (id: string) => void;\n\tdisabled?: boolean;\n\t/** Receives only visible, enabled questions. Respect signal to cancel application requests. */\n\tonSubmit?: (answers: QuestionnaireAnswers, context: QuestionnaireSubmitContext) => void | Promise<void>;\n\tonComplete?: (answers: QuestionnaireAnswers) => void;\n\tonError?: (error: unknown) => void;\n\tformatSubmitError?: (error: unknown) => string;\n\theaderSlot?: ReactNode;\n\temptySlot?: ReactNode;\n\t/** Replaces the completion state; default includes an edit-answers action. */\n\tcompletionSlot?: ReactNode;\n\tstrings?: StringsProp<QuestionnaireStrings>;\n}\n","import type { QuestionnaireAnswers, QuestionnaireQuestion, QuestionnaireStrings } from './questionnaire.types';\n\nexport function getVisibleQuestions(questions: readonly QuestionnaireQuestion[], answers: QuestionnaireAnswers) {\n\treturn questions.filter((question) => !question.when || question.when(answers));\n}\nexport function getQuestionnaireAnswer(answers: QuestionnaireAnswers, id: string) {\n\treturn Object.hasOwn(answers, id) ? answers[id] : undefined;\n}\nexport function validateQuestion(question: QuestionnaireQuestion, answers: QuestionnaireAnswers, strings: QuestionnaireStrings): string | undefined {\n\tif (question.disabled) return;\n\tconst value = getQuestionnaireAnswer(answers, question.id);\n\tconst empty = value === undefined || (typeof value === 'string' && !value.trim()) || (Array.isArray(value) && value.length === 0);\n\tif (question.required && (empty || (question.type === 'boolean' && value !== true))) return strings.required;\n\tif (value !== undefined) {\n\t\tif ((question.type === 'text' || question.type === 'textarea') && typeof value !== 'string') return strings.invalidFormat;\n\t\tif (question.type === 'boolean' && typeof value !== 'boolean') return strings.invalidFormat;\n\t\tif ((question.type === 'multiple' && !Array.isArray(value)) || ((question.type === 'single' || question.type === 'select') && typeof value !== 'string')) return strings.invalidChoice;\n\t}\n\tif (!empty) {\n\t\tif (question.type === 'single' || question.type === 'select' || question.type === 'multiple') {\n\t\t\tconst selected = Array.isArray(value) ? value : [value];\n\t\t\tif ((question.type === 'multiple' ? !Array.isArray(value) : typeof value !== 'string') || selected.some((entry) => !question.options.some((option) => option.value === entry && !option.disabled))) return strings.invalidChoice;\n\t\t} else if (question.type === 'text' || question.type === 'textarea') {\n\t\t\tif (typeof value !== 'string' || (question.maxLength !== undefined && value.length > question.maxLength)) return strings.invalidFormat;\n\t\t\tif (question.inputType === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) return strings.invalidFormat;\n\t\t\tif (question.inputType === 'url') { try { const url = new URL(value); if (!url.host || !['http:', 'https:'].includes(url.protocol)) return strings.invalidFormat; } catch { return strings.invalidFormat; } }\n\t\t} else if (question.type === 'boolean' && typeof value !== 'boolean') return strings.invalidFormat;\n\t}\n\tconst result = question.validate?.(value, answers);\n\treturn typeof result === 'string' && result.length > 0 ? result : undefined;\n}\n\nexport function getSubmissionAnswers(questions: readonly QuestionnaireQuestion[], answers: QuestionnaireAnswers): QuestionnaireAnswers {\n\treturn Object.fromEntries(getVisibleQuestions(questions, answers).filter((question) => !question.disabled).map((question) => {\n\t\tconst answer = getQuestionnaireAnswer(answers, question.id);\n\t\treturn [question.id, Array.isArray(answer) ? [...answer] : answer];\n\t}));\n}\n","import { forwardRef, useEffect, useId, useRef, useState } from 'react';\nimport { Button } from '../../base/buttons';\nimport { FormField } from '../../base/forms/form-field';\nimport { Progress } from '../../base/feedback';\nimport { Stack } from '../../base/structure';\nimport { Heading, Text } from '../../typography';\nimport { useStrings } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\nimport { QuestionnaireControl } from './questionnaire-control';\nimport { defaultQuestionnaireStrings, type QuestionnaireAnswer, type QuestionnaireAnswers, type QuestionnaireProps } from './questionnaire.types';\nimport { getQuestionnaireAnswer, getSubmissionAnswers, getVisibleQuestions, validateQuestion } from './questionnaire.utils';\n\nconst emptyAnswers: QuestionnaireAnswers = {};\n\nexport const Questionnaire = forwardRef<HTMLFormElement, QuestionnaireProps>(function Questionnaire(props, ref) {\n\tconst { questions, value: controlledValue, defaultValue = {}, onValueChange, questionId, defaultQuestionId, onQuestionChange,\n\t\tdisabled = false, onSubmit, onComplete, onError, formatSubmitError, headerSlot, emptySlot, completionSlot, strings: stringsProp,\n\t\tclassName, onReset, ...formProps } = props;\n\tconst controlled = Object.prototype.hasOwnProperty.call(props, 'value');\n\tconst stepControlled = Object.prototype.hasOwnProperty.call(props, 'questionId');\n\tconst [internalValue, setInternalValue] = useState<QuestionnaireAnswers>(defaultValue);\n\tconst answers = controlled ? controlledValue ?? emptyAnswers : internalValue;\n\tconst answersRef = useRef(answers); answersRef.current = answers;\n\tconst visible = getVisibleQuestions(questions, answers);\n\tconst [internalId, setInternalId] = useState<string | undefined>(defaultQuestionId ?? visible[0]?.id);\n\tconst requestedId = stepControlled ? questionId : internalId;\n\tconst current = visible.find((question) => question.id === requestedId) ?? visible[0];\n\tconst position = current ? visible.indexOf(current) : 0;\n\tconst [errors, setErrors] = useState<Record<string, string | undefined>>({});\n\tconst [submitError, setSubmitError] = useState<string>();\n\tconst [busy, setBusy] = useState(false);\n\tconst [completed, setCompleted] = useState(false);\n\tconst submission = useRef<AbortController | null>(null);\n\tconst resetTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\tconst mounted = useRef(true);\n\tconst stageRef = useRef<HTMLDivElement>(null);\n\tconst strings = useStrings(defaultQuestionnaireStrings, stringsProp);\n\tconst id = useId();\n\tconst labelId = `${id}-title`;\n\tconst descriptionId = `${id}-description`;\n\tconst locked = busy || disabled;\n\tconst cancelReset = () => { clearTimeout(resetTimer.current); resetTimer.current = undefined; };\n\tconst cancel = () => { submission.current?.abort(); submission.current = null; setBusy(false); };\n\tconst goTo = (nextId: string) => { if (!stepControlled) setInternalId(nextId); onQuestionChange?.(nextId); };\n\tconst setAnswer = (answer: QuestionnaireAnswer) => {\n\t\tif (!current || current.disabled || locked) return;\n\t\tconst next = { ...answersRef.current, [current.id]: answer };\n\t\tif (!controlled) { answersRef.current = next; setInternalValue(next); }\n\t\tonValueChange?.(next);\n\t\tsetErrors((previous) => ({ ...previous, [current.id]: undefined })); setSubmitError(undefined); setCompleted(false);\n\t};\n\tuseEffect(() => { stageRef.current?.focus(); }, [current?.id, completed]);\n\tuseEffect(() => {\n\t\t// Replacing data/schema or disabling during a request invalidates that result.\n\t\tcancelReset(); cancel(); setErrors({}); setSubmitError(undefined); setCompleted(false);\n\t}, [answers, questions, disabled]);\n\tuseEffect(() => { mounted.current = true; return () => { mounted.current = false; cancelReset(); submission.current?.abort(); submission.current = null; }; }, []);\n\tconst advance = () => {\n\t\tif (!current || locked) return;\n\t\tconst error = validateQuestion(current, answersRef.current, strings);\n\t\tsetErrors((previous) => ({ ...previous, [current.id]: error }));\n\t\tif (error) { stageRef.current?.focus(); return; }\n\t\tif (visible[position + 1]) goTo(visible[position + 1].id);\n\t};\n\tconst submit = async () => {\n\t\tif (submission.current || disabled || !visible.length) return;\n\t\tconst validation = Object.fromEntries(visible.map((question) => [question.id, validateQuestion(question, answersRef.current, strings)]));\n\t\tsetErrors(validation);\n\t\tconst firstInvalid = visible.find((question) => validation[question.id]);\n\t\tif (firstInvalid) { goTo(firstInvalid.id); stageRef.current?.focus(); return; }\n\t\tconst controller = new AbortController(); submission.current = controller;\n\t\tsetSubmitError(undefined); setBusy(true);\n\t\tconst snapshot = getSubmissionAnswers(questions, answersRef.current);\n\t\ttry {\n\t\t\tawait onSubmit?.(snapshot, { signal: controller.signal });\n\t\t\tif (submission.current !== controller || controller.signal.aborted) return;\n\t\t\tsetCompleted(true); onComplete?.(snapshot);\n\t\t} catch (error) {\n\t\t\tif (submission.current !== controller || controller.signal.aborted) return;\n\t\t\tsetSubmitError(formatSubmitError?.(error) ?? strings.submitError); onError?.(error);\n\t\t} finally { if (submission.current === controller) { submission.current = null; setBusy(false); } }\n\t};\n\tconst currentError = current && Object.hasOwn(errors, current.id) ? errors[current.id] : undefined;\n\tconst description = current && (currentError || current.description);\n\treturn <form {...formProps} ref={ref} noValidate aria-busy={busy || undefined} className={cn('questionnaire--component min-w-0', className)} onSubmit={(event) => { event.preventDefault(); if (position < visible.length - 1) advance(); else void submit(); }} onReset={(event) => {\n\t\tonReset?.(event); const nativeEvent = event.nativeEvent;\n\t\t// Trusted events can run microtasks before native ancestor listeners have cancelled reset.\n\t\tcancelReset(); resetTimer.current = setTimeout(() => {\n\t\t\tresetTimer.current = undefined;\n\t\t\tif (!mounted.current || nativeEvent.defaultPrevented || disabled) return; cancel();\n\t\t\tif (!controlled) { answersRef.current = defaultValue; setInternalValue(defaultValue); } onValueChange?.(defaultValue);\n\t\t\tsetErrors({}); setSubmitError(undefined); setCompleted(false);\n\t\t\tconst initialVisible = getVisibleQuestions(questions, defaultValue);\n\t\t\tconst initialQuestion = initialVisible.find((question) => question.id === defaultQuestionId) ?? initialVisible[0];\n\t\t\tif (initialQuestion) goTo(initialQuestion.id); else if (!stepControlled) setInternalId(undefined);\n\t\t}, 0);\n\t}}>\n\t\t<Stack gap=\"lg\">\n\t\t\t{headerSlot}\n\t\t\t{!current ? emptySlot ?? <Text type=\"secondary\">{strings.empty}</Text> : completed ? completionSlot ?? <Stack gap=\"sm\"><Text role=\"status\">{strings.submitted}</Text><Button disabled={disabled} type=\"button\" buttonStyle=\"outline\" onClick={() => { setCompleted(false); if (visible[0]) goTo(visible[0].id); }}>{strings.editAnswers}</Button></Stack> : <>\n\t\t\t\t<Progress value={position + 1} max={visible.length} label={strings.progress} valueSlot={<Text size=\"xs\" type=\"secondary\" aria-live=\"polite\">{strings.step(position + 1, visible.length)}</Text>} />\n\t\t\t\t<Stack ref={stageRef} gap=\"normal\" tabIndex={-1} role=\"group\" aria-labelledby={labelId} className=\"questionnaire--question outline-none\">\n\t\t\t\t\t<Heading id={labelId} tag=\"h3\">{current.title}</Heading>\n\t\t\t\t\t<FormField required={current.required} error={currentError} hint={current.description} supportingTextId={descriptionId}>\n\t\t\t\t\t\t<QuestionnaireControl key={current.id} question={current} answer={getQuestionnaireAnswer(answers, current.id)} answers={answers} disabled={locked || Boolean(current.disabled)} error={currentError} labelId={labelId} descriptionId={description ? descriptionId : undefined} onAnswerChange={setAnswer} />\n\t\t\t\t\t</FormField>\n\t\t\t\t</Stack>\n\t\t\t\t{submitError && <Text role=\"alert\" type=\"error\">{submitError}</Text>}\n\t\t\t\t{busy && <Text role=\"status\" type=\"secondary\">{strings.submitting}</Text>}\n\t\t\t\t<Stack direction=\"horizontal\" gap=\"sm\" wrap>\n\t\t\t\t\t<Button type=\"button\" buttonStyle=\"outline\" disabled={locked || position === 0} onClick={() => { setSubmitError(undefined); goTo(visible[position - 1].id); }}>{strings.previous}</Button>\n\t\t\t\t\t{position < visible.length - 1 ? <Button type=\"button\" disabled={locked} onClick={advance}>{strings.next}</Button> : <Button type=\"submit\" disabled={locked}>{submitError ? strings.retry : strings.submit}</Button>}\n\t\t\t\t\t{busy && <Button type=\"button\" buttonStyle=\"outline\" disabled={disabled} onClick={cancel}>{strings.cancel}</Button>}\n\t\t\t\t</Stack>\n\t\t\t</>}\n\t\t</Stack>\n\t</form>;\n});\n"],"mappings":";;;;;;;;;;;;;;AAOA,SAAgBY,GAAqB,EAAE,aAAU,WAAQ,aAAU,UAAO,YAAS,kBAAe,mBAAgB,GAAGC,KAAyC;CAC7J,IAAMC,IAAS;EAAE;EAAU,SAAS,EAAQC;EAAQ,mBAAmBC;EAAS,oBAAoBC;EAAe,UAAUC,EAAS;CAAS;CAe/I,OAdIA,EAAS,SAAS,WAAiBA,EAAS,OAAO;EAAE,GAAGL;EAAS;EAAU;EAAQ;EAAU;EAAO;EAAS;EAAe;CAAe,CAAC,IAC5IK,EAAS,SAAS,SAAe,kBAACb,GAAD;EAAO,GAAIS;EAAQ,MAAMI,EAAS,aAAa;EAAQ,WAAWA,EAAS;EAAW,aAAaA,EAAS;EAAa,OAAO,OAAOC,KAAW,WAAWA,IAAS;EAAI,WAAW,MAAUC,EAAeC,EAAM,OAAO,KAAK;CAAI,CAAA,IACrQH,EAAS,SAAS,aAAmB,kBAACZ,GAAD;EAAU,GAAIQ;EAAQ,MAAMI,EAAS,QAAQ;EAAG,WAAWA,EAAS;EAAW,aAAaA,EAAS;EAAa,OAAO,OAAOC,KAAW,WAAWA,IAAS;EAAI,WAAW,MAAUC,EAAeC,EAAM,OAAO,KAAK;CAAI,CAAA,IAClQH,EAAS,SAAS,WAAiB,kBAACT,GAAD;EAAQ,GAAIK;EAAQ,SAASI,E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S,UAAAoE;IAAkB,CAAA;IAClEE,KAAQ,kBAACtE,GAAD;KAAM,MAAK;KAAS,MAAK;KAAa,UAAAuC,EAAQ;IAAiB,CAAA;IACxE,kBAACrC,GAAD;KAAO,WAAU;KAAa,KAAI;KAAK,MAAA;KAAvC,UAAA;MACC,kBAAC4G,GAAD;OAAQ,MAAK;OAAS,aAAY;OAAU,UAAU9B,KAAUf,MAAa;OAAG,eAAe;QAA6B,AAA3BI,EAAe,KAAA,CAAS,GAAGc,EAAKxB,EAAQM,IAAW,EAAE,CAAC,EAAE;OAAG;OAAI,UAAA1B,EAAQ;MAAiB,CAAA;MACxL0B,IAAWN,EAAQ,SAAS,IAAI,kBAACmD,GAAD;OAAQ,MAAK;OAAS,UAAU9B;OAAQ,SAASW;OAAU,UAAApD,EAAQ;MAAa,CAAA,IAAI,kBAACuE,GAAD;OAAQ,MAAK;OAAS,UAAU9B;OAAS,UAAAZ,IAAc7B,EAAQ,QAAQA,EAAQ;MAAe,CAAA;MAClN+B,KAAQ,kBAACwC,GAAD;OAAQ,MAAK;OAAS,aAAY;OAAoB;OAAU,SAAS5B;OAAS,UAAA3C,EAAQ;MAAe,CAAA;KAC5G;;GACN,EAAA,CAAA,IAfUyE,MAAa,kBAAChH,GAAD;IAAM,MAAK;IAAa,UAAAuC,EAAQ;GAAY,CAAA,CAgB/D;;CACF,CAAA;AACP,CAAC"}
|
|
1
|
+
{"version":3,"file":"questionnaire.js","names":["_Fragment","Text","Label","Stack","Progress","Input","Textarea","FormField","Select","CardRadioGroup","Checkbox","Fragment$1","QuestionnaireControl","context","common","error","labelId","descriptionId","question","answer","onAnswerChange","event","values","optionId","index","disabled","option","checked","entry","defaultQuestionnaireStrings","current","total","getVisibleQuestions","questions","answers","getQuestionnaireAnswer","id","validateQuestion","value","empty","strings","selected","url","result","getSubmissionAnswers","emptyAnswers","Questionnaire","forwardRef","controlledValue","stringsProp","formProps","props","controlled","stepControlled","internalValue","setInternalValue","useState","defaultValue","answersRef","useRef","visible","internalId","setInternalId","defaultQuestionId","requestedId","questionId","position","errors","setErrors","submitError","setSubmitError","busy","setBusy","completed","setCompleted","submission","resetTimer","mounted","stageRef","useStrings","useId","locked","cancelReset","cancel","goTo","nextId","onQuestionChange","setAnswer","next","onValueChange","previous","useEffect","advance","submit","validation","firstInvalid","controller","snapshot","onSubmit","onComplete","formatSubmitError","onError","currentError","description","cn","className","nativeEvent","initialVisible","initialQuestion","headerSlot","completionSlot","Button","Heading","emptySlot"],"sources":["../../src/components/features/questionnaire/questionnaire-control.tsx","../../src/components/features/questionnaire/questionnaire.types.ts","../../src/components/features/questionnaire/questionnaire.utils.ts","../../src/components/features/questionnaire/questionnaire.tsx"],"sourcesContent":["import { CardRadioGroup, Checkbox, Select } from '../../base/choice-inputs';\nimport { Input, Textarea } from '../../base/text-inputs';\nimport { Stack } from '../../base/structure';\nimport { Label, Text } from '../../typography';\nimport type { QuestionnaireQuestionContext } from './questionnaire.types';\n\n/** All interactive behavior remains with public Base UI-backed field owners. */\nexport function QuestionnaireControl({ question, answer, disabled, error, labelId, descriptionId, onAnswerChange, ...context }: QuestionnaireQuestionContext) {\n\tconst common = { disabled, invalid: Boolean(error), 'aria-labelledby': labelId, 'aria-describedby': descriptionId, required: question.required };\n\tif (question.type === 'custom') return question.render({ ...context, question, answer, disabled, error, labelId, descriptionId, onAnswerChange });\n\tif (question.type === 'text') return <Input {...common} type={question.inputType ?? 'text'} maxLength={question.maxLength} placeholder={question.placeholder} value={typeof answer === 'string' ? answer : ''} onChange={(event) => onAnswerChange(event.target.value)} />;\n\tif (question.type === 'textarea') return <Textarea {...common} rows={question.rows ?? 4} maxLength={question.maxLength} placeholder={question.placeholder} value={typeof answer === 'string' ? answer : ''} onChange={(event) => onAnswerChange(event.target.value)} />;\n\tif (question.type === 'select') return <Select {...common} options={question.options} value={typeof answer === 'string' ? answer : null} onValueChange={onAnswerChange} />;\n\tif (question.type === 'single') return <fieldset aria-labelledby={labelId} aria-describedby={descriptionId} className=\"questionnaire--choices m-0 min-w-0 border-0 p-0\"><CardRadioGroup options={question.options} value={typeof answer === 'string' ? answer : ''} disabled={disabled} invalid={Boolean(error)} onValueChange={onAnswerChange} columns={1} /></fieldset>;\n\tif (question.type === 'multiple') return <fieldset aria-labelledby={labelId} aria-describedby={descriptionId} className=\"questionnaire--choices m-0 min-w-0 border-0 p-0\"><Stack gap=\"sm\">{question.options.map((option, index) => {\n\t\tconst values = Array.isArray(answer) ? answer : [];\n\t\tconst optionId = `${labelId}-option-${index}`;\n\t\treturn <Stack key={option.value} direction=\"horizontal\" align=\"start\" gap=\"sm\">\n\t\t\t<Checkbox id={optionId} disabled={disabled || option.disabled} aria-invalid={Boolean(error) || undefined} aria-describedby={[descriptionId, option.description ? `${optionId}-description` : undefined].filter(Boolean).join(' ') || undefined} checked={values.includes(option.value)} onCheckedChange={(checked) => onAnswerChange(checked ? [...values, option.value] : values.filter((entry) => entry !== option.value))} />\n\t\t\t<Stack gap=\"dense\"><Label htmlFor={optionId}>{option.label}</Label>{option.description && <Text id={`${optionId}-description`} size=\"xs\" type=\"secondary\">{option.description}</Text>}</Stack>\n\t\t</Stack>;\n\t})}</Stack></fieldset>;\n\tif (question.type === 'boolean') return <Stack direction=\"horizontal\" align=\"center\" gap=\"sm\"><Checkbox {...common} aria-labelledby={undefined} id={`${labelId}-checkbox`} checked={answer === true} onCheckedChange={(checked) => onAnswerChange(checked)} /><Label htmlFor={`${labelId}-checkbox`}>{question.label ?? question.title}</Label></Stack>;\n\treturn null;\n}\n","import type { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport type { StringsProp } from '../../../lib/strings';\n\nexport type QuestionnaireAnswer = string | string[] | boolean | undefined;\nexport type QuestionnaireAnswers = Record<string, QuestionnaireAnswer>;\nexport interface QuestionnaireOption { value: string; label: string; description?: string; disabled?: boolean }\nexport interface QuestionnaireQuestionBase {\n\t/** Unique stable key, used to retain answers across conditional visibility changes. */\n\tid: string;\n\ttitle: string;\n\tdescription?: string;\n\trequired?: boolean;\n\tdisabled?: boolean;\n\t/** Hidden answers are retained for editing, but excluded from validation/submission. */\n\twhen?: (answers: QuestionnaireAnswers) => boolean;\n\t/** Return an error message, or undefined/true for a valid answer. */\n\tvalidate?: (answer: QuestionnaireAnswer, answers: QuestionnaireAnswers) => string | true | undefined;\n}\nexport interface QuestionnaireTextQuestion extends QuestionnaireQuestionBase {\n\ttype: 'text' | 'textarea';\n\tplaceholder?: string;\n\t/** Native text input type. */\n\tinputType?: 'text' | 'email' | 'url' | 'tel';\n\trows?: number;\n\tmaxLength?: number;\n}\nexport interface QuestionnaireChoiceQuestion extends QuestionnaireQuestionBase {\n\ttype: 'single' | 'multiple' | 'select';\n\toptions: QuestionnaireOption[];\n}\nexport interface QuestionnaireBooleanQuestion extends QuestionnaireQuestionBase { type: 'boolean'; label?: string }\nexport interface QuestionnaireCustomQuestion extends QuestionnaireQuestionBase {\n\ttype: 'custom';\n\trender: (context: QuestionnaireQuestionContext) => ReactNode;\n}\nexport type QuestionnaireQuestion = QuestionnaireTextQuestion | QuestionnaireChoiceQuestion | QuestionnaireBooleanQuestion | QuestionnaireCustomQuestion;\nexport interface QuestionnaireQuestionContext {\n\tquestion: QuestionnaireQuestion;\n\tanswer: QuestionnaireAnswer;\n\tanswers: QuestionnaireAnswers;\n\tdisabled: boolean;\n\terror?: string;\n\t/** Connect custom controls to the visible title and description/error. */\n\tlabelId: string;\n\tdescriptionId?: string;\n\tonAnswerChange: (answer: QuestionnaireAnswer) => void;\n}\nexport interface QuestionnaireSubmitContext { signal: AbortSignal }\nexport interface QuestionnaireStrings {\n\tprevious: string; next: string; submit: string; retry: string; cancel: string;\n\tsubmitting: string; submitted: string; editAnswers: string; empty: string;\n\trequired: string; invalidChoice: string; invalidFormat: string; progress: string;\n\tstep: (current: number, total: number) => string;\n\tsubmitError: string;\n}\nexport const defaultQuestionnaireStrings: QuestionnaireStrings = {\n\tprevious: 'Previous', next: 'Next', submit: 'Submit answers', retry: 'Try again', cancel: 'Cancel submission',\n\tsubmitting: 'Submitting answers…', submitted: 'Your answers have been submitted.', editAnswers: 'Edit answers',\n\tempty: 'There are no questions to answer.', required: 'Please answer this question.', invalidChoice: 'Choose an available option.',\n\tinvalidFormat: 'Enter a valid answer.', progress: 'Questionnaire progress', step: (current, total) => `Question ${current} of ${total}`,\n\tsubmitError: 'Answers could not be submitted. Please try again.',\n};\nexport interface QuestionnaireProps extends Omit<ComponentPropsWithoutRef<'form'>, 'children' | 'onSubmit' | 'defaultValue' | 'onChange'> {\n\tquestions: readonly QuestionnaireQuestion[];\n\t/** Controlled answers. */\n\tvalue?: QuestionnaireAnswers;\n\t/** Initial answers for uncontrolled use. */\n\tdefaultValue?: QuestionnaireAnswers;\n\tonValueChange?: (answers: QuestionnaireAnswers) => void;\n\t/** Controlled active question key. */\n\tquestionId?: string;\n\tdefaultQuestionId?: string;\n\tonQuestionChange?: (id: string) => void;\n\tdisabled?: boolean;\n\t/** Receives only visible, enabled questions. Respect signal to cancel application requests. */\n\tonSubmit?: (answers: QuestionnaireAnswers, context: QuestionnaireSubmitContext) => void | Promise<void>;\n\tonComplete?: (answers: QuestionnaireAnswers) => void;\n\tonError?: (error: unknown) => void;\n\tformatSubmitError?: (error: unknown) => string;\n\theaderSlot?: ReactNode;\n\temptySlot?: ReactNode;\n\t/** Replaces the completion state; default includes an edit-answers action. */\n\tcompletionSlot?: ReactNode;\n\tstrings?: StringsProp<QuestionnaireStrings>;\n}\n","import type { QuestionnaireAnswers, QuestionnaireQuestion, QuestionnaireStrings } from './questionnaire.types';\n\nexport function getVisibleQuestions(questions: readonly QuestionnaireQuestion[], answers: QuestionnaireAnswers) {\n\treturn questions.filter((question) => !question.when || question.when(answers));\n}\nexport function getQuestionnaireAnswer(answers: QuestionnaireAnswers, id: string) {\n\treturn Object.hasOwn(answers, id) ? answers[id] : undefined;\n}\nexport function validateQuestion(question: QuestionnaireQuestion, answers: QuestionnaireAnswers, strings: QuestionnaireStrings): string | undefined {\n\tif (question.disabled) return;\n\tconst value = getQuestionnaireAnswer(answers, question.id);\n\tconst empty = value === undefined || (typeof value === 'string' && !value.trim()) || (Array.isArray(value) && value.length === 0);\n\tif (question.required && (empty || (question.type === 'boolean' && value !== true))) return strings.required;\n\tif (value !== undefined) {\n\t\tif ((question.type === 'text' || question.type === 'textarea') && typeof value !== 'string') return strings.invalidFormat;\n\t\tif (question.type === 'boolean' && typeof value !== 'boolean') return strings.invalidFormat;\n\t\tif ((question.type === 'multiple' && !Array.isArray(value)) || ((question.type === 'single' || question.type === 'select') && typeof value !== 'string')) return strings.invalidChoice;\n\t}\n\tif (!empty) {\n\t\tif (question.type === 'single' || question.type === 'select' || question.type === 'multiple') {\n\t\t\tconst selected = Array.isArray(value) ? value : [value];\n\t\t\tif ((question.type === 'multiple' ? !Array.isArray(value) : typeof value !== 'string') || selected.some((entry) => !question.options.some((option) => option.value === entry && !option.disabled))) return strings.invalidChoice;\n\t\t} else if (question.type === 'text' || question.type === 'textarea') {\n\t\t\tif (typeof value !== 'string' || (question.maxLength !== undefined && value.length > question.maxLength)) return strings.invalidFormat;\n\t\t\tif (question.inputType === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) return strings.invalidFormat;\n\t\t\tif (question.inputType === 'url') { try { const url = new URL(value); if (!url.host || !['http:', 'https:'].includes(url.protocol)) return strings.invalidFormat; } catch { return strings.invalidFormat; } }\n\t\t} else if (question.type === 'boolean' && typeof value !== 'boolean') return strings.invalidFormat;\n\t}\n\tconst result = question.validate?.(value, answers);\n\treturn typeof result === 'string' && result.length > 0 ? result : undefined;\n}\n\nexport function getSubmissionAnswers(questions: readonly QuestionnaireQuestion[], answers: QuestionnaireAnswers): QuestionnaireAnswers {\n\treturn Object.fromEntries(getVisibleQuestions(questions, answers).filter((question) => !question.disabled).map((question) => {\n\t\tconst answer = getQuestionnaireAnswer(answers, question.id);\n\t\treturn [question.id, Array.isArray(answer) ? [...answer] : answer];\n\t}));\n}\n","import { forwardRef, useEffect, useId, useRef, useState } from 'react';\nimport { Button } from '../../base/buttons';\nimport { FormField } from '../../base/forms/form-field';\nimport { Progress } from '../../base/feedback';\nimport { Stack } from '../../base/structure';\nimport { Heading, Text } from '../../typography';\nimport { useStrings } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\nimport { QuestionnaireControl } from './questionnaire-control';\nimport { defaultQuestionnaireStrings, type QuestionnaireAnswer, type QuestionnaireAnswers, type QuestionnaireProps } from './questionnaire.types';\nimport { getQuestionnaireAnswer, getSubmissionAnswers, getVisibleQuestions, validateQuestion } from './questionnaire.utils';\n\nconst emptyAnswers: QuestionnaireAnswers = {};\n\nexport const Questionnaire = forwardRef<HTMLFormElement, QuestionnaireProps>(function Questionnaire(props, ref) {\n\tconst { questions, value: controlledValue, defaultValue = {}, onValueChange, questionId, defaultQuestionId, onQuestionChange,\n\t\tdisabled = false, onSubmit, onComplete, onError, formatSubmitError, headerSlot, emptySlot, completionSlot, strings: stringsProp,\n\t\tclassName, onReset, ...formProps } = props;\n\tconst controlled = Object.prototype.hasOwnProperty.call(props, 'value');\n\tconst stepControlled = Object.prototype.hasOwnProperty.call(props, 'questionId');\n\tconst [internalValue, setInternalValue] = useState<QuestionnaireAnswers>(defaultValue);\n\tconst answers = controlled ? controlledValue ?? emptyAnswers : internalValue;\n\tconst answersRef = useRef(answers); answersRef.current = answers;\n\tconst visible = getVisibleQuestions(questions, answers);\n\tconst [internalId, setInternalId] = useState<string | undefined>(defaultQuestionId ?? visible[0]?.id);\n\tconst requestedId = stepControlled ? questionId : internalId;\n\tconst current = visible.find((question) => question.id === requestedId) ?? visible[0];\n\tconst position = current ? visible.indexOf(current) : 0;\n\tconst [errors, setErrors] = useState<Record<string, string | undefined>>({});\n\tconst [submitError, setSubmitError] = useState<string>();\n\tconst [busy, setBusy] = useState(false);\n\tconst [completed, setCompleted] = useState(false);\n\tconst submission = useRef<AbortController | null>(null);\n\tconst resetTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\tconst mounted = useRef(true);\n\tconst stageRef = useRef<HTMLDivElement>(null);\n\tconst strings = useStrings(defaultQuestionnaireStrings, stringsProp);\n\tconst id = useId();\n\tconst labelId = `${id}-title`;\n\tconst descriptionId = `${id}-description`;\n\tconst locked = busy || disabled;\n\tconst cancelReset = () => { clearTimeout(resetTimer.current); resetTimer.current = undefined; };\n\tconst cancel = () => { submission.current?.abort(); submission.current = null; setBusy(false); };\n\tconst goTo = (nextId: string) => { if (!stepControlled) setInternalId(nextId); onQuestionChange?.(nextId); };\n\tconst setAnswer = (answer: QuestionnaireAnswer) => {\n\t\tif (!current || current.disabled || locked) return;\n\t\tconst next = { ...answersRef.current, [current.id]: answer };\n\t\tif (!controlled) { answersRef.current = next; setInternalValue(next); }\n\t\tonValueChange?.(next);\n\t\tsetErrors((previous) => ({ ...previous, [current.id]: undefined })); setSubmitError(undefined); setCompleted(false);\n\t};\n\tuseEffect(() => { stageRef.current?.focus(); }, [current?.id, completed]);\n\tuseEffect(() => {\n\t\t// Replacing data/schema or disabling during a request invalidates that result.\n\t\tcancelReset(); cancel(); setErrors({}); setSubmitError(undefined); setCompleted(false);\n\t}, [answers, questions, disabled]);\n\tuseEffect(() => { mounted.current = true; return () => { mounted.current = false; cancelReset(); submission.current?.abort(); submission.current = null; }; }, []);\n\tconst advance = () => {\n\t\tif (!current || locked) return;\n\t\tconst error = validateQuestion(current, answersRef.current, strings);\n\t\tsetErrors((previous) => ({ ...previous, [current.id]: error }));\n\t\tif (error) { stageRef.current?.focus(); return; }\n\t\tif (visible[position + 1]) goTo(visible[position + 1].id);\n\t};\n\tconst submit = async () => {\n\t\tif (submission.current || disabled || !visible.length) return;\n\t\tconst validation = Object.fromEntries(visible.map((question) => [question.id, validateQuestion(question, answersRef.current, strings)]));\n\t\tsetErrors(validation);\n\t\tconst firstInvalid = visible.find((question) => validation[question.id]);\n\t\tif (firstInvalid) { goTo(firstInvalid.id); stageRef.current?.focus(); return; }\n\t\tconst controller = new AbortController(); submission.current = controller;\n\t\tsetSubmitError(undefined); setBusy(true);\n\t\tconst snapshot = getSubmissionAnswers(questions, answersRef.current);\n\t\ttry {\n\t\t\tawait onSubmit?.(snapshot, { signal: controller.signal });\n\t\t\tif (submission.current !== controller || controller.signal.aborted) return;\n\t\t\tsetCompleted(true); onComplete?.(snapshot);\n\t\t} catch (error) {\n\t\t\tif (submission.current !== controller || controller.signal.aborted) return;\n\t\t\tsetSubmitError(formatSubmitError?.(error) ?? strings.submitError); onError?.(error);\n\t\t} finally { if (submission.current === controller) { submission.current = null; setBusy(false); } }\n\t};\n\tconst currentError = current && Object.hasOwn(errors, current.id) ? errors[current.id] : undefined;\n\tconst description = current && (currentError || current.description);\n\treturn <form {...formProps} ref={ref} noValidate aria-busy={busy || undefined} className={cn('questionnaire--component min-w-0', className)} onSubmit={(event) => { event.preventDefault(); if (position < visible.length - 1) advance(); else void submit(); }} onReset={(event) => {\n\t\tonReset?.(event); const nativeEvent = event.nativeEvent;\n\t\t// Trusted events can run microtasks before native ancestor listeners have cancelled reset.\n\t\tcancelReset(); resetTimer.current = setTimeout(() => {\n\t\t\tresetTimer.current = undefined;\n\t\t\tif (!mounted.current || nativeEvent.defaultPrevented || disabled) return; cancel();\n\t\t\tif (!controlled) { answersRef.current = defaultValue; setInternalValue(defaultValue); } onValueChange?.(defaultValue);\n\t\t\tsetErrors({}); setSubmitError(undefined); setCompleted(false);\n\t\t\tconst initialVisible = getVisibleQuestions(questions, defaultValue);\n\t\t\tconst initialQuestion = initialVisible.find((question) => question.id === defaultQuestionId) ?? initialVisible[0];\n\t\t\tif (initialQuestion) goTo(initialQuestion.id); else if (!stepControlled) setInternalId(undefined);\n\t\t}, 0);\n\t}}>\n\t\t<Stack gap=\"lg\">\n\t\t\t{headerSlot}\n\t\t\t{!current ? emptySlot ?? <Text type=\"secondary\">{strings.empty}</Text> : completed ? completionSlot ?? <Stack gap=\"sm\"><Text role=\"status\">{strings.submitted}</Text><Button disabled={disabled} type=\"button\" buttonStyle=\"outline\" onClick={() => { setCompleted(false); if (visible[0]) goTo(visible[0].id); }}>{strings.editAnswers}</Button></Stack> : <>\n\t\t\t\t<Progress value={position + 1} max={visible.length} label={strings.progress} valueSlot={<Text size=\"xs\" type=\"secondary\" aria-live=\"polite\">{strings.step(position + 1, visible.length)}</Text>} />\n\t\t\t\t<Stack ref={stageRef} gap=\"normal\" tabIndex={-1} role=\"group\" aria-labelledby={labelId} className=\"questionnaire--question outline-none\">\n\t\t\t\t\t<Heading id={labelId} tag=\"h3\">{current.title}</Heading>\n\t\t\t\t\t<FormField required={current.required} error={currentError} hint={current.description} supportingTextId={descriptionId}>\n\t\t\t\t\t\t<QuestionnaireControl key={current.id} question={current} answer={getQuestionnaireAnswer(answers, current.id)} answers={answers} disabled={locked || Boolean(current.disabled)} error={currentError} labelId={labelId} descriptionId={description ? descriptionId : undefined} onAnswerChange={setAnswer} />\n\t\t\t\t\t</FormField>\n\t\t\t\t</Stack>\n\t\t\t\t{submitError && <Text role=\"alert\" type=\"error\">{submitError}</Text>}\n\t\t\t\t{busy && <Text role=\"status\" type=\"secondary\">{strings.submitting}</Text>}\n\t\t\t\t<Stack direction=\"horizontal\" gap=\"sm\" wrap>\n\t\t\t\t\t<Button type=\"button\" buttonStyle=\"outline\" disabled={locked || position === 0} onClick={() => { setSubmitError(undefined); goTo(visible[position - 1].id); }}>{strings.previous}</Button>\n\t\t\t\t\t{position < visible.length - 1 ? <Button type=\"button\" disabled={locked} onClick={advance}>{strings.next}</Button> : <Button type=\"submit\" disabled={locked}>{submitError ? strings.retry : strings.submit}</Button>}\n\t\t\t\t\t{busy && <Button type=\"button\" buttonStyle=\"outline\" disabled={disabled} onClick={cancel}>{strings.cancel}</Button>}\n\t\t\t\t</Stack>\n\t\t\t</>}\n\t\t</Stack>\n\t</form>;\n});\n"],"mappings":";;;;;;;;;;;;;;;AAOA,SAAgBY,GAAqB,EAAE,aAAU,WAAQ,aAAU,UAAO,YAAS,kBAAe,mBAAgB,GAAGC,KAAyC;CAC7J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uE,GAAD;OAAQ,MAAK;OAAS,UAAU9B;OAAS,UAAAZ,IAAc7B,EAAQ,QAAQA,EAAQ;MAAe,CAAA;MAClN+B,KAAQ,kBAACwC,GAAD;OAAQ,MAAK;OAAS,aAAY;OAAoB;OAAU,SAAS5B;OAAS,UAAA3C,EAAQ;MAAe,CAAA;KAC5G;;GACN,EAAA,CAAA,IAfUyE,MAAa,kBAAChH,GAAD;IAAM,MAAK;IAAa,UAAAuC,EAAQ;GAAY,CAAA,CAgB/D;;CACF,CAAA;AACP,CAAC"}
|
|
@@ -3,11 +3,11 @@ import { useStrings as e } from "../lib/strings.js";
|
|
|
3
3
|
import { t } from "../utils-C2EKeIw3.js";
|
|
4
4
|
import { n } from "../buttons-Co6GavvM.js";
|
|
5
5
|
import { a as r, r as i } from "../typography-Cv8MT-82.js";
|
|
6
|
-
import { t as a } from "../structure-
|
|
7
|
-
import { n as o } from "../cards-
|
|
8
|
-
import { r as s } from "../overlays-
|
|
9
|
-
import { n as c } from "../display-
|
|
10
|
-
import { l } from "../data-display-
|
|
6
|
+
import { t as a } from "../structure-MvKVq-oL.js";
|
|
7
|
+
import { n as o } from "../cards-Cum56XOF.js";
|
|
8
|
+
import { r as s } from "../overlays-B11wZka6.js";
|
|
9
|
+
import { n as c } from "../display-CFM5myut.js";
|
|
10
|
+
import { l } from "../data-display-cWIRdeaf.js";
|
|
11
11
|
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
12
12
|
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
13
|
import { Eye as v, PackageOpen as y } from "lucide-react";
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import { useStrings as e } from "../lib/strings.js";
|
|
3
3
|
import { t } from "../utils-C2EKeIw3.js";
|
|
4
4
|
import { a as n } from "../typography-Cv8MT-82.js";
|
|
5
|
-
import { t as r } from "../structure-
|
|
6
|
-
import { n as i, t as a } from "../feedback-
|
|
5
|
+
import { t as r } from "../structure-MvKVq-oL.js";
|
|
6
|
+
import { n as i, t as a } from "../feedback-DWUkgEjR.js";
|
|
7
7
|
import { u as o } from "../primitives-DKPOGVpj.js";
|
|
8
8
|
import { t as s } from "../icon-badge-Dv0RYQwj.js";
|
|
9
|
-
import { i as c, n as l, s as u } from "../avatar-
|
|
10
|
-
import { n as d } from "../display-
|
|
11
|
-
import { t as f } from "../navigation-
|
|
12
|
-
import { t as p } from "../page-header-
|
|
13
|
-
import { l as m, n as h } from "../data-display-
|
|
9
|
+
import { i as c, n as l, s as u } from "../avatar-Bpzty83c.js";
|
|
10
|
+
import { n as d } from "../display-CFM5myut.js";
|
|
11
|
+
import { t as f } from "../navigation-DBEu4POU.js";
|
|
12
|
+
import { t as p } from "../page-header-DQRa0jug.js";
|
|
13
|
+
import { l as m, n as h } from "../data-display-cWIRdeaf.js";
|
|
14
14
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/features/resource/resource.strings.ts
|
|
16
16
|
var v = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { n as e } from "../rich-text-editor.recipes-DxvOE0Lp.js";
|
|
3
3
|
import { t } from "../rich-text-editor.strings-BpnIQgMl.js";
|
|
4
|
-
import { n, t as r } from "../rich-text-editor-
|
|
4
|
+
import { n, t as r } from "../rich-text-editor-CoVrTiSv.js";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
6
|
import { useController as a, useFormContext as o } from "react-hook-form";
|
|
7
7
|
//#region src/components/features/rich-text-editor/form-rich-text-editor.tsx
|