@portnet/ui 5.0.27 → 6.0.0
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 +524 -0
- package/README.md +101 -38
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +174 -203
- package/dist/index.js.map +1 -0
- package/dist/v2/__tests__/MobileRowCard.test.js +337 -0
- package/dist/v2/__tests__/MobileRowCard.test.js.map +1 -0
- package/dist/v2/__tests__/apiError.test.js +182 -0
- package/dist/v2/__tests__/apiError.test.js.map +1 -0
- package/dist/v2/__tests__/banned-patterns.test.js +272 -0
- package/dist/v2/__tests__/banned-patterns.test.js.map +1 -0
- package/dist/v2/__tests__/contrast-palette.test.js +225 -0
- package/dist/v2/__tests__/contrast-palette.test.js.map +1 -0
- package/dist/v2/__tests__/cssVariables.test.js +158 -0
- package/dist/v2/__tests__/cssVariables.test.js.map +1 -0
- package/dist/v2/__tests__/labels-merge.test.js +153 -0
- package/dist/v2/__tests__/labels-merge.test.js.map +1 -0
- package/dist/v2/__tests__/locale-fallback.test.js +111 -0
- package/dist/v2/__tests__/locale-fallback.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusTrap.test.js +517 -0
- package/dist/v2/__tests__/useFocusTrap.test.js.map +1 -0
- package/dist/v2/components/Accordion.d.ts +56 -0
- package/dist/v2/components/Accordion.d.ts.map +1 -0
- package/dist/v2/components/Accordion.js +238 -0
- package/dist/v2/components/Accordion.js.map +1 -0
- package/dist/v2/components/ActionStrip.d.ts +67 -0
- package/dist/v2/components/ActionStrip.d.ts.map +1 -0
- package/dist/v2/components/ActionStrip.js +154 -0
- package/dist/v2/components/ActionStrip.js.map +1 -0
- package/dist/v2/components/Banner.d.ts +49 -0
- package/dist/v2/components/Banner.d.ts.map +1 -0
- package/dist/v2/components/Banner.js +183 -0
- package/dist/v2/components/Banner.js.map +1 -0
- package/dist/v2/components/Busy.d.ts +18 -0
- package/dist/v2/components/Busy.d.ts.map +1 -0
- package/dist/v2/components/Busy.js +104 -0
- package/dist/v2/components/Busy.js.map +1 -0
- package/dist/v2/components/Button.d.ts +36 -0
- package/dist/v2/components/Button.d.ts.map +1 -0
- package/dist/v2/components/Button.js +122 -0
- package/dist/v2/components/Button.js.map +1 -0
- package/dist/v2/components/CategoryTag.d.ts +45 -0
- package/dist/v2/components/CategoryTag.d.ts.map +1 -0
- package/dist/v2/components/CategoryTag.js +89 -0
- package/dist/v2/components/CategoryTag.js.map +1 -0
- package/dist/v2/components/Checkbox.d.ts +59 -0
- package/dist/v2/components/Checkbox.d.ts.map +1 -0
- package/dist/v2/components/Checkbox.js +134 -0
- package/dist/v2/components/Checkbox.js.map +1 -0
- package/dist/v2/components/Chip.d.ts +48 -0
- package/dist/v2/components/Chip.d.ts.map +1 -0
- package/dist/v2/components/Chip.js +131 -0
- package/dist/v2/components/Chip.js.map +1 -0
- package/dist/v2/components/Combobox.d.ts +134 -0
- package/dist/v2/components/Combobox.d.ts.map +1 -0
- package/dist/v2/components/Combobox.js +399 -0
- package/dist/v2/components/Combobox.js.map +1 -0
- package/dist/v2/components/CommandPalette.d.ts +36 -0
- package/dist/v2/components/CommandPalette.d.ts.map +1 -0
- package/dist/v2/components/CommandPalette.js +672 -0
- package/dist/v2/components/CommandPalette.js.map +1 -0
- package/dist/v2/components/ConfirmDialog.d.ts +23 -0
- package/dist/v2/components/ConfirmDialog.d.ts.map +1 -0
- package/dist/v2/components/ConfirmDialog.js +150 -0
- package/dist/v2/components/ConfirmDialog.js.map +1 -0
- package/dist/v2/components/DatePicker.d.ts +21 -0
- package/dist/v2/components/DatePicker.d.ts.map +1 -0
- package/dist/v2/components/DatePicker.js +207 -0
- package/dist/v2/components/DatePicker.js.map +1 -0
- package/dist/v2/components/DateRangePicker.d.ts +81 -0
- package/dist/v2/components/DateRangePicker.d.ts.map +1 -0
- package/dist/v2/components/DateRangePicker.js +295 -0
- package/dist/v2/components/DateRangePicker.js.map +1 -0
- package/dist/v2/components/DateTimePicker.d.ts +21 -0
- package/dist/v2/components/DateTimePicker.d.ts.map +1 -0
- package/dist/v2/components/DateTimePicker.js +189 -0
- package/dist/v2/components/DateTimePicker.js.map +1 -0
- package/dist/v2/components/Drawer.d.ts +34 -0
- package/dist/v2/components/Drawer.d.ts.map +1 -0
- package/dist/v2/components/Drawer.js +339 -0
- package/dist/v2/components/Drawer.js.map +1 -0
- package/dist/v2/components/Dropzone.d.ts +150 -0
- package/dist/v2/components/Dropzone.d.ts.map +1 -0
- package/dist/v2/components/Dropzone.js +539 -0
- package/dist/v2/components/Dropzone.js.map +1 -0
- package/dist/v2/components/EmptyState.d.ts +36 -0
- package/dist/v2/components/EmptyState.d.ts.map +1 -0
- package/dist/v2/components/EmptyState.js +112 -0
- package/dist/v2/components/EmptyState.js.map +1 -0
- package/dist/v2/components/FavoriteToggle.d.ts +22 -0
- package/dist/v2/components/FavoriteToggle.d.ts.map +1 -0
- package/dist/v2/components/FavoriteToggle.js +134 -0
- package/dist/v2/components/FavoriteToggle.js.map +1 -0
- package/dist/v2/components/Field.d.ts +58 -0
- package/dist/v2/components/Field.d.ts.map +1 -0
- package/dist/v2/components/Field.js +186 -0
- package/dist/v2/components/Field.js.map +1 -0
- package/dist/v2/components/FieldHelp.d.ts +54 -0
- package/dist/v2/components/FieldHelp.d.ts.map +1 -0
- package/dist/v2/components/FieldHelp.js +209 -0
- package/dist/v2/components/FieldHelp.js.map +1 -0
- package/dist/v2/components/FilterTab.d.ts +35 -0
- package/dist/v2/components/FilterTab.d.ts.map +1 -0
- package/dist/v2/components/FilterTab.js +144 -0
- package/dist/v2/components/FilterTab.js.map +1 -0
- package/dist/v2/components/ForbiddenPage.d.ts +40 -0
- package/dist/v2/components/ForbiddenPage.d.ts.map +1 -0
- package/dist/v2/components/ForbiddenPage.js +81 -0
- package/dist/v2/components/ForbiddenPage.js.map +1 -0
- package/dist/v2/components/FormGrid.d.ts +76 -0
- package/dist/v2/components/FormGrid.d.ts.map +1 -0
- package/dist/v2/components/FormGrid.js +177 -0
- package/dist/v2/components/FormGrid.js.map +1 -0
- package/dist/v2/components/FormikDisplay.d.ts +38 -0
- package/dist/v2/components/FormikDisplay.d.ts.map +1 -0
- package/dist/v2/components/FormikDisplay.js +125 -0
- package/dist/v2/components/FormikDisplay.js.map +1 -0
- package/dist/v2/components/Input.d.ts +62 -0
- package/dist/v2/components/Input.d.ts.map +1 -0
- package/dist/v2/components/Input.js +115 -0
- package/dist/v2/components/Input.js.map +1 -0
- package/dist/v2/components/KPICard.d.ts +22 -0
- package/dist/v2/components/KPICard.d.ts.map +1 -0
- package/dist/v2/components/KPICard.js +205 -0
- package/dist/v2/components/KPICard.js.map +1 -0
- package/dist/v2/components/KV.d.ts +25 -0
- package/dist/v2/components/KV.d.ts.map +1 -0
- package/dist/v2/components/KV.js +82 -0
- package/dist/v2/components/KV.js.map +1 -0
- package/dist/v2/components/KVGrid.d.ts +44 -0
- package/dist/v2/components/KVGrid.d.ts.map +1 -0
- package/dist/v2/components/KVGrid.js +73 -0
- package/dist/v2/components/KVGrid.js.map +1 -0
- package/dist/v2/components/Layout.d.ts +78 -0
- package/dist/v2/components/Layout.d.ts.map +1 -0
- package/dist/v2/components/Layout.js +284 -0
- package/dist/v2/components/Layout.js.map +1 -0
- package/dist/v2/components/MobileRowCard.d.ts +63 -0
- package/dist/v2/components/MobileRowCard.d.ts.map +1 -0
- package/dist/v2/components/MobileRowCard.js +321 -0
- package/dist/v2/components/MobileRowCard.js.map +1 -0
- package/dist/v2/components/Modal.d.ts +21 -0
- package/dist/v2/components/Modal.d.ts.map +1 -0
- package/dist/v2/components/Modal.js +281 -0
- package/dist/v2/components/Modal.js.map +1 -0
- package/dist/v2/components/NetworkErrorPage.d.ts +11 -0
- package/dist/v2/components/NetworkErrorPage.d.ts.map +1 -0
- package/dist/v2/components/NetworkErrorPage.js +86 -0
- package/dist/v2/components/NetworkErrorPage.js.map +1 -0
- package/dist/v2/components/NotFoundPage.d.ts +9 -0
- package/dist/v2/components/NotFoundPage.d.ts.map +1 -0
- package/dist/v2/components/NotFoundPage.js +66 -0
- package/dist/v2/components/NotFoundPage.js.map +1 -0
- package/dist/v2/components/NumberInput.d.ts +83 -0
- package/dist/v2/components/NumberInput.d.ts.map +1 -0
- package/dist/v2/components/NumberInput.js +316 -0
- package/dist/v2/components/NumberInput.js.map +1 -0
- package/dist/v2/components/OverflowMenu.d.ts +55 -0
- package/dist/v2/components/OverflowMenu.d.ts.map +1 -0
- package/dist/v2/components/OverflowMenu.js +196 -0
- package/dist/v2/components/OverflowMenu.js.map +1 -0
- package/dist/v2/components/PdfViewer.d.ts +56 -0
- package/dist/v2/components/PdfViewer.d.ts.map +1 -0
- package/dist/v2/components/PdfViewer.js +132 -0
- package/dist/v2/components/PdfViewer.js.map +1 -0
- package/dist/v2/components/ProgressBar.d.ts +53 -0
- package/dist/v2/components/ProgressBar.d.ts.map +1 -0
- package/dist/v2/components/ProgressBar.js +209 -0
- package/dist/v2/components/ProgressBar.js.map +1 -0
- package/dist/v2/components/Radio.d.ts +78 -0
- package/dist/v2/components/Radio.d.ts.map +1 -0
- package/dist/v2/components/Radio.js +238 -0
- package/dist/v2/components/Radio.js.map +1 -0
- package/dist/v2/components/SectionHeader.d.ts +53 -0
- package/dist/v2/components/SectionHeader.d.ts.map +1 -0
- package/dist/v2/components/SectionHeader.js +140 -0
- package/dist/v2/components/SectionHeader.js.map +1 -0
- package/dist/v2/components/Segmented.d.ts +61 -0
- package/dist/v2/components/Segmented.d.ts.map +1 -0
- package/dist/v2/components/Segmented.js +261 -0
- package/dist/v2/components/Segmented.js.map +1 -0
- package/dist/v2/components/Select.d.ts +72 -0
- package/dist/v2/components/Select.d.ts.map +1 -0
- package/dist/v2/components/Select.js +382 -0
- package/dist/v2/components/Select.js.map +1 -0
- package/dist/v2/components/ServerErrorPage.d.ts +11 -0
- package/dist/v2/components/ServerErrorPage.d.ts.map +1 -0
- package/dist/v2/components/ServerErrorPage.js +82 -0
- package/dist/v2/components/ServerErrorPage.js.map +1 -0
- package/dist/v2/components/Skeleton.d.ts +56 -0
- package/dist/v2/components/Skeleton.d.ts.map +1 -0
- package/dist/v2/components/Skeleton.js +281 -0
- package/dist/v2/components/Skeleton.js.map +1 -0
- package/dist/v2/components/SkipLink.d.ts +30 -0
- package/dist/v2/components/SkipLink.d.ts.map +1 -0
- package/dist/v2/components/SkipLink.js +58 -0
- package/dist/v2/components/SkipLink.js.map +1 -0
- package/dist/v2/components/Spinner.d.ts +40 -0
- package/dist/v2/components/Spinner.d.ts.map +1 -0
- package/dist/v2/components/Spinner.js +76 -0
- package/dist/v2/components/Spinner.js.map +1 -0
- package/dist/v2/components/Status.d.ts +42 -0
- package/dist/v2/components/Status.d.ts.map +1 -0
- package/dist/v2/components/Status.js +71 -0
- package/dist/v2/components/Status.js.map +1 -0
- package/dist/v2/components/Stepper.d.ts +136 -0
- package/dist/v2/components/Stepper.d.ts.map +1 -0
- package/dist/v2/components/Stepper.js +415 -0
- package/dist/v2/components/Stepper.js.map +1 -0
- package/dist/v2/components/Switch.d.ts +30 -0
- package/dist/v2/components/Switch.d.ts.map +1 -0
- package/dist/v2/components/Switch.js +136 -0
- package/dist/v2/components/Switch.js.map +1 -0
- package/dist/v2/components/Tabs.d.ts +49 -0
- package/dist/v2/components/Tabs.d.ts.map +1 -0
- package/dist/v2/components/Tabs.js +160 -0
- package/dist/v2/components/Tabs.js.map +1 -0
- package/dist/v2/components/TelInput.d.ts +33 -0
- package/dist/v2/components/TelInput.d.ts.map +1 -0
- package/dist/v2/components/TelInput.js +282 -0
- package/dist/v2/components/TelInput.js.map +1 -0
- package/dist/v2/components/Textarea.d.ts +23 -0
- package/dist/v2/components/Textarea.d.ts.map +1 -0
- package/dist/v2/components/Textarea.js +80 -0
- package/dist/v2/components/Textarea.js.map +1 -0
- package/dist/v2/components/TimePicker.d.ts +21 -0
- package/dist/v2/components/TimePicker.d.ts.map +1 -0
- package/dist/v2/components/TimePicker.js +141 -0
- package/dist/v2/components/TimePicker.js.map +1 -0
- package/dist/v2/components/Toast.d.ts +32 -0
- package/dist/v2/components/Toast.d.ts.map +1 -0
- package/dist/v2/components/Toast.js +384 -0
- package/dist/v2/components/Toast.js.map +1 -0
- package/dist/v2/components/Tooltip.d.ts +9 -0
- package/dist/v2/components/Tooltip.d.ts.map +1 -0
- package/dist/v2/components/Tooltip.js +169 -0
- package/dist/v2/components/Tooltip.js.map +1 -0
- package/dist/v2/components/_ErrorPageBody.d.ts +48 -0
- package/dist/v2/components/_ErrorPageBody.d.ts.map +1 -0
- package/dist/v2/components/_ErrorPageBody.js +96 -0
- package/dist/v2/components/_ErrorPageBody.js.map +1 -0
- package/dist/v2/components/_pickerShared.d.ts +47 -0
- package/dist/v2/components/_pickerShared.d.ts.map +1 -0
- package/dist/v2/components/_pickerShared.js +68 -0
- package/dist/v2/components/_pickerShared.js.map +1 -0
- package/dist/v2/components/index.d.ts +83 -0
- package/dist/v2/components/index.d.ts.map +1 -0
- package/dist/v2/components/index.js +477 -0
- package/dist/v2/components/index.js.map +1 -0
- package/dist/v2/hooks/index.d.ts +11 -0
- package/dist/v2/hooks/index.d.ts.map +1 -0
- package/dist/v2/hooks/index.js +85 -0
- package/dist/v2/hooks/index.js.map +1 -0
- package/dist/v2/hooks/useDelayedFlag.d.ts +22 -0
- package/dist/v2/hooks/useDelayedFlag.d.ts.map +1 -0
- package/dist/v2/hooks/useDelayedFlag.js +60 -0
- package/dist/v2/hooks/useDelayedFlag.js.map +1 -0
- package/dist/v2/hooks/useDensity.d.ts +23 -0
- package/dist/v2/hooks/useDensity.d.ts.map +1 -0
- package/dist/v2/hooks/useDensity.js +124 -0
- package/dist/v2/hooks/useDensity.js.map +1 -0
- package/dist/v2/hooks/useFocusFirstError.d.ts +121 -0
- package/dist/v2/hooks/useFocusFirstError.d.ts.map +1 -0
- package/dist/v2/hooks/useFocusFirstError.js +203 -0
- package/dist/v2/hooks/useFocusFirstError.js.map +1 -0
- package/dist/v2/hooks/useFocusTrap.d.ts +3 -0
- package/dist/v2/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/v2/hooks/useFocusTrap.js +207 -0
- package/dist/v2/hooks/useFocusTrap.js.map +1 -0
- package/dist/v2/hooks/useFormAutoSave.d.ts +42 -0
- package/dist/v2/hooks/useFormAutoSave.d.ts.map +1 -0
- package/dist/v2/hooks/useFormAutoSave.js +186 -0
- package/dist/v2/hooks/useFormAutoSave.js.map +1 -0
- package/dist/v2/hooks/useFormCompletionProgress.d.ts +52 -0
- package/dist/v2/hooks/useFormCompletionProgress.d.ts.map +1 -0
- package/dist/v2/hooks/useFormCompletionProgress.js +136 -0
- package/dist/v2/hooks/useFormCompletionProgress.js.map +1 -0
- package/dist/v2/hooks/useResolvedDensity.d.ts +31 -0
- package/dist/v2/hooks/useResolvedDensity.d.ts.map +1 -0
- package/dist/v2/hooks/useResolvedDensity.js +50 -0
- package/dist/v2/hooks/useResolvedDensity.js.map +1 -0
- package/dist/v2/hooks/useSortedRows.d.ts +25 -0
- package/dist/v2/hooks/useSortedRows.d.ts.map +1 -0
- package/dist/v2/hooks/useSortedRows.js +38 -0
- package/dist/v2/hooks/useSortedRows.js.map +1 -0
- package/dist/v2/hooks/useTabLoading.d.ts +39 -0
- package/dist/v2/hooks/useTabLoading.d.ts.map +1 -0
- package/dist/v2/hooks/useTabLoading.js +85 -0
- package/dist/v2/hooks/useTabLoading.js.map +1 -0
- package/dist/v2/index.d.ts +115 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.js +1127 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v2/modalContext.d.ts +96 -0
- package/dist/v2/modalContext.d.ts.map +1 -0
- package/dist/v2/modalContext.js +113 -0
- package/dist/v2/modalContext.js.map +1 -0
- package/dist/v2/models/favorite.d.ts +14 -0
- package/dist/v2/models/favorite.d.ts.map +1 -0
- package/dist/v2/models/favorite.js +6 -0
- package/dist/v2/models/favorite.js.map +1 -0
- package/dist/v2/models/index.d.ts +11 -0
- package/dist/v2/models/index.d.ts.map +1 -0
- package/dist/v2/models/index.js +50 -0
- package/dist/v2/models/index.js.map +1 -0
- package/dist/v2/models/personalization.d.ts +65 -0
- package/dist/v2/models/personalization.d.ts.map +1 -0
- package/dist/v2/models/personalization.js +6 -0
- package/dist/v2/models/personalization.js.map +1 -0
- package/dist/v2/models/referentiel.d.ts +67 -0
- package/dist/v2/models/referentiel.d.ts.map +1 -0
- package/dist/v2/models/referentiel.js +6 -0
- package/dist/v2/models/referentiel.js.map +1 -0
- package/dist/v2/models/savedFilter.d.ts +22 -0
- package/dist/v2/models/savedFilter.d.ts.map +1 -0
- package/dist/v2/models/savedFilter.js +6 -0
- package/dist/v2/models/savedFilter.js.map +1 -0
- package/dist/v2/patterns/ActionBar.d.ts +137 -0
- package/dist/v2/patterns/ActionBar.d.ts.map +1 -0
- package/dist/v2/patterns/ActionBar.js +601 -0
- package/dist/v2/patterns/ActionBar.js.map +1 -0
- package/dist/v2/patterns/BulkActionBar.d.ts +63 -0
- package/dist/v2/patterns/BulkActionBar.d.ts.map +1 -0
- package/dist/v2/patterns/BulkActionBar.js +153 -0
- package/dist/v2/patterns/BulkActionBar.js.map +1 -0
- package/dist/v2/patterns/CollapsibleDataGrid.d.ts +62 -0
- package/dist/v2/patterns/CollapsibleDataGrid.d.ts.map +1 -0
- package/dist/v2/patterns/CollapsibleDataGrid.js +306 -0
- package/dist/v2/patterns/CollapsibleDataGrid.js.map +1 -0
- package/dist/v2/patterns/ColumnsToggle.d.ts +55 -0
- package/dist/v2/patterns/ColumnsToggle.d.ts.map +1 -0
- package/dist/v2/patterns/ColumnsToggle.js +314 -0
- package/dist/v2/patterns/ColumnsToggle.js.map +1 -0
- package/dist/v2/patterns/DataGrid.d.ts +7 -0
- package/dist/v2/patterns/DataGrid.d.ts.map +1 -0
- package/dist/v2/patterns/DataGrid.js +834 -0
- package/dist/v2/patterns/DataGrid.js.map +1 -0
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts +68 -0
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts.map +1 -0
- package/dist/v2/patterns/DataGridSettingsMenu.js +381 -0
- package/dist/v2/patterns/DataGridSettingsMenu.js.map +1 -0
- package/dist/v2/patterns/DataGridToolbar.d.ts +81 -0
- package/dist/v2/patterns/DataGridToolbar.d.ts.map +1 -0
- package/dist/v2/patterns/DataGridToolbar.js +255 -0
- package/dist/v2/patterns/DataGridToolbar.js.map +1 -0
- package/dist/v2/patterns/DataGridVirtualized.d.ts +76 -0
- package/dist/v2/patterns/DataGridVirtualized.d.ts.map +1 -0
- package/dist/v2/patterns/DataGridVirtualized.js +528 -0
- package/dist/v2/patterns/DataGridVirtualized.js.map +1 -0
- package/dist/v2/patterns/DeleteResourceConfirmDialog.d.ts +46 -0
- package/dist/v2/patterns/DeleteResourceConfirmDialog.d.ts.map +1 -0
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js +77 -0
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -0
- package/dist/v2/patterns/FavoriteColumn.d.ts +72 -0
- package/dist/v2/patterns/FavoriteColumn.d.ts.map +1 -0
- package/dist/v2/patterns/FavoriteColumn.js +171 -0
- package/dist/v2/patterns/FavoriteColumn.js.map +1 -0
- package/dist/v2/patterns/FavoritesFilter.d.ts +51 -0
- package/dist/v2/patterns/FavoritesFilter.d.ts.map +1 -0
- package/dist/v2/patterns/FavoritesFilter.js +97 -0
- package/dist/v2/patterns/FavoritesFilter.js.map +1 -0
- package/dist/v2/patterns/FormErrorSummary.d.ts +39 -0
- package/dist/v2/patterns/FormErrorSummary.d.ts.map +1 -0
- package/dist/v2/patterns/FormErrorSummary.js +111 -0
- package/dist/v2/patterns/FormErrorSummary.js.map +1 -0
- package/dist/v2/patterns/FormPageShell.d.ts +55 -0
- package/dist/v2/patterns/FormPageShell.d.ts.map +1 -0
- package/dist/v2/patterns/FormPageShell.js +133 -0
- package/dist/v2/patterns/FormPageShell.js.map +1 -0
- package/dist/v2/patterns/FormSection.d.ts +53 -0
- package/dist/v2/patterns/FormSection.d.ts.map +1 -0
- package/dist/v2/patterns/FormSection.js +162 -0
- package/dist/v2/patterns/FormSection.js.map +1 -0
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts +51 -0
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts.map +1 -0
- package/dist/v2/patterns/FormikCheckboxGroup.js +117 -0
- package/dist/v2/patterns/FormikCheckboxGroup.js.map +1 -0
- package/dist/v2/patterns/FormikCombobox.d.ts +43 -0
- package/dist/v2/patterns/FormikCombobox.d.ts.map +1 -0
- package/dist/v2/patterns/FormikCombobox.js +121 -0
- package/dist/v2/patterns/FormikCombobox.js.map +1 -0
- package/dist/v2/patterns/FormikDatePicker.d.ts +87 -0
- package/dist/v2/patterns/FormikDatePicker.d.ts.map +1 -0
- package/dist/v2/patterns/FormikDatePicker.js +177 -0
- package/dist/v2/patterns/FormikDatePicker.js.map +1 -0
- package/dist/v2/patterns/FormikErrorFocus.d.ts +59 -0
- package/dist/v2/patterns/FormikErrorFocus.d.ts.map +1 -0
- package/dist/v2/patterns/FormikErrorFocus.js +83 -0
- package/dist/v2/patterns/FormikErrorFocus.js.map +1 -0
- package/dist/v2/patterns/FormikFile.d.ts +43 -0
- package/dist/v2/patterns/FormikFile.d.ts.map +1 -0
- package/dist/v2/patterns/FormikFile.js +156 -0
- package/dist/v2/patterns/FormikFile.js.map +1 -0
- package/dist/v2/patterns/FormikInput.d.ts +37 -0
- package/dist/v2/patterns/FormikInput.d.ts.map +1 -0
- package/dist/v2/patterns/FormikInput.js +87 -0
- package/dist/v2/patterns/FormikInput.js.map +1 -0
- package/dist/v2/patterns/FormikReferentielField.d.ts +33 -0
- package/dist/v2/patterns/FormikReferentielField.d.ts.map +1 -0
- package/dist/v2/patterns/FormikReferentielField.js +124 -0
- package/dist/v2/patterns/FormikReferentielField.js.map +1 -0
- package/dist/v2/patterns/FormikSelect.d.ts +40 -0
- package/dist/v2/patterns/FormikSelect.d.ts.map +1 -0
- package/dist/v2/patterns/FormikSelect.js +139 -0
- package/dist/v2/patterns/FormikSelect.js.map +1 -0
- package/dist/v2/patterns/FormikTextarea.d.ts +31 -0
- package/dist/v2/patterns/FormikTextarea.d.ts.map +1 -0
- package/dist/v2/patterns/FormikTextarea.js +84 -0
- package/dist/v2/patterns/FormikTextarea.js.map +1 -0
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts +44 -0
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts.map +1 -0
- package/dist/v2/patterns/KeyboardShortcutsHelp.js +207 -0
- package/dist/v2/patterns/KeyboardShortcutsHelp.js.map +1 -0
- package/dist/v2/patterns/NetworkErrorBanner.d.ts +26 -0
- package/dist/v2/patterns/NetworkErrorBanner.d.ts.map +1 -0
- package/dist/v2/patterns/NetworkErrorBanner.js +82 -0
- package/dist/v2/patterns/NetworkErrorBanner.js.map +1 -0
- package/dist/v2/patterns/PageContent.d.ts +40 -0
- package/dist/v2/patterns/PageContent.d.ts.map +1 -0
- package/dist/v2/patterns/PageContent.js +69 -0
- package/dist/v2/patterns/PageContent.js.map +1 -0
- package/dist/v2/patterns/ReferentielField.d.ts +118 -0
- package/dist/v2/patterns/ReferentielField.d.ts.map +1 -0
- package/dist/v2/patterns/ReferentielField.js +617 -0
- package/dist/v2/patterns/ReferentielField.js.map +1 -0
- package/dist/v2/patterns/SaveFilterDialog.d.ts +68 -0
- package/dist/v2/patterns/SaveFilterDialog.d.ts.map +1 -0
- package/dist/v2/patterns/SaveFilterDialog.js +203 -0
- package/dist/v2/patterns/SaveFilterDialog.js.map +1 -0
- package/dist/v2/patterns/SavedFiltersMenu.d.ts +74 -0
- package/dist/v2/patterns/SavedFiltersMenu.d.ts.map +1 -0
- package/dist/v2/patterns/SavedFiltersMenu.js +412 -0
- package/dist/v2/patterns/SavedFiltersMenu.js.map +1 -0
- package/dist/v2/patterns/SkeletonPageShell.d.ts +76 -0
- package/dist/v2/patterns/SkeletonPageShell.d.ts.map +1 -0
- package/dist/v2/patterns/SkeletonPageShell.js +347 -0
- package/dist/v2/patterns/SkeletonPageShell.js.map +1 -0
- package/dist/v2/patterns/SortableHeader.d.ts +47 -0
- package/dist/v2/patterns/SortableHeader.d.ts.map +1 -0
- package/dist/v2/patterns/SortableHeader.js +193 -0
- package/dist/v2/patterns/SortableHeader.js.map +1 -0
- package/dist/v2/patterns/Tour.d.ts +55 -0
- package/dist/v2/patterns/Tour.d.ts.map +1 -0
- package/dist/v2/patterns/Tour.js +473 -0
- package/dist/v2/patterns/Tour.js.map +1 -0
- package/dist/v2/patterns/_dataGridShared.d.ts +125 -0
- package/dist/v2/patterns/_dataGridShared.d.ts.map +1 -0
- package/dist/v2/patterns/_dataGridShared.js +406 -0
- package/dist/v2/patterns/_dataGridShared.js.map +1 -0
- package/dist/v2/patterns/_sort.d.ts +22 -0
- package/dist/v2/patterns/_sort.d.ts.map +1 -0
- package/dist/v2/patterns/_sort.js +118 -0
- package/dist/v2/patterns/_sort.js.map +1 -0
- package/dist/v2/patterns/_useColumnReorder.d.ts +69 -0
- package/dist/v2/patterns/_useColumnReorder.d.ts.map +1 -0
- package/dist/v2/patterns/_useColumnReorder.js +264 -0
- package/dist/v2/patterns/_useColumnReorder.js.map +1 -0
- package/dist/v2/patterns/_useColumnResize.d.ts +49 -0
- package/dist/v2/patterns/_useColumnResize.d.ts.map +1 -0
- package/dist/v2/patterns/_useColumnResize.js +198 -0
- package/dist/v2/patterns/_useColumnResize.js.map +1 -0
- package/dist/v2/patterns/index.d.ts +62 -0
- package/dist/v2/patterns/index.d.ts.map +1 -0
- package/dist/v2/patterns/index.js +246 -0
- package/dist/v2/patterns/index.js.map +1 -0
- package/dist/v2/personalization/PersonalizationProvider.d.ts +80 -0
- package/dist/v2/personalization/PersonalizationProvider.d.ts.map +1 -0
- package/dist/v2/personalization/PersonalizationProvider.js +177 -0
- package/dist/v2/personalization/PersonalizationProvider.js.map +1 -0
- package/dist/v2/personalization/adapters/_storageKey.d.ts +35 -0
- package/dist/v2/personalization/adapters/_storageKey.d.ts.map +1 -0
- package/dist/v2/personalization/adapters/_storageKey.js +69 -0
- package/dist/v2/personalization/adapters/_storageKey.js.map +1 -0
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.d.ts +31 -0
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.d.ts.map +1 -0
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js +128 -0
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -0
- package/dist/v2/personalization/adapters/createMemoryAdapter.d.ts +25 -0
- package/dist/v2/personalization/adapters/createMemoryAdapter.d.ts.map +1 -0
- package/dist/v2/personalization/adapters/createMemoryAdapter.js +76 -0
- package/dist/v2/personalization/adapters/createMemoryAdapter.js.map +1 -0
- package/dist/v2/personalization/adapters/index.d.ts +10 -0
- package/dist/v2/personalization/adapters/index.d.ts.map +1 -0
- package/dist/v2/personalization/adapters/index.js +21 -0
- package/dist/v2/personalization/adapters/index.js.map +1 -0
- package/dist/v2/personalization/capabilities/favorites.d.ts +53 -0
- package/dist/v2/personalization/capabilities/favorites.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/favorites.js +223 -0
- package/dist/v2/personalization/capabilities/favorites.js.map +1 -0
- package/dist/v2/personalization/capabilities/favoritesView.d.ts +58 -0
- package/dist/v2/personalization/capabilities/favoritesView.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/favoritesView.js +121 -0
- package/dist/v2/personalization/capabilities/favoritesView.js.map +1 -0
- package/dist/v2/personalization/capabilities/index.d.ts +16 -0
- package/dist/v2/personalization/capabilities/index.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/index.js +69 -0
- package/dist/v2/personalization/capabilities/index.js.map +1 -0
- package/dist/v2/personalization/capabilities/savedFilters.d.ts +61 -0
- package/dist/v2/personalization/capabilities/savedFilters.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/savedFilters.js +297 -0
- package/dist/v2/personalization/capabilities/savedFilters.js.map +1 -0
- package/dist/v2/personalization/createPersonalizationStore.d.ts +76 -0
- package/dist/v2/personalization/createPersonalizationStore.d.ts.map +1 -0
- package/dist/v2/personalization/createPersonalizationStore.js +475 -0
- package/dist/v2/personalization/createPersonalizationStore.js.map +1 -0
- package/dist/v2/personalization/index.d.ts +33 -0
- package/dist/v2/personalization/index.d.ts.map +1 -0
- package/dist/v2/personalization/index.js +111 -0
- package/dist/v2/personalization/index.js.map +1 -0
- package/dist/v2/personalization/personalizationContext.d.ts +78 -0
- package/dist/v2/personalization/personalizationContext.d.ts.map +1 -0
- package/dist/v2/personalization/personalizationContext.js +121 -0
- package/dist/v2/personalization/personalizationContext.js.map +1 -0
- package/dist/v2/personalization/schema.d.ts +60 -0
- package/dist/v2/personalization/schema.d.ts.map +1 -0
- package/dist/v2/personalization/schema.js +102 -0
- package/dist/v2/personalization/schema.js.map +1 -0
- package/dist/v2/personalization/types.d.ts +81 -0
- package/dist/v2/personalization/types.d.ts.map +1 -0
- package/dist/v2/personalization/types.js +6 -0
- package/dist/v2/personalization/types.js.map +1 -0
- package/dist/v2/referentiel/ReferentielProvider.d.ts +53 -0
- package/dist/v2/referentiel/ReferentielProvider.d.ts.map +1 -0
- package/dist/v2/referentiel/ReferentielProvider.js +94 -0
- package/dist/v2/referentiel/ReferentielProvider.js.map +1 -0
- package/dist/v2/referentiel/index.d.ts +18 -0
- package/dist/v2/referentiel/index.d.ts.map +1 -0
- package/dist/v2/referentiel/index.js +44 -0
- package/dist/v2/referentiel/index.js.map +1 -0
- package/dist/v2/referentiel/useReferentielClient.d.ts +15 -0
- package/dist/v2/referentiel/useReferentielClient.d.ts.map +1 -0
- package/dist/v2/referentiel/useReferentielClient.js +46 -0
- package/dist/v2/referentiel/useReferentielClient.js.map +1 -0
- package/dist/v2/referentiel/useReferentielOptions.d.ts +40 -0
- package/dist/v2/referentiel/useReferentielOptions.d.ts.map +1 -0
- package/dist/v2/referentiel/useReferentielOptions.js +177 -0
- package/dist/v2/referentiel/useReferentielOptions.js.map +1 -0
- package/dist/v2/referentiel/useReferentielSearch.d.ts +76 -0
- package/dist/v2/referentiel/useReferentielSearch.d.ts.map +1 -0
- package/dist/v2/referentiel/useReferentielSearch.js +140 -0
- package/dist/v2/referentiel/useReferentielSearch.js.map +1 -0
- package/dist/v2/styles/base.css +425 -0
- package/dist/v2/styles/css.d.ts +10 -0
- package/dist/v2/styles/index.d.ts +12 -0
- package/dist/v2/styles/index.d.ts.map +1 -0
- package/dist/v2/styles/index.js +4 -0
- package/dist/v2/styles/index.js.map +1 -0
- package/dist/v2/theme/_brand.d.ts +29 -0
- package/dist/v2/theme/_brand.d.ts.map +1 -0
- package/dist/v2/theme/_brand.js +69 -0
- package/dist/v2/theme/_brand.js.map +1 -0
- package/dist/v2/theme/_brandSecondary.d.ts +26 -0
- package/dist/v2/theme/_brandSecondary.d.ts.map +1 -0
- package/dist/v2/theme/_brandSecondary.js +65 -0
- package/dist/v2/theme/_brandSecondary.js.map +1 -0
- package/dist/v2/theme/createPortnetTheme.d.ts +50 -0
- package/dist/v2/theme/createPortnetTheme.d.ts.map +1 -0
- package/dist/v2/theme/createPortnetTheme.js +529 -0
- package/dist/v2/theme/createPortnetTheme.js.map +1 -0
- package/dist/v2/theme/cssVariables.d.ts +41 -0
- package/dist/v2/theme/cssVariables.d.ts.map +1 -0
- package/dist/v2/theme/cssVariables.js +205 -0
- package/dist/v2/theme/cssVariables.js.map +1 -0
- package/dist/v2/theme/index.d.ts +33 -0
- package/dist/v2/theme/index.d.ts.map +1 -0
- package/dist/v2/theme/index.js +60 -0
- package/dist/v2/theme/index.js.map +1 -0
- package/dist/v2/tokens/breakpoints.d.ts +74 -0
- package/dist/v2/tokens/breakpoints.d.ts.map +1 -0
- package/dist/v2/tokens/breakpoints.js +114 -0
- package/dist/v2/tokens/breakpoints.js.map +1 -0
- package/dist/v2/tokens/colors.d.ts +228 -0
- package/dist/v2/tokens/colors.d.ts.map +1 -0
- package/dist/v2/tokens/colors.js +225 -0
- package/dist/v2/tokens/colors.js.map +1 -0
- package/dist/v2/tokens/density.d.ts +142 -0
- package/dist/v2/tokens/density.d.ts.map +1 -0
- package/dist/v2/tokens/density.js +111 -0
- package/dist/v2/tokens/density.js.map +1 -0
- package/dist/v2/tokens/index.d.ts +556 -0
- package/dist/v2/tokens/index.d.ts.map +1 -0
- package/dist/v2/tokens/index.js +313 -0
- package/dist/v2/tokens/index.js.map +1 -0
- package/dist/v2/tokens/motion.d.ts +85 -0
- package/dist/v2/tokens/motion.d.ts.map +1 -0
- package/dist/v2/tokens/motion.js +94 -0
- package/dist/v2/tokens/motion.js.map +1 -0
- package/dist/v2/tokens/radius.d.ts +18 -0
- package/dist/v2/tokens/radius.d.ts.map +1 -0
- package/dist/v2/tokens/radius.js +28 -0
- package/dist/v2/tokens/radius.js.map +1 -0
- package/dist/v2/tokens/shadows.d.ts +25 -0
- package/dist/v2/tokens/shadows.d.ts.map +1 -0
- package/dist/v2/tokens/shadows.js +46 -0
- package/dist/v2/tokens/shadows.js.map +1 -0
- package/dist/v2/tokens/spacing.d.ts +38 -0
- package/dist/v2/tokens/spacing.d.ts.map +1 -0
- package/dist/v2/tokens/spacing.js +57 -0
- package/dist/v2/tokens/spacing.js.map +1 -0
- package/dist/v2/tokens/state.d.ts +40 -0
- package/dist/v2/tokens/state.d.ts.map +1 -0
- package/dist/v2/tokens/state.js +47 -0
- package/dist/v2/tokens/state.js.map +1 -0
- package/dist/v2/tokens/statusPalette.d.ts +54 -0
- package/dist/v2/tokens/statusPalette.d.ts.map +1 -0
- package/dist/v2/tokens/statusPalette.js +72 -0
- package/dist/v2/tokens/statusPalette.js.map +1 -0
- package/dist/v2/tokens/tokens.json +153 -0
- package/dist/v2/tokens/typography.d.ts +206 -0
- package/dist/v2/tokens/typography.d.ts.map +1 -0
- package/dist/v2/tokens/typography.js +155 -0
- package/dist/v2/tokens/typography.js.map +1 -0
- package/dist/v2/tokens/zIndex.d.ts +33 -0
- package/dist/v2/tokens/zIndex.d.ts.map +1 -0
- package/dist/v2/tokens/zIndex.js +50 -0
- package/dist/v2/tokens/zIndex.js.map +1 -0
- package/dist/v2/types/common.d.ts +24 -0
- package/dist/v2/types/common.d.ts.map +1 -0
- package/dist/v2/types/common.js +6 -0
- package/dist/v2/types/common.js.map +1 -0
- package/dist/v2/types/datagrid.d.ts +131 -0
- package/dist/v2/types/datagrid.d.ts.map +1 -0
- package/dist/v2/types/datagrid.js +6 -0
- package/dist/v2/types/datagrid.js.map +1 -0
- package/dist/v2/types/index.d.ts +11 -0
- package/dist/v2/types/index.d.ts.map +1 -0
- package/dist/v2/types/index.js +28 -0
- package/dist/v2/types/index.js.map +1 -0
- package/dist/v2/utils/apiError.d.ts +90 -0
- package/dist/v2/utils/apiError.d.ts.map +1 -0
- package/dist/v2/utils/apiError.js +227 -0
- package/dist/v2/utils/apiError.js.map +1 -0
- package/dist/v2/utils/contrast.d.ts +68 -0
- package/dist/v2/utils/contrast.d.ts.map +1 -0
- package/dist/v2/utils/contrast.js +167 -0
- package/dist/v2/utils/contrast.js.map +1 -0
- package/dist/v2/utils/cx.d.ts +9 -0
- package/dist/v2/utils/cx.d.ts.map +1 -0
- package/dist/v2/utils/cx.js +45 -0
- package/dist/v2/utils/cx.js.map +1 -0
- package/dist/v2/utils/fileDownload.d.ts +94 -0
- package/dist/v2/utils/fileDownload.d.ts.map +1 -0
- package/dist/v2/utils/fileDownload.js +236 -0
- package/dist/v2/utils/fileDownload.js.map +1 -0
- package/dist/v2/utils/fmtMoney.d.ts +28 -0
- package/dist/v2/utils/fmtMoney.d.ts.map +1 -0
- package/dist/v2/utils/fmtMoney.js +84 -0
- package/dist/v2/utils/fmtMoney.js.map +1 -0
- package/dist/v2/utils/index.d.ts +8 -0
- package/dist/v2/utils/index.d.ts.map +1 -0
- package/dist/v2/utils/index.js +90 -0
- package/dist/v2/utils/index.js.map +1 -0
- package/dist/v2/utils/networkStatus.d.ts +88 -0
- package/dist/v2/utils/networkStatus.d.ts.map +1 -0
- package/dist/v2/utils/networkStatus.js +121 -0
- package/dist/v2/utils/networkStatus.js.map +1 -0
- package/package.json +191 -73
- package/dist/api/guideApi.js +0 -12
- package/dist/api/guideImageService.js +0 -119
- package/dist/api/reclamationApi.js +0 -102
- package/dist/assets/guides/FAQ.json +0 -118
- package/dist/assets/guides/index.js +0 -11
- package/dist/assets/images/tijariaLogo.ico +0 -0
- package/dist/components/buttons/PuiButton.js +0 -217
- package/dist/components/buttons/PuiIconButton.js +0 -98
- package/dist/components/common/PuiAlertContext.js +0 -12
- package/dist/components/common/PuiHelpWidgetContext.js +0 -17
- package/dist/components/common/StyledMuiButton.js +0 -48
- package/dist/components/common/StyledMuiTextField.js +0 -180
- package/dist/components/inputs/PuiAutocomplete.js +0 -352
- package/dist/components/inputs/PuiCheckbox.js +0 -308
- package/dist/components/inputs/PuiCheckboxGroup.js +0 -215
- package/dist/components/inputs/PuiCheckboxItem.js +0 -162
- package/dist/components/inputs/PuiDateField.js +0 -280
- package/dist/components/inputs/PuiDateTimeField.js +0 -276
- package/dist/components/inputs/PuiFileField.js +0 -265
- package/dist/components/inputs/PuiRadioGroup.js +0 -197
- package/dist/components/inputs/PuiRadioItem.js +0 -100
- package/dist/components/inputs/PuiSelect.js +0 -427
- package/dist/components/inputs/PuiTextField.js +0 -263
- package/dist/components/others/PuiBadge.js +0 -58
- package/dist/components/others/PuiChip.js +0 -150
- package/dist/components/others/PuiDialog.js +0 -102
- package/dist/components/others/PuiFormikForm.js +0 -70
- package/dist/components/others/PuiGrid.js +0 -23
- package/dist/components/others/PuiIcon.js +0 -92
- package/dist/components/others/PuiLoadingBackdrop.js +0 -32
- package/dist/components/others/PuiMainContainer.js +0 -41
- package/dist/components/others/PuiNavigation.js +0 -68
- package/dist/components/others/PuiSection.js +0 -187
- package/dist/components/others/PuiTooltip.js +0 -86
- package/dist/components/providers/PuiAlertProvider.js +0 -134
- package/dist/components/providers/PuiHelpWidgetProvider.js +0 -91
- package/dist/components/providers/PuiLocalizationProvider.js +0 -34
- package/dist/components/referentiel/common/ReferetielContext.js +0 -12
- package/dist/components/referentiel/common/constants/specificReferentielsApis.js +0 -22
- package/dist/components/referentiel/common/constants/specificReferentielsBaseColumns.js +0 -691
- package/dist/components/referentiel/common/constants/specificReferentielsBaseFilters.js +0 -598
- package/dist/components/referentiel/common/constants/specificReferentielsInitialValues.js +0 -80
- package/dist/components/referentiel/common/constants/specificReferentielsKeys.js +0 -18
- package/dist/components/referentiel/common/constants/specificReferentielsTitles.js +0 -22
- package/dist/components/referentiel/common/constants/specificReferentielsValidationSchemas.js +0 -85
- package/dist/components/referentiel/components/PuiBasePopupReferentielField.js +0 -356
- package/dist/components/referentiel/components/PuiCustomPopupReferentielField.js +0 -181
- package/dist/components/referentiel/components/PuiSimplePopupReferentielField.js +0 -325
- package/dist/components/referentiel/components/PuiSimpleReferentielField.js +0 -203
- package/dist/components/referentiel/components/PuiSpecificReferentielField.js +0 -352
- package/dist/components/referentiel/providers/PuiReferentielProvider.js +0 -66
- package/dist/components/tab/PuiTab.js +0 -25
- package/dist/components/tab/PuiTabs.js +0 -148
- package/dist/components/table/PuiTable.js +0 -643
- package/dist/components/table/PuiTableAction.js +0 -75
- package/dist/components/typography/PuiDefinition.js +0 -42
- package/dist/components/typography/PuiIndication.js +0 -80
- package/dist/components/typography/PuiMainTitle.js +0 -144
- package/dist/components/ui/dialogs/PuiSearchDialog.js +0 -106
- package/dist/components/ui/pages/errors/PuiErrorBasePage.js +0 -73
- package/dist/components/ui/pages/errors/PuiForbiddenErrorPage.js +0 -36
- package/dist/components/ui/pages/errors/PuiNetworkErrorPage.js +0 -36
- package/dist/components/ui/pages/errors/PuiNotFoundErrorPage.js +0 -30
- package/dist/components/ui/pages/errors/PuiServerErrorPage.js +0 -37
- package/dist/components/ui/pages/general/PuiDefaultPage.js +0 -68
- package/dist/components/ui/pages/general/PuiSearchPage.js +0 -203
- package/dist/components/widgets/GuideImage.js +0 -251
- package/dist/components/widgets/PuiHelpWidget.js +0 -4153
- package/dist/config/apperance.js +0 -26
- package/dist/config/mapping.js +0 -26
- package/dist/config/referentiel.js +0 -10
- package/dist/general/yupValidationErrors.js +0 -8
- package/dist/hooks/useAlert.js +0 -19
- package/dist/hooks/useAxios.js +0 -23
- package/dist/hooks/useQuery.js +0 -21
- package/dist/hooks/useReclamation.js +0 -100
- package/dist/styles/ReclamationFormModal.css +0 -629
- package/dist/styles/help-widget.css +0 -621
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useFormAutoSave;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
/**
|
|
16
|
+
* useFormAutoSave — persist Formik (or any form) values to
|
|
17
|
+
* localStorage with debounced writes, and expose draft-restore
|
|
18
|
+
* affordances to the host. Pure orchestration; no UI.
|
|
19
|
+
*
|
|
20
|
+
* Usage:
|
|
21
|
+
* import { v2 } from "@portnet/ui";
|
|
22
|
+
* const { useFormAutoSave, Banner } = v2;
|
|
23
|
+
*
|
|
24
|
+
* const { hasDraft, lastSavedAt, restoreDraft, clearDraft } =
|
|
25
|
+
* useFormAutoSave({
|
|
26
|
+
* storageKey: `addpe:autorisation:draft:${id || "new"}`,
|
|
27
|
+
* values: formik.values,
|
|
28
|
+
* setValues: formik.setValues,
|
|
29
|
+
* enabled: !id, // CREATE only, not edit
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* Safety:
|
|
33
|
+
* - All localStorage access is try/catch-wrapped.
|
|
34
|
+
* - Empty-state values are skipped so we don't produce noise entries.
|
|
35
|
+
* - When a draft exists but hasn't been actioned (hasDraft=true),
|
|
36
|
+
* the debounced write is PAUSED to prevent overwriting the draft
|
|
37
|
+
* with empty initial values before the user decides to restore/ignore.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
function useFormAutoSave(_ref) {
|
|
41
|
+
var storageKey = _ref.storageKey,
|
|
42
|
+
values = _ref.values,
|
|
43
|
+
setValues = _ref.setValues,
|
|
44
|
+
_ref$enabled = _ref.enabled,
|
|
45
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled,
|
|
46
|
+
_ref$debounceMs = _ref.debounceMs,
|
|
47
|
+
debounceMs = _ref$debounceMs === void 0 ? 800 : _ref$debounceMs,
|
|
48
|
+
_ref$initialEmptyChec = _ref.initialEmptyCheck,
|
|
49
|
+
initialEmptyCheck = _ref$initialEmptyChec === void 0 ? defaultEmptyCheck : _ref$initialEmptyChec;
|
|
50
|
+
var _useState = (0, _react.useState)(false),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
hasDraft = _useState2[0],
|
|
53
|
+
setHasDraft = _useState2[1];
|
|
54
|
+
var _useState3 = (0, _react.useState)(null),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
lastSavedAt = _useState4[0],
|
|
57
|
+
setLastSavedAt = _useState4[1];
|
|
58
|
+
var debounceTimerRef = (0, _react.useRef)(null);
|
|
59
|
+
var mountedRef = (0, _react.useRef)(false);
|
|
60
|
+
|
|
61
|
+
/* ── Mount-time draft detection ────────────────── */
|
|
62
|
+
(0, _react.useEffect)(function () {
|
|
63
|
+
if (!enabled) return;
|
|
64
|
+
if (mountedRef.current) return;
|
|
65
|
+
mountedRef.current = true;
|
|
66
|
+
try {
|
|
67
|
+
var raw = localStorage.getItem(storageKey);
|
|
68
|
+
if (!raw) return;
|
|
69
|
+
var parsed = JSON.parse(raw);
|
|
70
|
+
if (parsed && _typeof(parsed) === "object" && "values" in parsed && parsed.values && _typeof(parsed.values) === "object") {
|
|
71
|
+
setHasDraft(true);
|
|
72
|
+
if ("savedAt" in parsed && typeof parsed.savedAt === "string") {
|
|
73
|
+
var d = new Date(parsed.savedAt);
|
|
74
|
+
if (!Number.isNaN(d.getTime())) setLastSavedAt(d);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
localStorage.removeItem(storageKey);
|
|
78
|
+
}
|
|
79
|
+
} catch (_unused) {
|
|
80
|
+
try {
|
|
81
|
+
localStorage.removeItem(storageKey);
|
|
82
|
+
} catch (_unused2) {
|
|
83
|
+
/* ignore */
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [enabled, storageKey]);
|
|
87
|
+
|
|
88
|
+
/* ── Debounced write on values change ──────────────────
|
|
89
|
+
*
|
|
90
|
+
* CRITICAL: do NOT write while hasDraft=true (draft not yet actioned).
|
|
91
|
+
*
|
|
92
|
+
* If we write immediately on mount, the empty initial values would
|
|
93
|
+
* overwrite the user's saved draft after `debounceMs` milliseconds.
|
|
94
|
+
* The user would see the "restore" banner, wait/hesitate, then click
|
|
95
|
+
* "Restaurer" only to find the form empty because restoreDraft() read
|
|
96
|
+
* the overwritten (empty) localStorage entry.
|
|
97
|
+
*
|
|
98
|
+
* We pause writes until hasDraft becomes false, which happens when:
|
|
99
|
+
* - restoreDraft() is called (user chose to restore)
|
|
100
|
+
* - clearDraft() is called (user chose to ignore)
|
|
101
|
+
* - No draft existed on mount (hasDraft was never set to true)
|
|
102
|
+
*/
|
|
103
|
+
(0, _react.useEffect)(function () {
|
|
104
|
+
if (!enabled) return undefined;
|
|
105
|
+
if (hasDraft) return undefined; // ← PAUSE: preserve existing draft
|
|
106
|
+
if (initialEmptyCheck(values)) return undefined;
|
|
107
|
+
if (debounceTimerRef.current) {
|
|
108
|
+
clearTimeout(debounceTimerRef.current);
|
|
109
|
+
}
|
|
110
|
+
debounceTimerRef.current = setTimeout(function () {
|
|
111
|
+
try {
|
|
112
|
+
var now = new Date();
|
|
113
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
114
|
+
values: values,
|
|
115
|
+
savedAt: now.toISOString()
|
|
116
|
+
}));
|
|
117
|
+
setLastSavedAt(now);
|
|
118
|
+
} catch (_unused3) {
|
|
119
|
+
// Quota full / private mode — no-op.
|
|
120
|
+
}
|
|
121
|
+
}, debounceMs);
|
|
122
|
+
return function () {
|
|
123
|
+
if (debounceTimerRef.current) {
|
|
124
|
+
clearTimeout(debounceTimerRef.current);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}, [values, enabled, hasDraft, storageKey, debounceMs, initialEmptyCheck]);
|
|
128
|
+
|
|
129
|
+
/* ── Restore draft ─────────────────────── */
|
|
130
|
+
var restoreDraft = (0, _react.useCallback)(function () {
|
|
131
|
+
if (!setValues) {
|
|
132
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
133
|
+
// eslint-disable-next-line no-console
|
|
134
|
+
console.warn("[v2.useFormAutoSave] restoreDraft called but setValues was not provided.");
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
var raw = localStorage.getItem(storageKey);
|
|
140
|
+
if (!raw) return false;
|
|
141
|
+
var parsed = JSON.parse(raw);
|
|
142
|
+
if (!parsed || _typeof(parsed) !== "object" || !("values" in parsed) || !parsed.values) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// Persisted draft payload is the form's Values, round-tripped
|
|
146
|
+
// through JSON; assert back to Values for the setter.
|
|
147
|
+
setValues(parsed.values);
|
|
148
|
+
setHasDraft(false); // ← resumes auto-save with restored values
|
|
149
|
+
return true;
|
|
150
|
+
} catch (_unused4) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}, [storageKey, setValues]);
|
|
154
|
+
|
|
155
|
+
/* ── Clear draft ─────────────────────── */
|
|
156
|
+
var clearDraft = (0, _react.useCallback)(function () {
|
|
157
|
+
try {
|
|
158
|
+
localStorage.removeItem(storageKey);
|
|
159
|
+
} catch (_unused5) {
|
|
160
|
+
/* ignore */
|
|
161
|
+
}
|
|
162
|
+
setHasDraft(false); // ← resumes auto-save for new input
|
|
163
|
+
setLastSavedAt(null);
|
|
164
|
+
}, [storageKey]);
|
|
165
|
+
return {
|
|
166
|
+
hasDraft: hasDraft,
|
|
167
|
+
lastSavedAt: lastSavedAt,
|
|
168
|
+
restoreDraft: restoreDraft,
|
|
169
|
+
clearDraft: clearDraft
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* ── Helpers ───────────────────────────── */
|
|
174
|
+
|
|
175
|
+
function isEmptyValue(v) {
|
|
176
|
+
if (v === null || v === undefined) return true;
|
|
177
|
+
if (typeof v === "string") return v.trim().length === 0;
|
|
178
|
+
if (Array.isArray(v)) return v.length === 0;
|
|
179
|
+
if (_typeof(v) === "object") return Object.keys(v).length === 0;
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
function defaultEmptyCheck(values) {
|
|
183
|
+
if (!values || _typeof(values) !== "object") return true;
|
|
184
|
+
return Object.values(values).every(isEmptyValue);
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=useFormAutoSave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormAutoSave.js","names":["_react","require","_typeof","obj","Symbol","iterator","constructor","prototype","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","toString","call","slice","name","Array","from","test","len","length","arr2","_i","_s","_e","_x","_r","_arr","_n","_d","next","done","push","value","err","isArray","useFormAutoSave","_ref","storageKey","values","setValues","_ref$enabled","enabled","_ref$debounceMs","debounceMs","_ref$initialEmptyChec","initialEmptyCheck","defaultEmptyCheck","_useState","useState","_useState2","hasDraft","setHasDraft","_useState3","_useState4","lastSavedAt","setLastSavedAt","debounceTimerRef","useRef","mountedRef","useEffect","current","raw","localStorage","getItem","parsed","JSON","parse","savedAt","d","Date","Number","isNaN","getTime","removeItem","_unused","_unused2","undefined","clearTimeout","setTimeout","now","setItem","stringify","toISOString","_unused3","restoreDraft","useCallback","process","env","console","warn","_unused4","clearDraft","_unused5","isEmptyValue","v","trim","keys","every"],"sources":["../../../src/lib/v2/hooks/useFormAutoSave.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\r\n\r\n/**\r\n * useFormAutoSave — persist Formik (or any form) values to\r\n * localStorage with debounced writes, and expose draft-restore\r\n * affordances to the host. Pure orchestration; no UI.\r\n *\r\n * Usage:\r\n * import { v2 } from \"@portnet/ui\";\r\n * const { useFormAutoSave, Banner } = v2;\r\n *\r\n * const { hasDraft, lastSavedAt, restoreDraft, clearDraft } =\r\n * useFormAutoSave({\r\n * storageKey: `addpe:autorisation:draft:${id || \"new\"}`,\r\n * values: formik.values,\r\n * setValues: formik.setValues,\r\n * enabled: !id, // CREATE only, not edit\r\n * });\r\n *\r\n * Safety:\r\n * - All localStorage access is try/catch-wrapped.\r\n * - Empty-state values are skipped so we don't produce noise entries.\r\n * - When a draft exists but hasn't been actioned (hasDraft=true),\r\n * the debounced write is PAUSED to prevent overwriting the draft\r\n * with empty initial values before the user decides to restore/ignore.\r\n */\r\n\r\ntype FormAutoSaveOptions<Values> = {\r\n storageKey: string;\r\n values: Values;\r\n /** Required if you call restoreDraft(). */\r\n setValues?: (values: Values) => void;\r\n enabled?: boolean;\r\n debounceMs?: number;\r\n initialEmptyCheck?: (values: Values) => boolean;\r\n};\r\n\r\ntype FormAutoSaveResult = {\r\n hasDraft: boolean;\r\n lastSavedAt: Date | null;\r\n restoreDraft: () => boolean;\r\n clearDraft: () => void;\r\n};\r\n\r\nexport default function useFormAutoSave<Values>({\r\n storageKey,\r\n values,\r\n setValues,\r\n enabled = true,\r\n debounceMs = 800,\r\n initialEmptyCheck = defaultEmptyCheck,\r\n}: FormAutoSaveOptions<Values>): FormAutoSaveResult {\r\n const [hasDraft, setHasDraft] = useState(false);\r\n const [lastSavedAt, setLastSavedAt] = useState<Date | null>(null);\r\n const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const mountedRef = useRef(false);\r\n\r\n /* ── Mount-time draft detection ────────────────── */\r\n useEffect(() => {\r\n if (!enabled) return;\r\n if (mountedRef.current) return;\r\n mountedRef.current = true;\r\n\r\n try {\r\n const raw = localStorage.getItem(storageKey);\r\n if (!raw) return;\r\n const parsed: unknown = JSON.parse(raw);\r\n if (\r\n parsed &&\r\n typeof parsed === \"object\" &&\r\n \"values\" in parsed &&\r\n parsed.values &&\r\n typeof parsed.values === \"object\"\r\n ) {\r\n setHasDraft(true);\r\n if (\"savedAt\" in parsed && typeof parsed.savedAt === \"string\") {\r\n const d = new Date(parsed.savedAt);\r\n if (!Number.isNaN(d.getTime())) setLastSavedAt(d);\r\n }\r\n } else {\r\n localStorage.removeItem(storageKey);\r\n }\r\n } catch {\r\n try {\r\n localStorage.removeItem(storageKey);\r\n } catch {\r\n /* ignore */\r\n }\r\n }\r\n }, [enabled, storageKey]);\r\n\r\n /* ── Debounced write on values change ──────────────────\r\n *\r\n * CRITICAL: do NOT write while hasDraft=true (draft not yet actioned).\r\n *\r\n * If we write immediately on mount, the empty initial values would\r\n * overwrite the user's saved draft after `debounceMs` milliseconds.\r\n * The user would see the \"restore\" banner, wait/hesitate, then click\r\n * \"Restaurer\" only to find the form empty because restoreDraft() read\r\n * the overwritten (empty) localStorage entry.\r\n *\r\n * We pause writes until hasDraft becomes false, which happens when:\r\n * - restoreDraft() is called (user chose to restore)\r\n * - clearDraft() is called (user chose to ignore)\r\n * - No draft existed on mount (hasDraft was never set to true)\r\n */\r\n useEffect(() => {\r\n if (!enabled) return undefined;\r\n if (hasDraft) return undefined; // ← PAUSE: preserve existing draft\r\n if (initialEmptyCheck(values)) return undefined;\r\n\r\n if (debounceTimerRef.current) {\r\n clearTimeout(debounceTimerRef.current);\r\n }\r\n\r\n debounceTimerRef.current = setTimeout(() => {\r\n try {\r\n const now = new Date();\r\n localStorage.setItem(\r\n storageKey,\r\n JSON.stringify({ values, savedAt: now.toISOString() })\r\n );\r\n setLastSavedAt(now);\r\n } catch {\r\n // Quota full / private mode — no-op.\r\n }\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceTimerRef.current) {\r\n clearTimeout(debounceTimerRef.current);\r\n }\r\n };\r\n }, [values, enabled, hasDraft, storageKey, debounceMs, initialEmptyCheck]);\r\n\r\n /* ── Restore draft ─────────────────────── */\r\n const restoreDraft = useCallback((): boolean => {\r\n if (!setValues) {\r\n if (process.env[\"NODE_ENV\"] !== \"production\") {\r\n // eslint-disable-next-line no-console\r\n console.warn(\"[v2.useFormAutoSave] restoreDraft called but setValues was not provided.\");\r\n }\r\n return false;\r\n }\r\n try {\r\n const raw = localStorage.getItem(storageKey);\r\n if (!raw) return false;\r\n const parsed: unknown = JSON.parse(raw);\r\n if (\r\n !parsed ||\r\n typeof parsed !== \"object\" ||\r\n !(\"values\" in parsed) ||\r\n !parsed.values\r\n ) {\r\n return false;\r\n }\r\n // Persisted draft payload is the form's Values, round-tripped\r\n // through JSON; assert back to Values for the setter.\r\n setValues(parsed.values as Values);\r\n setHasDraft(false); // ← resumes auto-save with restored values\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n }, [storageKey, setValues]);\r\n\r\n /* ── Clear draft ─────────────────────── */\r\n const clearDraft = useCallback((): void => {\r\n try {\r\n localStorage.removeItem(storageKey);\r\n } catch {\r\n /* ignore */\r\n }\r\n setHasDraft(false); // ← resumes auto-save for new input\r\n setLastSavedAt(null);\r\n }, [storageKey]);\r\n\r\n return { hasDraft, lastSavedAt, restoreDraft, clearDraft };\r\n}\r\n\r\n/* ── Helpers ───────────────────────────── */\r\n\r\nfunction isEmptyValue(v: unknown): boolean {\r\n if (v === null || v === undefined) return true;\r\n if (typeof v === \"string\") return v.trim().length === 0;\r\n if (Array.isArray(v)) return v.length === 0;\r\n if (typeof v === \"object\") return Object.keys(v).length === 0;\r\n return false;\r\n}\r\n\r\nfunction defaultEmptyCheck(values: unknown): boolean {\r\n if (!values || typeof values !== \"object\") return true;\r\n return Object.values(values).every(isEmptyValue);\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAiE,SAAAC,QAAAC,GAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,GAAA,kBAAA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hB,OAAO;IAAEa,QAAQ,EAARA,QAAQ;IAAEI,WAAW,EAAXA,WAAW;IAAE8B,YAAY,EAAZA,YAAY;IAAEO,UAAU,EAAVA;EAAW,CAAC;AAC5D;;AAEA;;AAEA,SAASE,YAAYA,CAACC,CAAU,EAAW;EACzC,IAAIA,CAAC,KAAK,IAAI,IAAIA,CAAC,KAAKlB,SAAS,EAAE,OAAO,IAAI;EAC9C,IAAI,OAAOkB,CAAC,KAAK,QAAQ,EAAE,OAAOA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC5E,MAAM,KAAK,CAAC;EACvD,IAAIJ,KAAK,CAACmB,OAAO,CAAC4D,CAAC,CAAC,EAAE,OAAOA,CAAC,CAAC3E,MAAM,KAAK,CAAC;EAC3C,IAAI3B,OAAA,CAAOsG,CAAC,MAAK,QAAQ,EAAE,OAAOpF,MAAM,CAACsF,IAAI,CAACF,CAAC,CAAC,CAAC3E,MAAM,KAAK,CAAC;EAC7D,OAAO,KAAK;AACd;AAEA,SAAS2B,iBAAiBA,CAACR,MAAe,EAAW;EACnD,IAAI,CAACA,MAAM,IAAI9C,OAAA,CAAO8C,MAAM,MAAK,QAAQ,EAAE,OAAO,IAAI;EACtD,OAAO5B,MAAM,CAAC4B,MAAM,CAACA,MAAM,CAAC,CAAC2D,KAAK,CAACJ,YAAY,CAAC;AAClD","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFormCompletionProgress — derive required/overall completion
|
|
3
|
+
* percentages from current form values and a declared field list.
|
|
4
|
+
* Pure useMemo computation, no side effects.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* import { v2 } from "@portnet/ui";
|
|
8
|
+
* const { useFormCompletionProgress, ProgressBar } = v2;
|
|
9
|
+
*
|
|
10
|
+
* const REQUIRED = ["typeAutorisation", "importer.id", "dateFinValidite"];
|
|
11
|
+
* const OPTIONAL = ["referenceLicence", "region"];
|
|
12
|
+
*
|
|
13
|
+
* const {
|
|
14
|
+
* requiredPct,
|
|
15
|
+
* overallPct,
|
|
16
|
+
* isCompleteRequired,
|
|
17
|
+
* missingRequired,
|
|
18
|
+
* filledRequired,
|
|
19
|
+
* totalRequired,
|
|
20
|
+
* } = useFormCompletionProgress({
|
|
21
|
+
* values: formik.values,
|
|
22
|
+
* requiredFields: REQUIRED,
|
|
23
|
+
* optionalFields: OPTIONAL,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* <ProgressBar value={requiredPct} />
|
|
27
|
+
* <span>{filledRequired}/{totalRequired} requis</span>
|
|
28
|
+
*
|
|
29
|
+
* Field paths support dot notation for nested values:
|
|
30
|
+
* "importer.id" → values.importer.id
|
|
31
|
+
* "articles" → values.articles (array length checked)
|
|
32
|
+
*/
|
|
33
|
+
type FormCompletionProgressOptions<Values> = {
|
|
34
|
+
values: Values;
|
|
35
|
+
/** Field keys / dot-paths that are required. */
|
|
36
|
+
requiredFields: string[];
|
|
37
|
+
/** Field keys / dot-paths that are optional. */
|
|
38
|
+
optionalFields?: string[];
|
|
39
|
+
};
|
|
40
|
+
type FormCompletionProgress = {
|
|
41
|
+
requiredPct: number;
|
|
42
|
+
overallPct: number;
|
|
43
|
+
filledRequired: number;
|
|
44
|
+
totalRequired: number;
|
|
45
|
+
filledOptional: number;
|
|
46
|
+
totalOptional: number;
|
|
47
|
+
isCompleteRequired: boolean;
|
|
48
|
+
missingRequired: string[];
|
|
49
|
+
};
|
|
50
|
+
export default function useFormCompletionProgress<Values>({ values, requiredFields, optionalFields, }: FormCompletionProgressOptions<Values>): FormCompletionProgress;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=useFormCompletionProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormCompletionProgress.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/hooks/useFormCompletionProgress.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,KAAK,6BAA6B,CAAC,MAAM,IAAI;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,MAAM,EAAE,EACxD,MAAM,EACN,cAAc,EACd,cAAmB,GACpB,EAAE,6BAA6B,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAwChE"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useFormCompletionProgress;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
12
|
+
/**
|
|
13
|
+
* useFormCompletionProgress — derive required/overall completion
|
|
14
|
+
* percentages from current form values and a declared field list.
|
|
15
|
+
* Pure useMemo computation, no side effects.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* import { v2 } from "@portnet/ui";
|
|
19
|
+
* const { useFormCompletionProgress, ProgressBar } = v2;
|
|
20
|
+
*
|
|
21
|
+
* const REQUIRED = ["typeAutorisation", "importer.id", "dateFinValidite"];
|
|
22
|
+
* const OPTIONAL = ["referenceLicence", "region"];
|
|
23
|
+
*
|
|
24
|
+
* const {
|
|
25
|
+
* requiredPct,
|
|
26
|
+
* overallPct,
|
|
27
|
+
* isCompleteRequired,
|
|
28
|
+
* missingRequired,
|
|
29
|
+
* filledRequired,
|
|
30
|
+
* totalRequired,
|
|
31
|
+
* } = useFormCompletionProgress({
|
|
32
|
+
* values: formik.values,
|
|
33
|
+
* requiredFields: REQUIRED,
|
|
34
|
+
* optionalFields: OPTIONAL,
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* <ProgressBar value={requiredPct} />
|
|
38
|
+
* <span>{filledRequired}/{totalRequired} requis</span>
|
|
39
|
+
*
|
|
40
|
+
* Field paths support dot notation for nested values:
|
|
41
|
+
* "importer.id" → values.importer.id
|
|
42
|
+
* "articles" → values.articles (array length checked)
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
function useFormCompletionProgress(_ref) {
|
|
46
|
+
var values = _ref.values,
|
|
47
|
+
requiredFields = _ref.requiredFields,
|
|
48
|
+
_ref$optionalFields = _ref.optionalFields,
|
|
49
|
+
optionalFields = _ref$optionalFields === void 0 ? [] : _ref$optionalFields;
|
|
50
|
+
return (0, _react.useMemo)(function () {
|
|
51
|
+
var required = Array.isArray(requiredFields) ? requiredFields : [];
|
|
52
|
+
var optional = Array.isArray(optionalFields) ? optionalFields : [];
|
|
53
|
+
var filledRequired = required.filter(function (path) {
|
|
54
|
+
return isFilled(getFieldValue(values, path));
|
|
55
|
+
}).length;
|
|
56
|
+
var filledOptional = optional.filter(function (path) {
|
|
57
|
+
return isFilled(getFieldValue(values, path));
|
|
58
|
+
}).length;
|
|
59
|
+
var missingRequired = required.filter(function (path) {
|
|
60
|
+
return !isFilled(getFieldValue(values, path));
|
|
61
|
+
});
|
|
62
|
+
var totalRequired = required.length;
|
|
63
|
+
var totalOptional = optional.length;
|
|
64
|
+
var requiredPct = totalRequired ? Math.round(filledRequired / totalRequired * 100) : 100;
|
|
65
|
+
var overallFilled = filledRequired + filledOptional;
|
|
66
|
+
var overallTotal = totalRequired + totalOptional;
|
|
67
|
+
var overallPct = overallTotal ? Math.round(overallFilled / overallTotal * 100) : 0;
|
|
68
|
+
return {
|
|
69
|
+
requiredPct: requiredPct,
|
|
70
|
+
overallPct: overallPct,
|
|
71
|
+
filledRequired: filledRequired,
|
|
72
|
+
totalRequired: totalRequired,
|
|
73
|
+
filledOptional: filledOptional,
|
|
74
|
+
totalOptional: totalOptional,
|
|
75
|
+
isCompleteRequired: totalRequired === 0 || filledRequired === totalRequired,
|
|
76
|
+
missingRequired: missingRequired
|
|
77
|
+
};
|
|
78
|
+
}, [values, requiredFields, optionalFields]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* ── Helpers ───────────────────────────── */
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Resolves a dot-separated field path against a values object.
|
|
85
|
+
* Returns undefined on any missing intermediate.
|
|
86
|
+
*
|
|
87
|
+
* getFieldValue({ a: { b: { c: 42 } } }, "a.b.c") → 42
|
|
88
|
+
* getFieldValue({ a: null }, "a.b.c") → undefined
|
|
89
|
+
* getFieldValue({}, "doesNotExist") → undefined
|
|
90
|
+
*/
|
|
91
|
+
function getFieldValue(obj, path) {
|
|
92
|
+
if (!obj || _typeof(obj) !== "object") return undefined;
|
|
93
|
+
if (!path) return undefined;
|
|
94
|
+
var parts = path.split(".");
|
|
95
|
+
var cur = obj;
|
|
96
|
+
var _iterator = _createForOfIteratorHelper(parts),
|
|
97
|
+
_step;
|
|
98
|
+
try {
|
|
99
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
100
|
+
var p = _step.value;
|
|
101
|
+
if (cur === null || cur === undefined) return undefined;
|
|
102
|
+
if (_typeof(cur) !== "object") return undefined;
|
|
103
|
+
cur = cur[p];
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
_iterator.e(err);
|
|
107
|
+
} finally {
|
|
108
|
+
_iterator.f();
|
|
109
|
+
}
|
|
110
|
+
return cur;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Centralised "is this value considered filled?" check.
|
|
115
|
+
*
|
|
116
|
+
* Considered EMPTY:
|
|
117
|
+
* - null, undefined
|
|
118
|
+
* - "" or whitespace-only string
|
|
119
|
+
* - empty array []
|
|
120
|
+
* - empty plain object {}
|
|
121
|
+
*
|
|
122
|
+
* Considered FILLED (intentional):
|
|
123
|
+
* - 0, false (valid user input distinct from "unset")
|
|
124
|
+
* - any non-empty array, object with keys, string, number
|
|
125
|
+
* - Date instances with valid time
|
|
126
|
+
*/
|
|
127
|
+
function isFilled(v) {
|
|
128
|
+
if (v === null || v === undefined) return false;
|
|
129
|
+
if (typeof v === "string") return v.trim().length > 0;
|
|
130
|
+
if (Array.isArray(v)) return v.length > 0;
|
|
131
|
+
if (v instanceof Date) return !Number.isNaN(v.getTime());
|
|
132
|
+
if (_typeof(v) === "object") return Object.keys(v).length > 0;
|
|
133
|
+
// numbers, booleans
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=useFormCompletionProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormCompletionProgress.js","names":["_react","require","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_typeof","obj","useFormCompletionProgress","_ref","values","requiredFields","_ref$optionalFields","optionalFields","useMemo","required","optional","filledRequired","filter","path","isFilled","getFieldValue","filledOptional","missingRequired","totalRequired","totalOptional","requiredPct","Math","round","overallFilled","overallTotal","overallPct","isCompleteRequired","undefined","parts","split","cur","_iterator","_step","p","v","trim","Date","Number","isNaN","getTime","keys"],"sources":["../../../src/lib/v2/hooks/useFormCompletionProgress.ts"],"sourcesContent":["import { useMemo } from \"react\";\r\n\r\n/**\r\n * useFormCompletionProgress — derive required/overall completion\r\n * percentages from current form values and a declared field list.\r\n * Pure useMemo computation, no side effects.\r\n *\r\n * Usage:\r\n * import { v2 } from \"@portnet/ui\";\r\n * const { useFormCompletionProgress, ProgressBar } = v2;\r\n *\r\n * const REQUIRED = [\"typeAutorisation\", \"importer.id\", \"dateFinValidite\"];\r\n * const OPTIONAL = [\"referenceLicence\", \"region\"];\r\n *\r\n * const {\r\n * requiredPct,\r\n * overallPct,\r\n * isCompleteRequired,\r\n * missingRequired,\r\n * filledRequired,\r\n * totalRequired,\r\n * } = useFormCompletionProgress({\r\n * values: formik.values,\r\n * requiredFields: REQUIRED,\r\n * optionalFields: OPTIONAL,\r\n * });\r\n *\r\n * <ProgressBar value={requiredPct} />\r\n * <span>{filledRequired}/{totalRequired} requis</span>\r\n *\r\n * Field paths support dot notation for nested values:\r\n * \"importer.id\" → values.importer.id\r\n * \"articles\" → values.articles (array length checked)\r\n */\r\n\r\ntype FormCompletionProgressOptions<Values> = {\r\n values: Values;\r\n /** Field keys / dot-paths that are required. */\r\n requiredFields: string[];\r\n /** Field keys / dot-paths that are optional. */\r\n optionalFields?: string[];\r\n};\r\n\r\ntype FormCompletionProgress = {\r\n requiredPct: number;\r\n overallPct: number;\r\n filledRequired: number;\r\n totalRequired: number;\r\n filledOptional: number;\r\n totalOptional: number;\r\n isCompleteRequired: boolean;\r\n missingRequired: string[];\r\n};\r\n\r\nexport default function useFormCompletionProgress<Values>({\r\n values,\r\n requiredFields,\r\n optionalFields = [],\r\n}: FormCompletionProgressOptions<Values>): FormCompletionProgress {\r\n return useMemo(() => {\r\n const required = Array.isArray(requiredFields) ? requiredFields : [];\r\n const optional = Array.isArray(optionalFields) ? optionalFields : [];\r\n\r\n const filledRequired = required.filter((path) =>\r\n isFilled(getFieldValue(values, path))\r\n ).length;\r\n const filledOptional = optional.filter((path) =>\r\n isFilled(getFieldValue(values, path))\r\n ).length;\r\n\r\n const missingRequired = required.filter(\r\n (path) => !isFilled(getFieldValue(values, path))\r\n );\r\n\r\n const totalRequired = required.length;\r\n const totalOptional = optional.length;\r\n\r\n const requiredPct = totalRequired\r\n ? Math.round((filledRequired / totalRequired) * 100)\r\n : 100;\r\n\r\n const overallFilled = filledRequired + filledOptional;\r\n const overallTotal = totalRequired + totalOptional;\r\n const overallPct = overallTotal\r\n ? Math.round((overallFilled / overallTotal) * 100)\r\n : 0;\r\n\r\n return {\r\n requiredPct,\r\n overallPct,\r\n filledRequired,\r\n totalRequired,\r\n filledOptional,\r\n totalOptional,\r\n isCompleteRequired: totalRequired === 0 || filledRequired === totalRequired,\r\n missingRequired,\r\n };\r\n }, [values, requiredFields, optionalFields]);\r\n}\r\n\r\n/* ── Helpers ───────────────────────────── */\r\n\r\n/**\r\n * Resolves a dot-separated field path against a values object.\r\n * Returns undefined on any missing intermediate.\r\n *\r\n * getFieldValue({ a: { b: { c: 42 } } }, \"a.b.c\") → 42\r\n * getFieldValue({ a: null }, \"a.b.c\") → undefined\r\n * getFieldValue({}, \"doesNotExist\") → undefined\r\n */\r\nfunction getFieldValue(obj: unknown, path: string): unknown {\r\n if (!obj || typeof obj !== \"object\") return undefined;\r\n if (!path) return undefined;\r\n const parts = path.split(\".\");\r\n let cur: unknown = obj;\r\n for (const p of parts) {\r\n if (cur === null || cur === undefined) return undefined;\r\n if (typeof cur !== \"object\") return undefined;\r\n cur = (cur as Record<string, unknown>)[p];\r\n }\r\n return cur;\r\n}\r\n\r\n/**\r\n * Centralised \"is this value considered filled?\" check.\r\n *\r\n * Considered EMPTY:\r\n * - null, undefined\r\n * - \"\" or whitespace-only string\r\n * - empty array []\r\n * - empty plain object {}\r\n *\r\n * Considered FILLED (intentional):\r\n * - 0, false (valid user input distinct from \"unset\")\r\n * - any non-empty array, object with keys, string, number\r\n * - Date instances with valid time\r\n */\r\nfunction isFilled(v: unknown): boolean {\r\n if (v === null || v === undefined) return false;\r\n if (typeof v === \"string\") return v.trim().length > 0;\r\n if (Array.isArray(v)) return v.length > 0;\r\n if (v instanceof Date) return !Number.isNaN(v.getTime());\r\n if (typeof v === \"object\") return Object.keys(v).length > 0;\r\n // numbers, booleans\r\n return true;\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAgC,SAAAC,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,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OAAOO,CAAC,KAAK,QAAQ,EAAE,OAAOA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAClE,MAAM,GAAG,CAAC;EACrD,IAAIH,KAAK,CAACC,OAAO,CAACmE,CAAC,CAAC,EAAE,OAAOA,CAAC,CAACjE,MAAM,GAAG,CAAC;EACzC,IAAIiE,CAAC,YAAYE,IAAI,EAAE,OAAO,CAACC,MAAM,CAACC,KAAK,CAACJ,CAAC,CAACK,OAAO,CAAC,CAAC,CAAC;EACxD,IAAIvC,OAAA,CAAOkC,CAAC,MAAK,QAAQ,EAAE,OAAO7C,MAAM,CAACmD,IAAI,CAACN,CAAC,CAAC,CAACjE,MAAM,GAAG,CAAC;EAC3D;EACA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import useDensity from "./useDensity";
|
|
2
|
+
/**
|
|
3
|
+
* useResolvedDensity — Portnet UI v2
|
|
4
|
+
*
|
|
5
|
+
* Returns the effective density for a component instance, applying
|
|
6
|
+
* the standard resolution order used across the v2 surface:
|
|
7
|
+
*
|
|
8
|
+
* (1) explicit `propValue` from the caller (component prop)
|
|
9
|
+
* (2) the global user preference from useDensity()
|
|
10
|
+
* (3) fallback "comfortable"
|
|
11
|
+
*
|
|
12
|
+
* Use this in any component that wants to honour the user-level
|
|
13
|
+
* density preference BY DEFAULT but still allow a caller to force
|
|
14
|
+
* an override per instance — e.g. a picker dialog that always
|
|
15
|
+
* wants "compact" regardless of the global preference, or a key
|
|
16
|
+
* report that always wants "comfortable" for legibility.
|
|
17
|
+
*
|
|
18
|
+
* The hook always subscribes to useDensity() so the component
|
|
19
|
+
* re-renders correctly when the user toggles the global density
|
|
20
|
+
* (same tab via setter, other tab via storage event). The prop
|
|
21
|
+
* simply wins on the resolved value when it's a valid density.
|
|
22
|
+
*
|
|
23
|
+
* Charter R-9.5 / R-DG.11.
|
|
24
|
+
*
|
|
25
|
+
* const effective = useResolvedDensity(props.density);
|
|
26
|
+
* <DataGrid density={effective} … />
|
|
27
|
+
*/
|
|
28
|
+
type DensityPref = ReturnType<typeof useDensity>[0];
|
|
29
|
+
export default function useResolvedDensity(propValue?: DensityPref): DensityPref;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=useResolvedDensity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedDensity.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/hooks/useResolvedDensity.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAIpD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,CAAC,EAAE,WAAW,GAAG,WAAW,CAI/E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useResolvedDensity;
|
|
7
|
+
var _useDensity3 = _interopRequireDefault(require("./useDensity"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
/**
|
|
16
|
+
* useResolvedDensity — Portnet UI v2
|
|
17
|
+
*
|
|
18
|
+
* Returns the effective density for a component instance, applying
|
|
19
|
+
* the standard resolution order used across the v2 surface:
|
|
20
|
+
*
|
|
21
|
+
* (1) explicit `propValue` from the caller (component prop)
|
|
22
|
+
* (2) the global user preference from useDensity()
|
|
23
|
+
* (3) fallback "comfortable"
|
|
24
|
+
*
|
|
25
|
+
* Use this in any component that wants to honour the user-level
|
|
26
|
+
* density preference BY DEFAULT but still allow a caller to force
|
|
27
|
+
* an override per instance — e.g. a picker dialog that always
|
|
28
|
+
* wants "compact" regardless of the global preference, or a key
|
|
29
|
+
* report that always wants "comfortable" for legibility.
|
|
30
|
+
*
|
|
31
|
+
* The hook always subscribes to useDensity() so the component
|
|
32
|
+
* re-renders correctly when the user toggles the global density
|
|
33
|
+
* (same tab via setter, other tab via storage event). The prop
|
|
34
|
+
* simply wins on the resolved value when it's a valid density.
|
|
35
|
+
*
|
|
36
|
+
* Charter R-9.5 / R-DG.11.
|
|
37
|
+
*
|
|
38
|
+
* const effective = useResolvedDensity(props.density);
|
|
39
|
+
* <DataGrid density={effective} … />
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
var VALID = new Set(["comfortable", "compact"]);
|
|
43
|
+
function useResolvedDensity(propValue) {
|
|
44
|
+
var _useDensity = (0, _useDensity3["default"])(),
|
|
45
|
+
_useDensity2 = _slicedToArray(_useDensity, 1),
|
|
46
|
+
globalDensity = _useDensity2[0];
|
|
47
|
+
if (propValue !== undefined && VALID.has(propValue)) return propValue;
|
|
48
|
+
return globalDensity;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=useResolvedDensity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolvedDensity.js","names":["_useDensity3","_interopRequireDefault","require","obj","__esModule","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","_i","Symbol","iterator","_s","_e","_x","_r","_arr","_n","_d","next","done","push","value","err","isArray","VALID","Set","useResolvedDensity","propValue","_useDensity","useDensity","_useDensity2","globalDensity","undefined","has"],"sources":["../../../src/lib/v2/hooks/useResolvedDensity.ts"],"sourcesContent":["import useDensity from \"./useDensity\";\r\n\r\n/**\r\n * useResolvedDensity — Portnet UI v2\r\n *\r\n * Returns the effective density for a component instance, applying\r\n * the standard resolution order used across the v2 surface:\r\n *\r\n * (1) explicit `propValue` from the caller (component prop)\r\n * (2) the global user preference from useDensity()\r\n * (3) fallback \"comfortable\"\r\n *\r\n * Use this in any component that wants to honour the user-level\r\n * density preference BY DEFAULT but still allow a caller to force\r\n * an override per instance — e.g. a picker dialog that always\r\n * wants \"compact\" regardless of the global preference, or a key\r\n * report that always wants \"comfortable\" for legibility.\r\n *\r\n * The hook always subscribes to useDensity() so the component\r\n * re-renders correctly when the user toggles the global density\r\n * (same tab via setter, other tab via storage event). The prop\r\n * simply wins on the resolved value when it's a valid density.\r\n *\r\n * Charter R-9.5 / R-DG.11.\r\n *\r\n * const effective = useResolvedDensity(props.density);\r\n * <DataGrid density={effective} … />\r\n */\r\n\r\ntype DensityPref = ReturnType<typeof useDensity>[0];\r\n\r\nconst VALID = new Set([\"comfortable\", \"compact\"]);\r\n\r\nexport default function useResolvedDensity(propValue?: DensityPref): DensityPref {\r\n const [globalDensity] = useDensity();\r\n if (propValue !== undefined && VALID.has(propValue)) return propValue;\r\n return globalDensity;\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,eAAAC,GAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,GAAA,KAAAG,qBAAA,CAAAH,GAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,GAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SAAAD,CAAA,qBAAAA,CAAA,sBAAAE,iBAAA,CAAAF,CAAA,EAAAC,MAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,CAAAC,QAAA,CAAAC,IAAA,CAAAP,CAAA,EAAAQ,KAAA,aAAAL,CAAA,iBAAAH,CAAA,CAAAS,WAAA,EAAAN,CAAA,GAAAH,CAAA,CAAAS,WAAA,CAAAC,IAAA,MAAAP,CAAA,cAAAA,CAAA,mBAAAQ,KAAA,CAAAC,IAAA,CAAAZ,CAAA,OAAAG,CAAA,+DAAAU,IAAA,CAAAV,CAAA,UAAAD,iBAAA,CAAAF,CAAA,EAAAC,MAAA;AAAA,SAAAC,kBAAAT,GAAA,EAAAqB,GAAA,QAAAA,GAAA,YAAAA,GAAA,GA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IAAMwC,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAElC,SAASC,kBAAkBA,CAACC,SAAuB,EAAe;EAC/E,IAAAC,WAAA,GAAwB,IAAAC,uBAAU,EAAC,CAAC;IAAAC,YAAA,GAAA/C,cAAA,CAAA6C,WAAA;IAA7BG,aAAa,GAAAD,YAAA;EACpB,IAAIH,SAAS,KAAKK,SAAS,IAAIR,KAAK,CAACS,GAAG,CAACN,SAAS,CAAC,EAAE,OAAOA,SAAS;EACrE,OAAOI,aAAa;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SortDescriptor } from "../types/common";
|
|
2
|
+
/**
|
|
3
|
+
* useSortedRows — Portnet UI v2
|
|
4
|
+
*
|
|
5
|
+
* Memoised, locale-aware sort. Wraps `applySort` (Batch 12 / C1) with a
|
|
6
|
+
* useMemo so consumers don't have to wire the dependency array themselves.
|
|
7
|
+
*
|
|
8
|
+
* const [sort, setSort] = useState<SortDescriptor[]>([{ key: "date", dir: "desc" }]);
|
|
9
|
+
* const sortedRows = useSortedRows(rows, sort, "fr-FR");
|
|
10
|
+
* <DataGrid rows={sortedRows} sort={sort} onSortChange={setSort} ... />
|
|
11
|
+
*
|
|
12
|
+
* Re-runs when:
|
|
13
|
+
* - `rows` reference changes (host responsibility — pass a stable ref
|
|
14
|
+
* when the data hasn't actually changed, otherwise the sort
|
|
15
|
+
* runs every render).
|
|
16
|
+
* - `sort` reference changes.
|
|
17
|
+
* - `locale` value changes (string compare).
|
|
18
|
+
*
|
|
19
|
+
* For server-side sorting, skip this hook and pass already-sorted rows
|
|
20
|
+
* straight to DataGrid.
|
|
21
|
+
*
|
|
22
|
+
* @returns A new sorted array (or the same reference when there's nothing to sort).
|
|
23
|
+
*/
|
|
24
|
+
export default function useSortedRows<T extends object>(rows: T[], sort: SortDescriptor[], locale?: string): T[];
|
|
25
|
+
//# sourceMappingURL=useSortedRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSortedRows.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/hooks/useSortedRows.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,SAAS,MAAM,EACpD,IAAI,EAAE,CAAC,EAAE,EACT,IAAI,EAAE,cAAc,EAAE,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,CAAC,EAAE,CAKL"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useSortedRows;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _sort = require("../patterns/_sort");
|
|
9
|
+
/**
|
|
10
|
+
* useSortedRows — Portnet UI v2
|
|
11
|
+
*
|
|
12
|
+
* Memoised, locale-aware sort. Wraps `applySort` (Batch 12 / C1) with a
|
|
13
|
+
* useMemo so consumers don't have to wire the dependency array themselves.
|
|
14
|
+
*
|
|
15
|
+
* const [sort, setSort] = useState<SortDescriptor[]>([{ key: "date", dir: "desc" }]);
|
|
16
|
+
* const sortedRows = useSortedRows(rows, sort, "fr-FR");
|
|
17
|
+
* <DataGrid rows={sortedRows} sort={sort} onSortChange={setSort} ... />
|
|
18
|
+
*
|
|
19
|
+
* Re-runs when:
|
|
20
|
+
* - `rows` reference changes (host responsibility — pass a stable ref
|
|
21
|
+
* when the data hasn't actually changed, otherwise the sort
|
|
22
|
+
* runs every render).
|
|
23
|
+
* - `sort` reference changes.
|
|
24
|
+
* - `locale` value changes (string compare).
|
|
25
|
+
*
|
|
26
|
+
* For server-side sorting, skip this hook and pass already-sorted rows
|
|
27
|
+
* straight to DataGrid.
|
|
28
|
+
*
|
|
29
|
+
* @returns A new sorted array (or the same reference when there's nothing to sort).
|
|
30
|
+
*/
|
|
31
|
+
function useSortedRows(rows, sort, locale) {
|
|
32
|
+
return (0, _react.useMemo)(function () {
|
|
33
|
+
return (0, _sort.applySort)(rows, sort, locale === undefined ? {} : {
|
|
34
|
+
locale: locale
|
|
35
|
+
});
|
|
36
|
+
}, [rows, sort, locale]);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useSortedRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSortedRows.js","names":["_react","require","_sort","useSortedRows","rows","sort","locale","useMemo","applySort","undefined"],"sources":["../../../src/lib/v2/hooks/useSortedRows.ts"],"sourcesContent":["import { useMemo } from \"react\";\r\nimport { applySort } from \"../patterns/_sort\";\r\nimport type { SortDescriptor } from \"../types/common\";\r\n\r\n/**\r\n * useSortedRows — Portnet UI v2\r\n *\r\n * Memoised, locale-aware sort. Wraps `applySort` (Batch 12 / C1) with a\r\n * useMemo so consumers don't have to wire the dependency array themselves.\r\n *\r\n * const [sort, setSort] = useState<SortDescriptor[]>([{ key: \"date\", dir: \"desc\" }]);\r\n * const sortedRows = useSortedRows(rows, sort, \"fr-FR\");\r\n * <DataGrid rows={sortedRows} sort={sort} onSortChange={setSort} ... />\r\n *\r\n * Re-runs when:\r\n * - `rows` reference changes (host responsibility — pass a stable ref\r\n * when the data hasn't actually changed, otherwise the sort\r\n * runs every render).\r\n * - `sort` reference changes.\r\n * - `locale` value changes (string compare).\r\n *\r\n * For server-side sorting, skip this hook and pass already-sorted rows\r\n * straight to DataGrid.\r\n *\r\n * @returns A new sorted array (or the same reference when there's nothing to sort).\r\n */\r\nexport default function useSortedRows<T extends object>(\r\n rows: T[],\r\n sort: SortDescriptor[],\r\n locale?: string,\r\n): T[] {\r\n return useMemo(\r\n () => applySort(rows, sort, locale === undefined ? {} : { locale }),\r\n [rows, sort, locale],\r\n );\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,aAAaA,CACnCC,IAAS,EACTC,IAAsB,EACtBC,MAAe,EACV;EACL,OAAO,IAAAC,cAAO,EACZ;IAAA,OAAM,IAAAC,eAAS,EAACJ,IAAI,EAAEC,IAAI,EAAEC,MAAM,KAAKG,SAAS,GAAG,CAAC,CAAC,GAAG;MAAEH,MAAM,EAANA;IAAO,CAAC,CAAC;EAAA,GACnE,CAACF,IAAI,EAAEC,IAAI,EAAEC,MAAM,CACrB,CAAC;AACH","ignoreList":[]}
|