@coopdigital/react 1.31.1 → 1.32.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/dist/components/AlertBanner/AlertBanner.d.ts +0 -2
- package/dist/components/AlertBanner/AlertBanner.js +1 -2
- package/dist/components/AlertBanner/index.js +1 -2
- package/dist/components/Author/Author.d.ts +0 -2
- package/dist/components/Author/Author.js +1 -2
- package/dist/components/Author/index.js +1 -2
- package/dist/components/Box/Box.d.ts +0 -2
- package/dist/components/Box/Box.js +1 -2
- package/dist/components/Box/index.js +1 -2
- package/dist/components/Button/Button.d.ts +2 -4
- package/dist/components/Button/Button.js +1 -2
- package/dist/components/Button/index.js +1 -2
- package/dist/components/Card/Card.d.ts +0 -2
- package/dist/components/Card/Card.js +1 -2
- package/dist/components/Card/index.js +1 -2
- package/dist/components/Checkbox/Checkbox.d.ts +0 -2
- package/dist/components/Checkbox/Checkbox.js +1 -2
- package/dist/components/Checkbox/index.js +1 -2
- package/dist/components/Combobox/Combobox.context.js +1 -2
- package/dist/components/Combobox/Combobox.d.ts +0 -2
- package/dist/components/Combobox/Combobox.js +1 -2
- package/dist/components/Combobox/combobox-internal.js +1 -2
- package/dist/components/Combobox/combobox-utils.d.ts +1 -3
- package/dist/components/Combobox/index.js +1 -2
- package/dist/components/DateInput/DateInput.context.js +1 -2
- package/dist/components/DateInput/DateInput.d.ts +2 -3
- package/dist/components/DateInput/DateInput.js +2 -3
- package/dist/components/DateInput/dateinput-utils.d.ts +2 -65
- package/dist/components/DateInput/dateinput-utils.js +2 -83
- package/dist/components/DateInput/index.d.ts +2 -2
- package/dist/components/DateInput/index.js +3 -4
- package/dist/components/DatePicker/DatePicker.d.ts +0 -2
- package/dist/components/DatePicker/DatePicker.js +1 -2
- package/dist/components/DatePicker/datepicker-utils.d.ts +1 -3
- package/dist/components/DatePicker/datepicker-utils.js +1 -2
- package/dist/components/DatePicker/index.js +1 -2
- package/dist/components/Dialog/Dialog.d.ts +0 -2
- package/dist/components/Dialog/Dialog.js +1 -2
- package/dist/components/Dialog/index.js +1 -2
- package/dist/components/Expandable/Expandable.d.ts +0 -2
- package/dist/components/Expandable/Expandable.js +1 -2
- package/dist/components/Expandable/index.js +1 -2
- package/dist/components/Field/Field.context.js +1 -2
- package/dist/components/Field/Field.d.ts +0 -2
- package/dist/components/Field/Field.js +1 -2
- package/dist/components/Field/index.js +1 -2
- package/dist/components/FieldMarkers/Error.d.ts +1 -3
- package/dist/components/FieldMarkers/Error.js +1 -2
- package/dist/components/FieldMarkers/Hint.d.ts +1 -3
- package/dist/components/FieldMarkers/Hint.js +1 -2
- package/dist/components/FieldMarkers/Label.d.ts +1 -3
- package/dist/components/FieldMarkers/Label.js +1 -2
- package/dist/components/FieldMarkers/Legend.d.ts +1 -3
- package/dist/components/FieldMarkers/Legend.js +1 -2
- package/dist/components/FieldMarkers/fieldmarkers-internal.js +1 -2
- package/dist/components/Fieldset/Fieldset.context.js +1 -2
- package/dist/components/Fieldset/Fieldset.d.ts +0 -2
- package/dist/components/Fieldset/Fieldset.js +1 -2
- package/dist/components/Fieldset/index.js +1 -2
- package/dist/components/Flourish/Flourish.d.ts +0 -2
- package/dist/components/Flourish/Flourish.js +1 -2
- package/dist/components/Flourish/index.js +1 -2
- package/dist/components/Form/Form.d.ts +0 -2
- package/dist/components/Form/Form.js +1 -2
- package/dist/components/Form/index.js +1 -2
- package/dist/components/Image/Image.d.ts +0 -2
- package/dist/components/Image/Image.js +1 -2
- package/dist/components/Image/index.js +1 -2
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +0 -2
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -2
- package/dist/components/LoadingSpinner/index.js +1 -2
- package/dist/components/Logo/Logo.d.ts +0 -2
- package/dist/components/Logo/Logo.js +1 -2
- package/dist/components/Logo/index.js +1 -2
- package/dist/components/PasswordInput/PasswordInput.d.ts +0 -2
- package/dist/components/PasswordInput/PasswordInput.js +1 -2
- package/dist/components/PasswordInput/index.js +1 -2
- package/dist/components/Picture/Picture.d.ts +0 -2
- package/dist/components/Picture/Picture.js +1 -2
- package/dist/components/Picture/index.js +1 -2
- package/dist/components/Pill/Pill.d.ts +0 -2
- package/dist/components/Pill/Pill.js +1 -2
- package/dist/components/Pill/index.js +1 -2
- package/dist/components/Popover/Popover.d.ts +0 -2
- package/dist/components/Popover/Popover.js +1 -2
- package/dist/components/Popover/index.js +1 -2
- package/dist/components/Prose/Prose.d.ts +0 -2
- package/dist/components/Prose/Prose.js +1 -2
- package/dist/components/Prose/index.js +1 -2
- package/dist/components/Radio/Radio.d.ts +0 -2
- package/dist/components/Radio/Radio.js +1 -2
- package/dist/components/Radio/index.js +1 -2
- package/dist/components/RootSVG/RootSVG.d.ts +0 -2
- package/dist/components/RootSVG/RootSVG.js +1 -2
- package/dist/components/RootSVG/index.js +1 -2
- package/dist/components/Searchbox/Searchbox.context.js +1 -2
- package/dist/components/Searchbox/Searchbox.d.ts +0 -2
- package/dist/components/Searchbox/Searchbox.js +1 -2
- package/dist/components/Searchbox/index.js +1 -2
- package/dist/components/Section/Section.d.ts +0 -2
- package/dist/components/Section/Section.js +1 -2
- package/dist/components/Section/index.js +1 -2
- package/dist/components/Select/Select.d.ts +0 -2
- package/dist/components/Select/Select.js +1 -2
- package/dist/components/Select/index.js +1 -2
- package/dist/components/Signpost/Signpost.d.ts +0 -2
- package/dist/components/Signpost/Signpost.js +1 -2
- package/dist/components/Signpost/index.js +1 -2
- package/dist/components/SkipNav/SkipNav.d.ts +0 -2
- package/dist/components/SkipNav/SkipNav.js +1 -2
- package/dist/components/SkipNav/index.js +1 -2
- package/dist/components/Squircle/Squircle.d.ts +0 -2
- package/dist/components/Squircle/Squircle.js +1 -2
- package/dist/components/Squircle/index.js +1 -2
- package/dist/components/Tag/Tag.d.ts +0 -2
- package/dist/components/Tag/Tag.js +1 -2
- package/dist/components/Tag/index.js +1 -2
- package/dist/components/TextInput/TextInput.d.ts +0 -2
- package/dist/components/TextInput/TextInput.js +1 -2
- package/dist/components/TextInput/index.js +1 -2
- package/dist/components/Textarea/Textarea.d.ts +0 -2
- package/dist/components/Textarea/Textarea.js +1 -2
- package/dist/components/Textarea/index.js +1 -2
- package/dist/components/ValidationSummary/ValidationSummary.context.js +1 -2
- package/dist/components/ValidationSummary/ValidationSummary.d.ts +0 -2
- package/dist/components/ValidationSummary/ValidationSummary.js +1 -2
- package/dist/components/ValidationSummary/index.js +1 -2
- package/dist/components/ValidationSummary/validationsummary-internal.d.ts +1 -3
- package/dist/components/ValidationSummary/validationsummary-internal.js +1 -2
- package/dist/components/Wrapper/Wrapper.d.ts +0 -2
- package/dist/components/Wrapper/Wrapper.js +1 -2
- package/dist/components/Wrapper/index.js +1 -2
- package/dist/components/icons/AccountCircleFilledIcon.d.ts +0 -2
- package/dist/components/icons/AccountCircleFilledIcon.js +1 -2
- package/dist/components/icons/AccountCircleIcon.d.ts +0 -2
- package/dist/components/icons/AccountCircleIcon.js +1 -2
- package/dist/components/icons/AccountFilledIcon.d.ts +0 -2
- package/dist/components/icons/AccountFilledIcon.js +1 -2
- package/dist/components/icons/AccountIcon.d.ts +0 -2
- package/dist/components/icons/AccountIcon.js +1 -2
- package/dist/components/icons/AddIcon.d.ts +0 -2
- package/dist/components/icons/AddIcon.js +1 -2
- package/dist/components/icons/AppsFilledIcon.d.ts +0 -2
- package/dist/components/icons/AppsFilledIcon.js +1 -2
- package/dist/components/icons/AppsIcon.d.ts +0 -2
- package/dist/components/icons/AppsIcon.js +1 -2
- package/dist/components/icons/ArrowDownIcon.d.ts +0 -2
- package/dist/components/icons/ArrowDownIcon.js +1 -2
- package/dist/components/icons/ArrowLeftIcon.d.ts +0 -2
- package/dist/components/icons/ArrowLeftIcon.js +1 -2
- package/dist/components/icons/ArrowRightIcon.d.ts +0 -2
- package/dist/components/icons/ArrowRightIcon.js +1 -2
- package/dist/components/icons/ArrowUpIcon.d.ts +0 -2
- package/dist/components/icons/ArrowUpIcon.js +1 -2
- package/dist/components/icons/BackspaceFilledIcon.d.ts +0 -2
- package/dist/components/icons/BackspaceFilledIcon.js +1 -2
- package/dist/components/icons/BackspaceIcon.d.ts +0 -2
- package/dist/components/icons/BackspaceIcon.js +1 -2
- package/dist/components/icons/BasketFilledIcon.d.ts +0 -2
- package/dist/components/icons/BasketFilledIcon.js +1 -2
- package/dist/components/icons/BasketIcon.d.ts +0 -2
- package/dist/components/icons/BasketIcon.js +1 -2
- package/dist/components/icons/BellFilledIcon.d.ts +0 -2
- package/dist/components/icons/BellFilledIcon.js +1 -2
- package/dist/components/icons/BellIcon.d.ts +0 -2
- package/dist/components/icons/BellIcon.js +1 -2
- package/dist/components/icons/BroomIcon.d.ts +0 -2
- package/dist/components/icons/BroomIcon.js +1 -2
- package/dist/components/icons/CalendarFilledIcon.d.ts +0 -2
- package/dist/components/icons/CalendarFilledIcon.js +1 -2
- package/dist/components/icons/CalendarIcon.d.ts +0 -2
- package/dist/components/icons/CalendarIcon.js +1 -2
- package/dist/components/icons/CashFilledIcon.d.ts +0 -2
- package/dist/components/icons/CashFilledIcon.js +1 -2
- package/dist/components/icons/CashIcon.d.ts +0 -2
- package/dist/components/icons/CashIcon.js +1 -2
- package/dist/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/components/icons/ChevronDownIcon.js +1 -2
- package/dist/components/icons/ChevronLeftIcon.d.ts +0 -2
- package/dist/components/icons/ChevronLeftIcon.js +1 -2
- package/dist/components/icons/ChevronRightIcon.d.ts +0 -2
- package/dist/components/icons/ChevronRightIcon.js +1 -2
- package/dist/components/icons/ChevronUpIcon.d.ts +0 -2
- package/dist/components/icons/ChevronUpIcon.js +1 -2
- package/dist/components/icons/CircleBurgerFilledIcon.d.ts +0 -2
- package/dist/components/icons/CircleBurgerFilledIcon.js +1 -2
- package/dist/components/icons/CircleBurgerIcon.d.ts +0 -2
- package/dist/components/icons/CircleBurgerIcon.js +1 -2
- package/dist/components/icons/ClipboardFilledIcon.d.ts +0 -2
- package/dist/components/icons/ClipboardFilledIcon.js +1 -2
- package/dist/components/icons/ClipboardIcon.d.ts +0 -2
- package/dist/components/icons/ClipboardIcon.js +1 -2
- package/dist/components/icons/ClockFilledIcon.d.ts +0 -2
- package/dist/components/icons/ClockFilledIcon.js +1 -2
- package/dist/components/icons/ClockIcon.d.ts +0 -2
- package/dist/components/icons/ClockIcon.js +1 -2
- package/dist/components/icons/CloseAltFilledIcon.d.ts +0 -2
- package/dist/components/icons/CloseAltFilledIcon.js +1 -2
- package/dist/components/icons/CloseAltIcon.d.ts +0 -2
- package/dist/components/icons/CloseAltIcon.js +1 -2
- package/dist/components/icons/CogIcon.d.ts +0 -2
- package/dist/components/icons/CogIcon.js +1 -2
- package/dist/components/icons/CommunityFilledIcon.d.ts +0 -2
- package/dist/components/icons/CommunityFilledIcon.js +1 -2
- package/dist/components/icons/CommunityIcon.d.ts +0 -2
- package/dist/components/icons/CommunityIcon.js +1 -2
- package/dist/components/icons/ComputerIcon.d.ts +0 -2
- package/dist/components/icons/ComputerIcon.js +1 -2
- package/dist/components/icons/ContactFilledIcon.d.ts +0 -2
- package/dist/components/icons/ContactFilledIcon.js +1 -2
- package/dist/components/icons/ContactIcon.d.ts +0 -2
- package/dist/components/icons/ContactIcon.js +1 -2
- package/dist/components/icons/ContactlessFilledIcon.d.ts +0 -2
- package/dist/components/icons/ContactlessFilledIcon.js +1 -2
- package/dist/components/icons/ContactlessIcon.d.ts +0 -2
- package/dist/components/icons/ContactlessIcon.js +1 -2
- package/dist/components/icons/CoopLiveIcon.d.ts +0 -2
- package/dist/components/icons/CoopLiveIcon.js +1 -2
- package/dist/components/icons/CoopLocationFilledIcon.d.ts +0 -2
- package/dist/components/icons/CoopLocationFilledIcon.js +1 -2
- package/dist/components/icons/CoopLogoIcon.d.ts +0 -2
- package/dist/components/icons/CoopLogoIcon.js +1 -2
- package/dist/components/icons/CoopMembershipCardFilledIcon.d.ts +0 -2
- package/dist/components/icons/CoopMembershipCardFilledIcon.js +1 -2
- package/dist/components/icons/CreditCardFilledIcon.d.ts +0 -2
- package/dist/components/icons/CreditCardFilledIcon.js +1 -2
- package/dist/components/icons/CreditCardIcon.d.ts +0 -2
- package/dist/components/icons/CreditCardIcon.js +1 -2
- package/dist/components/icons/CrossIcon.d.ts +0 -2
- package/dist/components/icons/CrossIcon.js +1 -2
- package/dist/components/icons/DocumentIcon.d.ts +0 -2
- package/dist/components/icons/DocumentIcon.js +1 -2
- package/dist/components/icons/DownloadIcon.d.ts +0 -2
- package/dist/components/icons/DownloadIcon.js +1 -2
- package/dist/components/icons/EnterStoreIcon.d.ts +0 -2
- package/dist/components/icons/EnterStoreIcon.js +1 -2
- package/dist/components/icons/ExitStoreIcon.d.ts +0 -2
- package/dist/components/icons/ExitStoreIcon.js +1 -2
- package/dist/components/icons/EyeFilledIcon.d.ts +0 -2
- package/dist/components/icons/EyeFilledIcon.js +1 -2
- package/dist/components/icons/EyeIcon.d.ts +0 -2
- package/dist/components/icons/EyeIcon.js +1 -2
- package/dist/components/icons/EyeStrikeFilledIcon.d.ts +0 -2
- package/dist/components/icons/EyeStrikeFilledIcon.js +1 -2
- package/dist/components/icons/EyeStrikeIcon.d.ts +0 -2
- package/dist/components/icons/EyeStrikeIcon.js +1 -2
- package/dist/components/icons/FeedbackFilledIcon.d.ts +0 -2
- package/dist/components/icons/FeedbackFilledIcon.js +1 -2
- package/dist/components/icons/FeedbackIcon.d.ts +0 -2
- package/dist/components/icons/FeedbackIcon.js +1 -2
- package/dist/components/icons/FilterIcon.d.ts +0 -2
- package/dist/components/icons/FilterIcon.js +1 -2
- package/dist/components/icons/GiftCardFilledIcon.d.ts +0 -2
- package/dist/components/icons/GiftCardFilledIcon.js +1 -2
- package/dist/components/icons/GiftCardIcon.d.ts +0 -2
- package/dist/components/icons/GiftCardIcon.js +1 -2
- package/dist/components/icons/GiftFilledIcon.d.ts +0 -2
- package/dist/components/icons/GiftFilledIcon.js +1 -2
- package/dist/components/icons/GiftIcon.d.ts +0 -2
- package/dist/components/icons/GiftIcon.js +1 -2
- package/dist/components/icons/HelpFilledIcon.d.ts +0 -2
- package/dist/components/icons/HelpFilledIcon.js +1 -2
- package/dist/components/icons/HelpIcon.d.ts +0 -2
- package/dist/components/icons/HelpIcon.js +1 -2
- package/dist/components/icons/HomeFilledIcon.d.ts +0 -2
- package/dist/components/icons/HomeFilledIcon.js +1 -2
- package/dist/components/icons/HomeIcon.d.ts +0 -2
- package/dist/components/icons/HomeIcon.js +1 -2
- package/dist/components/icons/HowDoIAssistantIcon.d.ts +0 -2
- package/dist/components/icons/HowDoIAssistantIcon.js +1 -2
- package/dist/components/icons/InfoIcon.d.ts +0 -2
- package/dist/components/icons/InfoIcon.js +1 -2
- package/dist/components/icons/KebabIcon.d.ts +0 -2
- package/dist/components/icons/KebabIcon.js +1 -2
- package/dist/components/icons/LoadingIcon.d.ts +0 -2
- package/dist/components/icons/LoadingIcon.js +1 -2
- package/dist/components/icons/LocationFilledIcon.d.ts +0 -2
- package/dist/components/icons/LocationFilledIcon.js +1 -2
- package/dist/components/icons/LocationIcon.d.ts +0 -2
- package/dist/components/icons/LocationIcon.js +1 -2
- package/dist/components/icons/LogoutIcon.d.ts +0 -2
- package/dist/components/icons/LogoutIcon.js +1 -2
- package/dist/components/icons/MailIcon.d.ts +0 -2
- package/dist/components/icons/MailIcon.js +1 -2
- package/dist/components/icons/MenuIcon.d.ts +0 -2
- package/dist/components/icons/MenuIcon.js +1 -2
- package/dist/components/icons/MessageIcon.d.ts +0 -2
- package/dist/components/icons/MessageIcon.js +1 -2
- package/dist/components/icons/MinusIcon.d.ts +0 -2
- package/dist/components/icons/MinusIcon.js +1 -2
- package/dist/components/icons/NotesFilledIcon.d.ts +0 -2
- package/dist/components/icons/NotesFilledIcon.js +1 -2
- package/dist/components/icons/NotesIcon.d.ts +0 -2
- package/dist/components/icons/NotesIcon.js +1 -2
- package/dist/components/icons/OpenNewIcon.d.ts +0 -2
- package/dist/components/icons/OpenNewIcon.js +1 -2
- package/dist/components/icons/OwnBagIcon.d.ts +0 -2
- package/dist/components/icons/OwnBagIcon.js +1 -2
- package/dist/components/icons/PadlockIcon.d.ts +0 -2
- package/dist/components/icons/PadlockIcon.js +1 -2
- package/dist/components/icons/PencilIcon.d.ts +0 -2
- package/dist/components/icons/PencilIcon.js +1 -2
- package/dist/components/icons/PhoneIcon.d.ts +0 -2
- package/dist/components/icons/PhoneIcon.js +1 -2
- package/dist/components/icons/PowerIcon.d.ts +0 -2
- package/dist/components/icons/PowerIcon.js +1 -2
- package/dist/components/icons/SaveFilledIcon.d.ts +0 -2
- package/dist/components/icons/SaveFilledIcon.js +1 -2
- package/dist/components/icons/SaveIcon.d.ts +0 -2
- package/dist/components/icons/SaveIcon.js +1 -2
- package/dist/components/icons/ScooterIcon.d.ts +0 -2
- package/dist/components/icons/ScooterIcon.js +1 -2
- package/dist/components/icons/SearchFilledIcon.d.ts +0 -2
- package/dist/components/icons/SearchFilledIcon.js +1 -2
- package/dist/components/icons/SearchIcon.d.ts +0 -2
- package/dist/components/icons/SearchIcon.js +1 -2
- package/dist/components/icons/SendIcon.d.ts +0 -2
- package/dist/components/icons/SendIcon.js +1 -2
- package/dist/components/icons/SpannerIcon.d.ts +0 -2
- package/dist/components/icons/SpannerIcon.js +1 -2
- package/dist/components/icons/StarFilledIcon.d.ts +0 -2
- package/dist/components/icons/StarFilledIcon.js +1 -2
- package/dist/components/icons/StarIcon.d.ts +0 -2
- package/dist/components/icons/StarIcon.js +1 -2
- package/dist/components/icons/TickAltFilledIcon.d.ts +0 -2
- package/dist/components/icons/TickAltFilledIcon.js +1 -2
- package/dist/components/icons/TickAltIcon.d.ts +0 -2
- package/dist/components/icons/TickAltIcon.js +1 -2
- package/dist/components/icons/TickIcon.d.ts +0 -2
- package/dist/components/icons/TickIcon.js +1 -2
- package/dist/components/icons/TruckIcon.d.ts +0 -2
- package/dist/components/icons/TruckIcon.js +1 -2
- package/dist/components/icons/UserWipeIcon.d.ts +0 -2
- package/dist/components/icons/UserWipeIcon.js +1 -2
- package/dist/components/icons/VoucherFilledIcon.d.ts +0 -2
- package/dist/components/icons/VoucherFilledIcon.js +1 -2
- package/dist/components/icons/VoucherIcon.d.ts +0 -2
- package/dist/components/icons/VoucherIcon.js +1 -2
- package/dist/components/icons/WarningCircleFilledIcon.d.ts +0 -2
- package/dist/components/icons/WarningCircleFilledIcon.js +1 -2
- package/dist/components/icons/WarningCircleIcon.d.ts +0 -2
- package/dist/components/icons/WarningCircleIcon.js +1 -2
- package/dist/components/icons/WarningFilledIcon.d.ts +0 -2
- package/dist/components/icons/WarningFilledIcon.js +1 -2
- package/dist/components/icons/WarningIcon.d.ts +0 -2
- package/dist/components/icons/WarningIcon.js +1 -2
- package/dist/components/icons/WifiIcon.d.ts +0 -2
- package/dist/components/icons/WifiIcon.js +1 -2
- package/dist/components/icons/WriteIcon.d.ts +0 -2
- package/dist/components/icons/WriteIcon.js +1 -2
- package/dist/hooks/useDebounce.d.ts +1 -3
- package/dist/hooks/useDebounce.js +1 -2
- package/dist/hooks/useFormReset.d.ts +0 -2
- package/dist/hooks/useFormReset.js +1 -2
- package/dist/hooks/useId.d.ts +1 -3
- package/dist/hooks/useId.js +1 -2
- package/dist/hooks/useSlots.d.ts +0 -2
- package/dist/hooks/useSlots.js +1 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/types/colors.d.ts +1 -3
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.js +1 -2
- package/dist/utils/classes.d.ts +1 -3
- package/dist/utils/classes.js +1 -2
- package/dist/utils/slots.d.ts +1 -3
- package/dist/utils/slots.js +1 -2
- package/dist/validations/date-internal.d.ts +4 -0
- package/dist/{components/DateInput/dateinput-internal.js → validations/date-internal.js} +4 -5
- package/dist/validations/date.d.ts +58 -0
- package/dist/validations/date.js +79 -0
- package/dist/validations/index.d.ts +2 -0
- package/dist/validations/index.js +1 -0
- package/package.json +18 -12
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/DateInput/DateInput.context.ts +2 -1
- package/src/components/DateInput/DateInput.tsx +4 -7
- package/src/components/DateInput/dateinput-utils.ts +1 -183
- package/src/index.ts +1 -0
- package/src/{components/DateInput/dateinput-internal.ts → validations/date-internal.ts} +15 -24
- package/src/validations/date.ts +177 -0
- package/src/validations/index.ts +1 -0
- package/dist/components/DateInput/dateinput-internal.d.ts +0 -6
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
2
|
-
//#region src/components/AlertBanner/AlertBanner.d.ts
|
|
3
2
|
export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
3
|
/** Content inside the component.
|
|
5
4
|
*
|
|
@@ -36,5 +35,4 @@ declare const AlertBannerHeading: {
|
|
|
36
35
|
name: string;
|
|
37
36
|
};
|
|
38
37
|
};
|
|
39
|
-
//#endregion
|
|
40
38
|
export { AlertBanner, AlertBanner as default, AlertBannerHeading };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/components/AlertBanner/AlertBanner.tsx
|
|
4
4
|
const AlertBanner = ({ children, className, ref, variant = "default", ...props }) => {
|
|
5
5
|
const componentProps = {
|
|
6
6
|
className: clsx("coop-alert-banner", className),
|
|
@@ -22,5 +22,4 @@ const AlertBannerHeading = ({ children, className }) => {
|
|
|
22
22
|
AlertBanner.slot = { name: "AlertBanner" };
|
|
23
23
|
AlertBannerHeading.slot = { name: "AlertBannerHeading" };
|
|
24
24
|
AlertBanner.Heading = AlertBannerHeading;
|
|
25
|
-
//#endregion
|
|
26
25
|
export { AlertBanner, AlertBanner as default, AlertBannerHeading };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AlertBanner, AlertBannerHeading } from "./AlertBanner.js";
|
|
2
|
-
|
|
2
|
+
// src/components/AlertBanner/index.ts
|
|
3
3
|
var AlertBanner_default = AlertBanner;
|
|
4
|
-
//#endregion
|
|
5
4
|
export { AlertBanner, AlertBannerHeading, AlertBanner_default as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ImageProps } from "../Image/Image.js";
|
|
2
2
|
import "../Image/index.js";
|
|
3
3
|
import { HTMLAttributes, JSX, Ref } from "react";
|
|
4
|
-
//#region src/components/Author/Author.d.ts
|
|
5
4
|
export interface AuthorProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
5
|
/** Content inside the component.
|
|
7
6
|
*
|
|
@@ -38,5 +37,4 @@ declare const Author: {
|
|
|
38
37
|
};
|
|
39
38
|
declare const AuthorImage: ({ alt, src, ...props }: AuthorImageProps) => JSX.Element;
|
|
40
39
|
declare const AuthorMeta: ({ date, datePrefix, name, ...props }: AuthorMetaProps) => JSX.Element;
|
|
41
|
-
//#endregion
|
|
42
40
|
export { Author, Author as default, AuthorImage, AuthorMeta };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Image } from "../Image/Image.js";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/Author/Author.tsx
|
|
5
5
|
const Author = ({ children, className, ref, size, ...props }) => {
|
|
6
6
|
const componentProps = {
|
|
7
7
|
className: clsx("coop-author", className),
|
|
@@ -41,5 +41,4 @@ const AuthorMeta = ({ date, datePrefix, name = "Co-op team", ...props }) => {
|
|
|
41
41
|
Author.Image = AuthorImage;
|
|
42
42
|
Author.Meta = AuthorMeta;
|
|
43
43
|
Author.slot = { name: "Author" };
|
|
44
|
-
//#endregion
|
|
45
44
|
export { Author, Author as default, AuthorImage, AuthorMeta };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StandardSizesWithNone } from "../../types/index.js";
|
|
2
2
|
import React, { ForwardRefExoticComponent, HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
3
|
-
//#region src/components/Box/Box.d.ts
|
|
4
3
|
export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
4
|
/** Specify a custom element for the component
|
|
6
5
|
*
|
|
@@ -19,5 +18,4 @@ export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
18
|
ref?: Ref<HTMLDivElement>;
|
|
20
19
|
}
|
|
21
20
|
export declare const Box: ({ as, children, className, padding, radius, ref, ...props }: BoxProps) => JSX.Element;
|
|
22
|
-
//#endregion
|
|
23
21
|
export { Box as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
3
|
+
// src/components/Box/Box.tsx
|
|
4
4
|
const Box = ({ as, children, className, padding, radius, ref, ...props }) => {
|
|
5
5
|
const componentProps = {
|
|
6
6
|
className: clsx("coop-box", className),
|
|
@@ -14,5 +14,4 @@ const Box = ({ as, children, className, padding, radius, ref, ...props }) => {
|
|
|
14
14
|
ref
|
|
15
15
|
}, children);
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
export { Box, Box as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StandardSizes } from "../../types/index.js";
|
|
2
2
|
import React, { ButtonHTMLAttributes, ForwardRefExoticComponent, JSX, Ref } from "react";
|
|
3
|
-
//#region src/components/Button/Button.d.ts
|
|
4
3
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
4
|
/** Specify a custom element for the component.
|
|
6
5
|
*
|
|
@@ -25,8 +24,8 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
25
24
|
onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
26
25
|
/** Specify a custom React ref for this component. */
|
|
27
26
|
ref?: Ref<HTMLElement>;
|
|
28
|
-
/** Specify the component size. */
|
|
29
|
-
size?: StandardSizes;
|
|
27
|
+
/** Specify the component size. Use `xs` only in compact places, such as the actions in a calendar. */
|
|
28
|
+
size?: "xs" | StandardSizes;
|
|
30
29
|
/** Specify the component variant. */
|
|
31
30
|
variant?: "solid" | "ghost" | "text";
|
|
32
31
|
}
|
|
@@ -36,5 +35,4 @@ declare const Button: {
|
|
|
36
35
|
name: string;
|
|
37
36
|
};
|
|
38
37
|
};
|
|
39
|
-
//#endregion
|
|
40
38
|
export { Button, Button as default };
|
|
@@ -4,7 +4,7 @@ import { hasUserBg } from "../../utils/classes.js";
|
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import React, { useCallback, useState } from "react";
|
|
7
|
-
|
|
7
|
+
// src/components/Button/Button.tsx
|
|
8
8
|
const Button = ({ as, children, className, href, isDisabled = false, isFullWidth = false, isLoading = false, loadingText = "Loading", onClick, ref, size, variant = "solid", ...props }) => {
|
|
9
9
|
const element = as ?? (href ? "a" : "button");
|
|
10
10
|
const [isPending, setIsPending] = useState(false);
|
|
@@ -35,5 +35,4 @@ const Button = ({ as, children, className, href, isDisabled = false, isFullWidth
|
|
|
35
35
|
}, finalChildren);
|
|
36
36
|
};
|
|
37
37
|
Button.slot = { name: "Button" };
|
|
38
|
-
//#endregion
|
|
39
38
|
export { Button, Button as default };
|
|
@@ -4,7 +4,6 @@ import { StandardSizes } from "../../types/index.js";
|
|
|
4
4
|
import { PictureProps } from "../Picture/Picture.js";
|
|
5
5
|
import "../Picture/index.js";
|
|
6
6
|
import React, { AnchorHTMLAttributes, ForwardRefExoticComponent, HTMLAttributes, JSX, Ref } from "react";
|
|
7
|
-
//#region src/components/Card/Card.d.ts
|
|
8
7
|
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
8
|
/** Specify how the Card behaves across screen sizes.
|
|
10
9
|
*
|
|
@@ -187,5 +186,4 @@ declare const CardLink: {
|
|
|
187
186
|
name: string;
|
|
188
187
|
};
|
|
189
188
|
};
|
|
190
|
-
//#endregion
|
|
191
189
|
export { Card, Card as default, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture };
|
|
@@ -5,7 +5,7 @@ import { useSlots } from "../../hooks/useSlots.js";
|
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import React from "react";
|
|
8
|
-
|
|
8
|
+
// src/components/Card/Card.tsx
|
|
9
9
|
const componentSlots = {
|
|
10
10
|
CardBadge: null,
|
|
11
11
|
Children: null
|
|
@@ -103,5 +103,4 @@ Card.Content = CardContent;
|
|
|
103
103
|
Card.Icon = CardIcon;
|
|
104
104
|
Card.Image = CardImage;
|
|
105
105
|
Card.Picture = CardPicture;
|
|
106
|
-
//#endregion
|
|
107
106
|
export { Card, Card as default, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture } from "./Card.js";
|
|
2
|
-
|
|
2
|
+
// src/components/Card/index.ts
|
|
3
3
|
var Card_default = Card;
|
|
4
|
-
//#endregion
|
|
5
4
|
export { Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, Card_default as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StandardSizes } from "../../types/index.js";
|
|
2
2
|
import { InputHTMLAttributes, JSX, Ref } from "react";
|
|
3
|
-
//#region src/components/Checkbox/Checkbox.d.ts
|
|
4
3
|
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
5
4
|
/** Specify additional CSS classes. */
|
|
6
5
|
className?: string;
|
|
@@ -25,5 +24,4 @@ declare const Checkbox: {
|
|
|
25
24
|
name: string;
|
|
26
25
|
};
|
|
27
26
|
};
|
|
28
|
-
//#endregion
|
|
29
27
|
export { Checkbox, Checkbox as default };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getDescribedBy, getFieldError, useField } from "../Field/Field.context.js";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
6
6
|
const Checkbox = ({ "aria-describedby": ariaDescribedBy, className, disabled, error, id, name, ref, size, ...props }) => {
|
|
7
7
|
const field = useField();
|
|
8
8
|
const hasError = getFieldError(error, field);
|
|
@@ -27,5 +27,4 @@ Checkbox.slot = {
|
|
|
27
27
|
inline: true,
|
|
28
28
|
name: "Checkbox"
|
|
29
29
|
};
|
|
30
|
-
//#endregion
|
|
31
30
|
export { Checkbox, Checkbox as default };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
|
|
3
|
+
// src/components/Combobox/Combobox.context.ts
|
|
4
4
|
const ComboboxContext = createContext(null);
|
|
5
5
|
const useComboboxContext = () => {
|
|
6
6
|
const context = useContext(ComboboxContext);
|
|
7
7
|
if (!context) throw new Error("Combobox components must be used inside <Combobox>");
|
|
8
8
|
return context;
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { ComboboxContext, useComboboxContext };
|
|
@@ -4,7 +4,6 @@ import { TextInputProps } from "../TextInput/TextInput.js";
|
|
|
4
4
|
import "../TextInput/index.js";
|
|
5
5
|
import { ButtonHTMLAttributes, HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
6
6
|
import { UseComboboxHighlightedIndexChange, UseComboboxInputValueChange, UseComboboxIsOpenChange, UseComboboxStateChange } from "downshift";
|
|
7
|
-
//#region src/components/Combobox/Combobox.d.ts
|
|
8
7
|
export interface ComboboxSelectEvent {
|
|
9
8
|
/** Whether the selection is a custom value, entered by users when `allowCustom` is set,
|
|
10
9
|
* rather than one of the options.
|
|
@@ -180,5 +179,4 @@ declare const ComboboxOptions: {
|
|
|
180
179
|
name: string;
|
|
181
180
|
};
|
|
182
181
|
};
|
|
183
|
-
//#endregion
|
|
184
182
|
export { Combobox, Combobox as default, ComboboxButton, ComboboxControls, ComboboxInput, ComboboxOptions };
|
|
@@ -14,7 +14,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
15
15
|
import { useCombobox } from "downshift";
|
|
16
16
|
import mergeRefs from "merge-refs";
|
|
17
|
-
|
|
17
|
+
// src/components/Combobox/Combobox.tsx
|
|
18
18
|
const DEFAULT_MAX_RESULTS = 50;
|
|
19
19
|
const ANNOUNCEMENT_DELAY = 750;
|
|
20
20
|
const componentSlots = {
|
|
@@ -279,5 +279,4 @@ Combobox.Controls = ComboboxControls;
|
|
|
279
279
|
Combobox.Input = ComboboxInput;
|
|
280
280
|
Combobox.Button = ComboboxButton;
|
|
281
281
|
Combobox.Options = ComboboxOptions;
|
|
282
|
-
//#endregion
|
|
283
282
|
export { Combobox, Combobox as default, ComboboxButton, ComboboxControls, ComboboxInput, ComboboxOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { matchSorter } from "match-sorter";
|
|
2
|
-
|
|
2
|
+
// src/components/Combobox/combobox-internal.ts
|
|
3
3
|
const defaultFilter = (items, inputValue) => inputValue !== "" ? matchSorter(items, inputValue, { keys: [(item) => [item.label ?? item.value]] }) : items;
|
|
4
4
|
const defaultIsItemDisabled = (item) => item.disabled ?? false;
|
|
5
5
|
const defaultItemToString = (item) => item?.label ?? item?.value ?? "";
|
|
@@ -13,5 +13,4 @@ const resolveOption = (option, items) => {
|
|
|
13
13
|
return items.find(({ value }) => value === item.value) ?? item;
|
|
14
14
|
};
|
|
15
15
|
const shouldShowSelectionText = (previous, current, inputValue) => current.value === previous.value && current.text !== previous.text && inputValue === previous.text;
|
|
16
|
-
//#endregion
|
|
17
16
|
export { defaultFilter, defaultIsItemDisabled, defaultItemToString, defaultMaxResultsText, isMatchingText, normalizeOptions, resolveOption, shouldShowSelectionText };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
//#region src/components/Combobox/combobox-utils.d.ts
|
|
3
2
|
export interface ComboboxItem extends HTMLAttributes<HTMLLIElement> {
|
|
4
3
|
/** Specify the disabled state.
|
|
5
4
|
*
|
|
@@ -16,5 +15,4 @@ export interface ComboboxItem extends HTMLAttributes<HTMLLIElement> {
|
|
|
16
15
|
/** Specify the option value. */
|
|
17
16
|
value: string;
|
|
18
17
|
}
|
|
19
|
-
export type ComboboxOption = ComboboxItem | string;
|
|
20
|
-
//#endregion
|
|
18
|
+
export type ComboboxOption = ComboboxItem | string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Combobox, ComboboxButton, ComboboxControls, ComboboxInput, ComboboxOptions } from "./Combobox.js";
|
|
2
|
-
|
|
2
|
+
// src/components/Combobox/index.ts
|
|
3
3
|
var Combobox_default = Combobox;
|
|
4
|
-
//#endregion
|
|
5
4
|
export { Combobox, ComboboxButton, ComboboxControls, ComboboxInput, ComboboxOptions, Combobox_default as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
|
|
3
|
+
// src/components/DateInput/DateInput.context.ts
|
|
4
4
|
const DateInputContext = createContext(null);
|
|
5
5
|
const useDateInput = () => useContext(DateInputContext);
|
|
6
|
-
//#endregion
|
|
7
6
|
export { DateInputContext, useDateInput };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StandardSizes } from "../../types/index.js";
|
|
2
2
|
import { TextInputProps } from "../TextInput/TextInput.js";
|
|
3
3
|
import "../TextInput/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { DateParts } from "../../validations/date.js";
|
|
5
|
+
import { DateInputMode } from "./dateinput-utils.js";
|
|
5
6
|
import { HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
6
|
-
//#region src/components/DateInput/DateInput.d.ts
|
|
7
7
|
export interface DateInputChangeEvent {
|
|
8
8
|
/** The parts as typed. */
|
|
9
9
|
parts: DateParts;
|
|
@@ -100,5 +100,4 @@ declare const DateInputYear: {
|
|
|
100
100
|
name: string;
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
-
//#endregion
|
|
104
103
|
export { DateInput, DateInput as default, DateInputDay, DateInputMonth, DateInputYear };
|
|
@@ -4,14 +4,14 @@ import { forEachSlot } from "../../utils/slots.js";
|
|
|
4
4
|
import { TextInput } from "../TextInput/TextInput.js";
|
|
5
5
|
import { useFormReset } from "../../hooks/useFormReset.js";
|
|
6
6
|
import { Field } from "../Field/Field.js";
|
|
7
|
-
import { formatDateValue, toDateParts, toDateValue } from "
|
|
7
|
+
import { formatDateValue, toDateParts, toDateValue } from "../../validations/date-internal.js";
|
|
8
8
|
import { getAutoComplete } from "./dateinput-utils.js";
|
|
9
9
|
import { DateInputContext, useDateInput } from "./DateInput.context.js";
|
|
10
10
|
import clsx from "clsx";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { useRef, useState } from "react";
|
|
13
13
|
import mergeRefs from "merge-refs";
|
|
14
|
-
|
|
14
|
+
// src/components/DateInput/DateInput.tsx
|
|
15
15
|
const PART_SLOTS = {
|
|
16
16
|
DateInputDay: "day",
|
|
17
17
|
DateInputMonth: "month",
|
|
@@ -124,5 +124,4 @@ DateInputYear.slot = { name: "DateInputYear" };
|
|
|
124
124
|
DateInput.Day = DateInputDay;
|
|
125
125
|
DateInput.Month = DateInputMonth;
|
|
126
126
|
DateInput.Year = DateInputYear;
|
|
127
|
-
//#endregion
|
|
128
127
|
export { DateInput, DateInput as default, DateInputDay, DateInputMonth, DateInputYear };
|
|
@@ -1,66 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/components/DateInput/dateinput-utils.d.ts
|
|
3
|
-
export type DatePart = "day" | "month" | "year";
|
|
4
|
-
export interface DateParts {
|
|
5
|
-
day?: string;
|
|
6
|
-
month?: string;
|
|
7
|
-
year?: string;
|
|
8
|
-
}
|
|
1
|
+
import { DatePart } from "../../validations/date.js";
|
|
9
2
|
export type DateInputMode = "dob" | undefined;
|
|
10
|
-
export
|
|
11
|
-
/** A message, or a function that builds one from the label. */
|
|
12
|
-
export type DateErrorMessage = string | ((label?: string) => string);
|
|
13
|
-
export interface DateValidationOptions {
|
|
14
|
-
/** The name of the date, as it would start a sentence, such as "Date
|
|
15
|
-
* of birth".
|
|
16
|
-
*
|
|
17
|
-
* Default: `Date`. */
|
|
18
|
-
label?: string;
|
|
19
|
-
/** The latest date allowed, as a `Date` or an ISO date such as `2026-12-31`.
|
|
20
|
-
*
|
|
21
|
-
* Only the parts used are compared, such as the month and year. */
|
|
22
|
-
max?: Date | string;
|
|
23
|
-
/** Messages to use instead of the defaults. */
|
|
24
|
-
messages?: Partial<Record<DateErrorCode, DateErrorMessage>>;
|
|
25
|
-
/** The earliest date allowed, as a `Date` or an ISO date such as `2020-01-01`.
|
|
26
|
-
*
|
|
27
|
-
* Only the parts used are compared, such as the month and year. */
|
|
28
|
-
min?: Date | string;
|
|
29
|
-
/** The parts used, in the order they are entered.
|
|
30
|
-
*
|
|
31
|
-
* Default: `day`, `month`, `year`. */
|
|
32
|
-
parts?: DatePart[];
|
|
33
|
-
}
|
|
34
|
-
export interface DateValidationSuccess {
|
|
35
|
-
/** Whether the date is valid. */
|
|
36
|
-
valid: true;
|
|
37
|
-
/** The date as an ISO 8601 string, such as 1990-08-21. */
|
|
38
|
-
value: string;
|
|
39
|
-
}
|
|
40
|
-
export interface DateValidationError {
|
|
41
|
-
/** The code for the first problem, in the order the parts are entered. */
|
|
42
|
-
error: DateErrorCode;
|
|
43
|
-
/** The parts with an error. Every part is invalid when the date is
|
|
44
|
-
* empty, impossible, has no ISO format or is outside `min` and `max`. */
|
|
45
|
-
invalid: DatePart[];
|
|
46
|
-
/** The message for the error. */
|
|
47
|
-
message: string;
|
|
48
|
-
/** Whether the date is valid. */
|
|
49
|
-
valid: false;
|
|
50
|
-
}
|
|
51
|
-
export type DateValidation = DateValidationSuccess | DateValidationError;
|
|
52
|
-
export declare const DATE_PARTS: DatePart[];
|
|
53
|
-
export declare const DATE_ERROR_MESSAGES: Record<DateErrorCode, string | ((label?: string, limits?: Limits) => string)>;
|
|
54
|
-
export declare const validateDateParts: (date: DateParts, { label, max, messages, min, parts }?: DateValidationOptions) => DateValidation;
|
|
55
|
-
/** Check a value, such as the DateInput value or the value a form
|
|
56
|
-
* submits, the same way as `validateDateParts`. Use the same `parts` as
|
|
57
|
-
* the DateInput. */
|
|
58
|
-
export declare const validateDate: (value: string, options?: DateValidationOptions) => DateValidation;
|
|
59
|
-
/** As this is a more specific function for a birth of date validation, we can make some assumptions.
|
|
60
|
-
* Such as, date needs to be today or in the past and error message should reflect date of birth.
|
|
61
|
-
* Check a value, such as the DateInput value or the value a form
|
|
62
|
-
* submits, the same way as `validateDateParts`. Use the same `parts` as
|
|
63
|
-
* the DateInput. */
|
|
64
|
-
export declare const validateDob: (value: string, options?: DateValidationOptions) => DateValidation;
|
|
65
|
-
export declare const getAutoComplete: (mode: DateInputMode, part: DatePart) => string | undefined;
|
|
66
|
-
//#endregion
|
|
3
|
+
export declare const getAutoComplete: (mode: DateInputMode, part: DatePart) => string | undefined;
|
|
@@ -1,84 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/components/DateInput/dateinput-utils.ts
|
|
3
|
-
const DATE_PARTS = [
|
|
4
|
-
"day",
|
|
5
|
-
"month",
|
|
6
|
-
"year"
|
|
7
|
-
];
|
|
8
|
-
const realDate = (label = "Date") => `${label} must be a real date`;
|
|
9
|
-
const DATE_ERROR_MESSAGES = {
|
|
10
|
-
"after-max": (label = "Date", limits) => `${label} must be on or before ${limits?.max}`,
|
|
11
|
-
"before-min": (label = "Date", limits) => `${label} must be on or after ${limits?.min}`,
|
|
12
|
-
"impossible-date": realDate,
|
|
13
|
-
"invalid-day": realDate,
|
|
14
|
-
"invalid-month": realDate,
|
|
15
|
-
"invalid-year": "Year must include 4 numbers",
|
|
16
|
-
"missing-date": "Enter a date",
|
|
17
|
-
"missing-day": (label = "Date") => `${label} must include a day`,
|
|
18
|
-
"missing-month": (label = "Date") => `${label} must include a month`,
|
|
19
|
-
"missing-year": (label = "Date") => `${label} must include a year`,
|
|
20
|
-
"unsupported-parts": realDate
|
|
21
|
-
};
|
|
22
|
-
const validateDateParts = (date, { label, max, messages = {}, min, parts = DATE_PARTS } = {}) => {
|
|
23
|
-
const minDate = min === void 0 ? void 0 : toLimit(min, "min");
|
|
24
|
-
const maxDate = max === void 0 ? void 0 : toLimit(max, "max");
|
|
25
|
-
const values = trimParts(date);
|
|
26
|
-
const errors = getDateErrors(values, parts);
|
|
27
|
-
let value = "";
|
|
28
|
-
if (errors.length === 0) {
|
|
29
|
-
value = toISODate(values, parts);
|
|
30
|
-
const rangeError = value ? getRangeError(value, minDate, maxDate) : "unsupported-parts";
|
|
31
|
-
if (!rangeError) return {
|
|
32
|
-
valid: true,
|
|
33
|
-
value
|
|
34
|
-
};
|
|
35
|
-
errors.push(rangeError);
|
|
36
|
-
}
|
|
37
|
-
const [error] = errors;
|
|
38
|
-
const limits = {
|
|
39
|
-
max: maxDate && value ? formatLimit(maxDate, value.length) : void 0,
|
|
40
|
-
min: minDate && value ? formatLimit(minDate, value.length) : void 0
|
|
41
|
-
};
|
|
42
|
-
return {
|
|
43
|
-
error,
|
|
44
|
-
invalid: getInvalidParts(errors, parts),
|
|
45
|
-
message: getMessage(error, label, messages, limits, DATE_ERROR_MESSAGES),
|
|
46
|
-
valid: false
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
/** Check a value, such as the DateInput value or the value a form
|
|
50
|
-
* submits, the same way as `validateDateParts`. Use the same `parts` as
|
|
51
|
-
* the DateInput. */
|
|
52
|
-
const validateDate = (value, options = {}) => {
|
|
53
|
-
const date = parseDateValue(value, options.parts);
|
|
54
|
-
if (date) return validateDateParts(date, options);
|
|
55
|
-
const { label, messages, parts = DATE_PARTS } = options;
|
|
56
|
-
return {
|
|
57
|
-
error: "impossible-date",
|
|
58
|
-
invalid: parts,
|
|
59
|
-
message: getMessage("impossible-date", label, messages, {}, DATE_ERROR_MESSAGES),
|
|
60
|
-
valid: false
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
/** As this is a more specific function for a birth of date validation, we can make some assumptions.
|
|
64
|
-
* Such as, date needs to be today or in the past and error message should reflect date of birth.
|
|
65
|
-
* Check a value, such as the DateInput value or the value a form
|
|
66
|
-
* submits, the same way as `validateDateParts`. Use the same `parts` as
|
|
67
|
-
* the DateInput. */
|
|
68
|
-
const validateDob = (value, options = {}) => {
|
|
69
|
-
const { messages, ...rest } = options;
|
|
70
|
-
return validateDate(value, {
|
|
71
|
-
label: "Date of birth",
|
|
72
|
-
max: /* @__PURE__ */ new Date(),
|
|
73
|
-
messages: {
|
|
74
|
-
"after-max": "Date of birth must be today or in the past",
|
|
75
|
-
"missing-date": "Enter your date of birth",
|
|
76
|
-
...messages
|
|
77
|
-
},
|
|
78
|
-
parts: DATE_PARTS,
|
|
79
|
-
...rest
|
|
80
|
-
});
|
|
81
|
-
};
|
|
1
|
+
// src/components/DateInput/dateinput-utils.ts
|
|
82
2
|
const getAutoComplete = (mode, part) => {
|
|
83
3
|
if (!mode) return void 0;
|
|
84
4
|
if (mode === "dob") {
|
|
@@ -87,5 +7,4 @@ const getAutoComplete = (mode, part) => {
|
|
|
87
7
|
if (part === "year") return "bday-year";
|
|
88
8
|
}
|
|
89
9
|
};
|
|
90
|
-
|
|
91
|
-
export { DATE_ERROR_MESSAGES, DATE_PARTS, getAutoComplete, validateDate, validateDateParts, validateDob };
|
|
10
|
+
export { getAutoComplete };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateInputMode, getAutoComplete } from "./dateinput-utils.js";
|
|
2
2
|
import { DateInput, DateInputChangeEvent, DateInputDay, DateInputMonth, DateInputPartProps, DateInputProps, DateInputYear } from "./DateInput.js";
|
|
3
|
-
export {
|
|
3
|
+
export { DateInput, DateInput as default, DateInputChangeEvent, DateInputDay, DateInputMode, DateInputMonth, DateInputPartProps, DateInputProps, DateInputYear, getAutoComplete };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAutoComplete } from "./dateinput-utils.js";
|
|
2
2
|
import { DateInput, DateInputDay, DateInputMonth, DateInputYear } from "./DateInput.js";
|
|
3
|
-
|
|
3
|
+
// src/components/DateInput/index.ts
|
|
4
4
|
var DateInput_default = DateInput;
|
|
5
|
-
|
|
6
|
-
export { DATE_ERROR_MESSAGES, DATE_PARTS, DateInput, DateInputDay, DateInputMonth, DateInputYear, DateInput_default as default, getAutoComplete, validateDate, validateDateParts, validateDob };
|
|
5
|
+
export { DateInput, DateInputDay, DateInputMonth, DateInputYear, DateInput_default as default, getAutoComplete };
|
|
@@ -2,7 +2,6 @@ import { StandardSizes } from "../../types/index.js";
|
|
|
2
2
|
import { DateRange, DateType, DateTypeStr } from "./datepicker-utils.js";
|
|
3
3
|
import { InputHTMLAttributes, JSX, Ref } from "react";
|
|
4
4
|
import { DayPickerProps, Mode } from "react-day-picker";
|
|
5
|
-
//#region src/components/DatePicker/DatePicker.d.ts
|
|
6
5
|
type OnDateSelectHandler = (selected: DateTypeStr) => void;
|
|
7
6
|
export interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onSelect" | "onChange" | "onChangeCapture" | "size" | "type"> {
|
|
8
7
|
/** Specify additional CSS classes. */
|
|
@@ -61,5 +60,4 @@ declare const DatePicker: {
|
|
|
61
60
|
suffix: string;
|
|
62
61
|
};
|
|
63
62
|
};
|
|
64
|
-
//#endregion
|
|
65
63
|
export { DatePicker, DatePicker as default, type DateType, type DateTypeStr };
|
|
@@ -11,7 +11,7 @@ import clsx from "clsx";
|
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { useCallback, useMemo, useReducer } from "react";
|
|
13
13
|
import { DayPicker } from "react-day-picker";
|
|
14
|
-
|
|
14
|
+
// src/components/DatePicker/DatePicker.tsx
|
|
15
15
|
const now = /* @__PURE__ */ new Date();
|
|
16
16
|
const baseValueProps = {
|
|
17
17
|
readOnly: true,
|
|
@@ -250,5 +250,4 @@ DatePicker.slot = {
|
|
|
250
250
|
name: "DatePicker",
|
|
251
251
|
suffix: "_display"
|
|
252
252
|
};
|
|
253
|
-
//#endregion
|
|
254
253
|
export { DatePicker, DatePicker as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Mode } from "react-day-picker";
|
|
2
|
-
//#region src/components/DatePicker/datepicker-utils.d.ts
|
|
3
2
|
export interface DateRangeStr {
|
|
4
3
|
from?: string;
|
|
5
4
|
to?: string;
|
|
@@ -9,5 +8,4 @@ export interface DateRange {
|
|
|
9
8
|
to?: Date | undefined;
|
|
10
9
|
}
|
|
11
10
|
export type DateType = Date | Date[] | DateRange | string | undefined;
|
|
12
|
-
export type DateTypeStr = string | string[] | DateRangeStr | undefined;
|
|
13
|
-
//#endregion
|
|
11
|
+
export type DateTypeStr = string | string[] | DateRangeStr | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addYears, format, isBefore, isValid, parse } from "date-fns";
|
|
2
|
-
|
|
2
|
+
// src/components/DatePicker/datepicker-utils.ts
|
|
3
3
|
function isValidDate(date) {
|
|
4
4
|
return !!date && typeof date !== "string" && typeof date !== "number" && isValid(date);
|
|
5
5
|
}
|
|
@@ -198,5 +198,4 @@ const shouldClose = (mode, value, closeOnSelect) => {
|
|
|
198
198
|
const isSingle = (m, d) => m === "single";
|
|
199
199
|
const isMultiple = (m, d) => m === "multiple";
|
|
200
200
|
const isRange = (m, d) => m === "range";
|
|
201
|
-
//#endregion
|
|
202
201
|
export { getDateValues, getDefaultMonth, getEndDate, getISODateString, getInitialDate, getMultipleDate, getRangeDate, getRangeFromString, getSingleDate, getStartDate, isMultiple, isRange, isSingle, isValidDate, isValidRangeFrom, isValidRangeTo, shouldClose, shouldSkipParsing };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { DialogHTMLAttributes, HTMLAttributes, JSX, ReactEventHandler, ReactNode, Ref } from "react";
|
|
2
|
-
//#region src/components/Dialog/Dialog.d.ts
|
|
3
2
|
export interface DialogProps extends Omit<DialogHTMLAttributes<HTMLDialogElement>, "closedby"> {
|
|
4
3
|
/** Content inside the component.
|
|
5
4
|
*
|
|
@@ -91,5 +90,4 @@ declare const DialogBody: {
|
|
|
91
90
|
name: string;
|
|
92
91
|
};
|
|
93
92
|
};
|
|
94
|
-
//#endregion
|
|
95
93
|
export { Dialog, Dialog as default, DialogBody, DialogHeader };
|