@zimyo/ui 1.0.2 → 1.1.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/package.json +78 -83
- package/dist/components/index.d.ts +0 -60
- package/dist/components/ui/accordion.d.ts +0 -10
- package/dist/components/ui/accordion.js +0 -58
- package/dist/components/ui/alert-dialog.d.ts +0 -17
- package/dist/components/ui/alert-dialog.js +0 -108
- package/dist/components/ui/alert.d.ts +0 -13
- package/dist/components/ui/alert.js +0 -52
- package/dist/components/ui/aspect-ratio.d.ts +0 -6
- package/dist/components/ui/aspect-ratio.js +0 -12
- package/dist/components/ui/avatar.d.ts +0 -9
- package/dist/components/ui/avatar.js +0 -37
- package/dist/components/ui/badge.d.ts +0 -13
- package/dist/components/ui/badge.js +0 -36
- package/dist/components/ui/breadcrumb.d.ts +0 -14
- package/dist/components/ui/breadcrumb.js +0 -94
- package/dist/components/ui/button.d.ts +0 -14
- package/dist/components/ui/button.js +0 -48
- package/dist/components/ui/calendar.d.ts +0 -13
- package/dist/components/ui/calendar.js +0 -137
- package/dist/components/ui/card.d.ts +0 -12
- package/dist/components/ui/card.js +0 -76
- package/dist/components/ui/carousel.d.ts +0 -25
- package/dist/components/ui/carousel.js +0 -173
- package/dist/components/ui/chart.d.ts +0 -44
- package/dist/components/ui/chart.js +0 -203
- package/dist/components/ui/checkbox.d.ts +0 -7
- package/dist/components/ui/checkbox.js +0 -26
- package/dist/components/ui/collapsible.d.ts +0 -8
- package/dist/components/ui/collapsible.js +0 -24
- package/dist/components/ui/command.d.ts +0 -22
- package/dist/components/ui/command.js +0 -119
- package/dist/components/ui/context-menu.d.ts +0 -28
- package/dist/components/ui/context-menu.js +0 -171
- package/dist/components/ui/dialog.d.ts +0 -18
- package/dist/components/ui/dialog.js +0 -106
- package/dist/components/ui/drawer.d.ts +0 -16
- package/dist/components/ui/drawer.js +0 -99
- package/dist/components/ui/dropdown-menu.d.ts +0 -28
- package/dist/components/ui/dropdown-menu.js +0 -173
- package/dist/components/ui/form.d.ts +0 -27
- package/dist/components/ui/form.js +0 -129
- package/dist/components/ui/hover-card.d.ts +0 -9
- package/dist/components/ui/hover-card.js +0 -36
- package/dist/components/ui/input-otp.d.ts +0 -14
- package/dist/components/ui/input-otp.js +0 -66
- package/dist/components/ui/input.d.ts +0 -6
- package/dist/components/ui/input.js +0 -18
- package/dist/components/ui/label.d.ts +0 -7
- package/dist/components/ui/label.js +0 -17
- package/dist/components/ui/menubar.d.ts +0 -29
- package/dist/components/ui/menubar.js +0 -191
- package/dist/components/ui/navigation-menu.d.ts +0 -18
- package/dist/components/ui/navigation-menu.js +0 -108
- package/dist/components/ui/pagination.d.ts +0 -18
- package/dist/components/ui/pagination.js +0 -103
- package/dist/components/ui/popover.d.ts +0 -10
- package/dist/components/ui/popover.js +0 -41
- package/dist/components/ui/progress.d.ts +0 -7
- package/dist/components/ui/progress.js +0 -26
- package/dist/components/ui/radio-group.d.ts +0 -8
- package/dist/components/ui/radio-group.js +0 -36
- package/dist/components/ui/resizable.d.ts +0 -11
- package/dist/components/ui/resizable.js +0 -42
- package/dist/components/ui/scroll-area.d.ts +0 -8
- package/dist/components/ui/scroll-area.js +0 -41
- package/dist/components/ui/select.d.ts +0 -18
- package/dist/components/ui/select.js +0 -136
- package/dist/components/ui/separator.d.ts +0 -7
- package/dist/components/ui/separator.js +0 -21
- package/dist/components/ui/sheet.d.ts +0 -16
- package/dist/components/ui/sheet.js +0 -106
- package/dist/components/ui/sidebar.d.ts +0 -74
- package/dist/components/ui/sidebar.js +0 -511
- package/dist/components/ui/skeleton.d.ts +0 -5
- package/dist/components/ui/skeleton.js +0 -16
- package/dist/components/ui/slider.d.ts +0 -7
- package/dist/components/ui/slider.js +0 -41
- package/dist/components/ui/sonner.d.ts +0 -6
- package/dist/components/ui/sonner.js +0 -18
- package/dist/components/ui/switch.d.ts +0 -7
- package/dist/components/ui/switch.js +0 -22
- package/dist/components/ui/table.d.ts +0 -13
- package/dist/components/ui/table.js +0 -90
- package/dist/components/ui/tabs.d.ts +0 -10
- package/dist/components/ui/tabs.js +0 -47
- package/dist/components/ui/textarea.d.ts +0 -6
- package/dist/components/ui/textarea.js +0 -16
- package/dist/components/ui/toggle-group.d.ts +0 -11
- package/dist/components/ui/toggle-group.js +0 -57
- package/dist/components/ui/toggle.d.ts +0 -13
- package/dist/components/ui/toggle.js +0 -41
- package/dist/components/ui/tooltip.d.ts +0 -10
- package/dist/components/ui/tooltip.js +0 -50
- package/dist/index.d.ts +0 -63
- package/dist/index.js +0 -48
- package/dist/lib/utils.d.ts +0 -5
- package/dist/lib/utils.js +0 -8
- package/dist/node_modules/@date-fns/tz/date/index.js +0 -101
- package/dist/node_modules/@date-fns/tz/date/mini.js +0 -207
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +0 -43
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -89
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
- package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
- package/dist/node_modules/clsx/dist/clsx.js +0 -3
- package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.js +0 -3
- package/dist/node_modules/cmdk/dist/index.js +0 -10
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -7
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -775
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -94
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -66
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -31
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -25
- package/dist/node_modules/date-fns/addDays.js +0 -41
- package/dist/node_modules/date-fns/addMonths.js +0 -75
- package/dist/node_modules/date-fns/addWeeks.js +0 -33
- package/dist/node_modules/date-fns/addYears.js +0 -33
- package/dist/node_modules/date-fns/constants.js +0 -46
- package/dist/node_modules/date-fns/constructFrom.js +0 -49
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -62
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -42
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +0 -65
- package/dist/node_modules/date-fns/endOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/endOfMonth.js +0 -37
- package/dist/node_modules/date-fns/endOfWeek.js +0 -53
- package/dist/node_modules/date-fns/endOfYear.js +0 -37
- package/dist/node_modules/date-fns/format.js +0 -423
- package/dist/node_modules/date-fns/getDayOfYear.js +0 -34
- package/dist/node_modules/date-fns/getDaysInMonth.js +0 -36
- package/dist/node_modules/date-fns/getISOWeek.js +0 -40
- package/dist/node_modules/date-fns/getISOWeekYear.js +0 -52
- package/dist/node_modules/date-fns/getMonth.js +0 -29
- package/dist/node_modules/date-fns/getWeek.js +0 -54
- package/dist/node_modules/date-fns/getWeekYear.js +0 -75
- package/dist/node_modules/date-fns/getYear.js +0 -29
- package/dist/node_modules/date-fns/isAfter.js +0 -25
- package/dist/node_modules/date-fns/isBefore.js +0 -25
- package/dist/node_modules/date-fns/isDate.js +0 -41
- package/dist/node_modules/date-fns/isSameDay.js +0 -46
- package/dist/node_modules/date-fns/isSameMonth.js +0 -43
- package/dist/node_modules/date-fns/isSameYear.js +0 -35
- package/dist/node_modules/date-fns/isValid.js +0 -39
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -10
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -64
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -59
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -22
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -103
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -41
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -13
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -189
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -134
- package/dist/node_modules/date-fns/locale/en-US.js +0 -28
- package/dist/node_modules/date-fns/max.js +0 -49
- package/dist/node_modules/date-fns/min.js +0 -49
- package/dist/node_modules/date-fns/setMonth.js +0 -46
- package/dist/node_modules/date-fns/setYear.js +0 -40
- package/dist/node_modules/date-fns/startOfDay.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeek.js +0 -35
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -42
- package/dist/node_modules/date-fns/startOfMonth.js +0 -37
- package/dist/node_modules/date-fns/startOfWeek.js +0 -53
- package/dist/node_modules/date-fns/startOfWeekYear.js +0 -64
- package/dist/node_modules/date-fns/startOfYear.js +0 -36
- package/dist/node_modules/date-fns/toDate.js +0 -46
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
- package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
- package/dist/node_modules/input-otp/dist/index.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +0 -285
- package/dist/node_modules/react-day-picker/dist/esm/UI.js +0 -122
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +0 -522
- package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +0 -26
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +0 -23
- package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +0 -7
- package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +0 -73
- package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +0 -95
- package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +0 -20
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +0 -19
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +0 -46
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +0 -28
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +0 -33
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +0 -69
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +0 -51
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +0 -39
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +0 -36
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +0 -37
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +0 -38
- package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +0 -27
- package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +0 -11
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +0 -32
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +0 -24
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +0 -22
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +0 -13
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +0 -15
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +0 -18
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +0 -14
- package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +0 -57
- package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +0 -45
- package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +0 -44
- package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +0 -175
- package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +0 -85
- package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +0 -25
- package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +0 -50
- package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +0 -31
- package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +0 -92
- package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +0 -62
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +0 -30
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +0 -74
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +0 -35
- package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +0 -21
- package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +0 -66
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -507
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -160
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
- package/dist/node_modules/react-resizable-panels/dist/react-resizable-panels.js +0 -2407
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
- package/dist/node_modules/sonner/dist/index.js +0 -1125
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2956
- package/dist/node_modules/tslib/tslib.es6.js +0 -56
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
- package/dist/node_modules/vaul/dist/index.js +0 -1627
- package/dist/providers/ThemeProvider.d.ts +0 -12
- package/dist/providers/ThemeProvider.js +0 -27
- package/dist/providers/index.d.ts +0 -3
- package/dist/styles.css +0 -1
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
3
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
4
|
-
import { useCallbackRef } from '../../react-use-callback-ref/dist/index.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
8
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
9
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
10
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
11
|
-
var FocusScope = React.forwardRef((props, forwardedRef) => {
|
|
12
|
-
const {
|
|
13
|
-
loop = false,
|
|
14
|
-
trapped = false,
|
|
15
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
16
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
17
|
-
...scopeProps
|
|
18
|
-
} = props;
|
|
19
|
-
const [container, setContainer] = React.useState(null);
|
|
20
|
-
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
21
|
-
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
22
|
-
const lastFocusedElementRef = React.useRef(null);
|
|
23
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
24
|
-
const focusScope = React.useRef({
|
|
25
|
-
paused: false,
|
|
26
|
-
pause() {
|
|
27
|
-
this.paused = true;
|
|
28
|
-
},
|
|
29
|
-
resume() {
|
|
30
|
-
this.paused = false;
|
|
31
|
-
}
|
|
32
|
-
}).current;
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
if (trapped) {
|
|
35
|
-
let handleFocusIn2 = function(event) {
|
|
36
|
-
if (focusScope.paused || !container) return;
|
|
37
|
-
const target = event.target;
|
|
38
|
-
if (container.contains(target)) {
|
|
39
|
-
lastFocusedElementRef.current = target;
|
|
40
|
-
} else {
|
|
41
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
42
|
-
}
|
|
43
|
-
}, handleFocusOut2 = function(event) {
|
|
44
|
-
if (focusScope.paused || !container) return;
|
|
45
|
-
const relatedTarget = event.relatedTarget;
|
|
46
|
-
if (relatedTarget === null) return;
|
|
47
|
-
if (!container.contains(relatedTarget)) {
|
|
48
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
49
|
-
}
|
|
50
|
-
}, handleMutations2 = function(mutations) {
|
|
51
|
-
const focusedElement = document.activeElement;
|
|
52
|
-
if (focusedElement !== document.body) return;
|
|
53
|
-
for (const mutation of mutations) {
|
|
54
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
58
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
59
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
60
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
61
|
-
return () => {
|
|
62
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
63
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
64
|
-
mutationObserver.disconnect();
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}, [trapped, container, focusScope.paused]);
|
|
68
|
-
React.useEffect(() => {
|
|
69
|
-
if (container) {
|
|
70
|
-
focusScopesStack.add(focusScope);
|
|
71
|
-
const previouslyFocusedElement = document.activeElement;
|
|
72
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
73
|
-
if (!hasFocusedCandidate) {
|
|
74
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
75
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
76
|
-
container.dispatchEvent(mountEvent);
|
|
77
|
-
if (!mountEvent.defaultPrevented) {
|
|
78
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
79
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
80
|
-
focus(container);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return () => {
|
|
85
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
86
|
-
setTimeout(() => {
|
|
87
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
88
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
89
|
-
container.dispatchEvent(unmountEvent);
|
|
90
|
-
if (!unmountEvent.defaultPrevented) {
|
|
91
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
92
|
-
}
|
|
93
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
94
|
-
focusScopesStack.remove(focusScope);
|
|
95
|
-
}, 0);
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
99
|
-
const handleKeyDown = React.useCallback(
|
|
100
|
-
(event) => {
|
|
101
|
-
if (!loop && !trapped) return;
|
|
102
|
-
if (focusScope.paused) return;
|
|
103
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
104
|
-
const focusedElement = document.activeElement;
|
|
105
|
-
if (isTabKey && focusedElement) {
|
|
106
|
-
const container2 = event.currentTarget;
|
|
107
|
-
const [first, last] = getTabbableEdges(container2);
|
|
108
|
-
const hasTabbableElementsInside = first && last;
|
|
109
|
-
if (!hasTabbableElementsInside) {
|
|
110
|
-
if (focusedElement === container2) event.preventDefault();
|
|
111
|
-
} else {
|
|
112
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
113
|
-
event.preventDefault();
|
|
114
|
-
if (loop) focus(first, { select: true });
|
|
115
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
if (loop) focus(last, { select: true });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
[loop, trapped, focusScope.paused]
|
|
123
|
-
);
|
|
124
|
-
return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
125
|
-
});
|
|
126
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
127
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
128
|
-
const previouslyFocusedElement = document.activeElement;
|
|
129
|
-
for (const candidate of candidates) {
|
|
130
|
-
focus(candidate, { select });
|
|
131
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function getTabbableEdges(container) {
|
|
135
|
-
const candidates = getTabbableCandidates(container);
|
|
136
|
-
const first = findVisible(candidates, container);
|
|
137
|
-
const last = findVisible(candidates.reverse(), container);
|
|
138
|
-
return [first, last];
|
|
139
|
-
}
|
|
140
|
-
function getTabbableCandidates(container) {
|
|
141
|
-
const nodes = [];
|
|
142
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
143
|
-
acceptNode: (node) => {
|
|
144
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
145
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
146
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
150
|
-
return nodes;
|
|
151
|
-
}
|
|
152
|
-
function findVisible(elements, container) {
|
|
153
|
-
for (const element of elements) {
|
|
154
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function isHidden(node, { upTo }) {
|
|
158
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
159
|
-
while (node) {
|
|
160
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
161
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
162
|
-
node = node.parentElement;
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
function isSelectableInput(element) {
|
|
167
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
168
|
-
}
|
|
169
|
-
function focus(element, { select = false } = {}) {
|
|
170
|
-
if (element && element.focus) {
|
|
171
|
-
const previouslyFocusedElement = document.activeElement;
|
|
172
|
-
element.focus({ preventScroll: true });
|
|
173
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
174
|
-
element.select();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
var focusScopesStack = createFocusScopesStack();
|
|
178
|
-
function createFocusScopesStack() {
|
|
179
|
-
let stack = [];
|
|
180
|
-
return {
|
|
181
|
-
add(focusScope) {
|
|
182
|
-
const activeFocusScope = stack[0];
|
|
183
|
-
if (focusScope !== activeFocusScope) {
|
|
184
|
-
activeFocusScope?.pause();
|
|
185
|
-
}
|
|
186
|
-
stack = arrayRemove(stack, focusScope);
|
|
187
|
-
stack.unshift(focusScope);
|
|
188
|
-
},
|
|
189
|
-
remove(focusScope) {
|
|
190
|
-
stack = arrayRemove(stack, focusScope);
|
|
191
|
-
stack[0]?.resume();
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
function arrayRemove(array, item) {
|
|
196
|
-
const updatedArray = [...array];
|
|
197
|
-
const index = updatedArray.indexOf(item);
|
|
198
|
-
if (index !== -1) {
|
|
199
|
-
updatedArray.splice(index, 1);
|
|
200
|
-
}
|
|
201
|
-
return updatedArray;
|
|
202
|
-
}
|
|
203
|
-
function removeLinks(items) {
|
|
204
|
-
return items.filter((item) => item.tagName !== "A");
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export { FocusScope };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
3
|
-
|
|
4
|
-
// packages/react/id/src/id.tsx
|
|
5
|
-
var useReactId = React[" useId ".trim().toString()] || (() => void 0);
|
|
6
|
-
var count = 0;
|
|
7
|
-
function useId(deterministicId) {
|
|
8
|
-
const [id, setId] = React.useState(useReactId());
|
|
9
|
-
useLayoutEffect2(() => {
|
|
10
|
-
setId((reactId) => reactId ?? String(count++));
|
|
11
|
-
}, [deterministicId]);
|
|
12
|
-
return (id ? `radix-${id}` : "");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { useId };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import ReactDOM__default from 'react-dom';
|
|
3
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
4
|
-
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var PORTAL_NAME = "Portal";
|
|
8
|
-
var Portal = React.forwardRef((props, forwardedRef) => {
|
|
9
|
-
const { container: containerProp, ...portalProps } = props;
|
|
10
|
-
const [mounted, setMounted] = React.useState(false);
|
|
11
|
-
useLayoutEffect2(() => setMounted(true), []);
|
|
12
|
-
const container = containerProp || mounted && globalThis?.document?.body;
|
|
13
|
-
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
14
|
-
});
|
|
15
|
-
Portal.displayName = PORTAL_NAME;
|
|
16
|
-
|
|
17
|
-
export { Portal };
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
3
|
-
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
4
|
-
|
|
5
|
-
function useStateMachine(initialState, machine) {
|
|
6
|
-
return React.useReducer((state, event) => {
|
|
7
|
-
const nextState = machine[state][event];
|
|
8
|
-
return nextState ?? state;
|
|
9
|
-
}, initialState);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// src/presence.tsx
|
|
13
|
-
var Presence = (props) => {
|
|
14
|
-
const { present, children } = props;
|
|
15
|
-
const presence = usePresence(present);
|
|
16
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
17
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
18
|
-
const forceMount = typeof children === "function";
|
|
19
|
-
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
20
|
-
};
|
|
21
|
-
Presence.displayName = "Presence";
|
|
22
|
-
function usePresence(present) {
|
|
23
|
-
const [node, setNode] = React.useState();
|
|
24
|
-
const stylesRef = React.useRef(null);
|
|
25
|
-
const prevPresentRef = React.useRef(present);
|
|
26
|
-
const prevAnimationNameRef = React.useRef("none");
|
|
27
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
28
|
-
const [state, send] = useStateMachine(initialState, {
|
|
29
|
-
mounted: {
|
|
30
|
-
UNMOUNT: "unmounted",
|
|
31
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
32
|
-
},
|
|
33
|
-
unmountSuspended: {
|
|
34
|
-
MOUNT: "mounted",
|
|
35
|
-
ANIMATION_END: "unmounted"
|
|
36
|
-
},
|
|
37
|
-
unmounted: {
|
|
38
|
-
MOUNT: "mounted"
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
43
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
44
|
-
}, [state]);
|
|
45
|
-
useLayoutEffect2(() => {
|
|
46
|
-
const styles = stylesRef.current;
|
|
47
|
-
const wasPresent = prevPresentRef.current;
|
|
48
|
-
const hasPresentChanged = wasPresent !== present;
|
|
49
|
-
if (hasPresentChanged) {
|
|
50
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
51
|
-
const currentAnimationName = getAnimationName(styles);
|
|
52
|
-
if (present) {
|
|
53
|
-
send("MOUNT");
|
|
54
|
-
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
55
|
-
send("UNMOUNT");
|
|
56
|
-
} else {
|
|
57
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
58
|
-
if (wasPresent && isAnimating) {
|
|
59
|
-
send("ANIMATION_OUT");
|
|
60
|
-
} else {
|
|
61
|
-
send("UNMOUNT");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
prevPresentRef.current = present;
|
|
65
|
-
}
|
|
66
|
-
}, [present, send]);
|
|
67
|
-
useLayoutEffect2(() => {
|
|
68
|
-
if (node) {
|
|
69
|
-
let timeoutId;
|
|
70
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
71
|
-
const handleAnimationEnd = (event) => {
|
|
72
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
73
|
-
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
74
|
-
if (event.target === node && isCurrentAnimation) {
|
|
75
|
-
send("ANIMATION_END");
|
|
76
|
-
if (!prevPresentRef.current) {
|
|
77
|
-
const currentFillMode = node.style.animationFillMode;
|
|
78
|
-
node.style.animationFillMode = "forwards";
|
|
79
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
80
|
-
if (node.style.animationFillMode === "forwards") {
|
|
81
|
-
node.style.animationFillMode = currentFillMode;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const handleAnimationStart = (event) => {
|
|
88
|
-
if (event.target === node) {
|
|
89
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
93
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
94
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
95
|
-
return () => {
|
|
96
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
97
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
98
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
99
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
100
|
-
};
|
|
101
|
-
} else {
|
|
102
|
-
send("ANIMATION_END");
|
|
103
|
-
}
|
|
104
|
-
}, [node, send]);
|
|
105
|
-
return {
|
|
106
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
107
|
-
ref: React.useCallback((node2) => {
|
|
108
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
109
|
-
setNode(node2);
|
|
110
|
-
}, [])
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
function getAnimationName(styles) {
|
|
114
|
-
return styles?.animationName || "none";
|
|
115
|
-
}
|
|
116
|
-
function getElementRef(element) {
|
|
117
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
118
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
119
|
-
if (mayWarn) {
|
|
120
|
-
return element.ref;
|
|
121
|
-
}
|
|
122
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
123
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
124
|
-
if (mayWarn) {
|
|
125
|
-
return element.props.ref;
|
|
126
|
-
}
|
|
127
|
-
return element.props.ref || element.ref;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export { Presence };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as ReactDOM from 'react-dom';
|
|
3
|
-
import { createSlot } from '../../react-slot/dist/index.js';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
// src/primitive.tsx
|
|
7
|
-
var NODES = [
|
|
8
|
-
"a",
|
|
9
|
-
"button",
|
|
10
|
-
"div",
|
|
11
|
-
"form",
|
|
12
|
-
"h2",
|
|
13
|
-
"h3",
|
|
14
|
-
"img",
|
|
15
|
-
"input",
|
|
16
|
-
"label",
|
|
17
|
-
"li",
|
|
18
|
-
"nav",
|
|
19
|
-
"ol",
|
|
20
|
-
"p",
|
|
21
|
-
"select",
|
|
22
|
-
"span",
|
|
23
|
-
"svg",
|
|
24
|
-
"ul"
|
|
25
|
-
];
|
|
26
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
27
|
-
const Slot = createSlot(`Primitive.${node}`);
|
|
28
|
-
const Node = React.forwardRef((props, forwardedRef) => {
|
|
29
|
-
const { asChild, ...primitiveProps } = props;
|
|
30
|
-
const Comp = asChild ? Slot : node;
|
|
31
|
-
if (typeof window !== "undefined") {
|
|
32
|
-
window[Symbol.for("radix-ui")] = true;
|
|
33
|
-
}
|
|
34
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
35
|
-
});
|
|
36
|
-
Node.displayName = `Primitive.${node}`;
|
|
37
|
-
return { ...primitive, [node]: Node };
|
|
38
|
-
}, {});
|
|
39
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
40
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { Primitive, dispatchDiscreteCustomEvent };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { composeRefs } from '../../react-compose-refs/dist/index.js';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
// src/slot.tsx
|
|
6
|
-
// @__NO_SIDE_EFFECTS__
|
|
7
|
-
function createSlot(ownerName) {
|
|
8
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
9
|
-
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
|
10
|
-
const { children, ...slotProps } = props;
|
|
11
|
-
const childrenArray = React.Children.toArray(children);
|
|
12
|
-
const slottable = childrenArray.find(isSlottable);
|
|
13
|
-
if (slottable) {
|
|
14
|
-
const newElement = slottable.props.children;
|
|
15
|
-
const newChildren = childrenArray.map((child) => {
|
|
16
|
-
if (child === slottable) {
|
|
17
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
18
|
-
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
19
|
-
} else {
|
|
20
|
-
return child;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
24
|
-
}
|
|
25
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
26
|
-
});
|
|
27
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
28
|
-
return Slot2;
|
|
29
|
-
}
|
|
30
|
-
// @__NO_SIDE_EFFECTS__
|
|
31
|
-
function createSlotClone(ownerName) {
|
|
32
|
-
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
33
|
-
const { children, ...slotProps } = props;
|
|
34
|
-
if (React.isValidElement(children)) {
|
|
35
|
-
const childrenRef = getElementRef(children);
|
|
36
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
37
|
-
if (children.type !== React.Fragment) {
|
|
38
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
39
|
-
}
|
|
40
|
-
return React.cloneElement(children, props2);
|
|
41
|
-
}
|
|
42
|
-
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
43
|
-
});
|
|
44
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
45
|
-
return SlotClone;
|
|
46
|
-
}
|
|
47
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
48
|
-
function isSlottable(child) {
|
|
49
|
-
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
50
|
-
}
|
|
51
|
-
function mergeProps(slotProps, childProps) {
|
|
52
|
-
const overrideProps = { ...childProps };
|
|
53
|
-
for (const propName in childProps) {
|
|
54
|
-
const slotPropValue = slotProps[propName];
|
|
55
|
-
const childPropValue = childProps[propName];
|
|
56
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
57
|
-
if (isHandler) {
|
|
58
|
-
if (slotPropValue && childPropValue) {
|
|
59
|
-
overrideProps[propName] = (...args) => {
|
|
60
|
-
const result = childPropValue(...args);
|
|
61
|
-
slotPropValue(...args);
|
|
62
|
-
return result;
|
|
63
|
-
};
|
|
64
|
-
} else if (slotPropValue) {
|
|
65
|
-
overrideProps[propName] = slotPropValue;
|
|
66
|
-
}
|
|
67
|
-
} else if (propName === "style") {
|
|
68
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
69
|
-
} else if (propName === "className") {
|
|
70
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return { ...slotProps, ...overrideProps };
|
|
74
|
-
}
|
|
75
|
-
function getElementRef(element) {
|
|
76
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
77
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
78
|
-
if (mayWarn) {
|
|
79
|
-
return element.ref;
|
|
80
|
-
}
|
|
81
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
82
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
83
|
-
if (mayWarn) {
|
|
84
|
-
return element.props.ref;
|
|
85
|
-
}
|
|
86
|
-
return element.props.ref || element.ref;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export { createSlot };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
// packages/react/use-callback-ref/src/use-callback-ref.tsx
|
|
4
|
-
function useCallbackRef(callback) {
|
|
5
|
-
const callbackRef = React.useRef(callback);
|
|
6
|
-
React.useEffect(() => {
|
|
7
|
-
callbackRef.current = callback;
|
|
8
|
-
});
|
|
9
|
-
return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { useCallbackRef };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
3
|
-
|
|
4
|
-
// src/use-controllable-state.tsx
|
|
5
|
-
var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
6
|
-
function useControllableState({
|
|
7
|
-
prop,
|
|
8
|
-
defaultProp,
|
|
9
|
-
onChange = () => {
|
|
10
|
-
},
|
|
11
|
-
caller
|
|
12
|
-
}) {
|
|
13
|
-
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
14
|
-
defaultProp,
|
|
15
|
-
onChange
|
|
16
|
-
});
|
|
17
|
-
const isControlled = prop !== void 0;
|
|
18
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
19
|
-
{
|
|
20
|
-
const isControlledRef = React.useRef(prop !== void 0);
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
const wasControlled = isControlledRef.current;
|
|
23
|
-
if (wasControlled !== isControlled) {
|
|
24
|
-
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
25
|
-
const to = isControlled ? "controlled" : "uncontrolled";
|
|
26
|
-
console.warn(
|
|
27
|
-
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
isControlledRef.current = isControlled;
|
|
31
|
-
}, [isControlled, caller]);
|
|
32
|
-
}
|
|
33
|
-
const setValue = React.useCallback(
|
|
34
|
-
(nextValue) => {
|
|
35
|
-
if (isControlled) {
|
|
36
|
-
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
37
|
-
if (value2 !== prop) {
|
|
38
|
-
onChangeRef.current?.(value2);
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
setUncontrolledProp(nextValue);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
45
|
-
);
|
|
46
|
-
return [value, setValue];
|
|
47
|
-
}
|
|
48
|
-
function useUncontrolledState({
|
|
49
|
-
defaultProp,
|
|
50
|
-
onChange
|
|
51
|
-
}) {
|
|
52
|
-
const [value, setValue] = React.useState(defaultProp);
|
|
53
|
-
const prevValueRef = React.useRef(value);
|
|
54
|
-
const onChangeRef = React.useRef(onChange);
|
|
55
|
-
useInsertionEffect(() => {
|
|
56
|
-
onChangeRef.current = onChange;
|
|
57
|
-
}, [onChange]);
|
|
58
|
-
React.useEffect(() => {
|
|
59
|
-
if (prevValueRef.current !== value) {
|
|
60
|
-
onChangeRef.current?.(value);
|
|
61
|
-
prevValueRef.current = value;
|
|
62
|
-
}
|
|
63
|
-
}, [value, prevValueRef]);
|
|
64
|
-
return [value, setValue, onChangeRef];
|
|
65
|
-
}
|
|
66
|
-
function isFunction(value) {
|
|
67
|
-
return typeof value === "function";
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { useControllableState };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useCallbackRef } from '../../react-use-callback-ref/dist/index.js';
|
|
3
|
-
|
|
4
|
-
// packages/react/use-escape-keydown/src/use-escape-keydown.tsx
|
|
5
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
6
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
7
|
-
React.useEffect(() => {
|
|
8
|
-
const handleKeyDown = (event) => {
|
|
9
|
-
if (event.key === "Escape") {
|
|
10
|
-
onEscapeKeyDown(event);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
14
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
15
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { useEscapeKeydown };
|