@pathscale/ui 1.2.6 → 1.2.7
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/LICENSE +22 -22
- package/README.md +59 -59
- package/dist/components/_shared/index.js +2 -3
- package/dist/components/_shared/overlayPosition.js +5 -5
- package/dist/components/accordion/Accordion.css +158 -158
- package/dist/components/accordion/Accordion.js +44 -44
- package/dist/components/accordion/index.js +2 -9
- package/dist/components/alert/Alert.css +116 -116
- package/dist/components/alert/Alert.js +30 -30
- package/dist/components/alert/index.js +2 -8
- package/dist/components/auth-card/AuthCard.js +20 -20
- package/dist/components/auth-card/index.js +2 -3
- package/dist/components/auth-error-message/AuthErrorMessage.js +12 -12
- package/dist/components/auth-error-message/index.js +2 -3
- package/dist/components/auth-field-group/AuthFieldGroup.js +11 -11
- package/dist/components/auth-field-group/index.js +2 -3
- package/dist/components/auth-footer-links/AuthFooterLinks.js +20 -20
- package/dist/components/auth-footer-links/index.js +2 -3
- package/dist/components/auth-form/AuthForm.js +11 -11
- package/dist/components/auth-form/index.js +2 -3
- package/dist/components/auth-powered-by/AuthPoweredBy.js +12 -12
- package/dist/components/auth-powered-by/index.js +2 -3
- package/dist/components/auth-submit-button/AuthSubmitButton.js +10 -10
- package/dist/components/auth-submit-button/index.js +2 -3
- package/dist/components/auth-success-message/AuthSuccessMessage.js +9 -9
- package/dist/components/auth-success-message/index.js +2 -3
- package/dist/components/avatar/Avatar.css +124 -124
- package/dist/components/avatar/Avatar.js +27 -27
- package/dist/components/avatar/AvatarGroup.js +11 -11
- package/dist/components/avatar/index.js +2 -6
- package/dist/components/badge/Badge.css +164 -164
- package/dist/components/badge/Badge.js +19 -19
- package/dist/components/badge/index.js +6 -9
- package/dist/components/breadcrumbs/Breadcrumbs.css +63 -63
- package/dist/components/breadcrumbs/Breadcrumbs.js +25 -25
- package/dist/components/breadcrumbs/index.js +2 -5
- package/dist/components/button/Button.css +194 -194
- package/dist/components/button/Button.js +22 -22
- package/dist/components/button/index.js +2 -3
- package/dist/components/button-group/ButtonGroup.css +117 -117
- package/dist/components/button-group/ButtonGroup.js +14 -14
- package/dist/components/button-group/context.js +2 -2
- package/dist/components/button-group/index.js +2 -6
- package/dist/components/calendar/Calendar.css +258 -258
- package/dist/components/calendar/Calendar.js +85 -85
- package/dist/components/calendar/index.js +2 -3
- package/dist/components/card/Card.css +110 -110
- package/dist/components/card/Card.js +21 -21
- package/dist/components/card/index.js +2 -8
- package/dist/components/chatbubble/ChatBubble.css +164 -164
- package/dist/components/chatbubble/ChatBubble.js +19 -19
- package/dist/components/chatbubble/ChatBubbleAvatar.js +8 -8
- package/dist/components/chatbubble/ChatBubbleFooter.js +11 -11
- package/dist/components/chatbubble/ChatBubbleHeader.js +8 -8
- package/dist/components/chatbubble/ChatBubbleMessage.js +12 -12
- package/dist/components/chatbubble/ChatBubbleTime.js +11 -11
- package/dist/components/chatbubble/index.js +2 -3
- package/dist/components/checkbox/Checkbox.css +183 -183
- package/dist/components/checkbox/Checkbox.js +29 -29
- package/dist/components/checkbox/index.js +2 -3
- package/dist/components/checkbox-group/CheckboxGroup.css +10 -10
- package/dist/components/checkbox-group/CheckboxGroup.js +16 -16
- package/dist/components/checkbox-group/context.js +2 -2
- package/dist/components/checkbox-group/index.js +3 -4
- package/dist/components/chip/Chip.css +197 -197
- package/dist/components/chip/Chip.js +32 -32
- package/dist/components/chip/index.js +5 -7
- package/dist/components/close-button/CloseButton.css +81 -81
- package/dist/components/close-button/CloseButton.js +22 -22
- package/dist/components/close-button/index.js +2 -3
- package/dist/components/color-area/ColorArea.css +54 -54
- package/dist/components/color-area/ColorArea.js +13 -13
- package/dist/components/color-area/index.js +2 -2
- package/dist/components/color-field/ColorField.css +88 -88
- package/dist/components/color-field/ColorField.js +23 -23
- package/dist/components/color-field/index.js +2 -2
- package/dist/components/color-picker/ColorPicker.css +28 -28
- package/dist/components/color-picker/ColorPicker.js +44 -44
- package/dist/components/color-picker/index.js +2 -8
- package/dist/components/color-slider/ColorSlider.css +57 -57
- package/dist/components/color-slider/ColorSlider.js +21 -21
- package/dist/components/color-slider/index.js +2 -2
- package/dist/components/color-swatch/ColorSwatch.css +84 -84
- package/dist/components/color-swatch/ColorSwatch.js +14 -14
- package/dist/components/color-swatch/index.js +2 -2
- package/dist/components/color-swatch-picker/ColorSwatchPicker.css +12 -12
- package/dist/components/color-swatch-picker/ColorSwatchPicker.js +14 -14
- package/dist/components/color-swatch-picker/index.js +2 -5
- package/dist/components/color-wheel-flower/ColorWheelFlower.css +147 -147
- package/dist/components/color-wheel-flower/ColorWheelFlower.js +83 -83
- package/dist/components/color-wheel-flower/colorWheelFlowerContext.js +3 -3
- package/dist/components/color-wheel-flower/index.js +3 -6
- package/dist/components/combo-box/ComboBox.css +344 -344
- package/dist/components/combo-box/ComboBox.js +90 -90
- package/dist/components/combo-box/index.js +2 -10
- package/dist/components/date-field/DateField.css +215 -215
- package/dist/components/date-field/DateField.js +41 -41
- package/dist/components/date-field/index.js +2 -11
- package/dist/components/date-picker/DatePicker.css +143 -143
- package/dist/components/date-picker/DatePicker.js +40 -40
- package/dist/components/date-picker/index.js +2 -3
- package/dist/components/date-range-picker/DateRangePicker.css +149 -149
- package/dist/components/date-range-picker/DateRangePicker.js +55 -55
- package/dist/components/date-range-picker/index.js +2 -3
- package/dist/components/description/Description.css +10 -10
- package/dist/components/description/Description.js +9 -9
- package/dist/components/description/index.js +2 -5
- package/dist/components/disclosure/Disclosure.css +84 -84
- package/dist/components/disclosure/Disclosure.js +40 -40
- package/dist/components/disclosure/index.js +3 -9
- package/dist/components/disclosure-group/DisclosureGroup.css +9 -9
- package/dist/components/disclosure-group/DisclosureGroup.js +13 -13
- package/dist/components/disclosure-group/index.js +4 -6
- package/dist/components/disclosure-group/useDisclosureGroupNavigation.js +4 -4
- package/dist/components/drawer/Drawer.context.js +3 -3
- package/dist/components/drawer/Drawer.css +463 -463
- package/dist/components/drawer/Drawer.js +107 -107
- package/dist/components/drawer/index.js +2 -15
- package/dist/components/dropdown/Dropdown.css +211 -211
- package/dist/components/dropdown/Dropdown.js +66 -66
- package/dist/components/dropdown/index.js +2 -4
- package/dist/components/empty-state/EmptyState.css +39 -39
- package/dist/components/empty-state/EmptyState.js +25 -25
- package/dist/components/empty-state/index.js +2 -8
- package/dist/components/error-message/ErrorMessage.css +20 -20
- package/dist/components/error-message/ErrorMessage.js +12 -12
- package/dist/components/error-message/index.js +2 -5
- package/dist/components/field-error/FieldError.css +27 -27
- package/dist/components/field-error/FieldError.js +14 -14
- package/dist/components/field-error/index.js +2 -5
- package/dist/components/fieldset/Fieldset.css +30 -30
- package/dist/components/fieldset/Fieldset.js +21 -21
- package/dist/components/fieldset/index.js +2 -8
- package/dist/components/flex/Flex.css +5 -5
- package/dist/components/flex/Flex.js +14 -14
- package/dist/components/flex/index.js +2 -3
- package/dist/components/floating-dock/FloatingDock.css +208 -208
- package/dist/components/floating-dock/FloatingDock.js +76 -76
- package/dist/components/floating-dock/index.js +2 -3
- package/dist/components/footer/Footer.js +11 -11
- package/dist/components/footer/FooterTitle.js +9 -9
- package/dist/components/footer/footer.css +51 -51
- package/dist/components/footer/index.js +2 -3
- package/dist/components/form/FieldErrorMessage.js +8 -8
- package/dist/components/form/Form.css +5 -5
- package/dist/components/form/Form.js +21 -21
- package/dist/components/form/FormField.js +19 -19
- package/dist/components/form/FormSubmitButton.js +11 -11
- package/dist/components/form/index.js +5 -12
- package/dist/components/glass-panel/GlassPanel.classes.d.ts +3 -0
- package/dist/components/glass-panel/GlassPanel.classes.js +3 -0
- package/dist/components/glass-panel/GlassPanel.css +359 -282
- package/dist/components/glass-panel/GlassPanel.d.ts +3 -0
- package/dist/components/glass-panel/GlassPanel.js +32 -29
- package/dist/components/glass-panel/index.js +2 -3
- package/dist/components/glow-card/GlowCard.css +100 -100
- package/dist/components/glow-card/GlowCard.js +10 -10
- package/dist/components/glow-card/index.js +2 -3
- package/dist/components/grid/Grid.css +5 -5
- package/dist/components/grid/Grid.js +15 -15
- package/dist/components/grid/index.js +2 -3
- package/dist/components/header/Header.css +13 -13
- package/dist/components/header/Header.js +12 -12
- package/dist/components/header/index.js +2 -5
- package/dist/components/icon/Icon.css +10 -10
- package/dist/components/icon/Icon.js +8 -8
- package/dist/components/icon/index.js +2 -3
- package/dist/components/immersive-landing/ImmersiveLanding.css +565 -565
- package/dist/components/immersive-landing/ImmersiveLanding.js +44 -44
- package/dist/components/immersive-landing/ImmersiveLandingArrows.js +17 -17
- package/dist/components/immersive-landing/ImmersiveLandingContext.js +3 -3
- package/dist/components/immersive-landing/ImmersiveLandingNavigation.js +36 -36
- package/dist/components/immersive-landing/ImmersiveLandingPage.js +15 -15
- package/dist/components/immersive-landing/components/CookieConsent.js +71 -71
- package/dist/components/immersive-landing/components/FirefoxPWABanner.js +42 -42
- package/dist/components/immersive-landing/components/PWAInstallPrompt.js +40 -40
- package/dist/components/immersive-landing/index.js +7 -14
- package/dist/components/immersive-landing/useImmersiveLanding.js +7 -7
- package/dist/components/input/Input.css +155 -155
- package/dist/components/input/Input.js +48 -48
- package/dist/components/input/index.js +2 -2
- package/dist/components/input-group/InputGroup.css +172 -172
- package/dist/components/input-group/InputGroup.js +33 -33
- package/dist/components/input-group/index.js +2 -9
- package/dist/components/input-otp/InputOTP.css +170 -170
- package/dist/components/input-otp/InputOTP.js +48 -48
- package/dist/components/input-otp/index.js +2 -11
- package/dist/components/join/Join.js +14 -14
- package/dist/components/join/index.js +2 -3
- package/dist/components/kbd/Kbd.css +60 -60
- package/dist/components/kbd/Kbd.js +20 -20
- package/dist/components/kbd/index.js +2 -8
- package/dist/components/label/Label.css +30 -30
- package/dist/components/label/Label.js +9 -9
- package/dist/components/label/index.js +2 -5
- package/dist/components/language-switcher/LanguageSwitcher.css +56 -56
- package/dist/components/language-switcher/LanguageSwitcher.js +26 -26
- package/dist/components/language-switcher/createI18n.js +8 -8
- package/dist/components/language-switcher/index.js +3 -8
- package/dist/components/link/Link.css +131 -131
- package/dist/components/link/Link.js +22 -22
- package/dist/components/link/index.js +2 -5
- package/dist/components/list-box/ListBox.css +148 -148
- package/dist/components/list-box/ListBox.js +17 -17
- package/dist/components/list-box/ListBoxItem.js +32 -32
- package/dist/components/list-box/ListBoxSection.js +13 -13
- package/dist/components/list-box/context.js +2 -2
- package/dist/components/list-box/index.js +9 -15
- package/dist/components/live-chat/LiveChat.css +324 -324
- package/dist/components/live-chat/LiveChatBubble.js +27 -27
- package/dist/components/live-chat/LiveChatPanel.js +62 -62
- package/dist/components/live-chat/index.js +3 -5
- package/dist/components/menu/Menu.css +199 -199
- package/dist/components/menu/Menu.js +25 -30
- package/dist/components/menu/MenuItem.js +38 -38
- package/dist/components/menu/MenuSection.js +13 -13
- package/dist/components/menu/context.js +2 -2
- package/dist/components/menu/index.js +3 -12
- package/dist/components/meter/Meter.css +89 -89
- package/dist/components/meter/Meter.js +31 -31
- package/dist/components/meter/index.js +2 -8
- package/dist/components/modal/Modal.css +320 -320
- package/dist/components/modal/Modal.js +80 -80
- package/dist/components/modal/index.js +2 -13
- package/dist/components/navbar/Navbar.css +110 -110
- package/dist/components/navbar/Navbar.js +18 -18
- package/dist/components/navbar/NavbarRow.js +10 -10
- package/dist/components/navbar/NavbarSection.js +9 -9
- package/dist/components/navbar/NavbarStack.js +10 -10
- package/dist/components/navbar/index.js +2 -3
- package/dist/components/noise-background/NoiseBackground.css +66 -66
- package/dist/components/noise-background/NoiseBackground.js +35 -35
- package/dist/components/noise-background/index.js +2 -3
- package/dist/components/number-field/NumberField.css +198 -198
- package/dist/components/number-field/NumberField.js +42 -42
- package/dist/components/number-field/index.js +2 -9
- package/dist/components/pagination/Pagination.css +121 -121
- package/dist/components/pagination/Pagination.js +34 -34
- package/dist/components/pagination/index.js +2 -3
- package/dist/components/password-field/PasswordField.js +15 -15
- package/dist/components/password-field/index.js +2 -3
- package/dist/components/password-requirements/PasswordRequirements.js +24 -24
- package/dist/components/password-requirements/index.js +2 -3
- package/dist/components/password-rules/index.js +2 -4
- package/dist/components/popover/Popover.css +117 -117
- package/dist/components/popover/Popover.js +50 -50
- package/dist/components/popover/index.js +3 -9
- package/dist/components/progress-bar/ProgressBar.css +104 -104
- package/dist/components/progress-bar/ProgressBar.js +27 -27
- package/dist/components/progress-bar/index.js +2 -3
- package/dist/components/progress-circle/ProgressCircle.css +82 -82
- package/dist/components/progress-circle/ProgressCircle.js +32 -32
- package/dist/components/progress-circle/index.js +2 -3
- package/dist/components/radio/Radio.css +129 -129
- package/dist/components/radio/Radio.js +27 -27
- package/dist/components/radio/index.js +2 -3
- package/dist/components/radio-group/RadioGroup.css +58 -58
- package/dist/components/radio-group/RadioGroup.js +33 -33
- package/dist/components/radio-group/context.js +2 -2
- package/dist/components/radio-group/index.js +3 -4
- package/dist/components/range-calendar/RangeCalendar.css +51 -51
- package/dist/components/range-calendar/RangeCalendar.js +15 -15
- package/dist/components/range-calendar/index.js +2 -3
- package/dist/components/scroll-shadow/ScrollShadow.css +93 -93
- package/dist/components/scroll-shadow/ScrollShadow.js +19 -19
- package/dist/components/scroll-shadow/index.js +2 -3
- package/dist/components/scroll-shadow/useScrollShadow.js +3 -3
- package/dist/components/search-field/SearchField.css +183 -183
- package/dist/components/search-field/SearchField.js +38 -38
- package/dist/components/search-field/index.js +2 -9
- package/dist/components/select/Select.css +284 -284
- package/dist/components/select/Select.js +129 -129
- package/dist/components/select/index.js +2 -3
- package/dist/components/separator/Separator.css +35 -35
- package/dist/components/separator/Separator.js +11 -11
- package/dist/components/separator/index.js +2 -4
- package/dist/components/size-picker/SizePicker.js +17 -17
- package/dist/components/size-picker/index.js +3 -6
- package/dist/components/size-picker/sizeStore.js +3 -3
- package/dist/components/skeleton/Skeleton.css +95 -95
- package/dist/components/skeleton/Skeleton.js +8 -8
- package/dist/components/skeleton/index.js +2 -3
- package/dist/components/slider/Slider.css +122 -122
- package/dist/components/slider/Slider.js +26 -26
- package/dist/components/slider/index.js +2 -3
- package/dist/components/spinner/Spinner.css +131 -131
- package/dist/components/spinner/Spinner.js +19 -19
- package/dist/components/spinner/index.js +2 -5
- package/dist/components/surface/Surface.css +37 -37
- package/dist/components/surface/Surface.js +9 -9
- package/dist/components/surface/index.js +2 -4
- package/dist/components/table/ExpandToggle.js +14 -14
- package/dist/components/table/InlineConfirm.js +11 -11
- package/dist/components/table/MobileListView.js +24 -24
- package/dist/components/table/SortIcon.js +13 -13
- package/dist/components/table/Table.css +426 -426
- package/dist/components/table/Table.js +80 -80
- package/dist/components/table/VirtualSpacerRow.js +8 -8
- package/dist/components/table/index.js +8 -38
- package/dist/components/tabs/Tabs.css +203 -203
- package/dist/components/tabs/Tabs.js +59 -59
- package/dist/components/tabs/index.js +2 -4
- package/dist/components/tag/Tag.css +121 -121
- package/dist/components/tag/Tag.js +40 -40
- package/dist/components/tag/index.js +2 -6
- package/dist/components/tag-group/TagGroup.css +22 -22
- package/dist/components/tag-group/TagGroup.js +20 -20
- package/dist/components/tag-group/context.js +2 -2
- package/dist/components/tag-group/index.js +2 -6
- package/dist/components/text/Text.css +66 -66
- package/dist/components/text/Text.js +9 -9
- package/dist/components/text/index.js +2 -5
- package/dist/components/text-area/TextArea.css +95 -95
- package/dist/components/text-area/TextArea.js +10 -10
- package/dist/components/text-area/index.js +2 -5
- package/dist/components/text-field/TextField.css +33 -33
- package/dist/components/text-field/TextField.js +15 -15
- package/dist/components/text-field/index.js +2 -7
- package/dist/components/textarea/Textarea.js +11 -13
- package/dist/components/textarea/index.js +2 -6
- package/dist/components/theme-color-picker/ThemeColorPicker.js +49 -49
- package/dist/components/theme-color-picker/hueShift.js +3 -3
- package/dist/components/theme-color-picker/index.js +3 -7
- package/dist/components/time-field/TimeField.css +215 -215
- package/dist/components/time-field/TimeField.js +41 -41
- package/dist/components/time-field/index.js +2 -11
- package/dist/components/toast/Toast.css +344 -344
- package/dist/components/toast/Toast.js +98 -98
- package/dist/components/toast/index.js +2 -19
- package/dist/components/toggle/Toggle.css +237 -237
- package/dist/components/toggle/Toggle.js +31 -31
- package/dist/components/toggle/index.js +2 -3
- package/dist/components/toolbar/Toolbar.css +55 -55
- package/dist/components/toolbar/Toolbar.js +10 -10
- package/dist/components/toolbar/index.js +2 -5
- package/dist/components/tooltip/Tooltip.css +153 -153
- package/dist/components/tooltip/Tooltip.js +36 -36
- package/dist/components/tooltip/index.js +2 -7
- package/dist/components/utils.js +6 -7
- package/dist/components/video-preview/VideoPreview.js +15 -15
- package/dist/components/video-preview/index.js +2 -3
- package/dist/hooks/date/useCalendarNavigation.js +18 -18
- package/dist/hooks/date/useCalendarState.js +19 -19
- package/dist/hooks/date/useDateSelection.js +7 -7
- package/dist/hooks/date/usePickerOpenState.js +8 -8
- package/dist/hooks/date/useRangeSelection.js +16 -16
- package/dist/hooks/form/FormContext.js +3 -3
- package/dist/hooks/form/createForm.js +4 -4
- package/dist/hooks/form/index.js +5 -10
- package/dist/hooks/form/useFieldNew.js +10 -10
- package/dist/hooks/layout/index.js +2 -3
- package/dist/hooks/layout/useDesktop.js +4 -4
- package/dist/hooks/table/index.js +9 -18
- package/dist/hooks/table/useAnchoredOverlayPosition.js +4 -4
- package/dist/hooks/table/useTableExpansion.js +4 -4
- package/dist/hooks/table/useTableFiltering.js +8 -8
- package/dist/hooks/table/useTableModel.js +10 -10
- package/dist/hooks/table/useTablePagination.js +4 -4
- package/dist/hooks/table/useTableSelection.js +4 -4
- package/dist/hooks/table/useTableSorting.js +6 -6
- package/dist/index.css +74 -74
- package/dist/index.js +108 -398
- package/dist/lib/refs/index.js +2 -3
- package/dist/lib/refs/mergeRefs.js +2 -2
- package/dist/lib/style/index.js +2 -4
- package/dist/lib/tag/createIsButton.js +4 -4
- package/dist/lib/tag/createTagName.js +2 -2
- package/dist/lib/tag/index.js +3 -7
- package/dist/motion/engine.js +4 -4
- package/dist/motion/index.js +11 -39
- package/dist/motion/popmotion.js +2 -2
- package/dist/motion/presets.js +4 -4
- package/dist/motion/route.js +7 -7
- package/dist/motion/solid/AnimatedCollapse.js +27 -27
- package/dist/motion/solid/MotionDiv.js +13 -13
- package/dist/motion/solid/Presence.js +9 -9
- package/dist/motion/solid/index.js +4 -10
- package/dist/motion/system.js +9 -9
- package/dist/primitives/streaming/index.js +3 -5
- package/dist/primitives/streaming/useStreamingBuffer.js +2 -2
- package/dist/primitives/streaming/useStreamingSubscription.js +7 -7
- package/dist/primitives/virtualizer/index.js +2 -3
- package/dist/primitives/virtualizer/useVirtualRows.js +7 -7
- package/dist/purge-manifest.json +14972 -15063
- package/dist/styles/base/index.css +43 -43
- package/dist/styles/icons/generated-icons.css +1 -173
- package/dist/styles/themes/dark.css +141 -141
- package/dist/styles/themes/light.css +143 -143
- package/package.json +31 -31
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Portal, createComponent, insert, mergeProps, spread, template, use } from "solid-js/web";
|
|
2
2
|
import "./Tooltip.css";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/
|
|
8
|
-
const TooltipContext =
|
|
3
|
+
import { Show, createContext, createEffect, createSignal, onCleanup, splitProps, useContext } from "solid-js";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
import { createOverlayPosition } from "../_shared/overlayPosition.js";
|
|
6
|
+
import { CLASSES } from "./Tooltip.classes.js";
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/ template("<span>"), _tmpl$2 = /*#__PURE__*/ template("<div>"), _tmpl$3 = /*#__PURE__*/ template('<svg aria-hidden=true data-slot=tooltip-arrow-svg height=12 viewBox="0 0 12 12"width=12 xmlns=http://www.w3.org/2000/svg><path d="M0 0C5.48483 8 6.5 8 12 0Z"fill=currentColor>');
|
|
8
|
+
const TooltipContext = createContext();
|
|
9
9
|
const useTooltipContext = ()=>{
|
|
10
|
-
const ctx =
|
|
10
|
+
const ctx = useContext(TooltipContext);
|
|
11
11
|
if (!ctx) throw new Error("Tooltip compound components must be used within <Tooltip>");
|
|
12
12
|
return ctx;
|
|
13
13
|
};
|
|
14
14
|
const TooltipRoot = (props)=>{
|
|
15
|
-
const [local, _others] =
|
|
15
|
+
const [local, _others] = splitProps(props, [
|
|
16
16
|
"children",
|
|
17
17
|
"placement",
|
|
18
18
|
"autoFlip",
|
|
@@ -28,10 +28,10 @@ const TooltipRoot = (props)=>{
|
|
|
28
28
|
"className",
|
|
29
29
|
"style"
|
|
30
30
|
]);
|
|
31
|
-
const [internalOpen, setInternalOpen] =
|
|
32
|
-
const [triggerRef, setTriggerRef] =
|
|
33
|
-
const [contentRef, setContentRef] =
|
|
34
|
-
const [resolvedPlacement, setResolvedPlacement] =
|
|
31
|
+
const [internalOpen, setInternalOpen] = createSignal(Boolean(local.defaultOpen));
|
|
32
|
+
const [triggerRef, setTriggerRef] = createSignal();
|
|
33
|
+
const [contentRef, setContentRef] = createSignal();
|
|
34
|
+
const [resolvedPlacement, setResolvedPlacement] = createSignal(local.placement ?? "top");
|
|
35
35
|
let delayTimer;
|
|
36
36
|
let closeTimer;
|
|
37
37
|
const isControlled = ()=>void 0 !== local.isOpen;
|
|
@@ -50,7 +50,7 @@ const TooltipRoot = (props)=>{
|
|
|
50
50
|
clearTimeout(closeTimer);
|
|
51
51
|
closeTimer = setTimeout(()=>setIsOpen(false), local.closeDelay ?? 100);
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
onCleanup(()=>{
|
|
54
54
|
clearTimeout(delayTimer);
|
|
55
55
|
clearTimeout(closeTimer);
|
|
56
56
|
});
|
|
@@ -71,12 +71,12 @@ const TooltipRoot = (props)=>{
|
|
|
71
71
|
setContentRef,
|
|
72
72
|
dataTheme: ()=>local.dataTheme
|
|
73
73
|
};
|
|
74
|
-
return
|
|
74
|
+
return createComponent(TooltipContext.Provider, {
|
|
75
75
|
value: ctx,
|
|
76
76
|
get children () {
|
|
77
77
|
var _el$ = _tmpl$();
|
|
78
|
-
|
|
79
|
-
class:
|
|
78
|
+
spread(_el$, mergeProps(()=>({
|
|
79
|
+
class: twMerge(CLASSES.base, local.class, local.className)
|
|
80
80
|
}), {
|
|
81
81
|
"data-slot": "tooltip-root",
|
|
82
82
|
get ["data-theme"] () {
|
|
@@ -86,13 +86,13 @@ const TooltipRoot = (props)=>{
|
|
|
86
86
|
return local.style;
|
|
87
87
|
}
|
|
88
88
|
}), false, true);
|
|
89
|
-
|
|
89
|
+
insert(_el$, ()=>local.children);
|
|
90
90
|
return _el$;
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
const TooltipTrigger = (props)=>{
|
|
95
|
-
const [local, others] =
|
|
95
|
+
const [local, others] = splitProps(props, [
|
|
96
96
|
"children",
|
|
97
97
|
"class",
|
|
98
98
|
"className",
|
|
@@ -122,9 +122,9 @@ const TooltipTrigger = (props)=>{
|
|
|
122
122
|
};
|
|
123
123
|
return (()=>{
|
|
124
124
|
var _el$2 = _tmpl$2();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
class:
|
|
125
|
+
use((el)=>ctx.setTriggerRef(el), _el$2);
|
|
126
|
+
spread(_el$2, mergeProps(others, ()=>({
|
|
127
|
+
class: twMerge(CLASSES.slot.trigger, local.class, local.className)
|
|
128
128
|
}), {
|
|
129
129
|
"data-slot": "tooltip-trigger",
|
|
130
130
|
get ["data-theme"] () {
|
|
@@ -138,12 +138,12 @@ const TooltipTrigger = (props)=>{
|
|
|
138
138
|
onFocusIn: handleFocusIn,
|
|
139
139
|
onFocusOut: handleFocusOut
|
|
140
140
|
}), false, true);
|
|
141
|
-
|
|
141
|
+
insert(_el$2, ()=>local.children);
|
|
142
142
|
return _el$2;
|
|
143
143
|
})();
|
|
144
144
|
};
|
|
145
145
|
const TooltipContent = (props)=>{
|
|
146
|
-
const [local, others] =
|
|
146
|
+
const [local, others] = splitProps(props, [
|
|
147
147
|
"children",
|
|
148
148
|
"class",
|
|
149
149
|
"className",
|
|
@@ -153,7 +153,7 @@ const TooltipContent = (props)=>{
|
|
|
153
153
|
"onMouseLeave"
|
|
154
154
|
]);
|
|
155
155
|
const ctx = useTooltipContext();
|
|
156
|
-
const overlayPosition =
|
|
156
|
+
const overlayPosition = createOverlayPosition({
|
|
157
157
|
open: ctx.isOpen,
|
|
158
158
|
triggerRef: ctx.triggerRef,
|
|
159
159
|
overlayRef: ctx.contentRef,
|
|
@@ -162,7 +162,7 @@ const TooltipContent = (props)=>{
|
|
|
162
162
|
autoFlip: ctx.autoFlip,
|
|
163
163
|
align: ()=>"center"
|
|
164
164
|
});
|
|
165
|
-
|
|
165
|
+
createEffect(()=>{
|
|
166
166
|
ctx.setPlacement(overlayPosition.placement());
|
|
167
167
|
});
|
|
168
168
|
const style = ()=>{
|
|
@@ -184,19 +184,19 @@ const TooltipContent = (props)=>{
|
|
|
184
184
|
ctx.closeTooltip();
|
|
185
185
|
if ("function" == typeof local.onMouseLeave) local.onMouseLeave(event);
|
|
186
186
|
};
|
|
187
|
-
return
|
|
187
|
+
return createComponent(Show, {
|
|
188
188
|
get when () {
|
|
189
189
|
return ctx.isOpen();
|
|
190
190
|
},
|
|
191
191
|
get children () {
|
|
192
|
-
return
|
|
192
|
+
return createComponent(Portal, {
|
|
193
193
|
get children () {
|
|
194
194
|
var _el$3 = _tmpl$2();
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
use((el)=>ctx.setContentRef(el), _el$3);
|
|
196
|
+
spread(_el$3, mergeProps(others, {
|
|
197
197
|
role: "tooltip"
|
|
198
198
|
}, ()=>({
|
|
199
|
-
class:
|
|
199
|
+
class: twMerge(CLASSES.slot.content, local.class, local.className)
|
|
200
200
|
}), {
|
|
201
201
|
"data-slot": "tooltip-content",
|
|
202
202
|
get ["data-placement"] () {
|
|
@@ -214,7 +214,7 @@ const TooltipContent = (props)=>{
|
|
|
214
214
|
onMouseEnter: handleMouseEnter,
|
|
215
215
|
onMouseLeave: handleMouseLeave
|
|
216
216
|
}), false, true);
|
|
217
|
-
|
|
217
|
+
insert(_el$3, ()=>local.children);
|
|
218
218
|
return _el$3;
|
|
219
219
|
}
|
|
220
220
|
});
|
|
@@ -222,7 +222,7 @@ const TooltipContent = (props)=>{
|
|
|
222
222
|
});
|
|
223
223
|
};
|
|
224
224
|
const TooltipArrow = (props)=>{
|
|
225
|
-
const [local, others] =
|
|
225
|
+
const [local, others] = splitProps(props, [
|
|
226
226
|
"children",
|
|
227
227
|
"class",
|
|
228
228
|
"className",
|
|
@@ -233,8 +233,8 @@ const TooltipArrow = (props)=>{
|
|
|
233
233
|
const defaultArrow = _tmpl$3();
|
|
234
234
|
return (()=>{
|
|
235
235
|
var _el$5 = _tmpl$();
|
|
236
|
-
|
|
237
|
-
class:
|
|
236
|
+
spread(_el$5, mergeProps(others, ()=>({
|
|
237
|
+
class: twMerge(CLASSES.slot.arrow, local.class, local.className)
|
|
238
238
|
}), {
|
|
239
239
|
"data-slot": "tooltip-arrow",
|
|
240
240
|
get ["data-placement"] () {
|
|
@@ -248,7 +248,7 @@ const TooltipArrow = (props)=>{
|
|
|
248
248
|
},
|
|
249
249
|
"aria-hidden": "true"
|
|
250
250
|
}), false, true);
|
|
251
|
-
|
|
251
|
+
insert(_el$5, createComponent(Show, {
|
|
252
252
|
get when () {
|
|
253
253
|
return local.children;
|
|
254
254
|
},
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var __webpack_exports__TooltipContent = __WEBPACK_EXTERNAL_MODULE__Tooltip_js_5e198f9c__.TooltipContent;
|
|
4
|
-
var __webpack_exports__TooltipRoot = __WEBPACK_EXTERNAL_MODULE__Tooltip_js_5e198f9c__.TooltipRoot;
|
|
5
|
-
var __webpack_exports__TooltipTrigger = __WEBPACK_EXTERNAL_MODULE__Tooltip_js_5e198f9c__.TooltipTrigger;
|
|
6
|
-
var __webpack_exports__default = __WEBPACK_EXTERNAL_MODULE__Tooltip_js_5e198f9c__["default"];
|
|
7
|
-
export { __webpack_exports__TooltipArrow as TooltipArrow, __webpack_exports__TooltipContent as TooltipContent, __webpack_exports__TooltipRoot as TooltipRoot, __webpack_exports__TooltipTrigger as TooltipTrigger, __webpack_exports__default as default };
|
|
1
|
+
import external_Tooltip_js_default, { TooltipArrow, TooltipContent, TooltipRoot, TooltipTrigger } from "./Tooltip.js";
|
|
2
|
+
export { TooltipArrow, TooltipContent, TooltipRoot, TooltipTrigger, external_Tooltip_js_default as default };
|
package/dist/components/utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Dynamic, createComponent, mergeProps } from "solid-js/web";
|
|
2
|
+
import { breakpoints } from "./types.js";
|
|
3
|
+
import { useDesktop } from "../hooks/layout/index.js";
|
|
4
4
|
function isJSXElement(node) {
|
|
5
5
|
return "object" == typeof node && null !== node;
|
|
6
6
|
}
|
|
7
7
|
function wrapWithElementIfInvalid({ node, wrapper = "div", className = "" }) {
|
|
8
8
|
null == node || "string" == typeof node || "number" == typeof node || isJSXElement(node);
|
|
9
|
-
return
|
|
9
|
+
return createComponent(Dynamic, mergeProps({
|
|
10
10
|
component: wrapper
|
|
11
11
|
}, {
|
|
12
12
|
class: className
|
|
@@ -19,7 +19,7 @@ function mapResponsiveProp(prop, classMap) {
|
|
|
19
19
|
if ("string" == typeof prop || "boolean" == typeof prop) return [
|
|
20
20
|
classMap[String(prop)]
|
|
21
21
|
];
|
|
22
|
-
return
|
|
22
|
+
return breakpoints.flatMap((bp)=>{
|
|
23
23
|
const value = prop[bp];
|
|
24
24
|
if (void 0 === value) return [];
|
|
25
25
|
const className = classMap[String(value)];
|
|
@@ -30,5 +30,4 @@ function mapResponsiveProp(prop, classMap) {
|
|
|
30
30
|
];
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
export { mapResponsiveProp, wrapWithElementIfInvalid, __webpack_exports__useDesktop as useDesktop };
|
|
33
|
+
export { mapResponsiveProp, useDesktop, wrapWithElementIfInvalid };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
var _tmpl$ = /*#__PURE__*/
|
|
6
|
-
const
|
|
7
|
-
const [local, others] =
|
|
1
|
+
import { createComponent, mergeProps, spread, template, use } from "solid-js/web";
|
|
2
|
+
import { Show, createEffect, onCleanup, splitProps } from "solid-js";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { CLASSES } from "./VideoPreview.classes.js";
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/ template("<video>");
|
|
6
|
+
const VideoPreview_VideoPreview = (props)=>{
|
|
7
|
+
const [local, others] = splitProps(props, [
|
|
8
8
|
"stream",
|
|
9
9
|
"muted",
|
|
10
10
|
"mirror",
|
|
@@ -15,23 +15,23 @@ const VideoPreview = (props)=>{
|
|
|
15
15
|
]);
|
|
16
16
|
const muted = ()=>local.muted ?? true;
|
|
17
17
|
const mirror = ()=>local.mirror ?? false;
|
|
18
|
-
return
|
|
18
|
+
return createComponent(Show, {
|
|
19
19
|
get when () {
|
|
20
20
|
return local.stream();
|
|
21
21
|
},
|
|
22
22
|
children: (stream)=>{
|
|
23
23
|
let videoRef;
|
|
24
|
-
|
|
24
|
+
createEffect(()=>{
|
|
25
25
|
videoRef.srcObject = stream();
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
onCleanup(()=>{
|
|
28
28
|
videoRef.srcObject = null;
|
|
29
29
|
});
|
|
30
30
|
return (()=>{
|
|
31
31
|
var _el$ = _tmpl$();
|
|
32
32
|
var _ref$ = videoRef;
|
|
33
|
-
"function" == typeof _ref$ ?
|
|
34
|
-
|
|
33
|
+
"function" == typeof _ref$ ? use(_ref$, _el$) : videoRef = _el$;
|
|
34
|
+
spread(_el$, mergeProps(others, {
|
|
35
35
|
autoplay: true,
|
|
36
36
|
playsinline: true,
|
|
37
37
|
get muted () {
|
|
@@ -41,7 +41,7 @@ const VideoPreview = (props)=>{
|
|
|
41
41
|
return local.dataTheme;
|
|
42
42
|
}
|
|
43
43
|
}, ()=>({
|
|
44
|
-
class:
|
|
44
|
+
class: twMerge(mirror() && CLASSES.mirror, local.class, local.className)
|
|
45
45
|
}), {
|
|
46
46
|
get style () {
|
|
47
47
|
return local.style;
|
|
@@ -52,5 +52,5 @@ const VideoPreview = (props)=>{
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
|
-
const
|
|
56
|
-
export { VideoPreview,
|
|
55
|
+
const VideoPreview = VideoPreview_VideoPreview;
|
|
56
|
+
export { VideoPreview_VideoPreview as VideoPreview, VideoPreview as default };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export { __webpack_exports__VideoPreview as VideoPreview };
|
|
1
|
+
import external_VideoPreview_js_default from "./VideoPreview.js";
|
|
2
|
+
export { external_VideoPreview_js_default as VideoPreview };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createMemo, createSignal } from "solid-js";
|
|
2
|
+
import { addDays, addMonths, compareMonths, isSameMonth, shiftDateByMonths, startOfMonth } from "./date.utils.js";
|
|
3
3
|
const useCalendarNavigation = (options)=>{
|
|
4
|
-
const [visibleMonth, setVisibleMonth] =
|
|
5
|
-
const [focusedDate, setFocusedDate] =
|
|
4
|
+
const [visibleMonth, setVisibleMonth] = createSignal(startOfMonth(options.initialFocusedDate()));
|
|
5
|
+
const [focusedDate, setFocusedDate] = createSignal(options.initialFocusedDate());
|
|
6
6
|
const clampVisibleMonth = (nextVisibleMonth)=>{
|
|
7
7
|
const min = options.minDate();
|
|
8
8
|
const max = options.maxDate();
|
|
9
|
-
if (min &&
|
|
10
|
-
if (max &&
|
|
9
|
+
if (min && compareMonths(nextVisibleMonth, startOfMonth(min)) < 0) return startOfMonth(min);
|
|
10
|
+
if (max && compareMonths(nextVisibleMonth, startOfMonth(max)) > 0) return startOfMonth(max);
|
|
11
11
|
return nextVisibleMonth;
|
|
12
12
|
};
|
|
13
13
|
const setVisibleMonthFromDate = (date)=>{
|
|
14
|
-
const nextMonth =
|
|
15
|
-
if (!
|
|
14
|
+
const nextMonth = startOfMonth(date);
|
|
15
|
+
if (!isSameMonth(nextMonth, visibleMonth())) setVisibleMonth(clampVisibleMonth(nextMonth));
|
|
16
16
|
};
|
|
17
17
|
const findNearestEnabledDate = (startDate, direction)=>{
|
|
18
18
|
let current = startDate;
|
|
19
19
|
for(let index = 0; index < 400; index += 1){
|
|
20
20
|
if (!options.isDateDisabled(current)) return current;
|
|
21
|
-
current =
|
|
21
|
+
current = addDays(current, direction);
|
|
22
22
|
}
|
|
23
23
|
return startDate;
|
|
24
24
|
};
|
|
@@ -29,24 +29,24 @@ const useCalendarNavigation = (options)=>{
|
|
|
29
29
|
return nextFocus;
|
|
30
30
|
};
|
|
31
31
|
const navigateMonth = (direction)=>{
|
|
32
|
-
const nextMonth = clampVisibleMonth(
|
|
33
|
-
if (
|
|
32
|
+
const nextMonth = clampVisibleMonth(addMonths(visibleMonth(), direction));
|
|
33
|
+
if (isSameMonth(nextMonth, visibleMonth())) return null;
|
|
34
34
|
setVisibleMonth(nextMonth);
|
|
35
|
-
const nextFocus = findNearestEnabledDate(
|
|
35
|
+
const nextFocus = findNearestEnabledDate(shiftDateByMonths(focusedDate(), direction), direction);
|
|
36
36
|
setFocusedDate(nextFocus);
|
|
37
37
|
return nextFocus;
|
|
38
38
|
};
|
|
39
|
-
const canNavigatePrevious =
|
|
40
|
-
const previousMonth =
|
|
39
|
+
const canNavigatePrevious = createMemo(()=>{
|
|
40
|
+
const previousMonth = addMonths(visibleMonth(), -1);
|
|
41
41
|
const min = options.minDate();
|
|
42
42
|
if (!min) return true;
|
|
43
|
-
return
|
|
43
|
+
return compareMonths(previousMonth, startOfMonth(min)) >= 0;
|
|
44
44
|
});
|
|
45
|
-
const canNavigateNext =
|
|
46
|
-
const nextMonth =
|
|
45
|
+
const canNavigateNext = createMemo(()=>{
|
|
46
|
+
const nextMonth = addMonths(visibleMonth(), 1);
|
|
47
47
|
const max = options.maxDate();
|
|
48
48
|
if (!max) return true;
|
|
49
|
-
return
|
|
49
|
+
return compareMonths(nextMonth, startOfMonth(max)) <= 0;
|
|
50
50
|
});
|
|
51
51
|
const syncFocusedDate = (value)=>{
|
|
52
52
|
if (!value) return;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createMemo } from "solid-js";
|
|
2
|
+
import { addDays, buildCalendarGrid, compareDates, createPreviewRange, getToday, isSameDay, isSameMonth, normalizeRange, splitWeeks } from "./date.utils.js";
|
|
3
3
|
const useCalendarState = (options)=>{
|
|
4
|
-
const monthFormatter =
|
|
4
|
+
const monthFormatter = createMemo(()=>new Intl.DateTimeFormat(options.locale(), {
|
|
5
5
|
month: "long",
|
|
6
6
|
year: "numeric"
|
|
7
7
|
}));
|
|
8
|
-
const dayLabelFormatter =
|
|
8
|
+
const dayLabelFormatter = createMemo(()=>new Intl.DateTimeFormat(options.locale(), {
|
|
9
9
|
dateStyle: "full"
|
|
10
10
|
}));
|
|
11
|
-
const weekdayFormatter =
|
|
11
|
+
const weekdayFormatter = createMemo(()=>new Intl.DateTimeFormat(options.locale(), {
|
|
12
12
|
weekday: options.weekdayFormat()
|
|
13
13
|
}));
|
|
14
|
-
const weekdayLabels =
|
|
14
|
+
const weekdayLabels = createMemo(()=>{
|
|
15
15
|
const firstSunday = new Date(2024, 0, 7, 12, 0, 0, 0);
|
|
16
16
|
return Array.from({
|
|
17
17
|
length: 7
|
|
18
|
-
}, (_, index)=>weekdayFormatter().format(
|
|
18
|
+
}, (_, index)=>weekdayFormatter().format(addDays(firstSunday, index)));
|
|
19
19
|
});
|
|
20
|
-
const calendarWeeks =
|
|
21
|
-
const normalizedRange =
|
|
22
|
-
const previewRange =
|
|
23
|
-
const todayDate =
|
|
20
|
+
const calendarWeeks = createMemo(()=>splitWeeks(buildCalendarGrid(options.visibleMonth(), 0)));
|
|
21
|
+
const normalizedRange = createMemo(()=>normalizeRange(options.rangeStart(), options.rangeEnd()));
|
|
22
|
+
const previewRange = createMemo(()=>createPreviewRange(normalizedRange().start, normalizedRange().end, options.rangePreview()));
|
|
23
|
+
const todayDate = createMemo(()=>getToday());
|
|
24
24
|
const getCellState = (date)=>{
|
|
25
25
|
const mode = options.selectionMode();
|
|
26
26
|
const selectedDate = options.selectedDate();
|
|
27
27
|
const normalized = normalizedRange();
|
|
28
28
|
const preview = previewRange();
|
|
29
|
-
const isOutsideMonth = !
|
|
30
|
-
const isSelected = "single" === mode && null !== selectedDate &&
|
|
31
|
-
const isRangeStart = "range" === mode && null !== normalized.start &&
|
|
32
|
-
const isRangeEnd = "range" === mode && null !== normalized.end &&
|
|
33
|
-
const isInCommittedRange = "range" === mode && null !== normalized.start && null !== normalized.end &&
|
|
34
|
-
const isInPreviewRange = "range" === mode && null !== preview.start && null !== preview.end &&
|
|
29
|
+
const isOutsideMonth = !isSameMonth(date, options.visibleMonth());
|
|
30
|
+
const isSelected = "single" === mode && null !== selectedDate && isSameDay(date, selectedDate);
|
|
31
|
+
const isRangeStart = "range" === mode && null !== normalized.start && isSameDay(date, normalized.start);
|
|
32
|
+
const isRangeEnd = "range" === mode && null !== normalized.end && isSameDay(date, normalized.end);
|
|
33
|
+
const isInCommittedRange = "range" === mode && null !== normalized.start && null !== normalized.end && compareDates(date, normalized.start) >= 0 && compareDates(date, normalized.end) <= 0;
|
|
34
|
+
const isInPreviewRange = "range" === mode && null !== preview.start && null !== preview.end && compareDates(date, preview.start) >= 0 && compareDates(date, preview.end) <= 0;
|
|
35
35
|
const isInRange = isInCommittedRange || isInPreviewRange;
|
|
36
|
-
const isToday =
|
|
36
|
+
const isToday = isSameDay(date, todayDate());
|
|
37
37
|
const isUnavailable = options.isDateUnavailable(date);
|
|
38
38
|
const isDisabled = options.isDateDisabled(date);
|
|
39
|
-
const isFocused =
|
|
39
|
+
const isFocused = isSameDay(date, options.focusedDate());
|
|
40
40
|
const isAriaSelected = "range" === mode ? isRangeStart || isRangeEnd || isInRange : isSelected;
|
|
41
41
|
return {
|
|
42
42
|
isOutsideMonth,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createMemo, createSignal } from "solid-js";
|
|
2
|
+
import { normalizeDate } from "./date.utils.js";
|
|
3
3
|
const useDateSelection = (options)=>{
|
|
4
|
-
const [internalValue, setInternalValue] =
|
|
5
|
-
const isControlled =
|
|
6
|
-
const selectedDate =
|
|
7
|
-
if (isControlled()) return
|
|
4
|
+
const [internalValue, setInternalValue] = createSignal(normalizeDate(options.defaultValue()));
|
|
5
|
+
const isControlled = createMemo(()=>void 0 !== options.value());
|
|
6
|
+
const selectedDate = createMemo(()=>{
|
|
7
|
+
if (isControlled()) return normalizeDate(options.value());
|
|
8
8
|
return internalValue();
|
|
9
9
|
});
|
|
10
10
|
const setSelectedDate = (value)=>{
|
|
11
|
-
const normalized =
|
|
11
|
+
const normalized = normalizeDate(value);
|
|
12
12
|
if (!normalized) return;
|
|
13
13
|
if (!isControlled()) setInternalValue(normalized);
|
|
14
14
|
options.onChange()?.(normalized);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createEffect, createMemo, createSignal, onCleanup, onMount } from "solid-js";
|
|
2
2
|
const usePickerOpenState = (options)=>{
|
|
3
|
-
const [internalOpen, setInternalOpen] =
|
|
4
|
-
const [rootRef, setRootRef] =
|
|
5
|
-
const isControlled =
|
|
6
|
-
const isOpen =
|
|
3
|
+
const [internalOpen, setInternalOpen] = createSignal(Boolean(options.defaultOpen()));
|
|
4
|
+
const [rootRef, setRootRef] = createSignal(void 0);
|
|
5
|
+
const isControlled = createMemo(()=>void 0 !== options.isOpen());
|
|
6
|
+
const isOpen = createMemo(()=>isControlled() ? Boolean(options.isOpen()) : internalOpen());
|
|
7
7
|
const setOpen = (nextOpen)=>{
|
|
8
8
|
if (nextOpen && options.isDisabled()) return;
|
|
9
9
|
const previous = isOpen();
|
|
@@ -13,7 +13,7 @@ const usePickerOpenState = (options)=>{
|
|
|
13
13
|
const toggleOpen = ()=>{
|
|
14
14
|
setOpen(!isOpen());
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
onMount(()=>{
|
|
17
17
|
const handlePointerDown = (event)=>{
|
|
18
18
|
if (!isOpen()) return;
|
|
19
19
|
const root = rootRef();
|
|
@@ -29,12 +29,12 @@ const usePickerOpenState = (options)=>{
|
|
|
29
29
|
};
|
|
30
30
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
31
31
|
document.addEventListener("keydown", handleGlobalKeyDown);
|
|
32
|
-
|
|
32
|
+
onCleanup(()=>{
|
|
33
33
|
document.removeEventListener("pointerdown", handlePointerDown);
|
|
34
34
|
document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
createEffect(()=>{
|
|
38
38
|
if (!options.isDisabled()) return;
|
|
39
39
|
if (!isOpen()) return;
|
|
40
40
|
setOpen(false);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createMemo, createSignal } from "solid-js";
|
|
2
|
+
import { compareDates, createPreviewRange, normalizeDate, normalizeRange } from "./date.utils.js";
|
|
3
3
|
const normalizeCompleteRange = (value)=>{
|
|
4
4
|
if (!value) return null;
|
|
5
|
-
const normalized =
|
|
5
|
+
const normalized = normalizeRange(value.start, value.end);
|
|
6
6
|
if (!normalized.start || !normalized.end) return null;
|
|
7
7
|
return {
|
|
8
8
|
start: normalized.start,
|
|
@@ -10,19 +10,19 @@ const normalizeCompleteRange = (value)=>{
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
const useRangeSelection = (options)=>{
|
|
13
|
-
const [internalCommittedRange, setInternalCommittedRange] =
|
|
14
|
-
const [pendingStartDate, setPendingStartDate] =
|
|
15
|
-
const [hoveredDate, setHoveredDate] =
|
|
16
|
-
const isControlled =
|
|
17
|
-
const committedRange =
|
|
13
|
+
const [internalCommittedRange, setInternalCommittedRange] = createSignal(normalizeCompleteRange(options.defaultValue()));
|
|
14
|
+
const [pendingStartDate, setPendingStartDate] = createSignal(null);
|
|
15
|
+
const [hoveredDate, setHoveredDate] = createSignal(null);
|
|
16
|
+
const isControlled = createMemo(()=>void 0 !== options.value());
|
|
17
|
+
const committedRange = createMemo(()=>{
|
|
18
18
|
if (isControlled()) return normalizeCompleteRange(options.value());
|
|
19
19
|
return internalCommittedRange();
|
|
20
20
|
});
|
|
21
|
-
const isSelectingEnd =
|
|
22
|
-
const rangeStart =
|
|
23
|
-
const rangeEnd =
|
|
24
|
-
const previewRange =
|
|
25
|
-
const focusDate =
|
|
21
|
+
const isSelectingEnd = createMemo(()=>null !== pendingStartDate());
|
|
22
|
+
const rangeStart = createMemo(()=>pendingStartDate() ?? committedRange()?.start ?? null);
|
|
23
|
+
const rangeEnd = createMemo(()=>pendingStartDate() ? null : committedRange()?.end ?? null);
|
|
24
|
+
const previewRange = createMemo(()=>createPreviewRange(rangeStart(), rangeEnd(), hoveredDate()));
|
|
25
|
+
const focusDate = createMemo(()=>rangeEnd() ?? rangeStart() ?? null);
|
|
26
26
|
const setCommittedRange = (nextValue)=>{
|
|
27
27
|
const normalized = normalizeCompleteRange(nextValue);
|
|
28
28
|
if (!isControlled()) setInternalCommittedRange(normalized);
|
|
@@ -34,10 +34,10 @@ const useRangeSelection = (options)=>{
|
|
|
34
34
|
};
|
|
35
35
|
const setHoverDate = (value)=>{
|
|
36
36
|
if (!isSelectingEnd()) return void setHoveredDate(null);
|
|
37
|
-
setHoveredDate(
|
|
37
|
+
setHoveredDate(normalizeDate(value));
|
|
38
38
|
};
|
|
39
39
|
const selectDate = (value)=>{
|
|
40
|
-
const normalized =
|
|
40
|
+
const normalized = normalizeDate(value);
|
|
41
41
|
if (!normalized) return;
|
|
42
42
|
const pendingStart = pendingStartDate();
|
|
43
43
|
if (!pendingStart) {
|
|
@@ -45,7 +45,7 @@ const useRangeSelection = (options)=>{
|
|
|
45
45
|
setHoveredDate(null);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (
|
|
48
|
+
if (compareDates(normalized, pendingStart) < 0) {
|
|
49
49
|
setPendingStartDate(normalized);
|
|
50
50
|
setHoveredDate(null);
|
|
51
51
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
const FormContext =
|
|
1
|
+
import { createContext, useContext } from "solid-js";
|
|
2
|
+
const FormContext = createContext(null);
|
|
3
3
|
const useFormContext = ()=>{
|
|
4
|
-
const ctx =
|
|
4
|
+
const ctx = useContext(FormContext);
|
|
5
5
|
if (null === ctx) throw new Error("[pathscale/ui] useFormContext() was called outside of a <Form> component.\nMake sure this component is rendered as a descendant of <Form form={...}>.");
|
|
6
6
|
return ctx;
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createForm } from "@tanstack/solid-form";
|
|
2
2
|
const createValidationLogic = (props)=>{
|
|
3
3
|
if (!props.validators) return props.runValidation({
|
|
4
4
|
validators: [],
|
|
@@ -69,10 +69,10 @@ const createValidationLogic = (props)=>{
|
|
|
69
69
|
throw new Error(`Unknown validation event type: ${props.event.type}`);
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const createForm_createForm = (options)=>{
|
|
73
73
|
const hasSchema = Boolean(options.schema);
|
|
74
74
|
const hasAsyncValidators = Boolean(options.asyncValidators);
|
|
75
|
-
const tsForm =
|
|
75
|
+
const tsForm = createForm(()=>({
|
|
76
76
|
defaultValues: options.defaultValues,
|
|
77
77
|
validators: hasSchema || hasAsyncValidators ? {
|
|
78
78
|
onChange: options.schema,
|
|
@@ -90,4 +90,4 @@ const createForm = (options)=>{
|
|
|
90
90
|
_tsForm: tsForm
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
export { createForm };
|
|
93
|
+
export { createForm_createForm as createForm };
|
package/dist/hooks/form/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
var __webpack_exports__createForm = __WEBPACK_EXTERNAL_MODULE__createForm_js_8fe217ba__.createForm;
|
|
7
|
-
var __webpack_exports__getFirstFieldError = __WEBPACK_EXTERNAL_MODULE__getFirstFieldError_js_285cebb2__.getFirstFieldError;
|
|
8
|
-
var __webpack_exports__useField = __WEBPACK_EXTERNAL_MODULE__useFieldNew_js_75d863ae__.useField;
|
|
9
|
-
var __webpack_exports__useFormContext = __WEBPACK_EXTERNAL_MODULE__FormContext_js_47b39222__.useFormContext;
|
|
10
|
-
export { __webpack_exports__FormContext as FormContext, __webpack_exports__createForm as createForm, __webpack_exports__getFirstFieldError as getFirstFieldError, __webpack_exports__useField as useField, __webpack_exports__useFormContext as useFormContext };
|
|
1
|
+
import { createForm } from "./createForm.js";
|
|
2
|
+
import { FormContext, useFormContext } from "./FormContext.js";
|
|
3
|
+
import { useField } from "./useFieldNew.js";
|
|
4
|
+
import { getFirstFieldError } from "./getFirstFieldError.js";
|
|
5
|
+
export { FormContext, createForm, getFirstFieldError, useField, useFormContext };
|