@coopdigital/react 0.49.0 → 0.50.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/Button/Button.js +2 -2
- package/dist/components/Button/index.js +5 -0
- package/dist/components/Card/Card.js +4 -4
- package/dist/components/Checkbox/Checkbox.d.ts +7 -1
- package/dist/components/Checkbox/Checkbox.js +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +61 -0
- package/dist/components/DatePicker/DatePicker.js +135 -0
- package/dist/components/DatePicker/datepicker-utils.d.ts +68 -0
- package/dist/components/DatePicker/datepicker-utils.js +215 -0
- package/dist/components/DatePicker/index.d.ts +4 -0
- package/dist/components/Field/Field.js +29 -26
- package/dist/components/Field/index.js +6 -0
- package/dist/components/Pill/Pill.js +2 -2
- package/dist/components/Popover/Popover.d.ts +74 -0
- package/dist/components/Popover/Popover.js +75 -0
- package/dist/components/Popover/index.d.ts +4 -0
- package/dist/components/Popover/index.js +5 -0
- package/dist/components/Radio/Radio.d.ts +7 -1
- package/dist/components/Radio/Radio.js +4 -0
- package/dist/components/Searchbox/Searchbox.js +4 -3
- package/dist/components/Select/Select.d.ts +3 -0
- package/dist/components/Select/Select.js +4 -1
- package/dist/components/Signpost/Signpost.js +2 -2
- package/dist/components/Tag/Tag.js +2 -2
- package/dist/components/TextInput/TextInput.d.ts +6 -1
- package/dist/components/TextInput/TextInput.js +3 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -5
- package/dist/components/Textarea/Textarea.js +5 -4
- package/dist/hooks/useSlots.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +83 -0
- package/dist/node_modules/@date-fns/tz/date/mini.js +235 -0
- package/dist/node_modules/@date-fns/tz/tzName/index.js +39 -0
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +44 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +814 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +751 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +350 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +161 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +137 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +213 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +31 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +209 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +303 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +285 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +19 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +132 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +43 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +89 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +137 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.js +775 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +94 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +66 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +31 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +25 -0
- package/dist/node_modules/date-fns/addDays.js +41 -0
- package/dist/node_modules/date-fns/addMonths.js +75 -0
- package/dist/node_modules/date-fns/addWeeks.js +33 -0
- package/dist/node_modules/date-fns/addYears.js +33 -0
- package/dist/node_modules/date-fns/constants.js +67 -0
- package/dist/node_modules/date-fns/constructFrom.js +49 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +62 -0
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +42 -0
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +65 -0
- package/dist/node_modules/date-fns/eachYearOfInterval.js +65 -0
- package/dist/node_modules/date-fns/endOfISOWeek.js +35 -0
- package/dist/node_modules/date-fns/endOfMonth.js +37 -0
- package/dist/node_modules/date-fns/endOfWeek.js +53 -0
- package/dist/node_modules/date-fns/endOfYear.js +37 -0
- package/dist/node_modules/date-fns/format.js +423 -0
- package/dist/node_modules/date-fns/getDayOfYear.js +34 -0
- package/dist/node_modules/date-fns/getDaysInMonth.js +36 -0
- package/dist/node_modules/date-fns/getDefaultOptions.js +31 -0
- package/dist/node_modules/date-fns/getISODay.js +33 -0
- package/dist/node_modules/date-fns/getISOWeek.js +40 -0
- package/dist/node_modules/date-fns/getISOWeekYear.js +52 -0
- package/dist/node_modules/date-fns/getMonth.js +29 -0
- package/dist/node_modules/date-fns/getWeek.js +54 -0
- package/dist/node_modules/date-fns/getWeekYear.js +75 -0
- package/dist/node_modules/date-fns/getYear.js +29 -0
- package/dist/node_modules/date-fns/isAfter.js +25 -0
- package/dist/node_modules/date-fns/isBefore.js +25 -0
- package/dist/node_modules/date-fns/isDate.js +41 -0
- package/dist/node_modules/date-fns/isSameDay.js +46 -0
- package/dist/node_modules/date-fns/isSameMonth.js +43 -0
- package/dist/node_modules/date-fns/isSameYear.js +35 -0
- package/dist/node_modules/date-fns/isValid.js +39 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +10 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +64 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +59 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +22 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +103 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +41 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +13 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +189 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +134 -0
- package/dist/node_modules/date-fns/locale/en-US.js +28 -0
- package/dist/node_modules/date-fns/max.js +49 -0
- package/dist/node_modules/date-fns/min.js +49 -0
- package/dist/node_modules/date-fns/parse/_lib/Parser.js +27 -0
- package/dist/node_modules/date-fns/parse/_lib/Setter.js +59 -0
- package/dist/node_modules/date-fns/parse/_lib/constants.js +33 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +55 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +55 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DateParser.js +59 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +57 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayParser.js +64 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +56 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/EraParser.js +41 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +24 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +21 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +36 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +31 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +32 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +38 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +118 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +48 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +44 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +96 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +47 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +76 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +31 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +86 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +83 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +31 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +97 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +86 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +83 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +19 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +19 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers/YearParser.js +62 -0
- package/dist/node_modules/date-fns/parse/_lib/parsers.js +110 -0
- package/dist/node_modules/date-fns/parse/_lib/utils.js +135 -0
- package/dist/node_modules/date-fns/parse.js +497 -0
- package/dist/node_modules/date-fns/setDay.js +59 -0
- package/dist/node_modules/date-fns/setISODay.js +40 -0
- package/dist/node_modules/date-fns/setISOWeek.js +39 -0
- package/dist/node_modules/date-fns/setMonth.js +46 -0
- package/dist/node_modules/date-fns/setWeek.js +53 -0
- package/dist/node_modules/date-fns/setYear.js +40 -0
- package/dist/node_modules/date-fns/startOfDay.js +35 -0
- package/dist/node_modules/date-fns/startOfISOWeek.js +35 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +42 -0
- package/dist/node_modules/date-fns/startOfMonth.js +37 -0
- package/dist/node_modules/date-fns/startOfWeek.js +53 -0
- package/dist/node_modules/date-fns/startOfWeekYear.js +64 -0
- package/dist/node_modules/date-fns/startOfYear.js +36 -0
- package/dist/node_modules/date-fns/toDate.js +46 -0
- package/dist/node_modules/date-fns/transpose.js +52 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +320 -0
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +122 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +604 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +31 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +23 -0
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +7 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +73 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +95 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +22 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +28 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +20 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +59 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +19 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +24 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +46 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +24 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getLabels.js +53 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +33 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +69 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +51 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +40 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +36 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +37 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +26 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +36 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +27 -0
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +31 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +11 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +32 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +25 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +22 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +13 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +16 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +15 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +18 -0
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +14 -0
- package/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js +67 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +57 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +45 -0
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +44 -0
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +174 -0
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +113 -0
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +25 -0
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +56 -0
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +31 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +95 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js +57 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +62 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +30 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +74 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +35 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +21 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js +16 -0
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +66 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +167 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +110 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/types/index.d.ts +10 -0
- package/package.json +17 -13
- package/src/components/Checkbox/Checkbox.tsx +6 -1
- package/src/components/DatePicker/DatePicker.tsx +372 -0
- package/src/components/DatePicker/datepicker-utils.ts +269 -0
- package/src/components/DatePicker/index.ts +5 -0
- package/src/components/Field/Field.tsx +30 -28
- package/src/components/Popover/Popover.tsx +198 -0
- package/src/components/Popover/index.ts +5 -0
- package/src/components/Radio/Radio.tsx +6 -1
- package/src/components/Searchbox/Searchbox.tsx +4 -1
- package/src/components/Select/Select.tsx +7 -2
- package/src/components/TextInput/TextInput.tsx +5 -1
- package/src/components/Textarea/Textarea.tsx +9 -13
- package/src/index.ts +2 -0
- package/src/types/index.ts +15 -0
|
@@ -5,26 +5,19 @@ import React from "react"
|
|
|
5
5
|
|
|
6
6
|
import { useId } from "../../hooks/useId"
|
|
7
7
|
import { useSlots } from "../../hooks/useSlots"
|
|
8
|
+
import { ReactNodeWithConfig } from "../../types"
|
|
8
9
|
import { Error as BaseError, type ErrorProps } from "../FieldMarkers/Error"
|
|
9
10
|
import { Hint as BaseHint, type HintProps } from "../FieldMarkers/Hint"
|
|
10
11
|
import { Label as BaseLabel, type LabelProps } from "../FieldMarkers/Label"
|
|
11
12
|
|
|
12
13
|
const componentSlots = {
|
|
13
|
-
Checkbox: null,
|
|
14
14
|
Children: null,
|
|
15
15
|
Control: null,
|
|
16
16
|
FieldError: null,
|
|
17
17
|
FieldHint: null,
|
|
18
18
|
FieldLabel: null,
|
|
19
|
-
Radio: null,
|
|
20
|
-
Select: null,
|
|
21
|
-
Textarea: null,
|
|
22
|
-
TextInput: null,
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
const standardFields = ["Children", "FieldError", "FieldHint", "FieldLabel"]
|
|
26
|
-
const inlineFields = ["Checkbox", "Radio"]
|
|
27
|
-
|
|
28
21
|
interface FieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
29
22
|
/** **(Optional)** Specify whether the Field should render inside a box. */
|
|
30
23
|
boxed?: boolean
|
|
@@ -52,38 +45,47 @@ const Root = ({
|
|
|
52
45
|
...props
|
|
53
46
|
}: FieldProps) => {
|
|
54
47
|
const slots = { ...useSlots(componentSlots, children) }
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const isInlineControl = slotsArray.some((s) => s[1] !== null && inlineFields.includes(s[0]))
|
|
58
|
-
const hasFieldMarkers = !!(slots.FieldLabel ?? slots.FieldError ?? slots.FieldHint)
|
|
59
|
-
const [, control] =
|
|
60
|
-
slotsArray.find((s) => (!standardFields.includes(s[0]) && s[1] !== null ? s : null)) ?? []
|
|
48
|
+
const hasMarkers = !!(slots.FieldLabel ?? slots.FieldError ?? slots.FieldHint)
|
|
61
49
|
|
|
50
|
+
let isInline = false
|
|
51
|
+
let control: ReactNodeWithConfig
|
|
52
|
+
let controlSuffix = ""
|
|
62
53
|
let controlId = useId()
|
|
63
54
|
let controlDisabled = false
|
|
64
55
|
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
slots.Control = React.cloneElement(control as React.ReactElement<HTMLInputElement>, {
|
|
73
|
-
id: controlId,
|
|
56
|
+
if (Array.isArray(slots.Children)) {
|
|
57
|
+
slots.Children = slots.Children.filter((child: ReactNodeWithConfig) => {
|
|
58
|
+
if (child?.type?.config?.isField) {
|
|
59
|
+
control = child
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
return true
|
|
74
63
|
})
|
|
75
64
|
}
|
|
76
65
|
|
|
77
|
-
if (
|
|
66
|
+
if (React.isValidElement(control)) {
|
|
67
|
+
const controlProps = control.props as HTMLProps<HTMLElement>
|
|
68
|
+
|
|
69
|
+
controlId = controlProps.id ?? controlId
|
|
70
|
+
controlDisabled = controlProps.disabled ?? false
|
|
71
|
+
controlSuffix = control?.type?.config?.fieldSuffix ?? ""
|
|
72
|
+
isInline = control?.type?.config?.isInline ?? false
|
|
73
|
+
|
|
74
|
+
slots.Control = controlProps.id
|
|
75
|
+
? control
|
|
76
|
+
: React.cloneElement(control as React.ReactElement<HTMLInputElement>, { id: controlId })
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (React.isValidElement(slots.FieldLabel) && !(slots.FieldLabel.props as LabelProps).htmlFor) {
|
|
78
80
|
slots.FieldLabel = React.cloneElement(slots.FieldLabel as React.ReactElement<LabelProps>, {
|
|
79
|
-
htmlFor:
|
|
81
|
+
htmlFor: controlId + controlSuffix,
|
|
80
82
|
})
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
const componentProps = {
|
|
84
86
|
...props,
|
|
85
87
|
"aria-disabled": controlDisabled || undefined,
|
|
86
|
-
className: clsx("coop-field",
|
|
88
|
+
className: clsx("coop-field", isInline && "coop-field-inline", className),
|
|
87
89
|
"data-boxed": boxed || undefined,
|
|
88
90
|
"data-error": error || undefined,
|
|
89
91
|
"data-hide-error": hideErrorBar || undefined,
|
|
@@ -91,7 +93,7 @@ const Root = ({
|
|
|
91
93
|
|
|
92
94
|
return (
|
|
93
95
|
<div {...componentProps} ref={ref}>
|
|
94
|
-
{!
|
|
96
|
+
{!isInline && hasMarkers && (
|
|
95
97
|
<div className="coop-field-markers">
|
|
96
98
|
{slots.FieldLabel}
|
|
97
99
|
{slots.FieldHint}
|
|
@@ -101,7 +103,7 @@ const Root = ({
|
|
|
101
103
|
{slots.Control && (
|
|
102
104
|
<div className="coop-field-control">
|
|
103
105
|
{slots.Control}
|
|
104
|
-
{
|
|
106
|
+
{isInline && hasMarkers && (
|
|
105
107
|
<div className="coop-field-markers">
|
|
106
108
|
{slots.FieldLabel}
|
|
107
109
|
{slots.FieldHint}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PopoverAnchorProps as RadixPopoverAnchorProps,
|
|
3
|
+
PopoverCloseProps as RadixPopoverCloseProps,
|
|
4
|
+
PopoverContentProps as RadixPopoverContentProps,
|
|
5
|
+
PopoverProps as RadixPopoverProps,
|
|
6
|
+
PopoverTriggerProps as RadixPopoverTriggerProps,
|
|
7
|
+
} from "@radix-ui/react-popover"
|
|
8
|
+
import type { JSX, ReactNode, Ref } from "react"
|
|
9
|
+
|
|
10
|
+
import * as RadixPopover from "@radix-ui/react-popover"
|
|
11
|
+
import clsx from "clsx"
|
|
12
|
+
|
|
13
|
+
import { useSlots } from "../../hooks/useSlots"
|
|
14
|
+
import { bgClassToColor, hasUserBg } from "../../utils"
|
|
15
|
+
|
|
16
|
+
export interface PopoverProps extends RadixPopoverProps {
|
|
17
|
+
/** Content inside the Popover.
|
|
18
|
+
*
|
|
19
|
+
* This should be a `Popover.Trigger` and `Popover.Content`, with an optional `Popover.Close`. Other children will be ignored. */
|
|
20
|
+
children: string | ReactNode
|
|
21
|
+
/** **(Optional)** Callback to run when the Popover is opened or closed. */
|
|
22
|
+
onOpenChange?: RadixPopoverProps["onOpenChange"]
|
|
23
|
+
/** **(Optional)** Force the Popover state. Must be used together with `onOpenChange`. */
|
|
24
|
+
open?: RadixPopoverProps["open"]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface PopoverTriggerProps extends RadixPopoverTriggerProps {
|
|
28
|
+
/** **(Optional)** When true, the element passed as a child becomes the trigger root element. */
|
|
29
|
+
asChild?: RadixPopoverTriggerProps["asChild"]
|
|
30
|
+
/** **(Optional)** Content inside the Popover Trigger. */
|
|
31
|
+
children?: React.ReactNode
|
|
32
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
33
|
+
className?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface PopoverContentProps extends RadixPopoverContentProps {
|
|
37
|
+
/** **(Optional)** Specify horizontal alignment of the Popover against the trigger. May change when collisions occur. */
|
|
38
|
+
align?: RadixPopoverContentProps["align"]
|
|
39
|
+
/** **(Optional)** Specify pixel offset from the "start" or "end" alignment. */
|
|
40
|
+
alignOffset?: RadixPopoverContentProps["alignOffset"]
|
|
41
|
+
/** **(Optional)** Specify whether the Popover should reposition itself if it falls out of the viewport. */
|
|
42
|
+
avoidCollisions?: RadixPopoverContentProps["avoidCollisions"]
|
|
43
|
+
/** **(Optional)** Content inside the Popover window. */
|
|
44
|
+
children?: React.ReactNode
|
|
45
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
46
|
+
className?: string
|
|
47
|
+
/** **(Optional)** Specify pixel boundary for collision safe area. */
|
|
48
|
+
collisionPadding?: RadixPopoverContentProps["collisionPadding"]
|
|
49
|
+
/** **(Optional)** Specify a custom React ref for this component. */
|
|
50
|
+
ref?: Ref<HTMLDivElement>
|
|
51
|
+
/** **(Optional)** Specify placement of the Popover against the trigger. Will change when collisions occur. */
|
|
52
|
+
side?: RadixPopoverContentProps["side"]
|
|
53
|
+
/** **(Optional)** Specify pixel offset from the trigger element. */
|
|
54
|
+
sideOffset?: RadixPopoverContentProps["sideOffset"]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface PopoverCloseProps extends RadixPopoverCloseProps {
|
|
58
|
+
/** **(Optional)** When true, the element passed as a child becomes the close button root element. */
|
|
59
|
+
asChild?: RadixPopoverCloseProps["asChild"]
|
|
60
|
+
/** **(Optional)** Content inside the Popover Close element. */
|
|
61
|
+
children?: React.ReactNode
|
|
62
|
+
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
63
|
+
className?: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface PopoverAnchorProps extends RadixPopoverAnchorProps {
|
|
67
|
+
/** **(Optional)** When true, the element passed as a child becomes the anchor root element. */
|
|
68
|
+
asChild?: RadixPopoverAnchorProps["asChild"]
|
|
69
|
+
/** **(Optional)** Content inside the Popover Anchor element. */
|
|
70
|
+
children?: React.ReactNode
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const componentSlots = {
|
|
74
|
+
PopoverAnchor: null,
|
|
75
|
+
PopoverContent: null,
|
|
76
|
+
PopoverTrigger: null,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const Popover = ({ children, ...props }: PopoverProps): JSX.Element => {
|
|
80
|
+
const slots = useSlots(componentSlots, children)
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<RadixPopover.Root {...props}>
|
|
84
|
+
{slots.PopoverAnchor ?? slots.PopoverTrigger}
|
|
85
|
+
<RadixPopover.Portal>{slots.PopoverContent}</RadixPopover.Portal>
|
|
86
|
+
</RadixPopover.Root>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const PopoverContent = ({
|
|
91
|
+
align = "center",
|
|
92
|
+
alignOffset = 0,
|
|
93
|
+
asChild = false,
|
|
94
|
+
avoidCollisions = true,
|
|
95
|
+
children,
|
|
96
|
+
className,
|
|
97
|
+
collisionPadding = 16,
|
|
98
|
+
ref,
|
|
99
|
+
side = "bottom",
|
|
100
|
+
sideOffset = 4,
|
|
101
|
+
style,
|
|
102
|
+
...props
|
|
103
|
+
}: PopoverContentProps): JSX.Element => {
|
|
104
|
+
const componentProps = {
|
|
105
|
+
align,
|
|
106
|
+
alignOffset,
|
|
107
|
+
asChild,
|
|
108
|
+
avoidCollisions,
|
|
109
|
+
className: clsx("coop-popover", !hasUserBg(className) && "bg-tint-grey", className),
|
|
110
|
+
collisionPadding,
|
|
111
|
+
side,
|
|
112
|
+
sideOffset,
|
|
113
|
+
style,
|
|
114
|
+
...props,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
componentProps.style = {
|
|
118
|
+
...style,
|
|
119
|
+
"--popover-bg": `var(--color-${bgClassToColor(componentProps.className)})`,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<RadixPopover.Content ref={ref} {...componentProps}>
|
|
124
|
+
{children}
|
|
125
|
+
<RadixPopover.Arrow className="coop-popover-arrow" />
|
|
126
|
+
</RadixPopover.Content>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
PopoverContent.displayName = "Popover.Content"
|
|
131
|
+
|
|
132
|
+
const PopoverTrigger = ({
|
|
133
|
+
asChild = false,
|
|
134
|
+
children,
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: PopoverTriggerProps): JSX.Element => {
|
|
138
|
+
const componentProps = {
|
|
139
|
+
// There is a known issue with aria-controls being set to target
|
|
140
|
+
// elements that do not exist yet. This does not seem to affect
|
|
141
|
+
// screen readers or fail e2e avt tests, but may display in
|
|
142
|
+
// storybook as an "inconclusive" axe error.
|
|
143
|
+
|
|
144
|
+
// https://github.com/radix-ui/primitives/pull/3243
|
|
145
|
+
// https://github.com/radix-ui/primitives/issues/3242
|
|
146
|
+
|
|
147
|
+
// "aria-controls": undefined,
|
|
148
|
+
asChild,
|
|
149
|
+
className: clsx("coop-popover-trigger", className),
|
|
150
|
+
...props,
|
|
151
|
+
}
|
|
152
|
+
return <RadixPopover.Trigger {...componentProps}>{children}</RadixPopover.Trigger>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
PopoverTrigger.displayName = "Popover.Trigger"
|
|
156
|
+
|
|
157
|
+
const PopoverClose = ({
|
|
158
|
+
asChild = false,
|
|
159
|
+
children,
|
|
160
|
+
className,
|
|
161
|
+
...props
|
|
162
|
+
}: PopoverCloseProps): JSX.Element => {
|
|
163
|
+
const componentProps = {
|
|
164
|
+
asChild,
|
|
165
|
+
className: clsx("coop-popover-close", className),
|
|
166
|
+
...props,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<RadixPopover.Close aria-label="Close" {...componentProps}>
|
|
171
|
+
{children}
|
|
172
|
+
</RadixPopover.Close>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
PopoverClose.displayName = "Popover.Close"
|
|
177
|
+
|
|
178
|
+
const PopoverAnchor = ({
|
|
179
|
+
asChild = false,
|
|
180
|
+
children,
|
|
181
|
+
...props
|
|
182
|
+
}: PopoverAnchorProps): JSX.Element => {
|
|
183
|
+
const componentProps = {
|
|
184
|
+
asChild,
|
|
185
|
+
...props,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return <RadixPopover.Anchor {...componentProps}>{children}</RadixPopover.Anchor>
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
PopoverAnchor.displayName = "Popover.Anchor"
|
|
192
|
+
|
|
193
|
+
Popover.Trigger = PopoverTrigger
|
|
194
|
+
Popover.Content = PopoverContent
|
|
195
|
+
Popover.Close = PopoverClose
|
|
196
|
+
Popover.Anchor = PopoverAnchor
|
|
197
|
+
|
|
198
|
+
export default Popover
|
|
@@ -2,7 +2,7 @@ import clsx from "clsx"
|
|
|
2
2
|
import { type InputHTMLAttributes, type JSX, Ref } from "react"
|
|
3
3
|
|
|
4
4
|
import { useId } from "../../hooks/useId"
|
|
5
|
-
import { StandardSizes } from "../../types"
|
|
5
|
+
import { ComponentConfig, StandardSizes } from "../../types"
|
|
6
6
|
|
|
7
7
|
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
8
8
|
/** **(Optional)** Specify additional CSS classes to be applied to the component. */
|
|
@@ -47,4 +47,9 @@ export const Radio = ({
|
|
|
47
47
|
return <input {...componentProps} ref={ref} />
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
Radio.config = {
|
|
51
|
+
isField: true,
|
|
52
|
+
isInline: true,
|
|
53
|
+
} satisfies ComponentConfig
|
|
54
|
+
|
|
50
55
|
export default Radio
|
|
@@ -8,6 +8,7 @@ import React, { useCallback, useState } from "react"
|
|
|
8
8
|
import { useId } from "../../hooks/useId"
|
|
9
9
|
import { StandardSizes } from "../../types"
|
|
10
10
|
import { Button, type ButtonProps } from "../Button"
|
|
11
|
+
import Field from "../Field"
|
|
11
12
|
import { Label as FieldLabel } from "../FieldMarkers/Label"
|
|
12
13
|
import { SearchIcon } from "../Icon"
|
|
13
14
|
import TextInput, { TextInputProps } from "../TextInput"
|
|
@@ -132,7 +133,9 @@ export const Searchbox = ({
|
|
|
132
133
|
<form {...formProps} ref={ref}>
|
|
133
134
|
{label && <FieldLabel {...labelProps}>{label}</FieldLabel>}
|
|
134
135
|
<div className="coop-searchbox--inner">
|
|
135
|
-
<
|
|
136
|
+
<Field>
|
|
137
|
+
<TextInput {...inputProps} />
|
|
138
|
+
</Field>
|
|
136
139
|
<Button {...buttonProps}>{button.label}</Button>
|
|
137
140
|
</div>
|
|
138
141
|
</form>
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
|
|
10
10
|
import clsx from "clsx"
|
|
11
11
|
|
|
12
|
-
import { StandardSizes } from "../../../src/types"
|
|
12
|
+
import { ComponentConfig, StandardSizes } from "../../../src/types"
|
|
13
13
|
import { useId } from "../../hooks/useId"
|
|
14
14
|
|
|
15
15
|
export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
|
|
@@ -80,6 +80,8 @@ const SelectOptionGroup = ({ children, ...props }: SelectOptionGroupProps): JSX.
|
|
|
80
80
|
return <optgroup {...props}>{children}</optgroup>
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
SelectOptionGroup.displayName = "Select.OptionGroup"
|
|
84
|
+
|
|
83
85
|
const SelectOption = ({ children, className, ...props }: SelectOptionProps): JSX.Element => {
|
|
84
86
|
return (
|
|
85
87
|
<option className={clsx("coop-select--option", className)} {...props}>
|
|
@@ -88,10 +90,13 @@ const SelectOption = ({ children, className, ...props }: SelectOptionProps): JSX
|
|
|
88
90
|
)
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
SelectOptionGroup.displayName = "Select.OptionGroup"
|
|
92
93
|
SelectOption.displayName = "Select.Option"
|
|
93
94
|
|
|
94
95
|
Select.OptionGroup = SelectOptionGroup
|
|
95
96
|
Select.Option = SelectOption
|
|
96
97
|
|
|
98
|
+
Select.config = {
|
|
99
|
+
isField: true,
|
|
100
|
+
} satisfies ComponentConfig
|
|
101
|
+
|
|
97
102
|
export default Select
|
|
@@ -2,7 +2,7 @@ import type { InputHTMLAttributes, JSX, Ref } from "react"
|
|
|
2
2
|
|
|
3
3
|
import clsx from "clsx"
|
|
4
4
|
|
|
5
|
-
import { StandardSizes } from "../../../src/types"
|
|
5
|
+
import { ComponentConfig, StandardSizes } from "../../../src/types"
|
|
6
6
|
import { useId } from "../../hooks/useId"
|
|
7
7
|
|
|
8
8
|
export interface TextInputProps extends Omit<
|
|
@@ -84,4 +84,8 @@ export const TextInput = ({
|
|
|
84
84
|
)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
TextInput.config = {
|
|
88
|
+
isField: true,
|
|
89
|
+
} satisfies ComponentConfig
|
|
90
|
+
|
|
87
91
|
export default TextInput
|
|
@@ -5,7 +5,7 @@ import { useState } from "react"
|
|
|
5
5
|
|
|
6
6
|
import { useDebounce } from "../../hooks/useDebounce"
|
|
7
7
|
import { useId } from "../../hooks/useId"
|
|
8
|
-
import { StandardSizes } from "../../types"
|
|
8
|
+
import { ComponentConfig, StandardSizes } from "../../types"
|
|
9
9
|
|
|
10
10
|
const DEBOUNCE_DELAY = 750
|
|
11
11
|
|
|
@@ -22,9 +22,7 @@ export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
|
|
|
22
22
|
counter?: boolean
|
|
23
23
|
/** **(Optional)** Specify whether the Textarea should allow more characters than its `maxLength` value.
|
|
24
24
|
*
|
|
25
|
-
* Defaults to `false`, meaning users can enter more characters than the maximum but will be warned if they go over the limit.
|
|
26
|
-
*
|
|
27
|
-
* Remember it is still your responsibility to handle validation on submission, this is simply a hint for the user.
|
|
25
|
+
* Defaults to `false`, meaning users can enter more characters than the maximum but will be warned if they go over the limit.
|
|
28
26
|
*/
|
|
29
27
|
cutoff?: boolean
|
|
30
28
|
/** **(Optional)** Specify whether the Textarea should be disabled. Refer to Experience Library guidance on disabled form controls and accessibility. */
|
|
@@ -41,7 +39,7 @@ export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
|
|
|
41
39
|
placeholder?: string
|
|
42
40
|
/** **(Optional)** Specify a custom React ref for this component. */
|
|
43
41
|
ref?: Ref<HTMLTextAreaElement>
|
|
44
|
-
/** Specify the number of rows (lines of text) in the Textarea. Defaults to `4`. */
|
|
42
|
+
/** **(Optional)** Specify the number of rows (lines of text) in the Textarea. Defaults to `4`. */
|
|
45
43
|
rows?: number
|
|
46
44
|
/** **(Optional)** Specify the Textarea size. */
|
|
47
45
|
size?: StandardSizes
|
|
@@ -88,19 +86,13 @@ export const Textarea = ({
|
|
|
88
86
|
!disabled && counter && maxLength && remaining != null && debouncedRemaining != null
|
|
89
87
|
|
|
90
88
|
const handleChange = (e: ChangeEvent<HTMLTextAreaElement>) => {
|
|
89
|
+
userOnChange?.(e)
|
|
91
90
|
maxLength && e.target && setRemaining(maxLength - e.target.value.length)
|
|
92
91
|
}
|
|
93
92
|
// const formItemProps = { "aria-disabled": disabled ? true : undefined }
|
|
94
93
|
return (
|
|
95
94
|
<div className="coop-textarea-wrapper">
|
|
96
|
-
<textarea
|
|
97
|
-
{...componentProps}
|
|
98
|
-
onChange={(e) => {
|
|
99
|
-
userOnChange?.(e)
|
|
100
|
-
handleChange(e)
|
|
101
|
-
}}
|
|
102
|
-
ref={ref}
|
|
103
|
-
/>
|
|
95
|
+
<textarea {...componentProps} onChange={handleChange} ref={ref} />
|
|
104
96
|
{showCounter && (
|
|
105
97
|
<>
|
|
106
98
|
<small
|
|
@@ -119,4 +111,8 @@ export const Textarea = ({
|
|
|
119
111
|
)
|
|
120
112
|
}
|
|
121
113
|
|
|
114
|
+
Textarea.config = {
|
|
115
|
+
isField: true,
|
|
116
|
+
} satisfies ComponentConfig
|
|
117
|
+
|
|
122
118
|
export default Textarea
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./components/Author"
|
|
|
3
3
|
export * from "./components/Button"
|
|
4
4
|
export * from "./components/Card"
|
|
5
5
|
export * from "./components/Checkbox"
|
|
6
|
+
export * from "./components/DatePicker"
|
|
6
7
|
export * from "./components/Expandable"
|
|
7
8
|
export * from "./components/Field"
|
|
8
9
|
export * from "./components/Fieldset"
|
|
@@ -10,6 +11,7 @@ export * from "./components/Flourish"
|
|
|
10
11
|
export * from "./components/Form"
|
|
11
12
|
export * from "./components/Image"
|
|
12
13
|
export * from "./components/Pill"
|
|
14
|
+
export * from "./components/Popover"
|
|
13
15
|
export * from "./components/Radio"
|
|
14
16
|
export * from "./components/RootSVG"
|
|
15
17
|
export * from "./components/Searchbox"
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
export type StandardSizes = "sm" | "md" | "lg"
|
|
2
2
|
|
|
3
3
|
export type FormFieldError = { message?: string; type?: string } | boolean | null | undefined
|
|
4
|
+
|
|
5
|
+
export type ReactNodeWithConfig =
|
|
6
|
+
| (React.ReactNode & {
|
|
7
|
+
type?: {
|
|
8
|
+
config?: ComponentConfig
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
| undefined
|
|
12
|
+
| null
|
|
13
|
+
|
|
14
|
+
export interface ComponentConfig {
|
|
15
|
+
fieldSuffix?: string
|
|
16
|
+
isField?: boolean
|
|
17
|
+
isInline?: boolean
|
|
18
|
+
}
|