@spscommerce/ds-react 0.0.0-20260319-8230915ce
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/README.md +55 -0
- package/lib/advanced-search/SpsAdvancedSearch.d.ts +10 -0
- package/lib/advanced-search/SpsAdvancedSearch.examples.d.ts +2 -0
- package/lib/advanced-search/index.d.ts +2 -0
- package/lib/autocomplete/SpsAutocomplete.d.ts +31 -0
- package/lib/autocomplete/SpsAutocomplete.examples.d.ts +2 -0
- package/lib/autocomplete/index.d.ts +2 -0
- package/lib/button/SpsButton.d.ts +14 -0
- package/lib/button/SpsButton.examples.d.ts +2 -0
- package/lib/button/SpsButtonGroup.d.ts +4 -0
- package/lib/button/SpsIconButtonPanel.d.ts +4 -0
- package/lib/button/index.d.ts +4 -0
- package/lib/card/SpsCard.d.ts +11 -0
- package/lib/card/SpsCardHeader.d.ts +9 -0
- package/lib/card/SpsCardTabbedPane.d.ts +15 -0
- package/lib/card/index.d.ts +2 -0
- package/lib/card/useTab.d.ts +18 -0
- package/lib/card-v2/SpsCardV2.d.ts +2 -0
- package/lib/card-v2/SpsCardV2Footer.d.ts +2 -0
- package/lib/card-v2/SpsCardV2Header.d.ts +2 -0
- package/lib/card-v2/SpsCardV2Title.d.ts +2 -0
- package/lib/card-v2/index.d.ts +5 -0
- package/lib/checkbox/SpsCheckbox.d.ts +17 -0
- package/lib/checkbox/SpsCheckbox.examples.d.ts +2 -0
- package/lib/checkbox/index.d.ts +2 -0
- package/lib/checkbox-dropdown/SpsCheckboxDropdown.d.ts +9 -0
- package/lib/checkbox-dropdown/index.d.ts +1 -0
- package/lib/clickable-tag/SpsClickableTag.d.ts +12 -0
- package/lib/clickable-tag/SpsClickableTag.examples.d.ts +2 -0
- package/lib/clickable-tag/index.d.ts +2 -0
- package/lib/column-chooser/SpsColumnChooser.d.ts +16 -0
- package/lib/column-chooser/SpsColumnChooser.examples.d.ts +2 -0
- package/lib/column-chooser/SpsColumnChooserColumn.d.ts +13 -0
- package/lib/column-chooser/index.d.ts +3 -0
- package/lib/conditional-field/SpsConditionalField.d.ts +6 -0
- package/lib/conditional-field/SpsConditionalField.examples.d.ts +2 -0
- package/lib/conditional-field/index.d.ts +2 -0
- package/lib/content-row/SpsContentRow.d.ts +16 -0
- package/lib/content-row/SpsContentRow.examples.d.ts +2 -0
- package/lib/content-row/SpsContentRowCol.d.ts +10 -0
- package/lib/content-row/SpsContentRowExpansion.d.ts +4 -0
- package/lib/content-row/index.d.ts +4 -0
- package/lib/context-bar/SpsContextBar.d.ts +6 -0
- package/lib/context-bar/index.d.ts +1 -0
- package/lib/currency-input/SpsCurrencyInput.d.ts +13 -0
- package/lib/currency-input/SpsCurrencyInput.examples.d.ts +2 -0
- package/lib/currency-input/index.d.ts +2 -0
- package/lib/dateRangePicker/SpsDateRangePicker.d.ts +21 -0
- package/lib/dateRangePicker/SpsDateRangePicker.examples.d.ts +2 -0
- package/lib/dateRangePicker/index.d.ts +2 -0
- package/lib/dateTimeRangePicker/SpsDateTimeRangePicker.d.ts +23 -0
- package/lib/dateTimeRangePicker/SpsDateTimeRangePicker.examples.d.ts +2 -0
- package/lib/dateTimeRangePicker/index.d.ts +2 -0
- package/lib/datepicker/SpsDatepicker.d.ts +18 -0
- package/lib/datepicker/SpsDatepicker.examples.d.ts +2 -0
- package/lib/datepicker/SpsDatepickerCalendar.d.ts +15 -0
- package/lib/datepicker/SpsDatepickerPopup.d.ts +11 -0
- package/lib/datepicker/index.d.ts +4 -0
- package/lib/datepicker/useCalendar.d.ts +2 -0
- package/lib/datepicker/useMoment.d.ts +3 -0
- package/lib/datepicker/utils.d.ts +38 -0
- package/lib/datepicker/validation.d.ts +11 -0
- package/lib/datetime/SpsDateTime.d.ts +11 -0
- package/lib/datetime/SpsDateTime.examples.d.ts +2 -0
- package/lib/datetime/SpsLocaleProvider.d.ts +7 -0
- package/lib/datetime/index.d.ts +3 -0
- package/lib/datetime/localeDefinitions.d.ts +20 -0
- package/lib/datetime/momentLocale.d.ts +3 -0
- package/lib/description-list/SpsDescriptionList.d.ts +9 -0
- package/lib/description-list/SpsDescriptionList.examples.d.ts +2 -0
- package/lib/description-list/SpsDescriptionListDefinition.d.ts +5 -0
- package/lib/description-list/SpsDescriptionListTerm.d.ts +13 -0
- package/lib/description-list/index.d.ts +4 -0
- package/lib/dropdown/SpsDropdown.d.ts +24 -0
- package/lib/dropdown/SpsDropdown.examples.d.ts +2 -0
- package/lib/dropdown/index.d.ts +2 -0
- package/lib/feedback-block/SpsFeedbackBlock.d.ts +7 -0
- package/lib/feedback-block/SpsFeedbackBlock.examples.d.ts +2 -0
- package/lib/feedback-block/index.d.ts +2 -0
- package/lib/fieldset/SpsFieldset.d.ts +22 -0
- package/lib/fieldset/SpsFieldset.examples.d.ts +2 -0
- package/lib/fieldset/index.d.ts +2 -0
- package/lib/filter-panel/SpsFilterPanel.d.ts +4 -0
- package/lib/filter-panel/SpsFilterPanel.examples.d.ts +2 -0
- package/lib/filter-panel/SpsFilterPanelCap.d.ts +6 -0
- package/lib/filter-panel/SpsFilterPanelFilterBox.d.ts +10 -0
- package/lib/filter-panel/SpsFilterPanelSection.d.ts +11 -0
- package/lib/filter-panel/index.d.ts +5 -0
- package/lib/filter-tile-list/SpsFilterTile.d.ts +10 -0
- package/lib/filter-tile-list/SpsFilterTileList.d.ts +4 -0
- package/lib/filter-tile-list/SpsFilterTileList.examples.d.ts +2 -0
- package/lib/filter-tile-list/index.d.ts +3 -0
- package/lib/focused-task/SpsFocusedTask.d.ts +8 -0
- package/lib/focused-task/SpsFocusedTask.examples.d.ts +2 -0
- package/lib/focused-task/SpsFocusedTaskActions.d.ts +4 -0
- package/lib/focused-task/index.d.ts +3 -0
- package/lib/form/AddRemoveFormRows.examples.d.ts +18 -0
- package/lib/form/SpsForm.d.ts +18 -0
- package/lib/form/SpsForm.examples.d.ts +1 -0
- package/lib/form/SpsFormComponentWrapper.d.ts +14 -0
- package/lib/form/hooks/SpsAbstractControl.interface.d.ts +24 -0
- package/lib/form/hooks/SpsControlSet.interface.d.ts +7 -0
- package/lib/form/hooks/formArray.d.ts +12 -0
- package/lib/form/hooks/formControl.d.ts +9 -0
- package/lib/form/hooks/formGroup.d.ts +10 -0
- package/lib/form/hooks/useCustomValidator.d.ts +7 -0
- package/lib/form/hooks/useForm.d.ts +2 -0
- package/lib/form/hooks/useFormControlId.d.ts +4 -0
- package/lib/form/hooks/useServerSideValidation.d.ts +3 -0
- package/lib/form/hooks/useSpsForm.d.ts +92 -0
- package/lib/form/index.d.ts +16 -0
- package/lib/form/validation/SpsValidators.d.ts +20 -0
- package/lib/form/validation/types.d.ts +10 -0
- package/lib/form/validation/validate.d.ts +2 -0
- package/lib/growler/SpsGrowler.d.ts +11 -0
- package/lib/growler/SpsGrowler.examples.d.ts +2 -0
- package/lib/growler/index.d.ts +3 -0
- package/lib/growler/useGrowlers.d.ts +13 -0
- package/lib/icon/SpsIcon.d.ts +9 -0
- package/lib/icon/index.d.ts +1 -0
- package/lib/incrementor/SpsIncrementor.d.ts +12 -0
- package/lib/incrementor/SpsIncrementor.examples.d.ts +2 -0
- package/lib/incrementor/index.d.ts +2 -0
- package/lib/index.d.ts +74 -0
- package/lib/index.js +35288 -0
- package/lib/index.umd.cjs +11826 -0
- package/lib/input-group/SpsInputGroup.d.ts +12 -0
- package/lib/input-group/index.d.ts +1 -0
- package/lib/insight-tile/SpsInsightTile.d.ts +13 -0
- package/lib/insight-tile/SpsInsights.d.ts +4 -0
- package/lib/insight-tile/index.d.ts +2 -0
- package/lib/key-value-list/SpsKeyValueList.d.ts +6 -0
- package/lib/key-value-list/SpsKeyValueListItem.d.ts +8 -0
- package/lib/key-value-list/index.d.ts +2 -0
- package/lib/key-value-tag/SpsKeyValueTag.d.ts +11 -0
- package/lib/key-value-tag/SpsKeyValueTag.examples.d.ts +2 -0
- package/lib/key-value-tag/index.d.ts +2 -0
- package/lib/label/SpsLabel.d.ts +15 -0
- package/lib/label/SpsLabel.examples.d.ts +2 -0
- package/lib/label/index.d.ts +2 -0
- package/lib/list-action-bar/SpsListActionBar.d.ts +7 -0
- package/lib/list-action-bar/SpsListActionBar.examples.d.ts +2 -0
- package/lib/list-action-bar/index.d.ts +2 -0
- package/lib/list-toolbar/SpsListToolbar.d.ts +22 -0
- package/lib/list-toolbar/SpsListToolbar.examples.d.ts +4 -0
- package/lib/list-toolbar/SpsListToolbarSearch.d.ts +6 -0
- package/lib/list-toolbar/SpsListToolbarSearchInfo.d.ts +4 -0
- package/lib/list-toolbar/SpsListToolbarSortBy.d.ts +16 -0
- package/lib/list-toolbar/index.d.ts +5 -0
- package/lib/manifest.d.ts +2 -0
- package/lib/micro-block/SpsMicroBlock.d.ts +8 -0
- package/lib/micro-block/SpsMicroBlock.examples.d.ts +2 -0
- package/lib/micro-block/index.d.ts +2 -0
- package/lib/modal/SpsModal.d.ts +13 -0
- package/lib/modal/SpsModal.examples.d.ts +2 -0
- package/lib/modal/index.d.ts +3 -0
- package/lib/modal/useModals.d.ts +15 -0
- package/lib/multi-select/SpsMultiSelect.d.ts +37 -0
- package/lib/multi-select/SpsMultiSelect.examples.d.ts +2 -0
- package/lib/multi-select/index.d.ts +2 -0
- package/lib/multi-value-text-input/SpsMultiValueTextInput.d.ts +20 -0
- package/lib/multi-value-text-input/SpsMultiValueTextInput.examples.d.ts +2 -0
- package/lib/multi-value-text-input/index.d.ts +2 -0
- package/lib/multi-value-text-input/splitStringByDelimiter.d.ts +2 -0
- package/lib/option-list/SpsOptionList.d.ts +3 -0
- package/lib/option-list/SpsOptionListProps.d.ts +89 -0
- package/lib/option-list/index.d.ts +1 -0
- package/lib/option-list/useOptionListOptions.d.ts +8 -0
- package/lib/option-list/useOptionListSearch.d.ts +13 -0
- package/lib/option-list/usePreventScroll.d.ts +7 -0
- package/lib/option-list/useSpsAction.d.ts +2 -0
- package/lib/option-list-v2/SpsOptionListV2.d.ts +0 -0
- package/lib/option-list-v2/index.d.ts +0 -0
- package/lib/page-title/SpsPageSubtitle.d.ts +4 -0
- package/lib/page-title/SpsPageTitle.d.ts +4 -0
- package/lib/page-title/SpsPageTitle.examples.d.ts +2 -0
- package/lib/page-title/index.d.ts +3 -0
- package/lib/pagination/SpsPageSelector.d.ts +12 -0
- package/lib/pagination/SpsPagination.d.ts +15 -0
- package/lib/pagination/SpsPagination.examples.d.ts +2 -0
- package/lib/pagination/index.d.ts +3 -0
- package/lib/product-bar/SpsProductBar.d.ts +13 -0
- package/lib/product-bar/SpsProductBar.examples.d.ts +2 -0
- package/lib/product-bar/SpsProductBarTab.d.ts +6 -0
- package/lib/product-bar/index.d.ts +3 -0
- package/lib/progress-bar/SpsProgressBar.d.ts +10 -0
- package/lib/progress-bar/SpsProgressBar.examples.d.ts +28 -0
- package/lib/progress-bar/index.d.ts +2 -0
- package/lib/progress-ring/SpsProgressRing.d.ts +8 -0
- package/lib/progress-ring/index.d.ts +1 -0
- package/lib/prop-types.d.ts +4 -0
- package/lib/radio-button/SpsRadioButton.d.ts +19 -0
- package/lib/radio-button/SpsRadioButton.examples.d.ts +2 -0
- package/lib/radio-button/index.d.ts +2 -0
- package/lib/scrollable-container/SpsScrollableContainer.d.ts +6 -0
- package/lib/scrollable-container/index.d.ts +1 -0
- package/lib/search-results-bar/SpsSearchResultsBar.d.ts +8 -0
- package/lib/search-results-bar/SpsSearchResultsBar.examples.d.ts +2 -0
- package/lib/search-results-bar/SpsSearchResultsBarV2.d.ts +9 -0
- package/lib/search-results-bar/index.d.ts +3 -0
- package/lib/select/SpsSelect.d.ts +76 -0
- package/lib/select/SpsSelect.examples.d.ts +2 -0
- package/lib/select/index.d.ts +2 -0
- package/lib/side-nav/SpsSideNav.d.ts +38 -0
- package/lib/side-nav/SpsSideNav.examples.d.ts +2 -0
- package/lib/side-nav/SpsSideNavBranch.d.ts +9 -0
- package/lib/side-nav/index.d.ts +2 -0
- package/lib/slack-link/SpsSlackLink.d.ts +6 -0
- package/lib/slack-link/SpsSlackLink.examples.d.ts +2 -0
- package/lib/slack-link/index.d.ts +2 -0
- package/lib/slide-in-panel/SpsSlideInPanel.d.ts +11 -0
- package/lib/slide-in-panel/SpsSlideInPanel.examples.d.ts +2 -0
- package/lib/slide-in-panel/index.d.ts +2 -0
- package/lib/sorting-header/SpsSortingHeader.d.ts +8 -0
- package/lib/sorting-header/SpsSortingHeader.examples.d.ts +2 -0
- package/lib/sorting-header/SpsSortingHeaderCell.d.ts +12 -0
- package/lib/sorting-header/index.d.ts +3 -0
- package/lib/spinner/SpsSpinner.d.ts +9 -0
- package/lib/spinner/index.d.ts +1 -0
- package/lib/split-button/SpsSplitButton.d.ts +17 -0
- package/lib/split-button/SpsSplitButton.examples.d.ts +2 -0
- package/lib/split-button/index.d.ts +2 -0
- package/lib/stepped-progress-bar/SpsSteppedProgressBar.d.ts +21 -0
- package/lib/stepped-progress-bar/SpsSteppedProgressBar.examples.d.ts +29 -0
- package/lib/stepped-progress-bar/index.d.ts +2 -0
- package/lib/summary-list/SpsSummaryList.examples.d.ts +2 -0
- package/lib/summary-list/SpsSummaryListColumn.d.ts +9 -0
- package/lib/summary-list/SpsSummaryListExpansion.d.ts +4 -0
- package/lib/summary-list/SpsSummaryListRow.d.ts +8 -0
- package/lib/summary-list/index.d.ts +4 -0
- package/lib/table/SpsTable.d.ts +14 -0
- package/lib/table/SpsTable.examples.d.ts +2 -0
- package/lib/table/SpsTableBody.d.ts +5 -0
- package/lib/table/SpsTableCell.d.ts +10 -0
- package/lib/table/SpsTableContext.d.ts +20 -0
- package/lib/table/SpsTableHead.d.ts +7 -0
- package/lib/table/SpsTableHeader.d.ts +10 -0
- package/lib/table/SpsTableRow.d.ts +5 -0
- package/lib/table/index.d.ts +8 -0
- package/lib/table/useColumnResizer.d.ts +9 -0
- package/lib/table/usePinnedStyles.d.ts +6 -0
- package/lib/tabs/SpsTabs.d.ts +9 -0
- package/lib/tabs-v2/SpsTab.d.ts +7 -0
- package/lib/tabs-v2/SpsTabPanel.d.ts +6 -0
- package/lib/tabs-v2/SpsTabsV2.d.ts +3 -0
- package/lib/tabs-v2/index.d.ts +4 -0
- package/lib/tag/SpsTag.d.ts +9 -0
- package/lib/tag/SpsTag.examples.d.ts +2 -0
- package/lib/tag/index.d.ts +2 -0
- package/lib/task-queue/SpsTaskQueue.d.ts +30 -0
- package/lib/task-queue/SpsTaskQueue.examples.d.ts +2 -0
- package/lib/task-queue/index.d.ts +2 -0
- package/lib/text-input/SpsTextInput.d.ts +33 -0
- package/lib/text-input/SpsTextInput.examples.d.ts +2 -0
- package/lib/text-input/index.d.ts +2 -0
- package/lib/textarea/SpsTextarea.d.ts +18 -0
- package/lib/textarea/SpsTextarea.examples.d.ts +2 -0
- package/lib/textarea/index.d.ts +2 -0
- package/lib/tile-list/SpsTile.d.ts +15 -0
- package/lib/tile-list/SpsTileList.d.ts +4 -0
- package/lib/tile-list/SpsTileList.examples.d.ts +2 -0
- package/lib/tile-list/index.d.ts +3 -0
- package/lib/time-input/SpsTimeInput.d.ts +18 -0
- package/lib/time-input/SpsTimeInput.examples.d.ts +2 -0
- package/lib/time-input/index.d.ts +2 -0
- package/lib/toggle/SpsToggle.d.ts +18 -0
- package/lib/toggle/SpsToggle.examples.d.ts +2 -0
- package/lib/toggle/index.d.ts +2 -0
- package/lib/tooltip/SpsTooltip.d.ts +23 -0
- package/lib/tooltip/SpsTooltip.examples.d.ts +2 -0
- package/lib/tooltip/SpsTooltipTitle.d.ts +9 -0
- package/lib/tooltip/index.d.ts +3 -0
- package/lib/utils/FauxChangeEvent.d.ts +20 -0
- package/lib/utils/Provide.d.ts +24 -0
- package/lib/utils/bindProps.d.ts +33 -0
- package/lib/utils/contentOf.d.ts +2 -0
- package/lib/utils/getPosition.d.ts +11 -0
- package/lib/utils/getScrollParent.d.ts +1 -0
- package/lib/utils/index.d.ts +14 -0
- package/lib/utils/letterAndNumberKeys.d.ts +1 -0
- package/lib/utils/selectChildren.d.ts +5 -0
- package/lib/utils/useCheckDeprecatedProps.d.ts +1 -0
- package/lib/utils/useDidUpdateEffect.d.ts +11 -0
- package/lib/utils/useDocumentEventListener.d.ts +1 -0
- package/lib/utils/useElementId.d.ts +3 -0
- package/lib/utils/useInputPopup.d.ts +6 -0
- package/lib/utils/usePatchReducer.d.ts +2 -0
- package/lib/utils/usePortal.d.ts +6 -0
- package/lib/vertical-rule/SpsVerticalRule.d.ts +5 -0
- package/lib/vertical-rule/index.d.ts +1 -0
- package/lib/wizard/SpsWizard.examples.d.ts +2 -0
- package/lib/wizard/SpsWizardSidebar.d.ts +18 -0
- package/lib/wizard/SpsWizardSubstep.d.ts +9 -0
- package/lib/wizard/index.d.ts +3 -0
- package/lib/workflow/SpsWorkflow.DeprecationWarning.d.ts +2 -0
- package/lib/workflow/SpsWorkflow.d.ts +9 -0
- package/lib/workflow/SpsWorkflow.examples.d.ts +2 -0
- package/lib/workflow/SpsWorkflowDocument.d.ts +5 -0
- package/lib/workflow/SpsWorkflowDocumentStatus.d.ts +8 -0
- package/lib/workflow/SpsWorkflowStep.d.ts +9 -0
- package/lib/workflow/index.d.ts +5 -0
- package/lib/zero-state/SpsMicroZeroState.d.ts +10 -0
- package/lib/zero-state/SpsZeroState.d.ts +9 -0
- package/lib/zero-state/SpsZeroState.examples.d.ts +2 -0
- package/lib/zero-state/index.d.ts +3 -0
- package/package.json +92 -0
- package/vite.config.mjs +20 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SimpleDate, SimpleDateRange, DatePreset, DateTimePreset, SimpleMomentRange } from "@spscommerce/ds-shared";
|
|
2
|
+
import type { Moment } from "moment-timezone";
|
|
3
|
+
export declare const FORMAT = "MM/DD/YYYY";
|
|
4
|
+
export declare const FORMAT_WITH_TIME = "MM/DD/YYYY hh:mm A";
|
|
5
|
+
export declare const FORMAT_WITH_TIME_24 = "MM/DD/YYYY HH:mm";
|
|
6
|
+
export declare const TIME_FORMAT = "hh:mm A";
|
|
7
|
+
export declare const TIME_FORMAT_24 = "HH:mm";
|
|
8
|
+
export declare const FORMAT_PATTERN: RegExp;
|
|
9
|
+
export declare const SYMBOL_DATE_PARSE_ERROR: unique symbol;
|
|
10
|
+
export declare const SimpleDateUtils: Readonly<{
|
|
11
|
+
createFrom(input?: string | Moment | null, format?: string): SimpleDate | null;
|
|
12
|
+
createMomentFrom(input: string | Moment | SimpleDate, format?: string): Moment | null;
|
|
13
|
+
getRangeSeparator(format?: string): string;
|
|
14
|
+
createRangeFrom(input: string, format?: string): SimpleDateRange | null;
|
|
15
|
+
isValid(date?: SimpleDate | Moment | null): boolean | undefined;
|
|
16
|
+
nullifyInvalidDate(value: any): SimpleDate | null;
|
|
17
|
+
toMoment(date?: Moment | SimpleDate | null): Moment | null;
|
|
18
|
+
toString(date?: Moment | SimpleDate | null, format?: string): string;
|
|
19
|
+
toStringRange(dateRange: SimpleDateRange, format?: string): string;
|
|
20
|
+
toDateTimeString(dateMoment: Moment | null, twentyFourHourFormat?: boolean, dateFormat?: string): string;
|
|
21
|
+
toDateTimeStringRange(dateRange: SimpleMomentRange, twentyFourHourFormat?: boolean, dateFormat?: string): string;
|
|
22
|
+
create(): SimpleDate;
|
|
23
|
+
isSameDate(d1: SimpleDate, d2: SimpleDate): boolean;
|
|
24
|
+
isSameMonth(d1: SimpleDate, d2: SimpleDate): boolean;
|
|
25
|
+
isAfter(date: SimpleDate | Moment | null, referenceDate: SimpleDate | Moment | null): boolean | null;
|
|
26
|
+
isBefore(date: SimpleDate | Moment | null, referenceDate: SimpleDate | Moment | null): boolean | null;
|
|
27
|
+
isInRange(date: SimpleDate, range: SimpleDateRange, inclusive?: boolean): boolean | 0 | null;
|
|
28
|
+
prevMonth(date: SimpleDate): SimpleDate;
|
|
29
|
+
nextMonth(date: SimpleDate): SimpleDate;
|
|
30
|
+
createRangeFromPreset(preset: DatePreset, format?: string): SimpleDateRange;
|
|
31
|
+
createDateTimeRangeFromPreset(preset: DateTimePreset): SimpleMomentRange;
|
|
32
|
+
splitMomentInDateTimeParts(dateMoment?: Moment | null, twentyFourHourFormat?: boolean, dateFormat?: string, defaultToEndOfDay?: boolean): [string, string, string | undefined];
|
|
33
|
+
getCurrentMoment(): Moment;
|
|
34
|
+
validateTimeString(timeString?: string, twentyFourHourFormat?: boolean): boolean;
|
|
35
|
+
padIncompleteTimeString(timeString?: string, twentyFourHourFormat?: boolean): string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const twelveHourTimes: string[];
|
|
38
|
+
export declare const twentyFourHourTimes: string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SimpleDate, SimpleDateRange, SimpleMomentRange } from "@spscommerce/ds-shared";
|
|
2
|
+
import type { Duration, Moment } from "moment-timezone";
|
|
3
|
+
import type { SpsValidator, SpsValidatorFactory } from "../form/validation/types";
|
|
4
|
+
export declare function setDateFormat(format: string): void;
|
|
5
|
+
export declare const date: SpsValidator<SimpleDate | SimpleDateRange | Moment | SimpleMomentRange | null>;
|
|
6
|
+
export declare const dateRange: SpsValidator<SimpleDateRange | Duration | SimpleMomentRange>;
|
|
7
|
+
export interface DateConstraintError {
|
|
8
|
+
minExceeded: string | null;
|
|
9
|
+
maxExceeded: string | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const dateConstraint: SpsValidatorFactory<SimpleDate | SimpleDateRange | Moment | SimpleMomentRange>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SpsDateTimeProps = React.PropsWithChildren<{
|
|
3
|
+
currentUser?: any;
|
|
4
|
+
dateToFormat?: string | Date;
|
|
5
|
+
format?: string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
relative?: boolean;
|
|
8
|
+
relativeHrs?: number;
|
|
9
|
+
tz?: string;
|
|
10
|
+
}> & React.HTMLAttributes<HTMLSpanElement>;
|
|
11
|
+
export declare function SpsDateTime(props: SpsDateTimeProps): React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SpsLocaleProviderProps = React.PropsWithChildren<{
|
|
3
|
+
currentUser?: any;
|
|
4
|
+
locale?: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function SpsLocaleProvider({ currentUser, locale, children, }: SpsLocaleProviderProps): React.ReactElement;
|
|
7
|
+
export declare function useSpsLocale(currentUser?: any): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type MomentInstance = typeof import("moment");
|
|
2
|
+
export declare function registerLocale_de(moment: MomentInstance): void;
|
|
3
|
+
export declare function registerLocale_enAu(moment: MomentInstance): void;
|
|
4
|
+
export declare function registerLocale_enCa(moment: MomentInstance): void;
|
|
5
|
+
export declare function registerLocale_enGb(moment: MomentInstance): void;
|
|
6
|
+
export declare function registerLocale_enIe(moment: MomentInstance): void;
|
|
7
|
+
export declare function registerLocale_es(moment: MomentInstance): void;
|
|
8
|
+
export declare function registerLocale_fr(moment: MomentInstance): void;
|
|
9
|
+
export declare function registerLocale_frCa(moment: MomentInstance): void;
|
|
10
|
+
export declare function registerLocale_it(moment: MomentInstance): void;
|
|
11
|
+
export declare function registerLocale_nl(moment: MomentInstance): void;
|
|
12
|
+
export declare function registerLocale_zhCn(moment: MomentInstance): void;
|
|
13
|
+
export declare function registerLocale_zhTw(moment: MomentInstance): void;
|
|
14
|
+
/**
|
|
15
|
+
* Register all supported locales on the provided moment instance.
|
|
16
|
+
* Call this function with your moment instance to ensure locales
|
|
17
|
+
* are registered on the correct instance.
|
|
18
|
+
*/
|
|
19
|
+
export declare function registerAllLocales(moment: MomentInstance): void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsDescriptionListProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
4
|
+
compact?: boolean;
|
|
5
|
+
wideTerms?: boolean;
|
|
6
|
+
widerTerms?: boolean;
|
|
7
|
+
}> & React.HTMLAttributes<HTMLDListElement>;
|
|
8
|
+
export declare function SpsDescriptionList(props: SpsDescriptionListProps): React.JSX.Element;
|
|
9
|
+
export declare function SpsDl(props: SpsDescriptionListProps): React.JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsDescriptionListDefinitionProps = React.PropsWithChildren<SpsGlobalPropTypes> & React.HTMLAttributes<HTMLElement>;
|
|
4
|
+
export declare function SpsDescriptionListDefinition(props: SpsDescriptionListDefinitionProps): React.JSX.Element;
|
|
5
|
+
export declare function SpsDd(props: SpsDescriptionListDefinitionProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsFormControl } from "../form/hooks/formControl";
|
|
3
|
+
import type { SpsFormFieldMeta } from "../form/hooks/useSpsForm";
|
|
4
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
5
|
+
export type SpsDescriptionListTermProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
6
|
+
error?: boolean;
|
|
7
|
+
errors?: React.ReactNode | (() => React.ReactNode);
|
|
8
|
+
help?: React.ReactNode | (() => React.ReactNode);
|
|
9
|
+
labelFor?: SpsFormControl<any> | SpsFormFieldMeta<any>;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
}> & React.HTMLAttributes<HTMLElement>;
|
|
12
|
+
export declare function SpsDescriptionListTerm(props: SpsDescriptionListTermProps): React.JSX.Element;
|
|
13
|
+
export declare function SpsDt(props: SpsDescriptionListTermProps): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SpsActionDescriptor, SpsActionMethod } from "@spscommerce/ds-shared";
|
|
2
|
+
import { DropdownKind, SpsIcon } from "@spscommerce/ds-shared";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
5
|
+
export type SpsDropdownProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
6
|
+
action?: (...args: any[]) => void;
|
|
7
|
+
alignLeft?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
conformWidth?: boolean;
|
|
10
|
+
icon?: SpsIcon;
|
|
11
|
+
kind?: DropdownKind;
|
|
12
|
+
label?: string;
|
|
13
|
+
options?: Array<SpsActionMethod | [SpsActionDescriptor, () => void]>;
|
|
14
|
+
spinning?: boolean;
|
|
15
|
+
spinningTitle?: string;
|
|
16
|
+
tallOptionList?: boolean;
|
|
17
|
+
onOpen?: () => void;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
maxHeightOptionListPx?: number;
|
|
21
|
+
maxHeightOptionListRem?: number;
|
|
22
|
+
disableOptionsMemoization?: boolean;
|
|
23
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
24
|
+
export declare function SpsDropdown(props: SpsDropdownProps): React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FeedbackBlockKind } from "@spscommerce/ds-shared";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
4
|
+
export type SpsFeedbackBlockProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
5
|
+
kind?: FeedbackBlockKind;
|
|
6
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
export declare function SpsFeedbackBlock(props: SpsFeedbackBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TooltipShowTrigger, Position } from "@spscommerce/ds-shared";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
4
|
+
import type { SpsFormArray } from "../form/hooks/formArray";
|
|
5
|
+
import type { SpsFormGroup } from "../form/hooks/formGroup";
|
|
6
|
+
import type { SpsFormSetMeta } from "../form/hooks/useSpsForm";
|
|
7
|
+
export type SpsFieldsetProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
8
|
+
errors?: React.ReactNode | (() => React.ReactNode);
|
|
9
|
+
formArray?: SpsFormArray<any>;
|
|
10
|
+
formGroup?: SpsFormGroup;
|
|
11
|
+
formMeta?: SpsFormSetMeta<any>;
|
|
12
|
+
legend?: string;
|
|
13
|
+
hasRequiredFields?: boolean;
|
|
14
|
+
optional?: boolean;
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
onToggled?: (isEnabled: boolean) => void;
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
applyNestedStyles?: boolean;
|
|
19
|
+
errorsTooltipTrigger?: TooltipShowTrigger;
|
|
20
|
+
errorsTooltipPosition?: Position;
|
|
21
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
22
|
+
export declare function SpsFieldset({ children, className, errors, formArray, formGroup, formMeta, legend, unsafelyReplaceClassName, hasRequiredFields, optional, enabled, onToggled, tooltip, applyNestedStyles, "data-testid": testId, errorsTooltipTrigger, errorsTooltipPosition, }: SpsFieldsetProps): React.JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsFilterPanelProps = React.PropsWithChildren<SpsGlobalPropTypes> & React.HTMLAttributes<HTMLDivElement>;
|
|
4
|
+
export declare function SpsFilterPanel({ children, className, ...rest }: SpsFilterPanelProps): React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsFilterPanelCapProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
4
|
+
onClear?: () => void;
|
|
5
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
export declare function SpsFilterPanelCap({ children, className, onClear, ...rest }: SpsFilterPanelCapProps): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
import type { SpsFormFieldMeta } from "../form";
|
|
4
|
+
export type SpsFilterPanelFilterBoxProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
5
|
+
value?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
formMeta?: SpsFormFieldMeta<string>;
|
|
8
|
+
onFilterChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
9
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export declare function SpsFilterPanelFilterBox({ className, value, placeholder, formMeta, onFilterChange, ...rest }: SpsFilterPanelFilterBoxProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsFilterPanelSectionProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
4
|
+
title?: string | React.ReactNode;
|
|
5
|
+
expanded?: boolean;
|
|
6
|
+
heightPx?: number;
|
|
7
|
+
heightRem?: number;
|
|
8
|
+
onExpand?: () => void;
|
|
9
|
+
onCollapse?: () => void;
|
|
10
|
+
}> & Omit<React.HTMLAttributes<HTMLDivElement>, "title">;
|
|
11
|
+
export declare function SpsFilterPanelSection({ children, className, title, expanded, heightPx, heightRem, onExpand, onCollapse, ...rest }: SpsFilterPanelSectionProps): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { SpsFilterTileKind } from "@spscommerce/ds-shared";
|
|
3
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
4
|
+
export type SpsFilterTileProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
5
|
+
value: number;
|
|
6
|
+
title: string;
|
|
7
|
+
kind?: SpsFilterTileKind;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export declare function SpsFilterTile(props: SpsFilterTileProps): React.JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsFilterTileListProps = React.PropsWithChildren<SpsGlobalPropTypes> & React.HTMLAttributes<HTMLDivElement>;
|
|
4
|
+
export declare function SpsFilterTileList(props: SpsFilterTileListProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsFocusedTaskProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
4
|
+
fullWidth?: boolean;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
8
|
+
export declare function SpsFocusedTask(props: SpsFocusedTaskProps): React.JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
export type SpsFocusedTaskActionsProps = React.PropsWithChildren<SpsGlobalPropTypes> & React.HTMLAttributes<HTMLDivElement>;
|
|
4
|
+
export declare function SpsFocusedTaskActions(props: SpsFocusedTaskActionsProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsFormArray } from "./hooks/formArray";
|
|
3
|
+
import type { SpsFormGroup } from "./hooks/formGroup";
|
|
4
|
+
import type { SpsFormSetMeta } from "./hooks/useSpsForm";
|
|
5
|
+
export declare const spsFormProps: {
|
|
6
|
+
formMeta: string;
|
|
7
|
+
onSubmit: string;
|
|
8
|
+
};
|
|
9
|
+
export type SpsFormProps = React.PropsWithChildren<{
|
|
10
|
+
formArray?: SpsFormArray<any>;
|
|
11
|
+
formGroup?: SpsFormGroup;
|
|
12
|
+
formMeta?: SpsFormSetMeta<any>;
|
|
13
|
+
onSubmit?: React.FormEventHandler;
|
|
14
|
+
}> & React.HTMLAttributes<HTMLFormElement>;
|
|
15
|
+
type SpsFormForwardRefType = SpsFormProps & React.RefAttributes<HTMLFormElement>;
|
|
16
|
+
type SpsFormForwardRefExoticComponent = React.ForwardRefExoticComponent<SpsFormForwardRefType>;
|
|
17
|
+
export declare const SpsForm: SpsFormForwardRefExoticComponent;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SpsFormExamples: {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
|
+
import type { SpsFormControl } from "./hooks/formControl";
|
|
4
|
+
import type { SpsFormMetaBase } from "./hooks/useSpsForm";
|
|
5
|
+
export type SpsFormComponentWrapperProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
6
|
+
focusInputOnClick?: boolean;
|
|
7
|
+
formMeta?: SpsFormMetaBase<any>;
|
|
8
|
+
formControl?: SpsFormControl<any>;
|
|
9
|
+
inputRef?: React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
10
|
+
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
11
|
+
type SpsFormComponentWrapperForwardRefType = SpsFormComponentWrapperProps & React.RefAttributes<HTMLDivElement>;
|
|
12
|
+
type SpsFormComponentWrapperForwardRefExoticComponent = React.ForwardRefExoticComponent<SpsFormComponentWrapperForwardRefType>;
|
|
13
|
+
export declare const SpsFormComponentWrapper: SpsFormComponentWrapperForwardRefExoticComponent;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SpsValidator, SpsValidationErrors } from "../validation/types";
|
|
2
|
+
export interface SpsAbstractControlConfig<T> {
|
|
3
|
+
validators?: Array<SpsValidator<T>>;
|
|
4
|
+
}
|
|
5
|
+
export interface SpsAbstractControl<T> extends SpsAbstractControlConfig<T> {
|
|
6
|
+
_type: string;
|
|
7
|
+
errors: SpsValidationErrors | null;
|
|
8
|
+
invalid: boolean;
|
|
9
|
+
setInitValue: (newValue: T) => any;
|
|
10
|
+
getValue: () => T;
|
|
11
|
+
setValue: (newValue: T) => any;
|
|
12
|
+
isValid: () => boolean;
|
|
13
|
+
hasError: (errorKey: string) => boolean;
|
|
14
|
+
isFocused: () => boolean;
|
|
15
|
+
focus: () => any;
|
|
16
|
+
blur: () => any;
|
|
17
|
+
onFocus?: () => any;
|
|
18
|
+
onBlur?: () => any;
|
|
19
|
+
isPristine: () => boolean;
|
|
20
|
+
markAsPristine: () => any;
|
|
21
|
+
markAsDirty: () => any;
|
|
22
|
+
reset: (value?: T) => any;
|
|
23
|
+
update: () => any;
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SpsAbstractControl } from "./SpsAbstractControl.interface";
|
|
2
|
+
export interface SpsControlSet extends SpsAbstractControl<any> {
|
|
3
|
+
members: any;
|
|
4
|
+
get: <T extends SpsAbstractControl<any>>(path: PropertyKey | PropertyKey[]) => T;
|
|
5
|
+
update: () => any;
|
|
6
|
+
}
|
|
7
|
+
export declare function getMember<T extends SpsAbstractControl<any>>(controlSet: SpsControlSet, path: PropertyKey | PropertyKey[]): T;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SpsAbstractControl, SpsAbstractControlConfig } from "./SpsAbstractControl.interface";
|
|
2
|
+
import type { SpsControlSet } from "./SpsControlSet.interface";
|
|
3
|
+
export interface SpsFormArray<T> extends SpsControlSet {
|
|
4
|
+
members: Array<SpsAbstractControl<T>>;
|
|
5
|
+
length: number;
|
|
6
|
+
at: (index: number) => SpsAbstractControl<T>;
|
|
7
|
+
push: (control: SpsAbstractControl<T>) => any;
|
|
8
|
+
insert: (index: number, control: SpsAbstractControl<T>) => any;
|
|
9
|
+
removeAt: (index: number) => any;
|
|
10
|
+
setControl: (index: number, control: SpsAbstractControl<T>) => any;
|
|
11
|
+
}
|
|
12
|
+
export declare function formArray<T>(members?: Array<SpsAbstractControl<T>>, config?: SpsAbstractControlConfig<T>): SpsFormArray<T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SpsAbstractControl, SpsAbstractControlConfig } from "./SpsAbstractControl.interface";
|
|
2
|
+
export interface SpsFormControl<T> extends SpsAbstractControl<T> {
|
|
3
|
+
id: string;
|
|
4
|
+
value: T;
|
|
5
|
+
focused: boolean;
|
|
6
|
+
pristine: boolean;
|
|
7
|
+
isRequired: () => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function formControl<T>(initValue?: T, config?: SpsAbstractControlConfig<T>): SpsFormControl<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SpsAbstractControl, SpsAbstractControlConfig } from "./SpsAbstractControl.interface";
|
|
2
|
+
import type { SpsControlSet } from "./SpsControlSet.interface";
|
|
3
|
+
export interface SpsFormGroup extends SpsControlSet {
|
|
4
|
+
members: Record<string, SpsAbstractControl<any>>;
|
|
5
|
+
addControl: (name: string, control: SpsAbstractControl<any>) => any;
|
|
6
|
+
removeControl: (name: string) => any;
|
|
7
|
+
setControl: (name: string, control: SpsAbstractControl<any>) => any;
|
|
8
|
+
contains: (name: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function formGroup(members?: Record<string, SpsAbstractControl<any>>, config?: SpsAbstractControlConfig<any>): SpsFormGroup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SpsValidator } from "../validation/types";
|
|
2
|
+
export declare enum ValidationMode {
|
|
3
|
+
ON_CHANGE = 0,
|
|
4
|
+
ON_BLUR = 1,
|
|
5
|
+
ON_SUBMIT = 2
|
|
6
|
+
}
|
|
7
|
+
export declare function useCustomValidator<T>(validator: SpsValidator<T>, validatorConfig?: Record<string, ValidationMode>, dependencies?: any[]): SpsValidator<T>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SpsValidationStatus } from "../validation/types";
|
|
2
|
+
import type { SpsAbstractControl } from "./SpsAbstractControl.interface";
|
|
3
|
+
export declare function useServerSideValidation(formControl: SpsAbstractControl<any>, initialState?: SpsValidationStatus): (import("../validation/types").SpsValidationErrors | import("react").Dispatch<import("react").SetStateAction<import("../validation/types").SpsValidationErrors | null>> | null)[];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { SpsValidator } from "../validation/types";
|
|
2
|
+
import { ValidationMode } from "./useCustomValidator";
|
|
3
|
+
type PathComponent = string | number;
|
|
4
|
+
type Path = PathComponent[];
|
|
5
|
+
type UpdateFn = (path?: Path, newValue?: any, markAsBlurred?: boolean, newValidators?: Array<SpsValidator<any>>, markAsSubmitted?: boolean) => void;
|
|
6
|
+
interface UpdateFormOptions {
|
|
7
|
+
validators?: SpsValidatorMap;
|
|
8
|
+
runValidators?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class SpsFormMetaBase<T> {
|
|
11
|
+
#private;
|
|
12
|
+
path: Path;
|
|
13
|
+
update: UpdateFn;
|
|
14
|
+
validators: Array<SpsValidator<T>>;
|
|
15
|
+
preventativeErrors: string[];
|
|
16
|
+
submitted: boolean;
|
|
17
|
+
constructor(path: Path, update: UpdateFn);
|
|
18
|
+
get errors(): {
|
|
19
|
+
[x: string]: string | number | boolean | Record<string, any>;
|
|
20
|
+
} | null;
|
|
21
|
+
setValidators(newValidators: Array<SpsValidator<T>>): SpsFormMetaBase<T>;
|
|
22
|
+
validate(newValue: T, mode?: ValidationMode, skipUpdateAfterValidation?: boolean): SpsFormMetaBase<T>;
|
|
23
|
+
isValid(): boolean;
|
|
24
|
+
hasErrors(): boolean;
|
|
25
|
+
isVisibilyInvalid(): boolean;
|
|
26
|
+
hasError(errorKey: string): any;
|
|
27
|
+
hasPreventativeError(errorKey: string): boolean;
|
|
28
|
+
hasPreventativeErrors(): boolean;
|
|
29
|
+
isRequired(): boolean;
|
|
30
|
+
isSubmitted(): boolean;
|
|
31
|
+
onFocus(): void;
|
|
32
|
+
onBlur(): void;
|
|
33
|
+
abstract isPristine(): boolean;
|
|
34
|
+
abstract markAsPristine(): SpsFormMetaBase<T>;
|
|
35
|
+
abstract markAsDirty(): SpsFormMetaBase<T>;
|
|
36
|
+
abstract isFocused(): boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare class SpsFormFieldMeta<T> extends SpsFormMetaBase<T> {
|
|
39
|
+
id: string;
|
|
40
|
+
focused: boolean;
|
|
41
|
+
pristine: boolean;
|
|
42
|
+
setValue(newValue: T): void;
|
|
43
|
+
isPristine(): boolean;
|
|
44
|
+
markAsPristine(): SpsFormFieldMeta<T>;
|
|
45
|
+
markAsDirty(): SpsFormFieldMeta<T>;
|
|
46
|
+
isFocused(): boolean;
|
|
47
|
+
markAsFocused(): SpsFormFieldMeta<T>;
|
|
48
|
+
markAsBlurred(): SpsFormFieldMeta<T>;
|
|
49
|
+
markAsSubmitted(): SpsFormFieldMeta<T>;
|
|
50
|
+
}
|
|
51
|
+
export type InferredSpsFormMeta<T> = SpsFormMetaBase<T> & (T extends any[] ? SpsFormArrayMeta<T> : T extends (Array<infer U> | undefined) ? SpsFormArrayMeta<U[]> | undefined : T extends object ? SpsFormGroupMeta<T> : T extends (object | undefined) ? SpsFormGroupMeta<object & T> | undefined : T extends boolean ? SpsFormFieldMeta<boolean> : T extends (infer V | undefined) ? SpsFormFieldMeta<V> | undefined : SpsFormFieldMeta<T>);
|
|
52
|
+
export type SpsFormSetMembers<T> = {
|
|
53
|
+
[K in keyof T]?: SpsFormMetaBase<any>;
|
|
54
|
+
};
|
|
55
|
+
export type InferredSpsFormMetaSetMembers<T> = SpsFormSetMembers<T> & {
|
|
56
|
+
[K in keyof T]: InferredSpsFormMeta<T[K]>;
|
|
57
|
+
};
|
|
58
|
+
export type SpsFormSetValue = any[] | object;
|
|
59
|
+
export declare abstract class SpsFormSetMeta<T extends SpsFormSetValue, U extends SpsFormSetMembers<T> = InferredSpsFormMetaSetMembers<T>> extends SpsFormFieldMeta<T> {
|
|
60
|
+
fields: U;
|
|
61
|
+
constructor(path: Path, update: UpdateFn);
|
|
62
|
+
constructor(inferMembersFromValue: T, path: Path, update: UpdateFn);
|
|
63
|
+
isFocused(): boolean;
|
|
64
|
+
isValid(): boolean;
|
|
65
|
+
hasErrors(): boolean;
|
|
66
|
+
contentsAreValid(): boolean;
|
|
67
|
+
isPristine(): boolean;
|
|
68
|
+
markAsPristine(): this;
|
|
69
|
+
markAsDirty(): this;
|
|
70
|
+
markAsBlurred(): this;
|
|
71
|
+
markAsSubmitted(): this;
|
|
72
|
+
protected inferSpsControl(valueOrControl: any, key: PathComponent): SpsFormMetaBase<any>;
|
|
73
|
+
private rollup;
|
|
74
|
+
protected abstract inferMembers(inferFromValue: T): any;
|
|
75
|
+
}
|
|
76
|
+
export declare class SpsFormGroupMeta<T extends object> extends SpsFormSetMeta<T> {
|
|
77
|
+
protected inferMembers(inferFromValue: T): void;
|
|
78
|
+
}
|
|
79
|
+
export declare class SpsFormArrayMeta<T extends any[]> extends SpsFormSetMeta<T> {
|
|
80
|
+
protected inferMembers(inferFromValue: T): void;
|
|
81
|
+
}
|
|
82
|
+
export interface SpsFormState<T extends SpsFormSetValue> {
|
|
83
|
+
formValue: T;
|
|
84
|
+
formMeta: SpsFormSetMeta<T>;
|
|
85
|
+
updateForm: (newValue?: T, options?: UpdateFormOptions) => void;
|
|
86
|
+
validateForm: () => boolean;
|
|
87
|
+
getCurrentFormValue: () => T;
|
|
88
|
+
}
|
|
89
|
+
export type SpsValidatorMapValue = Array<SpsValidator<any>> | ((value: any) => Array<SpsValidator<any>>);
|
|
90
|
+
export type SpsValidatorMap = Record<string, SpsValidatorMapValue>;
|
|
91
|
+
export declare function useSpsForm<T extends SpsFormSetValue>(value: T, validatorMap?: SpsValidatorMap): SpsFormState<T>;
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./hooks/useSpsForm";
|
|
2
|
+
export * from "./hooks/formArray";
|
|
3
|
+
export * from "./hooks/formControl";
|
|
4
|
+
export * from "./hooks/formGroup";
|
|
5
|
+
export * from "./hooks/SpsAbstractControl.interface";
|
|
6
|
+
export * from "./hooks/SpsControlSet.interface";
|
|
7
|
+
export * from "./hooks/useForm";
|
|
8
|
+
export * from "./hooks/useServerSideValidation";
|
|
9
|
+
export * from "./hooks/useCustomValidator";
|
|
10
|
+
export * from "./validation/SpsValidators";
|
|
11
|
+
export * from "./validation/types";
|
|
12
|
+
export * from "./validation/validate";
|
|
13
|
+
export { SpsForm } from "./SpsForm";
|
|
14
|
+
export * from "./SpsForm.examples";
|
|
15
|
+
export * from "./AddRemoveFormRows.examples";
|
|
16
|
+
export { SpsFormComponentWrapper } from "./SpsFormComponentWrapper";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SpsValidator, SpsValidatorFactory } from "./types";
|
|
2
|
+
export declare const SpsValidators: Readonly<{
|
|
3
|
+
min: SpsValidatorFactory<string | number>;
|
|
4
|
+
max: SpsValidatorFactory<string | number>;
|
|
5
|
+
required: SpsValidator<any>;
|
|
6
|
+
minLength: SpsValidatorFactory<string>;
|
|
7
|
+
minLengthArray: SpsValidatorFactory<any[]>;
|
|
8
|
+
maxLength: SpsValidatorFactory<string>;
|
|
9
|
+
maxLengthArray: SpsValidatorFactory<any[]>;
|
|
10
|
+
pattern: SpsValidatorFactory<string>;
|
|
11
|
+
alpha: SpsValidator<string>;
|
|
12
|
+
numeric: SpsValidator<string>;
|
|
13
|
+
nonNumeric: SpsValidator<string>;
|
|
14
|
+
positiveOrNegativeNumber: SpsValidator<string>;
|
|
15
|
+
OnBlurErrorKeys: Set<string>;
|
|
16
|
+
setDateFormat(format: string): void;
|
|
17
|
+
date: SpsValidator<import("@spscommerce/ds-shared").SimpleDate | import("@spscommerce/ds-shared").SimpleDateRange | import("moment").Moment | import("@spscommerce/ds-shared").SimpleMomentRange | null>;
|
|
18
|
+
dateRange: SpsValidator<import("@spscommerce/ds-shared").SimpleDateRange | import("moment").Duration | import("@spscommerce/ds-shared").SimpleMomentRange>;
|
|
19
|
+
dateConstraint: SpsValidatorFactory<import("@spscommerce/ds-shared").SimpleDate | import("@spscommerce/ds-shared").SimpleDateRange | import("moment").Moment | import("@spscommerce/ds-shared").SimpleMomentRange>;
|
|
20
|
+
}>;
|