@synetics/ui 0.7.0-alpha
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/.env +3 -0
- package/.eslintrc.cjs +83 -0
- package/.eslintrc.json +53 -0
- package/.github/workflows/deploy.yml +7 -0
- package/.turbo/turbo-build.log +3 -0
- package/CONTRIBUTING.md +47 -0
- package/FIXES-IMPLEMENTATION-LOG.md +180 -0
- package/LICENSE +21 -0
- package/README.md +414 -0
- package/ROADMAP.md +112 -0
- package/TEST-DOCUMENTATION.md +67 -0
- package/TEST-FAILURE-ANALYSIS.md +326 -0
- package/console-mirror.html +79 -0
- package/control-flow-transformed.js +10129 -0
- package/daily-push.log +9 -0
- package/debug-router.html +54 -0
- package/debug-screenshot.png +0 -0
- package/dev-error.log +84 -0
- package/dev-output.log +10689 -0
- package/docs/README.md +527 -0
- package/e2e-results.txt +0 -0
- package/error-boundary-output.js +353 -0
- package/final-test.txt +2816 -0
- package/index.html +41 -0
- package/latest-test.txt +2900 -0
- package/package.json +68 -0
- package/parse-debug.txt +10 -0
- package/ping.txt +1 -0
- package/playwright.config.ts +25 -0
- package/postcss.config.js +6 -0
- package/pre-validation-code.js +25 -0
- package/reactivity-output.txt +0 -0
- package/reactivity-page.html +0 -0
- package/return-parse-test.txt +139 -0
- package/run-psr-test.ps1 +65 -0
- package/src/README.md +138 -0
- package/src/components/app-footer.syn +17 -0
- package/src/components/app-header.syn +43 -0
- package/src/components/atoms/avatar/avatar-simple.syn +25 -0
- package/src/components/atoms/avatar/avatar.syn +86 -0
- package/src/components/atoms/avatar/avatar.type.ts +39 -0
- package/src/components/atoms/avatar/index.ts +7 -0
- package/src/components/atoms/checkbox/checkbox.syn +72 -0
- package/src/components/atoms/checkbox/checkbox.type.ts +25 -0
- package/src/components/atoms/checkbox/index.ts +6 -0
- package/src/components/atoms/container/container.syn +53 -0
- package/src/components/atoms/container/container.type.ts +32 -0
- package/src/components/atoms/container/index.ts +7 -0
- package/src/components/atoms/divider/divider.syn +45 -0
- package/src/components/atoms/divider/divider.type.ts +24 -0
- package/src/components/atoms/divider/index.ts +7 -0
- package/src/components/atoms/grid/grid.syn +56 -0
- package/src/components/atoms/grid/grid.type.ts +44 -0
- package/src/components/atoms/grid/index.ts +7 -0
- package/src/components/atoms/icon/icon.syn +0 -0
- package/src/components/atoms/icon/icon.type.ts +5 -0
- package/src/components/atoms/input/index.ts +6 -0
- package/src/components/atoms/input/input.syn +75 -0
- package/src/components/atoms/input/input.type.ts +29 -0
- package/src/components/atoms/progress/index.ts +7 -0
- package/src/components/atoms/progress/progress.syn +68 -0
- package/src/components/atoms/progress/progress.type.ts +48 -0
- package/src/components/atoms/radio/index.ts +6 -0
- package/src/components/atoms/radio/radio.syn +72 -0
- package/src/components/atoms/radio/radio.type.ts +31 -0
- package/src/components/atoms/rating/index.ts +6 -0
- package/src/components/atoms/rating/rating.syn +119 -0
- package/src/components/atoms/rating/rating.type.ts +53 -0
- package/src/components/atoms/skeleton/index.ts +6 -0
- package/src/components/atoms/skeleton/skeleton.syn +31 -0
- package/src/components/atoms/skeleton/skeleton.type.ts +12 -0
- package/src/components/atoms/slider/index.ts +6 -0
- package/src/components/atoms/slider/slider.syn +101 -0
- package/src/components/atoms/slider/slider.type.ts +54 -0
- package/src/components/atoms/spinner/index.ts +6 -0
- package/src/components/atoms/spinner/spinner.syn +39 -0
- package/src/components/atoms/spinner/spinner.type.ts +40 -0
- package/src/components/atoms/stack/index.ts +7 -0
- package/src/components/atoms/stack/stack.syn +79 -0
- package/src/components/atoms/stack/stack.type.ts +42 -0
- package/src/components/atoms/textarea/index.ts +6 -0
- package/src/components/atoms/textarea/textarea.syn +78 -0
- package/src/components/atoms/textarea/textarea.type.ts +28 -0
- package/src/components/atoms/toggle/index.ts +6 -0
- package/src/components/atoms/toggle/toggle.syn +69 -0
- package/src/components/atoms/toggle/toggle.type.ts +27 -0
- package/src/components/atoms/tooltip/index.ts +5 -0
- package/src/components/atoms/tooltip/tooltip.syn +83 -0
- package/src/components/atoms/tooltip/tooltip.type.ts +36 -0
- package/src/components/atoms/typography/index.ts +6 -0
- package/src/components/atoms/typography/typography.syn +113 -0
- package/src/components/atoms/typography/typography.type.ts +36 -0
- package/src/components/enums/alert-variant.type.ts +5 -0
- package/src/components/enums/avatar-size.type.ts +5 -0
- package/src/components/enums/button-type.type.ts +5 -0
- package/src/components/enums/container-max-width.type.ts +5 -0
- package/src/components/enums/container-padding.type.ts +5 -0
- package/src/components/enums/divider-orientation.type.ts +5 -0
- package/src/components/enums/drawer-placement.type.ts +5 -0
- package/src/components/enums/drawer-size.type.ts +5 -0
- package/src/components/enums/icon-position.type.ts +5 -0
- package/src/components/enums/index.ts +27 -0
- package/src/components/enums/input-type.type.ts +5 -0
- package/src/components/enums/modal-size.type.ts +5 -0
- package/src/components/enums/popover-placement.type.ts +5 -0
- package/src/components/enums/popover-trigger.type.ts +5 -0
- package/src/components/enums/progress-size.type.ts +5 -0
- package/src/components/enums/progress-variant.type.ts +5 -0
- package/src/components/enums/readme.md +1 -0
- package/src/components/enums/spacing.type.ts +5 -0
- package/src/components/enums/stack-align.type.ts +5 -0
- package/src/components/enums/stack-justify.type.ts +11 -0
- package/src/components/enums/toast-position.type.ts +11 -0
- package/src/components/enums/toast-variant.type.ts +5 -0
- package/src/components/enums/tooltip-placement.type.ts +5 -0
- package/src/components/enums/typography-tag.type.ts +5 -0
- package/src/components/enums/typography-variant.type.ts +5 -0
- package/src/components/formular/components/debug/form-data-display.syn +155 -0
- package/src/components/formular/components/examples/advanced-text-field.syn +211 -0
- package/src/components/formular/components/form-context/form-context.ts +15 -0
- package/src/components/formular/components/form-context/index.ts +6 -0
- package/src/components/formular/components/form-context/use-form-context.ts +31 -0
- package/src/components/formular/components/form-provider/form-provider.syn +182 -0
- package/src/components/formular/components/form-provider/index.ts +5 -0
- package/src/components/formular/components/index.ts +20 -0
- package/src/components/formular/components/integrated/checkbox-field.syn +50 -0
- package/src/components/formular/components/integrated/checkbox.syn +53 -0
- package/src/components/formular/components/integrated/index.ts +21 -0
- package/src/components/formular/components/integrated/input-field.syn +51 -0
- package/src/components/formular/components/integrated/radio-group-field.syn +68 -0
- package/src/components/formular/components/integrated/radio-group.syn +63 -0
- package/src/components/formular/components/integrated/select-field.syn +51 -0
- package/src/components/formular/components/integrated/select-input.syn +73 -0
- package/src/components/formular/components/integrated/text-field.syn +49 -0
- package/src/components/formular/components/integrated/textarea-field.syn +51 -0
- package/src/components/formular/components/integrated/textarea-input.syn +73 -0
- package/src/components/formular/components/integrated/toggle-field.syn +50 -0
- package/src/components/formular/components/integrated/toggle.syn +53 -0
- package/src/components/formular/components/modal/error-message.syn +21 -0
- package/src/components/formular/components/modal/form-modale.syn +44 -0
- package/src/components/formular/components/modal/form-validation-results.syn +46 -0
- package/src/components/formular/components/modal/guide-message.syn +21 -0
- package/src/components/formular/components/modal/index.ts +10 -0
- package/src/components/formular/components/modal/use-modale.ts +82 -0
- package/src/components/formular/components/modal/validation-results.syn +63 -0
- package/src/components/formular/components/primitives/f-checkbox-field.syn +50 -0
- package/src/components/formular/components/primitives/f-input-field.syn +77 -0
- package/src/components/formular/components/primitives/f-radio-button.syn +64 -0
- package/src/components/formular/components/primitives/f-select-field.syn +61 -0
- package/src/components/formular/components/primitives/f-textarea-field.syn +53 -0
- package/src/components/formular/components/primitives/f-toggle-field.syn +50 -0
- package/src/components/formular/components/primitives/field-label.syn +49 -0
- package/src/components/formular/components/primitives/helper-text.syn +32 -0
- package/src/components/formular/components/primitives/index.ts +32 -0
- package/src/components/formular/components/primitives/validation-results.syn +76 -0
- package/src/components/formular/hooks/bindings/field-bindings.type.ts +58 -0
- package/src/components/formular/hooks/bindings/index.ts +16 -0
- package/src/components/formular/hooks/bindings/use-checkbox-bind.ts +31 -0
- package/src/components/formular/hooks/bindings/use-input-bind.ts +31 -0
- package/src/components/formular/hooks/bindings/use-radio-bind.ts +39 -0
- package/src/components/formular/hooks/bindings/use-select-bind.ts +32 -0
- package/src/components/formular/hooks/bindings/use-textarea-bind.ts +31 -0
- package/src/components/formular/hooks/bindings/use-toggle-bind.ts +31 -0
- package/src/components/formular/hooks/index.ts +28 -0
- package/src/components/formular/hooks/use-field-validation.ts +42 -0
- package/src/components/formular/hooks/use-field.ts +282 -0
- package/src/components/formular/hooks/use-formular-signal.ts +29 -0
- package/src/components/formular/index.ts +3 -0
- package/src/components/formular/types/field-component.type.ts +78 -0
- package/src/components/formular/types/field-descriptor-config.type.ts +79 -0
- package/src/components/formular/types/form-context.type.ts +67 -0
- package/src/components/formular/types/form-provider.type.ts +67 -0
- package/src/components/formular/types/formular.types.ts +49 -0
- package/src/components/formular/types/index.ts +78 -0
- package/src/components/formular/types/portal.type.ts +36 -0
- package/src/components/formular/utils/dev-logger.ts +44 -0
- package/src/components/formular/utils/index.ts +23 -0
- package/src/components/formular/utils/use-field-descriptors.ts +75 -0
- package/src/components/formular/utils/use-formular-manager.ts +37 -0
- package/src/components/hooks/use-drawer-position.ts +91 -0
- package/src/components/interfaces/component-config-internal.interface.ts +10 -0
- package/src/components/interfaces/component-config.interface.ts +57 -0
- package/src/components/interfaces/component-config.ts +151 -0
- package/src/components/interfaces/index.ts +7 -0
- package/src/components/interfaces/prototype/active.ts +13 -0
- package/src/components/interfaces/prototype/border.ts +13 -0
- package/src/components/interfaces/prototype/build.ts +31 -0
- package/src/components/interfaces/prototype/class-name.ts +13 -0
- package/src/components/interfaces/prototype/disabled.ts +13 -0
- package/src/components/interfaces/prototype/focus.ts +13 -0
- package/src/components/interfaces/prototype/full-width.ts +13 -0
- package/src/components/interfaces/prototype/hover.ts +13 -0
- package/src/components/interfaces/prototype/loading.ts +13 -0
- package/src/components/interfaces/prototype/rounded.ts +13 -0
- package/src/components/interfaces/prototype/shadow.ts +13 -0
- package/src/components/interfaces/prototype/size.ts +14 -0
- package/src/components/interfaces/prototype/transition-duration.ts +13 -0
- package/src/components/interfaces/prototype/transition.ts +13 -0
- package/src/components/interfaces/prototype/variant.ts +14 -0
- package/src/components/interfaces/readme.md +1 -0
- package/src/components/molecules/accordion/accordion-item.syn +80 -0
- package/src/components/molecules/accordion/accordion-item.type.ts +28 -0
- package/src/components/molecules/accordion/accordion.syn +92 -0
- package/src/components/molecules/accordion/accordion.type.ts +29 -0
- package/src/components/molecules/accordion/index.ts +8 -0
- package/src/components/molecules/alert/alert-description.syn +23 -0
- package/src/components/molecules/alert/alert-description.type.ts +9 -0
- package/src/components/molecules/alert/alert-icon.syn +19 -0
- package/src/components/molecules/alert/alert-icon.type.ts +9 -0
- package/src/components/molecules/alert/alert-title.syn +19 -0
- package/src/components/molecules/alert/alert-title.type.ts +9 -0
- package/src/components/molecules/alert/alert.syn +76 -0
- package/src/components/molecules/alert/alert.type.ts +17 -0
- package/src/components/molecules/alert/index.ts +12 -0
- package/src/components/molecules/badge/badge.syn +66 -0
- package/src/components/molecules/badge/badge.type.ts +25 -0
- package/src/components/molecules/badge/index.ts +6 -0
- package/src/components/molecules/breadcrumbs/breadcrumb-item.type.ts +23 -0
- package/src/components/molecules/breadcrumbs/breadcrumbs.syn +60 -0
- package/src/components/molecules/breadcrumbs/breadcrumbs.type.ts +18 -0
- package/src/components/molecules/breadcrumbs/index.ts +8 -0
- package/src/components/molecules/button/button.syn +124 -0
- package/src/components/molecules/button/button.type.ts +24 -0
- package/src/components/molecules/button/index.ts +9 -0
- package/src/components/molecules/dropdown/dropdown-item.syn +30 -0
- package/src/components/molecules/dropdown/dropdown-item.type.ts +11 -0
- package/src/components/molecules/dropdown/dropdown.syn +135 -0
- package/src/components/molecules/dropdown/dropdown.type.ts +12 -0
- package/src/components/molecules/dropdown/index.ts +8 -0
- package/src/components/molecules/label/index.ts +6 -0
- package/src/components/molecules/label/label.syn +72 -0
- package/src/components/molecules/label/label.type.ts +28 -0
- package/src/components/molecules/list/index.ts +8 -0
- package/src/components/molecules/list/list-item.syn +33 -0
- package/src/components/molecules/list/list-item.type.ts +10 -0
- package/src/components/molecules/list/list.syn +54 -0
- package/src/components/molecules/list/list.type.ts +17 -0
- package/src/components/molecules/menu/index.ts +10 -0
- package/src/components/molecules/menu/menu-divider.syn +21 -0
- package/src/components/molecules/menu/menu-divider.type.ts +8 -0
- package/src/components/molecules/menu/menu-item.syn +56 -0
- package/src/components/molecules/menu/menu-item.type.ts +12 -0
- package/src/components/molecules/menu/menu.syn +78 -0
- package/src/components/molecules/menu/menu.type.ts +14 -0
- package/src/components/molecules/option/index.ts +6 -0
- package/src/components/molecules/option/option.syn +41 -0
- package/src/components/molecules/option/option.type.ts +23 -0
- package/src/components/molecules/pagination/index.ts +7 -0
- package/src/components/molecules/pagination/pagination.syn +123 -0
- package/src/components/molecules/pagination/pagination.type.ts +34 -0
- package/src/components/molecules/popover/index.ts +6 -0
- package/src/components/molecules/popover/popover.syn +88 -0
- package/src/components/molecules/popover/popover.type.ts +20 -0
- package/src/components/molecules/radio-group/index.ts +7 -0
- package/src/components/molecules/radio-group/radio-group.syn +79 -0
- package/src/components/molecules/radio-group/radio-group.type.ts +29 -0
- package/src/components/molecules/radio-group/radio-option.type.ts +9 -0
- package/src/components/molecules/tabs/index.ts +14 -0
- package/src/components/molecules/tabs/tab-list.syn +70 -0
- package/src/components/molecules/tabs/tab-list.type.ts +9 -0
- package/src/components/molecules/tabs/tab-panel.syn +34 -0
- package/src/components/molecules/tabs/tab-panel.type.ts +11 -0
- package/src/components/molecules/tabs/tab-panels.syn +40 -0
- package/src/components/molecules/tabs/tab-panels.type.ts +9 -0
- package/src/components/molecules/tabs/tab.syn +52 -0
- package/src/components/molecules/tabs/tab.type.ts +13 -0
- package/src/components/molecules/tabs/tabs.syn +74 -0
- package/src/components/molecules/tabs/tabs.type.ts +17 -0
- package/src/components/organisms/card/card.syn +64 -0
- package/src/components/organisms/card/card.type.ts +25 -0
- package/src/components/organisms/card/index.ts +6 -0
- package/src/components/organisms/commands/commands.syn +0 -0
- package/src/components/organisms/commands/commands.type.ts +1 -0
- package/src/components/organisms/date-picker/components/date-picker.body.days.syn +98 -0
- package/src/components/organisms/date-picker/components/date-picker.body.months.syn +77 -0
- package/src/components/organisms/date-picker/components/date-picker.body.years.syn +86 -0
- package/src/components/organisms/date-picker/components/date-picker.cell.syn +104 -0
- package/src/components/organisms/date-picker/components/date-picker.context.ts +36 -0
- package/src/components/organisms/date-picker/components/date-picker.drawer.content.ui.syn +93 -0
- package/src/components/organisms/date-picker/components/date-picker.header.syn +130 -0
- package/src/components/organisms/date-picker/components/date-picker.switch.syn +27 -0
- package/src/components/organisms/date-picker/core/computed/compute-days-grid.ts +46 -0
- package/src/components/organisms/date-picker/core/computed/compute-months-grid.ts +43 -0
- package/src/components/organisms/date-picker/core/computed/compute-range.ts +36 -0
- package/src/components/organisms/date-picker/core/computed/compute-years-grid.ts +56 -0
- package/src/components/organisms/date-picker/core/constructors/create-cell.ts +37 -0
- package/src/components/organisms/date-picker/core/date-picker.types.ts +41 -0
- package/src/components/organisms/date-picker/core/getters/get-current-month-days.ts +35 -0
- package/src/components/organisms/date-picker/core/getters/get-next-date.ts +32 -0
- package/src/components/organisms/date-picker/core/getters/get-next-month-days.ts +23 -0
- package/src/components/organisms/date-picker/core/getters/get-previous-date.ts +32 -0
- package/src/components/organisms/date-picker/core/getters/get-previous-month-days.ts +32 -0
- package/src/components/organisms/date-picker/core/models/date-picker.models.constructors.ts +36 -0
- package/src/components/organisms/date-picker/core/models/date-picker.models.ts +46 -0
- package/src/components/organisms/date-picker/core/system/get-local-system-separator.ts +5 -0
- package/src/components/organisms/date-picker/date-picker.css +426 -0
- package/src/components/organisms/date-picker/date-picker.drawer.content.syn +238 -0
- package/src/components/organisms/date-picker/date-picker.stories.syn +275 -0
- package/src/components/organisms/date-picker/date-picker.syn +298 -0
- package/src/components/organisms/date-picker/examples.syn +197 -0
- package/src/components/organisms/date-picker/hooks/use-object-ref.ts +18 -0
- package/src/components/organisms/date-picker/index.ts +23 -0
- package/src/components/organisms/date-picker/internal-components/button.syn +36 -0
- package/src/components/organisms/date-picker/internal-components/icons.syn +76 -0
- package/src/components/organisms/date-picker/internal-components/portal.syn +62 -0
- package/src/components/organisms/date-picker/toggleable/toggleable.context.hook.ts +14 -0
- package/src/components/organisms/date-picker/toggleable/toggleable.context.ts +6 -0
- package/src/components/organisms/date-picker/toggleable/toggleable.syn +37 -0
- package/src/components/organisms/date-picker/utils/class-utils.ts +25 -0
- package/src/components/organisms/date-picker/utils/date-object.ts +42 -0
- package/src/components/organisms/date-picker/utils/date-utils.ts +112 -0
- package/src/components/organisms/drawer/drawer.syn +112 -0
- package/src/components/organisms/drawer/drawer.type.ts +53 -0
- package/src/components/organisms/drawer/index.ts +6 -0
- package/src/components/organisms/footer/footer.syn +53 -0
- package/src/components/organisms/footer/footer.type.ts +20 -0
- package/src/components/organisms/footer/index.ts +6 -0
- package/src/components/organisms/header/header.syn +52 -0
- package/src/components/organisms/header/header.type.ts +24 -0
- package/src/components/organisms/header/index.ts +6 -0
- package/src/components/organisms/modal/index.ts +12 -0
- package/src/components/organisms/modal/modal-body.syn +19 -0
- package/src/components/organisms/modal/modal-body.type.ts +9 -0
- package/src/components/organisms/modal/modal-footer.syn +25 -0
- package/src/components/organisms/modal/modal-footer.type.ts +9 -0
- package/src/components/organisms/modal/modal-header.syn +25 -0
- package/src/components/organisms/modal/modal-header.type.ts +9 -0
- package/src/components/organisms/modal/modal-parts.syn +21 -0
- package/src/components/organisms/modal/modal.syn +104 -0
- package/src/components/organisms/modal/modal.type.ts +15 -0
- package/src/components/organisms/retractable-panel/retractable-panel.syn +141 -0
- package/src/components/organisms/retractable-panel/retractable-panel.type.ts +52 -0
- package/src/components/organisms/select/index.ts +7 -0
- package/src/components/organisms/select/select-option.type.ts +9 -0
- package/src/components/organisms/select/select.syn +92 -0
- package/src/components/organisms/select/select.type.ts +31 -0
- package/src/components/organisms/stepper/INTEGRATION_GUIDE.md +230 -0
- package/src/components/organisms/stepper/PACKAGE_STATUS.md +180 -0
- package/src/components/organisms/stepper/README.md +293 -0
- package/src/components/organisms/stepper/Step.syn +61 -0
- package/src/components/organisms/stepper/Stepper.syn +605 -0
- package/src/components/organisms/stepper/StepperSummary.syn +36 -0
- package/src/components/organisms/stepper/adapters/atomosFormAdapter.ts +163 -0
- package/src/components/organisms/stepper/adapters/index.ts +7 -0
- package/src/components/organisms/stepper/adapters/rhfAdapter.ts +54 -0
- package/src/components/organisms/stepper/components/StepperDebug.syn +454 -0
- package/src/components/organisms/stepper/components/StepperFooter.syn +144 -0
- package/src/components/organisms/stepper/components/StepperHeader.syn +66 -0
- package/src/components/organisms/stepper/components/StepperTab.syn +118 -0
- package/src/components/organisms/stepper/components/stepperDebug.css +72 -0
- package/src/components/organisms/stepper/components/stepperFooter.css +28 -0
- package/src/components/organisms/stepper/components/stepperHeader.css +49 -0
- package/src/components/organisms/stepper/components/stepperTab.css +97 -0
- package/src/components/organisms/stepper/copy-to-atomos.ps1 +78 -0
- package/src/components/organisms/stepper/core/actions.ts +25 -0
- package/src/components/organisms/stepper/core/formAdapter.ts +66 -0
- package/src/components/organisms/stepper/core/helpers.ts +216 -0
- package/src/components/organisms/stepper/core/models.ts +220 -0
- package/src/components/organisms/stepper/core/reducer/addCustomValidators.ts +14 -0
- package/src/components/organisms/stepper/core/reducer/addError.ts +10 -0
- package/src/components/organisms/stepper/core/reducer/addStep.ts +7 -0
- package/src/components/organisms/stepper/core/reducer/computeSiblingStatus.ts +45 -0
- package/src/components/organisms/stepper/core/reducer/computeValidation.ts +61 -0
- package/src/components/organisms/stepper/core/reducer/goToStep.ts +143 -0
- package/src/components/organisms/stepper/core/reducer/init.ts +7 -0
- package/src/components/organisms/stepper/core/reducer/navigationRequest.ts +16 -0
- package/src/components/organisms/stepper/core/reducer/removeAllErrors.ts +26 -0
- package/src/components/organisms/stepper/core/reducer/removeError.ts +12 -0
- package/src/components/organisms/stepper/core/reducer/reset.ts +44 -0
- package/src/components/organisms/stepper/core/reducer/setData.ts +12 -0
- package/src/components/organisms/stepper/core/reducer/setFieldDefaultValue.ts +39 -0
- package/src/components/organisms/stepper/core/reducer/setFields.ts +41 -0
- package/src/components/organisms/stepper/core/reducer/setStepperDefaultValue.ts +33 -0
- package/src/components/organisms/stepper/core/reducer/setSubmittedTimes.ts +9 -0
- package/src/components/organisms/stepper/core/reducer/setVisible.ts +26 -0
- package/src/components/organisms/stepper/core/reducer/submitRequest.ts +19 -0
- package/src/components/organisms/stepper/core/reducer/updateFormCommon.ts +82 -0
- package/src/components/organisms/stepper/core/state.ts +106 -0
- package/src/components/organisms/stepper/index.ts +34 -0
- package/src/components/organisms/stepper/step.css +66 -0
- package/src/components/organisms/stepper/stepper.css +32 -0
- package/src/components/organisms/stepper/stepper.stories.tsx.disabled +329 -0
- package/src/components/organisms/table/index.ts +14 -0
- package/src/components/organisms/table/table-body.syn +43 -0
- package/src/components/organisms/table/table-body.type.ts +9 -0
- package/src/components/organisms/table/table-cell.syn +35 -0
- package/src/components/organisms/table/table-cell.type.ts +10 -0
- package/src/components/organisms/table/table-header.syn +23 -0
- package/src/components/organisms/table/table-header.type.ts +9 -0
- package/src/components/organisms/table/table-row.syn +35 -0
- package/src/components/organisms/table/table-row.type.ts +9 -0
- package/src/components/organisms/table/table.syn +71 -0
- package/src/components/organisms/table/table.type.ts +17 -0
- package/src/components/organisms/toast/index.ts +10 -0
- package/src/components/organisms/toast/toast-container.syn +108 -0
- package/src/components/organisms/toast/toast-container.type.ts +11 -0
- package/src/components/organisms/toast/toast-options.type.ts +11 -0
- package/src/components/organisms/toast/toast.syn +82 -0
- package/src/components/organisms/toast/toast.type.ts +14 -0
- package/src/components/organisms/toast/use-toast.ts +62 -0
- package/src/components/sidebar-nav.syn +107 -0
- package/src/components/utils/component-config-builder/component-config-builder.ts +49 -0
- package/src/components/utils/component-config-builder/component-config-builder.type.ts +27 -0
- package/src/components/utils/component-config-builder/component-config.type.ts +36 -0
- package/src/components/utils/component-config-builder/index.ts +7 -0
- package/src/components/utils/component-config-builder/prototype/active.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/border.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/build.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/class-name.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/color.ts +11 -0
- package/src/components/utils/component-config-builder/prototype/disabled.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/focus.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/full-width.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/hover.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/loading.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/rounded.ts +11 -0
- package/src/components/utils/component-config-builder/prototype/shadow.ts +11 -0
- package/src/components/utils/component-config-builder/prototype/size.ts +11 -0
- package/src/components/utils/component-config-builder/prototype/transition-duration.ts +11 -0
- package/src/components/utils/component-config-builder/prototype/transition.ts +10 -0
- package/src/components/utils/component-config-builder/prototype/variant.ts +11 -0
- package/src/components/utils/component-styling-builder/component-styling-builder.ts +45 -0
- package/src/components/utils/component-styling-builder/component-styling-builder.type.ts +26 -0
- package/src/components/utils/component-styling-builder/component-styling.type.ts +21 -0
- package/src/components/utils/component-styling-builder/index.ts +7 -0
- package/src/components/utils/component-styling-builder/prototype/active.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/background.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/base.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/border.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/build.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/custom.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/disabled.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/focus.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/hover.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/loading.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/read-only.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/rounded.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/shadow.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/size.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/transition.ts +10 -0
- package/src/components/utils/component-styling-builder/prototype/variant.ts +10 -0
- package/src/components/utils/index.ts +6 -0
- package/src/components/utils/readme.md +1 -0
- package/src/css.d.ts +14 -0
- package/src/debug-tokens.syn +11 -0
- package/src/design/sizes/index.ts +6 -0
- package/src/design/utility/class-names.ts +6 -0
- package/src/design/utility/index.ts +6 -0
- package/src/design/utility/rounded-classes.ts +6 -0
- package/src/docs/EXAMPLES.md +319 -0
- package/src/docs/EXAMPLES.ts.md +188 -0
- package/src/docs/IMPLEMENTATION_COMPLETE.md +232 -0
- package/src/docs/IMPLEMENTATION_PATTERN.md +319 -0
- package/src/docs/copilot-implementation-rules.md +328 -0
- package/src/index.ts +23 -0
- package/src/jsx.d.ts +8 -0
- package/src/lab/counter.syn +76 -0
- package/src/lab/transformer/README.md +115 -0
- package/src/lab/transformer/async-lazy-loading/2026-02-11-14-20-async-lazy-loading.syn +242 -0
- package/src/lab/transformer/batch-updates/2026-02-11-14-20-batch-updates.syn +228 -0
- package/src/lab/transformer/catcher-error-handlers/2026-02-11-14-20-catcher-error-handlers.syn +211 -0
- package/src/lab/transformer/complex-jsx-expressions/2026-02-11-14-20-complex-jsx-expressions.syn +49 -0
- package/src/lab/transformer/complex-jsx-expressions/2026-02-11-15-01-complex-jsx-expressions.syn +227 -0
- package/src/lab/transformer/concurrent-rendering/2026-02-11-14-20-concurrent-rendering.syn +291 -0
- package/src/lab/transformer/create-context-providers/2026-02-11-14-20-create-context-providers.syn +240 -0
- package/src/lab/transformer/create-effect-side-effects/2026-02-11-14-20-create-effect-side-effects.syn +339 -0
- package/src/lab/transformer/create-resource/2026-02-11-14-20-create-resource.syn +80 -0
- package/src/lab/transformer/dynamic-components/2026-02-11-14-20-dynamic-components.syn +78 -0
- package/src/lab/transformer/dynamic-components/2026-02-11-15-09-dynamic-components.syn +468 -0
- package/src/lab/transformer/for-iteration/2026-02-11-14-20-for-iteration.syn +62 -0
- package/src/lab/transformer/for-iteration-components/2026-02-11-15-07-for-iteration-components.syn +489 -0
- package/src/lab/transformer/generic-type-arguments/2026-02-11-14-20-generic-type-arguments.syn +53 -0
- package/src/lab/transformer/generic-type-arguments/2026-02-11-15-02-generic-type-arguments.syn +140 -0
- package/src/lab/transformer/memo-optimization/2026-02-11-14-20-memo-optimization.syn +275 -0
- package/src/lab/transformer/on-cleanup-patterns/2026-02-11-14-20-on-cleanup-patterns.syn +375 -0
- package/src/lab/transformer/on-mount-lifecycle/2026-02-11-14-20-on-mount-lifecycle.syn +347 -0
- package/src/lab/transformer/portal-transformation/2026-02-11-14-20-portal-transformation.syn +141 -0
- package/src/lab/transformer/render-effect-timing/2026-02-11-14-20-render-effect-timing.syn +334 -0
- package/src/lab/transformer/resource-dependency-tracking/2026-02-11-14-20-resource-dependency-tracking.syn +153 -0
- package/src/lab/transformer/resource-loading-states/2026-02-11-14-20-resource-loading-states.syn +382 -0
- package/src/lab/transformer/resource-mutations/2026-02-11-14-20-resource-mutations.syn +399 -0
- package/src/lab/transformer/resource-parallel-fetching/2026-02-11-14-20-resource-parallel-fetching.syn +446 -0
- package/src/lab/transformer/resource-pre-resolution/2026-02-11-14-20-resource-pre-resolution.syn +405 -0
- package/src/lab/transformer/resource-refetch-patterns/2026-02-11-14-20-resource-refetch-patterns.syn +120 -0
- package/src/lab/transformer/resource-state-handling/2026-02-11-14-20-resource-state-handling.syn +104 -0
- package/src/lab/transformer/server-side-rendering/2026-02-11-14-20-server-side-rendering.syn +234 -0
- package/src/lab/transformer/show-components/2026-02-11-14-20-show-components.syn +57 -0
- package/src/lab/transformer/show-when-components/2026-02-11-15-03-show-when-components.syn +202 -0
- package/src/lab/transformer/template-literals/2026-02-11-14-20-template-literals.syn +34 -0
- package/src/lab/transformer/template-literals/2026-02-11-15-00-template-literals.syn +146 -0
- package/src/lab/transformer/tryer-error-boundaries/2026-02-11-14-20-tryer-error-boundaries.syn +111 -0
- package/src/lab/transformer/type-inference-system/2026-02-11-14-20-type-inference-system.syn +50 -0
- package/src/lab/transformer/type-inference-system/2026-02-11-15-05-type-inference-system.syn +353 -0
- package/src/lab/transformer/untrack-isolation/2026-02-11-14-20-untrack-isolation.syn +326 -0
- package/src/lab/transformer/waiting-suspense/2026-02-11-14-20-waiting-suspense.syn +78 -0
- package/src/main-simple.syn +23 -0
- package/src/main.syn +101 -0
- package/src/main.ts +57 -0
- package/src/showcase/__tests__/e2e/context-structure.spec.ts +46 -0
- package/src/showcase/__tests__/e2e/context-ui.spec.ts +137 -0
- package/src/showcase/__tests__/e2e/control-flow-ui.spec.ts +149 -0
- package/src/showcase/__tests__/e2e/debug-compiled.spec.ts +13 -0
- package/src/showcase/__tests__/e2e/debug-screenshot.png +0 -0
- package/src/showcase/__tests__/e2e/debug.spec.ts +20 -0
- package/src/showcase/__tests__/e2e/deep-debug.spec.ts +130 -0
- package/src/showcase/__tests__/e2e/error-boundary-ui.spec.ts +113 -0
- package/src/showcase/__tests__/e2e/main-transformed.js +0 -0
- package/src/showcase/__tests__/e2e/portal-ui.spec.ts +135 -0
- package/src/showcase/__tests__/e2e/reactivity-ui.spec.ts +81 -0
- package/src/showcase/__tests__/e2e/resource-debug.spec.ts +37 -0
- package/src/showcase/__tests__/e2e/visual-debug.spec.ts +147 -0
- package/src/showcase/__tests__/integration/context-provider-consumer.test.ts +114 -0
- package/src/showcase/__tests__/integration/context-ui.test.ts +150 -0
- package/src/showcase/__tests__/integration/error-boundary-reactivity.test.ts +164 -0
- package/src/showcase/__tests__/integration/reactivity-control-flow.test.ts +226 -0
- package/src/showcase/__tests__/integration/reactivity-cross-component.test.ts +103 -0
- package/src/showcase/__tests__/integration/showcase-navigation.test.ts +159 -0
- package/src/showcase/__tests__/setup.ts +37 -0
- package/src/showcase/__tests__/unit/context.test.ts +122 -0
- package/src/showcase/__tests__/unit/control-flow.test.ts +167 -0
- package/src/showcase/__tests__/unit/error-boundary.test.ts +116 -0
- package/src/showcase/__tests__/unit/portal.test.ts +122 -0
- package/src/showcase/__tests__/unit/reactivity.test.ts +152 -0
- package/src/showcase/about/about.syn +59 -0
- package/src/showcase/about/components/details-section.syn +29 -0
- package/src/showcase/about/components/feature-list.syn +23 -0
- package/src/showcase/about/components/index.ts +7 -0
- package/src/showcase/about/components/route-info.syn +29 -0
- package/src/showcase/bootstrap/bootstrap-test.syn +152 -0
- package/src/showcase/bootstrap/components/config-service-error-view.syn +41 -0
- package/src/showcase/bootstrap/components/config-service-resolved-view.syn +69 -0
- package/src/showcase/bootstrap/demos/basic-demo.syn +26 -0
- package/src/showcase/bootstrap/demos/di-demo-interactive.syn +94 -0
- package/src/showcase/bootstrap/demos/di-demo.syn +64 -0
- package/src/showcase/bootstrap/demos/lifecycle-demo.syn +74 -0
- package/src/showcase/bootstrap/demos/return-value-demo.syn +95 -0
- package/src/showcase/bootstrap/types/config-service.types.ts +9 -0
- package/src/showcase/common/components/code-block.syn +24 -0
- package/src/showcase/common/components/console-log-viewer.syn +133 -0
- package/src/showcase/common/components/demo-button.syn +42 -0
- package/src/showcase/common/components/demo-section.syn +29 -0
- package/src/showcase/common/components/index.ts +13 -0
- package/src/showcase/common/components/isolated-demo.syn +95 -0
- package/src/showcase/common/components/modal.syn +58 -0
- package/src/showcase/common/components/page-header.syn +29 -0
- package/src/showcase/common/components/status-indicator.syn +34 -0
- package/src/showcase/common/examples/logging-example.syn +67 -0
- package/src/showcase/common/hooks/use-logger.ts +60 -0
- package/src/showcase/context/components/index.ts +12 -0
- package/src/showcase/context/components/multi-context-dashboard.syn +135 -0
- package/src/showcase/context/components/settings-provider.syn +35 -0
- package/src/showcase/context/components/theme-controls.syn +51 -0
- package/src/showcase/context/components/theme-provider.syn +25 -0
- package/src/showcase/context/components/themed-box.syn +20 -0
- package/src/showcase/context/components/user-controls.syn +38 -0
- package/src/showcase/context/components/user-profile.syn +26 -0
- package/src/showcase/context/components/user-provider.syn +34 -0
- package/src/showcase/context/context-test.syn +66 -0
- package/src/showcase/control-flow/components/for-demo.syn +67 -0
- package/src/showcase/control-flow/components/index-demo.syn +41 -0
- package/src/showcase/control-flow/components/index.ts +8 -0
- package/src/showcase/control-flow/components/show-demo.syn +53 -0
- package/src/showcase/control-flow/control-flow-test.syn +104 -0
- package/src/showcase/di/components/circular-dependency-demo.syn +113 -0
- package/src/showcase/di/components/hierarchical-di-demo.syn +81 -0
- package/src/showcase/di/components/index.ts +6 -0
- package/src/showcase/di/components/lifetime-card.syn +30 -0
- package/src/showcase/di/components/registered-services-list.syn +29 -0
- package/src/showcase/di/components/resolution-result.syn +34 -0
- package/src/showcase/di/components/service-button.syn +26 -0
- package/src/showcase/di/components/service-lifetime-demo.syn +135 -0
- package/src/showcase/di/components/service-registration-demo.syn +85 -0
- package/src/showcase/di/components/service-resolution-demo.syn +145 -0
- package/src/showcase/di/di-test.syn +121 -0
- package/src/showcase/di/services/demo-services.ts +128 -0
- package/src/showcase/drag-drop/components/drag-drop-zone-demo.syn +75 -0
- package/src/showcase/drag-drop/components/index.ts +7 -0
- package/src/showcase/drag-drop/components/kanban-board-demo.syn +76 -0
- package/src/showcase/drag-drop/components/sortable-list-demo.syn +71 -0
- package/src/showcase/drag-drop/drag-drop-test.syn +44 -0
- package/src/showcase/error-boundary/components/basic-boundary-demo.syn +54 -0
- package/src/showcase/error-boundary/components/boundary-section.syn +47 -0
- package/src/showcase/error-boundary/components/cleanup-demo.syn +88 -0
- package/src/showcase/error-boundary/components/control-button-group.syn +48 -0
- package/src/showcase/error-boundary/components/error-boundary-control-panel.syn +76 -0
- package/src/showcase/error-boundary/components/error-boundary-status-summary.syn +46 -0
- package/src/showcase/error-boundary/components/error-component.syn +15 -0
- package/src/showcase/error-boundary/components/error-display.syn +27 -0
- package/src/showcase/error-boundary/components/index.ts +14 -0
- package/src/showcase/error-boundary/components/reset-flow-demo.syn +107 -0
- package/src/showcase/error-boundary/components/retry-counter-demo.syn +97 -0
- package/src/showcase/error-boundary/components/safe-component.syn +12 -0
- package/src/showcase/error-boundary/components/visual-boundary-wrapper.syn +78 -0
- package/src/showcase/error-boundary/error-boundary-mega.syn +180 -0
- package/src/showcase/error-boundary/error-boundary-simple.syn +88 -0
- package/src/showcase/error-boundary/error-boundary-test.syn +77 -0
- package/src/showcase/forms/components/async-validation-demo.syn +101 -0
- package/src/showcase/forms/components/basic-form-demo.syn +42 -0
- package/src/showcase/forms/components/field-state-demo.syn +70 -0
- package/src/showcase/forms/components/index.ts +9 -0
- package/src/showcase/forms/components/submission-demo.syn +78 -0
- package/src/showcase/forms/components/validation-demo.syn +59 -0
- package/src/showcase/forms/forms-test.syn +179 -0
- package/src/showcase/forms/pages/cross-validation-page.syn +181 -0
- package/src/showcase/forms/pages/dependent-fields-page.syn +122 -0
- package/src/showcase/forms/pages/dynamic-fields-page.syn +245 -0
- package/src/showcase/forms/pages/edit-form-page.syn +163 -0
- package/src/showcase/forms/pages/index.ts +10 -0
- package/src/showcase/forms/pages/select-controls-page.syn +112 -0
- package/src/showcase/forms/pages/wizard-page.syn +253 -0
- package/src/showcase/home/home.syn +22 -0
- package/src/showcase/http/components/abort-demo.syn +87 -0
- package/src/showcase/http/components/basic-requests-demo.syn +88 -0
- package/src/showcase/http/components/index.ts +8 -0
- package/src/showcase/http/components/interceptors-demo.syn +90 -0
- package/src/showcase/http/components/retry-demo.syn +84 -0
- package/src/showcase/http/http-test.syn +88 -0
- package/src/showcase/index.ts +46 -0
- package/src/showcase/jsx/components/event-handlers-demo.syn +78 -0
- package/src/showcase/jsx/components/index.ts +7 -0
- package/src/showcase/jsx/components/reactive-attributes-demo.syn +69 -0
- package/src/showcase/jsx/components/style-objects-demo.syn +40 -0
- package/src/showcase/jsx/jsx-test.syn +81 -0
- package/src/showcase/pages/__tests__/about.test.ts +120 -0
- package/src/showcase/pages/__tests__/assignment-test.test.ts +68 -0
- package/src/showcase/pages/__tests__/context-test.test.ts +218 -0
- package/src/showcase/pages/__tests__/control-flow-test.test.ts +184 -0
- package/src/showcase/pages/__tests__/error-boundary-test.test.ts +220 -0
- package/src/showcase/pages/__tests__/home.test.ts +54 -0
- package/src/showcase/pages/__tests__/jsx-test.test.ts +182 -0
- package/src/showcase/pages/__tests__/reactivity-test.test.ts +177 -0
- package/src/showcase/pages/__tests__/resource-test.test.ts +215 -0
- package/src/showcase/pages/error-boundary-mega-demo.syn +0 -0
- package/src/showcase/portal/components/basic-portal-demo.syn +41 -0
- package/src/showcase/portal/components/index.ts +7 -0
- package/src/showcase/portal/components/modal-portal-demo.syn +84 -0
- package/src/showcase/portal/components/tooltip-portal-demo.syn +56 -0
- package/src/showcase/portal/portal-test.syn +44 -0
- package/src/showcase/reactivity/components/batch-demo.syn +43 -0
- package/src/showcase/reactivity/components/effect-demo.syn +19 -0
- package/src/showcase/reactivity/components/index.ts +11 -0
- package/src/showcase/reactivity/components/memo-demo.syn +29 -0
- package/src/showcase/reactivity/components/render-effect-demo.syn +78 -0
- package/src/showcase/reactivity/components/signal-demo.syn +45 -0
- package/src/showcase/reactivity/components/untrack-demo.syn +67 -0
- package/src/showcase/reactivity/components/use-sync-demo.syn +96 -0
- package/src/showcase/reactivity/reactivity-test.syn +170 -0
- package/src/showcase/resource/components/cache-demo.syn +141 -0
- package/src/showcase/resource/components/coordination-demo.syn +136 -0
- package/src/showcase/resource/components/deduplication-demo.syn +33 -0
- package/src/showcase/resource/components/error-resource-demo.syn +93 -0
- package/src/showcase/resource/components/image-card.syn +53 -0
- package/src/showcase/resource/components/image-gallery-demo.syn +56 -0
- package/src/showcase/resource/components/index.ts +15 -0
- package/src/showcase/resource/components/mock-api.ts +67 -0
- package/src/showcase/resource/components/refetch-clear-demo.syn +99 -0
- package/src/showcase/resource/components/suspend-control-demo.syn +62 -0
- package/src/showcase/resource/components/suspense-skeleton.syn +24 -0
- package/src/showcase/resource/components/user-card.syn +57 -0
- package/src/showcase/resource/components/waiting-demo.syn +118 -0
- package/src/showcase/resource/resource-test.syn +193 -0
- package/src/showcase/routing/components/guard-demo.syn +75 -0
- package/src/showcase/routing/components/index.ts +9 -0
- package/src/showcase/routing/components/navigation-demo.syn +47 -0
- package/src/showcase/routing/components/nested-outlet-demo.syn +73 -0
- package/src/showcase/routing/components/params-demo.syn +54 -0
- package/src/showcase/routing/components/query-demo.syn +63 -0
- package/src/showcase/routing/routing-test.syn +102 -0
- package/src/showcase/ssr/components/escape-demo.syn +80 -0
- package/src/showcase/ssr/components/hydrate-demo.syn +142 -0
- package/src/showcase/ssr/components/hydration-script-demo.syn +104 -0
- package/src/showcase/ssr/components/index.ts +8 -0
- package/src/showcase/ssr/components/render-to-string-demo.syn +71 -0
- package/src/showcase/ssr/ssr-test.syn +88 -0
- package/src/showcase/svg-canvas/board/components/canvas-badge-list.syn +59 -0
- package/src/showcase/svg-canvas/board/components/canvas-draw-preview.syn +75 -0
- package/src/showcase/svg-canvas/board/components/canvas-toolbar.syn +59 -0
- package/src/showcase/svg-canvas/board/components/line-canvas.syn +673 -0
- package/src/showcase/svg-canvas/board/components/side-toolbox.syn +51 -0
- package/src/showcase/svg-canvas/board/components/svg/canvas-dot-grid.syn +18 -0
- package/src/showcase/svg-canvas/board/model/i-board.ts +20 -0
- package/src/showcase/svg-canvas/board/store/canvas-board.slice.ts +51 -0
- package/src/showcase/svg-canvas/index.ts +2 -0
- package/src/showcase/svg-canvas/line/components/canvas-line-item.syn +85 -0
- package/src/showcase/svg-canvas/line/components/svg/svg-endpoint-handle.syn +29 -0
- package/src/showcase/svg-canvas/line/components/svg/svg-line-label.syn +33 -0
- package/src/showcase/svg-canvas/line/entity/canvas-line.ts +42 -0
- package/src/showcase/svg-canvas/line/entity/create-canvas-line.ts +24 -0
- package/src/showcase/svg-canvas/line/model/i-canvas-line.ts +42 -0
- package/src/showcase/svg-canvas/line/store/canvas-line.slice.ts +38 -0
- package/src/showcase/svg-canvas/modal/components/canvas-settings-modal.syn +118 -0
- package/src/showcase/svg-canvas/modal/model/i-canvas-modal.ts +10 -0
- package/src/showcase/svg-canvas/modal/store/canvas-modal.slice.ts +36 -0
- package/src/showcase/svg-canvas/shape/components/canvas-anchor-group.syn +33 -0
- package/src/showcase/svg-canvas/shape/components/canvas-diamond-body.syn +48 -0
- package/src/showcase/svg-canvas/shape/components/canvas-entity-card.syn +89 -0
- package/src/showcase/svg-canvas/shape/components/canvas-rect-body.syn +37 -0
- package/src/showcase/svg-canvas/shape/components/canvas-shape-item.syn +110 -0
- package/src/showcase/svg-canvas/shape/components/card-header.syn +45 -0
- package/src/showcase/svg-canvas/shape/components/property-row.syn +29 -0
- package/src/showcase/svg-canvas/shape/components/svg/svg-anchor-circle.syn +44 -0
- package/src/showcase/svg-canvas/shape/entity/canvas-diamond.ts +102 -0
- package/src/showcase/svg-canvas/shape/entity/canvas-entity.ts +19 -0
- package/src/showcase/svg-canvas/shape/entity/canvas-rectangle.ts +53 -0
- package/src/showcase/svg-canvas/shape/entity/canvas-square.ts +72 -0
- package/src/showcase/svg-canvas/shape/entity/create-shape.ts +69 -0
- package/src/showcase/svg-canvas/shape/model/i-shape.ts +37 -0
- package/src/showcase/svg-canvas/shape/store/canvas-shape.slice.ts +38 -0
- package/src/showcase/svg-canvas/shared/atoms/canvas-badge.syn +34 -0
- package/src/showcase/svg-canvas/shared/atoms/canvas-icon-btn.syn +32 -0
- package/src/showcase/svg-canvas/shared/atoms/canvas-text-input.syn +27 -0
- package/src/showcase/svg-canvas/shared/helpers/canvas-dom-ops.ts +187 -0
- package/src/showcase/svg-canvas/shared/helpers/canvas-helpers.ts +112 -0
- package/src/showcase/svg-canvas/shared/helpers/route-orthogonal.ts +176 -0
- package/src/showcase/svg-canvas/shared/model/i-drag.ts +84 -0
- package/src/showcase/svg-canvas/shared/model/i-entity.ts +71 -0
- package/src/showcase/svg-canvas/store/canvas-store.ts +60 -0
- package/src/showcase/svg-canvas/svg-canvas-page.syn +28 -0
- package/src/showcase/tests/assignment-test.syn +37 -0
- package/src/showcase/tests/minimal-export-test.syn +7 -0
- package/src/showcase/tests/object-literal-test.syn +26 -0
- package/src/showcase/tests/simple-codegen-test.syn +12 -0
- package/src/showcase/tests/simple-test.syn +51 -0
- package/src/showcase/tests/template-literal-demo.syn +138 -0
- package/src/showcase-styles.css +96 -0
- package/src/styles/design-system.css +275 -0
- package/src/styles/motion.css +121 -0
- package/src/styles/showcase-base.css +522 -0
- package/src/styles/showcase.css +653 -0
- package/src/styles/state-layers.css +55 -0
- package/src/styles/touch-targets.css +41 -0
- package/src/styles/transitions.css +617 -0
- package/src/styles/utilities.css +115 -0
- package/src/styles.css +23 -0
- package/src/test-keywords.syn +15 -0
- package/src/test-loop.syn +29 -0
- package/src/test-minimal.syn +9 -0
- package/src/test-object-literal.syn +19 -0
- package/src/test-simple.syn +12 -0
- package/src/types/psr-modules.d.ts +6 -0
- package/src/types.ts +37 -0
- package/tailwind.config.js +354 -0
- package/test-results/.last-run.json +4 -0
- package/test-signal-debug.syn +9 -0
- package/test-transformation.ts +35 -0
- package/tsconfig.build.json +31 -0
- package/tsconfig.json +44 -0
- package/tsconfig.stories.json +10 -0
- package/vite.config.ts +47 -0
- package/vitest.config.ts +41 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
/* eslint-disable sonarjs/no-identical-functions */
|
|
2
|
+
import './stepper.css'
|
|
3
|
+
|
|
4
|
+
import React, { createContext, useEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
formatDate,
|
|
8
|
+
isDateFormatValidDDMMYYYY,
|
|
9
|
+
isDateLongFormatValid
|
|
10
|
+
} from 'core/helpers/DateFormatHelper'
|
|
11
|
+
|
|
12
|
+
import StepperDebug from './components/StepperDebug'
|
|
13
|
+
import StepperFooter from './components/StepperFooter'
|
|
14
|
+
import StepperHeader from './components/StepperHeader'
|
|
15
|
+
import { StepperActionsKind } from './core/actions'
|
|
16
|
+
import { FormAdapter } from './core/formAdapter'
|
|
17
|
+
import { getAllowedIds, newStepAction } from './core/helpers'
|
|
18
|
+
import {
|
|
19
|
+
Action,
|
|
20
|
+
CustomValidation,
|
|
21
|
+
FormCommon,
|
|
22
|
+
IStepAvailabilityTriggeredBy,
|
|
23
|
+
StepField,
|
|
24
|
+
StepItem,
|
|
25
|
+
StepperDefaultValue,
|
|
26
|
+
StepperError,
|
|
27
|
+
StepperOptions,
|
|
28
|
+
StepperSibling,
|
|
29
|
+
StepperState,
|
|
30
|
+
StepsVisibility,
|
|
31
|
+
Summary,
|
|
32
|
+
ValidationMode
|
|
33
|
+
} from './core/models'
|
|
34
|
+
import { INITIAL_STEPPER_STATE, stepperStateReducer } from './core/state'
|
|
35
|
+
|
|
36
|
+
export interface StepperContext {
|
|
37
|
+
currentState: () => StepperState
|
|
38
|
+
watchSiblings: () => StepperSibling | undefined
|
|
39
|
+
stepWatch: (id?: number) => StepItem | StepItem[] | undefined
|
|
40
|
+
setStepVisibility: (
|
|
41
|
+
ids: number[],
|
|
42
|
+
visible: boolean,
|
|
43
|
+
shouldSkip?: IStepAvailabilityTriggeredBy[]
|
|
44
|
+
) => void
|
|
45
|
+
registerField: (id: number, fields: string[]) => void
|
|
46
|
+
setFieldDefaultValue: (id: number, fields: StepField) => void
|
|
47
|
+
setStepperDefaultValue: (defaultValue: StepperDefaultValue) => void
|
|
48
|
+
setCustomValidators: (customValidators: CustomValidation[]) => void
|
|
49
|
+
goToStep: (id: number) => void
|
|
50
|
+
goBack: () => void
|
|
51
|
+
goNext: () => void
|
|
52
|
+
resetForm: (id?: number) => void
|
|
53
|
+
submit: () => void
|
|
54
|
+
enableStep: (id: number) => void
|
|
55
|
+
errors: (id?: number) => StepperError[]
|
|
56
|
+
setError: (stepId: number, fieldName: string, message: string) => void
|
|
57
|
+
unSetError: (stepId: number, fieldName: string) => void
|
|
58
|
+
removeAllCustomErrors: (id?: number) => void
|
|
59
|
+
/**
|
|
60
|
+
* when field is selected: KEY MUST BE A STRING
|
|
61
|
+
* when all is selected: KEY IS OMMITED
|
|
62
|
+
* when step is selected: KEY MUST BE A NUMBER
|
|
63
|
+
* */
|
|
64
|
+
validate: (mode: ValidationMode, key?: string | number) => void
|
|
65
|
+
dispatch: React.Dispatch<Action>
|
|
66
|
+
summary: () => Summary[]
|
|
67
|
+
persistLocalData: (stepId: number) => void
|
|
68
|
+
recoverLocalData: (stepId: number) => void
|
|
69
|
+
/** Form adapter for accessing form library methods */
|
|
70
|
+
formAdapter: FormAdapter
|
|
71
|
+
}
|
|
72
|
+
// the fields Context CONTEXT definition
|
|
73
|
+
const StepperCtx = createContext<StepperContext>({
|
|
74
|
+
currentState: () => ({} as StepperState),
|
|
75
|
+
watchSiblings: () => ({} as StepperSibling),
|
|
76
|
+
stepWatch: (): StepItem | StepItem[] | undefined =>
|
|
77
|
+
(({} as StepItem | []) as StepItem[] | undefined),
|
|
78
|
+
setStepVisibility: () => ({}),
|
|
79
|
+
registerField: () => ({}),
|
|
80
|
+
setFieldDefaultValue: () => ({}),
|
|
81
|
+
setStepperDefaultValue: () => ({}),
|
|
82
|
+
setCustomValidators: () => ({}),
|
|
83
|
+
goToStep: () => ({}),
|
|
84
|
+
goBack: () => ({}),
|
|
85
|
+
goNext: () => ({}),
|
|
86
|
+
resetForm: () => ({}),
|
|
87
|
+
submit: () => ({}),
|
|
88
|
+
enableStep: () => ({}),
|
|
89
|
+
errors: (): StepperError[] => ({} as StepperError[]),
|
|
90
|
+
setError: () => ({}),
|
|
91
|
+
unSetError: () => ({}),
|
|
92
|
+
removeAllCustomErrors: () => ({}),
|
|
93
|
+
validate: () => ({}),
|
|
94
|
+
dispatch: {} as React.Dispatch<Action>,
|
|
95
|
+
summary: () => [] as Summary[],
|
|
96
|
+
persistLocalData: () => ({}),
|
|
97
|
+
recoverLocalData: () => ({}),
|
|
98
|
+
formAdapter: {} as FormAdapter
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Stepper description:
|
|
103
|
+
* Steps context that's manage multi steps using RHF as form provider
|
|
104
|
+
* Declaration: It MUST be wrapped into a RHF Form provider
|
|
105
|
+
*
|
|
106
|
+
* Process :
|
|
107
|
+
*
|
|
108
|
+
* 1) Init: form with the defaults values => go to step 0
|
|
109
|
+
*
|
|
110
|
+
* 2) Navigation:
|
|
111
|
+
* 1) we must request for a step (by clicking on goNext goBack goto) this will keep the navigation type (next, back, goto) and the In of the requested target step.
|
|
112
|
+
* 2) then we need to calculate the siblings: this will evaluate from the current navigation stepID the previous available step, the next available step, in order to be able to navigate after
|
|
113
|
+
* 3) We can decide here if we want to Execute Navigation OR Validate.
|
|
114
|
+
* Validation: this will first get all the steps fields,
|
|
115
|
+
* - then do a RHF.trigger (fields Collection) => will make a React Hook Forms Excplicit Validation for the given fields.
|
|
116
|
+
* - this will force RHF to update RHF.errors Collection that's used in the useEffect ... [errors, ...] below
|
|
117
|
+
* - in the useEffect we will store all the RHF metadata we need to compute the stepper state. => we dispatch those to the internal stepper store.
|
|
118
|
+
* - when RHF is validating it sets it's property isValidating to true. this is also triggering the previous useEffect in order to keep RHF stuffs in one go.
|
|
119
|
+
* - at this point in this useEffect we ONLY execute validation sequence if isValidating is true
|
|
120
|
+
* - the validation process will evaluate if the step is applicable, compare fields with the one from RHF and decide if the step is valid or not.
|
|
121
|
+
* - Here we should compute the sibling !
|
|
122
|
+
*
|
|
123
|
+
* Navigation schema;
|
|
124
|
+
*
|
|
125
|
+
* - the current step is invalid and the target step comes after.
|
|
126
|
+
* - the target step is locked / not applicable
|
|
127
|
+
*
|
|
128
|
+
* ===> [Cannot Navigate] ===> X
|
|
129
|
+
* //
|
|
130
|
+
* ||
|
|
131
|
+
* /\
|
|
132
|
+
* ===========> [GoTo Step] =======> < >
|
|
133
|
+
* / \/
|
|
134
|
+
* / ||
|
|
135
|
+
* from Init ===> [Navigation Request] =================> [Compute Sibling] == \\
|
|
136
|
+
* || /\ \\ ===> [Execute Navigation] ===> [Compute Sibling] ===> X
|
|
137
|
+
* \/ ||
|
|
138
|
+
* on validation RHF ==> [Update RHF Common] =======> [Validation]
|
|
139
|
+
*
|
|
140
|
+
*
|
|
141
|
+
* on click: GoNext/GoBack/GoTo ===> [Navigation Request]
|
|
142
|
+
* ===> [Clear Errors]
|
|
143
|
+
* ===> [Trigger RHF Validation] (will trigger async:[Update RHF Common])
|
|
144
|
+
*
|
|
145
|
+
* Navigation key points:
|
|
146
|
+
*
|
|
147
|
+
* - when a navigation request is set (above => #1) the process stores the navigation type and if (goto) the targeted stepId
|
|
148
|
+
* - if everthing is correct the navigation ca be executed otherwise the page remains the same.
|
|
149
|
+
* - the cases when the validation cannot be executed are mainly on forward (next and goto)
|
|
150
|
+
* - when targeted step is not applicable
|
|
151
|
+
* - or the current is not valid
|
|
152
|
+
* - or if the current is valid BUT the one before the targeted step is not valid. (in another words it stops if current is not valid or navigate to the very next invalid step if applicable)
|
|
153
|
+
* - backwards (goto / back) navigation are still possible only for applicable steps even if current and or the previous are valid or not.
|
|
154
|
+
* - Here we should compute the sibling !
|
|
155
|
+
*
|
|
156
|
+
*
|
|
157
|
+
* Submit process:
|
|
158
|
+
* - when the last step is reached the process wll display (send / submit button) instead of next.
|
|
159
|
+
* - On submit button the Stepper will validate the entire form within a promise, then if form is valid the pèromise is succeeded.
|
|
160
|
+
* - if success the passed handle submit function is invoked with the resule of the values.
|
|
161
|
+
* - as the stepper is agnostic, the stepper consumer component will take care of the submission process.
|
|
162
|
+
*
|
|
163
|
+
* - if rejected then the process stops. The previous validation result that are already displaying errors on the steps.
|
|
164
|
+
*
|
|
165
|
+
* Inputs :
|
|
166
|
+
*
|
|
167
|
+
* Default Values: the RHF default values that's also used by the reset process
|
|
168
|
+
* options: some configuration options
|
|
169
|
+
* submit form function which takes an object as parameter
|
|
170
|
+
*
|
|
171
|
+
* Outputs: Context methods that can be used by sub custom forms.
|
|
172
|
+
*
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
export interface StepperProps {
|
|
177
|
+
/** Form adapter - wraps any form library (RHF, Formik, etc.) */
|
|
178
|
+
formAdapter: FormAdapter
|
|
179
|
+
id: number
|
|
180
|
+
name: string
|
|
181
|
+
options: StepperOptions
|
|
182
|
+
children: React.ReactNode | React.ReactNode[]
|
|
183
|
+
submitMethod: CallableFunction
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const Stepper = ({
|
|
187
|
+
id,
|
|
188
|
+
formAdapter,
|
|
189
|
+
children,
|
|
190
|
+
options = { debug: false, enableFooterNavigation: false },
|
|
191
|
+
submitMethod
|
|
192
|
+
}: StepperProps): JSX.Element => {
|
|
193
|
+
const [stepperState, dispatch] = React.useReducer(stepperStateReducer, INITIAL_STEPPER_STATE)
|
|
194
|
+
const formState = formAdapter.getFormState()
|
|
195
|
+
const { errors, touchedFields, dirtyFields, isValidating, defaultValues } = formState
|
|
196
|
+
|
|
197
|
+
// This is used by the local storage process in order to refresh steps automatically on reloading,
|
|
198
|
+
// this is not used at the moment and will be enabled when localStorge will be reactivated.
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
200
|
+
const expectedSteps =
|
|
201
|
+
children &&
|
|
202
|
+
React.Children.toArray(children).filter((child) => React.isValidElement(child)).length
|
|
203
|
+
|
|
204
|
+
/** first action, position the stepper at the first step. */
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
// first make a navigation request
|
|
207
|
+
dispatch(newStepAction(StepperActionsKind.NAVIGATION_REQUEST, 0, 'goto'))
|
|
208
|
+
dispatch(newStepAction(StepperActionsKind.COMPUTE_SIBLING, 0, undefined))
|
|
209
|
+
}, [])
|
|
210
|
+
|
|
211
|
+
const localKey = 'accidentReportData'
|
|
212
|
+
|
|
213
|
+
/** Persist data */
|
|
214
|
+
const persistLocalData = (stepId: number) => {
|
|
215
|
+
if (!stepperState || !stepperState.steps || stepperState.steps.length === 0) return
|
|
216
|
+
// local storage key
|
|
217
|
+
const localStepKey = `${localKey}-${stepId}`
|
|
218
|
+
|
|
219
|
+
const step = stepperState.steps.find((o) => o.id === stepId)
|
|
220
|
+
if (!step) return
|
|
221
|
+
|
|
222
|
+
let dataBackupModel = {}
|
|
223
|
+
step.fields.forEach((field) => {
|
|
224
|
+
const fieldValue = formAdapter.getValues(field.name)
|
|
225
|
+
dataBackupModel = { ...dataBackupModel, [field.name]: fieldValue }
|
|
226
|
+
})
|
|
227
|
+
const stringified = JSON.stringify(dataBackupModel)
|
|
228
|
+
if (localStorage.getItem(localStepKey)) localStorage.removeItem(localStepKey)
|
|
229
|
+
localStorage.setItem(localStepKey, stringified)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** recover persisted data */
|
|
233
|
+
const recoverLocalData = (stepId: number): string[] => {
|
|
234
|
+
if (!stepperState || !stepperState.steps || stepperState.steps.length === 0) return []
|
|
235
|
+
// local storage key
|
|
236
|
+
const localStepKey = `${localKey}-${stepId}`
|
|
237
|
+
|
|
238
|
+
const step = stepperState.steps.find((o) => o.id === stepId)
|
|
239
|
+
if (!step) return []
|
|
240
|
+
|
|
241
|
+
try {
|
|
242
|
+
if (!localStorage.getItem(localStepKey)) return []
|
|
243
|
+
const localData = localStorage.getItem(localStepKey)
|
|
244
|
+
if (!localData) return []
|
|
245
|
+
const parsedModel = JSON.parse(localData)
|
|
246
|
+
if (!parsedModel) return []
|
|
247
|
+
|
|
248
|
+
Object.entries(parsedModel).forEach((field) => {
|
|
249
|
+
const localValue = field[1]
|
|
250
|
+
const dateValue = isDateLongFormatValid(field[1] as string)
|
|
251
|
+
|
|
252
|
+
if (localValue && dateValue) {
|
|
253
|
+
formAdapter.setValue(field[0], new Date(localValue as string), {
|
|
254
|
+
shouldDirty: true,
|
|
255
|
+
shouldTouch: true,
|
|
256
|
+
shouldValidate: true
|
|
257
|
+
})
|
|
258
|
+
} else {
|
|
259
|
+
formAdapter.setValue(field[0], localValue, {
|
|
260
|
+
shouldDirty: true,
|
|
261
|
+
shouldTouch: true,
|
|
262
|
+
shouldValidate: true
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
return Object.entries(parsedModel).map((o) => o[0]) as string[]
|
|
268
|
+
// localStorage.removeItem(localKey)
|
|
269
|
+
} catch (e) {
|
|
270
|
+
console.error(
|
|
271
|
+
`ACCIDENT REPORT: Error when trying to recover data from local storage ${e} `
|
|
272
|
+
)
|
|
273
|
+
return []
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** While validating do the following actions */
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
dispatch(
|
|
280
|
+
newStepAction(StepperActionsKind.UPDATE_RHF_COMMON, 0, {
|
|
281
|
+
errors,
|
|
282
|
+
touchedFields,
|
|
283
|
+
dirtyFields
|
|
284
|
+
} as FormCommon)
|
|
285
|
+
)
|
|
286
|
+
// if the process is in validation mode then
|
|
287
|
+
if (isValidating) {
|
|
288
|
+
dispatch(newStepAction(StepperActionsKind.COMPUTE_VALIDATION, 0, undefined))
|
|
289
|
+
dispatch(newStepAction(StepperActionsKind.COMPUTE_SIBLING, 0, undefined))
|
|
290
|
+
} else {
|
|
291
|
+
dispatch(newStepAction(StepperActionsKind.GO_TO_STEP, 0, undefined))
|
|
292
|
+
dispatch(newStepAction(StepperActionsKind.COMPUTE_SIBLING, 0, undefined))
|
|
293
|
+
}
|
|
294
|
+
}, [isValidating, errors])
|
|
295
|
+
|
|
296
|
+
/** Returns the step state by it's Id or all steps if nothing is provided */
|
|
297
|
+
const stepWatch = (id?: number): StepItem | StepItem[] | undefined => {
|
|
298
|
+
if (!stepperState || !stepperState.steps || stepperState.steps.length === 0)
|
|
299
|
+
return undefined
|
|
300
|
+
// use explicitely undefined because !id can also catch 0 be we need to have 0 as first ID
|
|
301
|
+
if (id === undefined) return stepperState.steps
|
|
302
|
+
return stepperState.steps.find((o) => o.id === id)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Returns the step state by it's Id or all steps if nothing is provided */
|
|
306
|
+
const getErrors = (id?: number): StepperError[] => {
|
|
307
|
+
if (!stepperState || !stepperState.errors || stepperState.errors.length === 0) return []
|
|
308
|
+
// use explicitely undefined because !id can also catch 0 be we need to have 0 as first ID
|
|
309
|
+
if (id === undefined) return stepperState.errors
|
|
310
|
+
return stepperState.errors.filter((o) => o.stepId === id)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** Register a fieds that should be tracked by the stepper as well it is tracked by RHF in the stepper collection
|
|
314
|
+
* As you may think that we could use the fields collection from RHF, RHF is not aware of what field is contained in which step.
|
|
315
|
+
* This methods does it that way.
|
|
316
|
+
*/
|
|
317
|
+
const registerField = (stepId: number, fields: string[]) => {
|
|
318
|
+
dispatch(newStepAction(StepperActionsKind.SET_FIELDS, stepId, fields))
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const setStepVisibility = (
|
|
322
|
+
ids: number[],
|
|
323
|
+
visible: boolean,
|
|
324
|
+
shouldSkip?: IStepAvailabilityTriggeredBy[]
|
|
325
|
+
) => {
|
|
326
|
+
if (!stepperState.steps.find((o) => ids.includes(o.id))) return
|
|
327
|
+
|
|
328
|
+
const idsToCompute =
|
|
329
|
+
shouldSkip && shouldSkip.length > 0
|
|
330
|
+
? [...getAllowedIds(ids, stepperState.dirtyFields, shouldSkip, formAdapter.getValues)]
|
|
331
|
+
: [...ids]
|
|
332
|
+
|
|
333
|
+
const stepsVisibility: StepsVisibility = { ids: idsToCompute, visible: visible }
|
|
334
|
+
dispatch(newStepAction(StepperActionsKind.SET_VISIBLE, id, stepsVisibility))
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** This will intent a RHF Validation and stepper validation aswell then combine both. */
|
|
338
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
339
|
+
const validate = async (mode: ValidationMode, key?: string | number) => {
|
|
340
|
+
let fields: string[] = []
|
|
341
|
+
|
|
342
|
+
const currentStepId =
|
|
343
|
+
stepperState && stepperState.currentStepId ? stepperState?.currentStepId : 0
|
|
344
|
+
|
|
345
|
+
// SELECT FIELDS TO VALIDATE
|
|
346
|
+
if (mode === 'all') {
|
|
347
|
+
fields = stepperState?.steps
|
|
348
|
+
// eslint-disable-next-line sonarjs/no-identical-functions
|
|
349
|
+
.reduce<string[]>((acc: string[], current: StepItem) => {
|
|
350
|
+
const outputCollection =
|
|
351
|
+
current && current.fields ? current?.fields?.map((o) => o.name) : []
|
|
352
|
+
return [...acc, ...outputCollection] as string[]
|
|
353
|
+
}, [])
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// SELECT FIELDS TO VALIDATE
|
|
357
|
+
if (mode === 'default') {
|
|
358
|
+
fields = stepperState?.steps
|
|
359
|
+
?.filter((o) => o.id === currentStepId)
|
|
360
|
+
// eslint-disable-next-line sonarjs/no-identical-functions
|
|
361
|
+
.reduce<string[]>((acc: string[], current: StepItem) => {
|
|
362
|
+
const outputCollection =
|
|
363
|
+
current && current.fields ? current?.fields?.map((o) => o.name) : []
|
|
364
|
+
return [...acc, ...outputCollection] as string[]
|
|
365
|
+
}, [])
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (mode === 'step' && key && typeof key === 'number') {
|
|
369
|
+
const step = stepperState?.steps?.find((o) => o.id === key)
|
|
370
|
+
if (step && step.fields) fields = step?.fields?.map((o) => o.name) as string[]
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (fields && fields.length > 0) {
|
|
374
|
+
dispatch(newStepAction(StepperActionsKind.CLEAR_ALL_ERRORS, -1, 0))
|
|
375
|
+
//await formAdapter.clearErrors([...fields])
|
|
376
|
+
runCustomValidatiors(currentStepId)
|
|
377
|
+
|
|
378
|
+
await formAdapter.trigger(fields)
|
|
379
|
+
} else {
|
|
380
|
+
await formAdapter.trigger()
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** Sets the default falue */
|
|
385
|
+
const setFieldDefaultValue = async (id: number, field: StepField) => {
|
|
386
|
+
if (!stepperState || !stepperState.steps) return
|
|
387
|
+
|
|
388
|
+
dispatch(newStepAction(StepperActionsKind.SET_FIELD_DEFAULT_VALUE, id, field))
|
|
389
|
+
await validate('default')
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** */
|
|
393
|
+
const setStepperDefaultValue = (defaultValue: StepperDefaultValue): void => {
|
|
394
|
+
dispatch(newStepAction(StepperActionsKind.SET_STEPPER_DEFAULT_VALUE, id, defaultValue))
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Intent to go to the step by the provided id */
|
|
398
|
+
const goToStep = async (id: number) => {
|
|
399
|
+
// this is a non sense to move toward the current step from the current step. So we skip it, avoid unusefully validation.
|
|
400
|
+
if (!stepperState || !stepperState.steps || stepperState.currentStepId === id) return
|
|
401
|
+
|
|
402
|
+
dispatch(newStepAction(StepperActionsKind.NAVIGATION_REQUEST, id, 'goto'))
|
|
403
|
+
await validate('default')
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Navigate backward of 1 step.
|
|
407
|
+
* If the boundary is hit, then it will stay where it is.
|
|
408
|
+
*/
|
|
409
|
+
const goBack = async () => {
|
|
410
|
+
dispatch(newStepAction(StepperActionsKind.NAVIGATION_REQUEST, 0, 'back'))
|
|
411
|
+
await validate('default')
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** Navigate forward of 1 step
|
|
415
|
+
* If the boundary is hit, then it will stay where it is.
|
|
416
|
+
*/
|
|
417
|
+
const goNext = async () => {
|
|
418
|
+
dispatch(newStepAction(StepperActionsKind.NAVIGATION_REQUEST, 0, 'next'))
|
|
419
|
+
await validate('default')
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** Navigate forward of 1 step
|
|
423
|
+
* adds a custom error to the stepper context
|
|
424
|
+
*/
|
|
425
|
+
const setError = (stepId: number, fieldName: string, message: string) => {
|
|
426
|
+
const stepperError: StepperError = {
|
|
427
|
+
stepId,
|
|
428
|
+
fieldName,
|
|
429
|
+
error: { name: fieldName, message: message } as Error
|
|
430
|
+
}
|
|
431
|
+
dispatch(newStepAction(StepperActionsKind.ADD_ERROR, id, stepperError))
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Navigate forward of 1 step
|
|
435
|
+
* reset a custom error to the stepper context
|
|
436
|
+
*/
|
|
437
|
+
const unSetError = (stepId: number, fieldName: string) => {
|
|
438
|
+
dispatch(newStepAction(StepperActionsKind.REMOVE_ERROR, id, fieldName))
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** Navigate forward of 1 step
|
|
442
|
+
* reset all custom error from the stepper context
|
|
443
|
+
* if an ID is provided, only related errors will be removed
|
|
444
|
+
*/
|
|
445
|
+
const removeAllCustomErrors = (id?: number) => {
|
|
446
|
+
if (!stepperState || !stepperState.steps || !stepperState.steps.find((o) => o.id === id))
|
|
447
|
+
return
|
|
448
|
+
const targetStep = stepperState.steps.find((o) => o.id === id) as StepItem
|
|
449
|
+
dispatch(
|
|
450
|
+
newStepAction(
|
|
451
|
+
StepperActionsKind.CLEAR_ALL_ERRORS,
|
|
452
|
+
targetStep ? targetStep.id : -1,
|
|
453
|
+
undefined
|
|
454
|
+
)
|
|
455
|
+
)
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
useEffect(() => {
|
|
459
|
+
// will not submit if the form is not valid
|
|
460
|
+
if (!stepperState.submitRequest || !stepperState.isValid) return
|
|
461
|
+
const values = formAdapter.getValues()
|
|
462
|
+
submitMethod(values)
|
|
463
|
+
}, [stepperState.isValid, stepperState.submitRequest])
|
|
464
|
+
|
|
465
|
+
/** Intent a validation before submit. */
|
|
466
|
+
const submitForm = async () => {
|
|
467
|
+
await validate('default')
|
|
468
|
+
// toggle submit request and remove it rightAfter
|
|
469
|
+
dispatch(newStepAction(StepperActionsKind.SUBMIT_REQUEST, id, true))
|
|
470
|
+
setTimeout(() => {
|
|
471
|
+
dispatch(newStepAction(StepperActionsKind.SUBMIT_REQUEST, id, false))
|
|
472
|
+
}, 5)
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** Will intent to reset the entire form */
|
|
476
|
+
const resetForm = async (id?: number) => {
|
|
477
|
+
if (id === undefined) {
|
|
478
|
+
dispatch(newStepAction(StepperActionsKind.RESET, 0, ''))
|
|
479
|
+
formAdapter.reset(defaultValues)
|
|
480
|
+
return
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const step = stepperState.steps.find((o) => o.id === id)
|
|
484
|
+
if (!step || step.fields === undefined || step.fields.length === 0) return
|
|
485
|
+
|
|
486
|
+
const fields = step.fields.map((o) => o.name)
|
|
487
|
+
fields.forEach((o) => {
|
|
488
|
+
formAdapter.resetField(o)
|
|
489
|
+
formAdapter.clearErrors(o)
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
dispatch(newStepAction(StepperActionsKind.REMOVE_ERROR, id, {}))
|
|
493
|
+
await formAdapter.trigger(fields)
|
|
494
|
+
// dispatch(newStepAction(StepperActionsKind.COMPUTE_VALIDATION, id, undefined))
|
|
495
|
+
// dispatch(newStepAction(StepperActionsKind.COMPUTE_SIBLING, id, undefined))
|
|
496
|
+
}
|
|
497
|
+
/** Enable a specific step and trigger validation */
|
|
498
|
+
const enableStep = async (id: number) => {
|
|
499
|
+
const step = stepperState.steps.find((o) => o.id === id)
|
|
500
|
+
if (!step || step.fields === undefined || step.fields.length === 0) return
|
|
501
|
+
const fields = step.fields.map((o) => o.name)
|
|
502
|
+
await formAdapter.trigger(fields)
|
|
503
|
+
dispatch(newStepAction(StepperActionsKind.COMPUTE_VALIDATION, id, undefined))
|
|
504
|
+
dispatch(newStepAction(StepperActionsKind.COMPUTE_SIBLING, id, undefined))
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
const getBooleanString = (val: boolean) => (val ? 'true' : 'false')
|
|
508
|
+
|
|
509
|
+
/** Returns the summary of all user input data */
|
|
510
|
+
const getSummary = (): Summary[] => {
|
|
511
|
+
const values = formAdapter.getValues()
|
|
512
|
+
if (!values) return []
|
|
513
|
+
const output: Summary[] = []
|
|
514
|
+
Object.entries(values).forEach((val) => {
|
|
515
|
+
try {
|
|
516
|
+
let value = ''
|
|
517
|
+
if (typeof val[1] === 'boolean') {
|
|
518
|
+
value = val[1] ? getBooleanString(val[1]) : 'bool undefined'
|
|
519
|
+
} else if (
|
|
520
|
+
val[1] instanceof Date &&
|
|
521
|
+
isDateFormatValidDDMMYYYY(formatDate(val[1]))
|
|
522
|
+
) {
|
|
523
|
+
value = formatDate(val[1])
|
|
524
|
+
} else {
|
|
525
|
+
value = val[1] as string
|
|
526
|
+
}
|
|
527
|
+
output.push({ name: val[0], value } as Summary)
|
|
528
|
+
} catch (e) {
|
|
529
|
+
//TODO Error ?
|
|
530
|
+
}
|
|
531
|
+
})
|
|
532
|
+
return output
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** custom validators are used when there is association within many fields which has no direct correlation known by RHF
|
|
536
|
+
* in these case we cannot set many times a validation in rules even more if we need to compare many values from many sources.
|
|
537
|
+
*/
|
|
538
|
+
const setCustomValidators = (customValidators: CustomValidation[]) => {
|
|
539
|
+
dispatch(newStepAction(StepperActionsKind.ADD_CUSTOM_VALIDATORS, id, customValidators))
|
|
540
|
+
}
|
|
541
|
+
/** This will run all setted custom validations */
|
|
542
|
+
const runCustomValidatiors = (currentStepId: number) => {
|
|
543
|
+
if (
|
|
544
|
+
!stepperState ||
|
|
545
|
+
!stepperState.customValidators ||
|
|
546
|
+
stepperState.customValidators.length === 0
|
|
547
|
+
)
|
|
548
|
+
return
|
|
549
|
+
stepperState.customValidators
|
|
550
|
+
.filter((o) => o.stepId === currentStepId)
|
|
551
|
+
.forEach((o) => {
|
|
552
|
+
o.method()
|
|
553
|
+
})
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/** Returns the context's methods */
|
|
557
|
+
const exposeContext = {
|
|
558
|
+
currentState: () => stepperState, // The current internal stepper reducer instance
|
|
559
|
+
watchSiblings: () => stepperState?.sibling, // The step sibling states (which are current step, next, previous, can go, etc... use this to access the step instance)
|
|
560
|
+
stepWatch, // This will watch one step if id is provided or all steps if nothing. Same result as stepperState.steps(o => o.id === ...) or just stepperState.steps
|
|
561
|
+
registerField, // This is required only once at the stepper builds. This method will let the stepper aware of the step itself if it's a part of the collection.
|
|
562
|
+
setFieldDefaultValue, // This is valuable when using components requiring an external managed default value. reference: @StepField
|
|
563
|
+
setCustomValidators, // Will add custom validators to the collection
|
|
564
|
+
setStepVisibility, // Will set the visibility true or false of a given step id
|
|
565
|
+
goToStep, // This will intent the navigation to a step.
|
|
566
|
+
goBack, // This will intent the navigation backward of 1, if the boundary is hit, then it will stay where it is.
|
|
567
|
+
goNext, // This will intent the navigation forsward of 1, if the boundary is hit, then it will stay where it is.
|
|
568
|
+
resetForm, // This will intent the complete form reset
|
|
569
|
+
enableStep, // Enable specific step
|
|
570
|
+
errors: getErrors, // This will provide the current error state collection.
|
|
571
|
+
setError, // This will add a custom error
|
|
572
|
+
submit: submitForm, // This will submit the form
|
|
573
|
+
unSetError, // This will remove a specific custom error
|
|
574
|
+
removeAllCustomErrors, // remove all custom errors
|
|
575
|
+
validate, // This will trigger a validaton. The mode targets the to target
|
|
576
|
+
dispatch, // STEPPER REDUCER: dispatch directly to the internal stepper reducer
|
|
577
|
+
summary: getSummary, // returns Summary of all inputs values
|
|
578
|
+
setStepperDefaultValue, // This can store default values to be (re)used
|
|
579
|
+
persistLocalData, // persist data into local storage
|
|
580
|
+
recoverLocalData, // recover data from local storage
|
|
581
|
+
formAdapter // Form adapter for accessing form library methods
|
|
582
|
+
} as StepperContext
|
|
583
|
+
|
|
584
|
+
return (
|
|
585
|
+
<StepperCtx.Provider value={exposeContext}>
|
|
586
|
+
<div className={'stepper-frame'}>
|
|
587
|
+
<StepperHeader debug={options.debug} />
|
|
588
|
+
|
|
589
|
+
<div className={'stepper-content'}>
|
|
590
|
+
<div className="stepper-content-steps">{children}</div>
|
|
591
|
+
</div>
|
|
592
|
+
|
|
593
|
+
{options && options.enableFooterNavigation && <StepperFooter />}
|
|
594
|
+
|
|
595
|
+
{options && options.debug && <StepperDebug />}
|
|
596
|
+
</div>
|
|
597
|
+
</StepperCtx.Provider>
|
|
598
|
+
)
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export const useStepperContext = (): StepperContext => {
|
|
602
|
+
return React.useContext(StepperCtx)
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export default Stepper
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './step.css'
|
|
2
|
+
|
|
3
|
+
import { Col, Container, Row } from 'react-bootstrap'
|
|
4
|
+
|
|
5
|
+
import StepperFooter from './components/StepperFooter'
|
|
6
|
+
import { useStepperContext } from './Stepper'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*Step description:
|
|
10
|
+
*/
|
|
11
|
+
const StepperSummary = (): JSX.Element => {
|
|
12
|
+
const { summary } = useStepperContext()
|
|
13
|
+
const summaryData = summary()
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div style={{ display: 'flex', flexDirection: 'column'}}>
|
|
17
|
+
<Container className="av-travel-details-block bg-white m-bottom-32 bc-gray100">
|
|
18
|
+
{summaryData &&
|
|
19
|
+
summaryData.map((s, i) => {
|
|
20
|
+
{
|
|
21
|
+
return (
|
|
22
|
+
<Row key={i} className="justify-content-start m-bottom-48">
|
|
23
|
+
<Col className={'bg-gray100'}>{s.name}</Col>
|
|
24
|
+
<Col>{s.value}</Col>
|
|
25
|
+
</Row>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
})}
|
|
29
|
+
</Container>
|
|
30
|
+
|
|
31
|
+
<StepperFooter />
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default StepperSummary
|