@liorian/sdk 0.28.0-alpha.56010ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +483 -0
- package/package.json +94 -0
- package/schemas/module.schema.json +818 -0
- package/src/application/index.ts +3 -0
- package/src/application/module-instance.ts +36 -0
- package/src/application/service/auth-api-service.ts +291 -0
- package/src/application/service/auth-user.service.ts +108 -0
- package/src/application/service/index.ts +12 -0
- package/src/application/service/module-activation-api.service.ts +105 -0
- package/src/application/service/notifications-api-service.ts +38 -0
- package/src/application/service/notifications-push.service.ts +299 -0
- package/src/application/service/notifications-socket-service.ts +76 -0
- package/src/application/service/organizations-api-service.ts +104 -0
- package/src/application/service/otp-api-service.ts +11 -0
- package/src/application/service/storage-api-service.ts +77 -0
- package/src/application/service/storefront-api.service.ts +72 -0
- package/src/application/service/user-preferences-api.service.ts +57 -0
- package/src/domain/config/app.config.ts +35 -0
- package/src/domain/config/auth.config.ts +30 -0
- package/src/domain/config/index.ts +4 -0
- package/src/domain/config/logo.config.ts +17 -0
- package/src/domain/entities/activities.interface.ts +18 -0
- package/src/domain/entities/catalog.interface.ts +96 -0
- package/src/domain/entities/index.ts +13 -0
- package/src/domain/entities/media.ts +22 -0
- package/src/domain/entities/module-activation.interface.ts +173 -0
- package/src/domain/entities/module.interface.ts +101 -0
- package/src/domain/entities/notification.interface.ts +23 -0
- package/src/domain/entities/objectable.type.ts +3 -0
- package/src/domain/entities/organization.interface.ts +81 -0
- package/src/domain/entities/user-auth.interface.ts +17 -0
- package/src/domain/entities/user-phone.interface.ts +11 -0
- package/src/domain/entities/user-profile.interface.ts +23 -0
- package/src/domain/entities/user.interface.ts +79 -0
- package/src/domain/enums/coloring.enum.ts +6 -0
- package/src/domain/enums/domains.enum.ts +282 -0
- package/src/domain/enums/index.ts +8 -0
- package/src/domain/enums/module-category.enum.ts +57 -0
- package/src/domain/enums/module.enum.ts +97 -0
- package/src/domain/enums/routine.enum.ts +12 -0
- package/src/domain/enums/user-profile.enum.ts +25 -0
- package/src/domain/enums/user-status.enum.ts +7 -0
- package/src/domain/index.ts +6 -0
- package/src/domain/typing/auth-caches.ts +12 -0
- package/src/domain/typing/auth-oauth.types.ts +172 -0
- package/src/domain/typing/devise.ts +2 -0
- package/src/domain/typing/index.ts +10 -0
- package/src/domain/typing/response.ts +30 -0
- package/src/domain/typing/routine.types.ts +113 -0
- package/src/domain/typing/session.interface.ts +28 -0
- package/src/domain/typing/statisticals.ts +11 -0
- package/src/domain/typing/user-media-upload.ts +9 -0
- package/src/domain/typing/values.ts +6 -0
- package/src/index.tsx +168 -0
- package/src/infrastructure/capabilities/cache-storage/capability.ts +129 -0
- package/src/infrastructure/capabilities/cache-storage/enum.ts +5 -0
- package/src/infrastructure/capabilities/cache-storage/index.ts +4 -0
- package/src/infrastructure/capabilities/cache-storage/types.ts +13 -0
- package/src/infrastructure/capabilities/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/capability.ts +55 -0
- package/src/infrastructure/capabilities/stackable/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/types.ts +24 -0
- package/src/infrastructure/common-classname.constant.ts +4 -0
- package/src/infrastructure/data/countries.ts +208 -0
- package/src/infrastructure/data/gender.ts +5 -0
- package/src/infrastructure/data/index.ts +3 -0
- package/src/infrastructure/dataset/index.ts +3 -0
- package/src/infrastructure/dataset/sign-in.dataset.ts +21 -0
- package/src/infrastructure/dataset/sign-up.dataset.ts +64 -0
- package/src/infrastructure/hooks/index.ts +10 -0
- package/src/infrastructure/hooks/use-activity-lock-draft.ts +69 -0
- package/src/infrastructure/hooks/use-auth.ts +24 -0
- package/src/infrastructure/hooks/use-elastic-interaction.ts +180 -0
- package/src/infrastructure/hooks/use-is-desktop.ts +25 -0
- package/src/infrastructure/hooks/use-is-tauri.ts +17 -0
- package/src/infrastructure/hooks/use-mobile.ts +19 -0
- package/src/infrastructure/hooks/use-notifications.ts +128 -0
- package/src/infrastructure/hooks/use-recent-colors.ts +113 -0
- package/src/infrastructure/hooks/use-recent-modules.ts +76 -0
- package/src/infrastructure/index.tsx +11 -0
- package/src/infrastructure/library/design-system.ts +95 -0
- package/src/infrastructure/library/index.tsx +5 -0
- package/src/infrastructure/library/motion-utils.ts +77 -0
- package/src/infrastructure/library/motion.tsx +31 -0
- package/src/infrastructure/library/scroll-progress.tsx +93 -0
- package/src/infrastructure/providers/auth-guard.provider.tsx +47 -0
- package/src/infrastructure/providers/auth.provider.tsx +168 -0
- package/src/infrastructure/providers/index.tsx +8 -0
- package/src/infrastructure/providers/module-usage.provider.tsx +95 -0
- package/src/infrastructure/providers/modules-guard.provider.tsx +64 -0
- package/src/infrastructure/providers/modules-routines.provider.tsx +33 -0
- package/src/infrastructure/providers/modules-switcher.provider.tsx +25 -0
- package/src/infrastructure/providers/query.provider.tsx +27 -0
- package/src/infrastructure/routines/__tests__/routine.test.ts +368 -0
- package/src/infrastructure/routines/index.tsx +3 -0
- package/src/infrastructure/routines/routine.hook.ts +121 -0
- package/src/infrastructure/routines/routine.ts +283 -0
- package/src/infrastructure/routines/routine.tsx +283 -0
- package/src/infrastructure/stores/activity-lock.store.ts +22 -0
- package/src/infrastructure/stores/auth-user-connected.store.ts +24 -0
- package/src/infrastructure/stores/dataset.store.ts +106 -0
- package/src/infrastructure/stores/index.ts +6 -0
- package/src/infrastructure/stores/module.store.ts +266 -0
- package/src/infrastructure/stores/upload.store.ts +198 -0
- package/src/infrastructure/utilities/access-label.util.ts +158 -0
- package/src/infrastructure/utilities/activities.util.tsx +54 -0
- package/src/infrastructure/utilities/activity-lock.service.ts +263 -0
- package/src/infrastructure/utilities/activity-tracker.service.ts +205 -0
- package/src/infrastructure/utilities/api-service.ts +237 -0
- package/src/infrastructure/utilities/auth-logout.util.ts +23 -0
- package/src/infrastructure/utilities/classname.util.ts +7 -0
- package/src/infrastructure/utilities/encryption.service.ts +125 -0
- package/src/infrastructure/utilities/form-snapshot.service.ts +304 -0
- package/src/infrastructure/utilities/format.util.ts +40 -0
- package/src/infrastructure/utilities/index.tsx +23 -0
- package/src/infrastructure/utilities/media-label.service.ts +47 -0
- package/src/infrastructure/utilities/modules.ts +11 -0
- package/src/infrastructure/utilities/permission.util.ts +22 -0
- package/src/infrastructure/utilities/push-permission.util.ts +43 -0
- package/src/infrastructure/utilities/route-access.ts +38 -0
- package/src/infrastructure/utilities/socket-service.ts +123 -0
- package/src/infrastructure/utilities/sso-auth.util.ts +188 -0
- package/src/infrastructure/utilities/stringable.util.ts +16 -0
- package/src/infrastructure/utilities/strings.util.ts +18 -0
- package/src/infrastructure/utilities/tauri.util.ts +15 -0
- package/src/infrastructure/utilities/utils.ts +6 -0
- package/src/infrastructure/utilities/values.ts +5 -0
- package/src/presentation/8starlabs-ui/button.tsx +94 -0
- package/src/presentation/8starlabs-ui/flip-clock.tsx +368 -0
- package/src/presentation/8starlabs-ui/heatmap.tsx +430 -0
- package/src/presentation/8starlabs-ui/hooks/index.tsx +2 -0
- package/src/presentation/8starlabs-ui/hooks/use-mobile.ts +21 -0
- package/src/presentation/8starlabs-ui/index.tsx +20 -0
- package/src/presentation/8starlabs-ui/json-viewer.tsx +972 -0
- package/src/presentation/8starlabs-ui/marquee.tsx +134 -0
- package/src/presentation/8starlabs-ui/partition-bar.tsx +198 -0
- package/src/presentation/8starlabs-ui/scroll-fade.tsx +158 -0
- package/src/presentation/8starlabs-ui/status-indicator.tsx +86 -0
- package/src/presentation/8starlabs-ui/system-banner.tsx +50 -0
- package/src/presentation/8starlabs-ui/timeline.tsx +576 -0
- package/src/presentation/8starlabs-ui/transport-badge.tsx +249 -0
- package/src/presentation/8starlabs-ui/ui/copy-button.tsx +60 -0
- package/src/presentation/8starlabs-ui/ui/index.tsx +2 -0
- package/src/presentation/analytics-section.tsx +85 -0
- package/src/presentation/app-sidebar.tsx +234 -0
- package/src/presentation/charts/area-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/area-widget.chart.tsx +128 -0
- package/src/presentation/charts/chart-widgets.types.ts +81 -0
- package/src/presentation/charts/index.tsx +16 -0
- package/src/presentation/charts/line-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/line-widget.chart.tsx +105 -0
- package/src/presentation/charts/pie-widget.chart-skeleton.tsx +56 -0
- package/src/presentation/charts/pie-widget.chart.tsx +168 -0
- package/src/presentation/charts/radar-widget.chart-skeleton.tsx +67 -0
- package/src/presentation/charts/radar-widget.chart.tsx +80 -0
- package/src/presentation/charts/radial-stacked-widget.chart-skeleton.tsx +66 -0
- package/src/presentation/charts/radial-stacked-widget.chart.tsx +120 -0
- package/src/presentation/charts/radial-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/radial-widget.chart.tsx +87 -0
- package/src/presentation/charts/tooltip-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/tooltip-widget.chart.tsx +89 -0
- package/src/presentation/components/activity-actions.tsx +20 -0
- package/src/presentation/components/activity-container.tsx +55 -0
- package/src/presentation/components/activity-content.tsx +20 -0
- package/src/presentation/components/activity-descriptor-parser.tsx +37 -0
- package/src/presentation/components/activity-header.tsx +20 -0
- package/src/presentation/components/activity-loader.tsx +19 -0
- package/src/presentation/components/activity-title.tsx +32 -0
- package/src/presentation/components/activity.tsx +22 -0
- package/src/presentation/components/auth/index.tsx +4 -0
- package/src/presentation/components/auth/sso-callback.view.tsx +44 -0
- package/src/presentation/components/auth/sso-disconnect.view.tsx +41 -0
- package/src/presentation/components/auth/sso-sign-in.view.tsx +29 -0
- package/src/presentation/components/auth-lock-screen.tsx +309 -0
- package/src/presentation/components/auth-session.view.tsx +17 -0
- package/src/presentation/components/data-table.tsx +814 -0
- package/src/presentation/components/dynamic-icon.tsx +16 -0
- package/src/presentation/components/floating-upload.tsx +291 -0
- package/src/presentation/components/index.tsx +40 -0
- package/src/presentation/components/local-time.tsx +170 -0
- package/src/presentation/components/markdown-parser.tsx +201 -0
- package/src/presentation/components/message-scroller.tsx +131 -0
- package/src/presentation/components/module-first-access-config.view.tsx +181 -0
- package/src/presentation/components/module-first-access-pending.view.tsx +38 -0
- package/src/presentation/components/module-guard.tsx +34 -0
- package/src/presentation/components/modules-first-access.guard.tsx +88 -0
- package/src/presentation/components/modules-guard-forbidden.tsx +46 -0
- package/src/presentation/components/notification-details.modal.tsx +145 -0
- package/src/presentation/components/notification-item.tsx +127 -0
- package/src/presentation/components/notifications-popover.tsx +128 -0
- package/src/presentation/components/push-notifications.provider.tsx +65 -0
- package/src/presentation/components/upload-progress-dialog.tsx +140 -0
- package/src/presentation/components/waiting-bar.tsx +22 -0
- package/src/presentation/components/waiting-section.tsx +15 -0
- package/src/presentation/components/waiting.tsx +14 -0
- package/src/presentation/data-grid/data-grid-empty.tsx +24 -0
- package/src/presentation/data-grid/data-grid-search-engine.tsx +32 -0
- package/src/presentation/data-grid/data-grid.tsx +892 -0
- package/src/presentation/data-grid/index.tsx +4 -0
- package/src/presentation/form-screen.tsx +95 -0
- package/src/presentation/icons/custom.tsx +20 -0
- package/src/presentation/icons/glyphIcons.tsx +53 -0
- package/src/presentation/icons/icons.enum.ts +4 -0
- package/src/presentation/icons/icons.util.ts +6 -0
- package/src/presentation/icons/index.tsx +8 -0
- package/src/presentation/icons/lucide.tsx +17 -0
- package/src/presentation/icons/remix.tsx +33 -0
- package/src/presentation/icons/types.ts +27 -0
- package/src/presentation/index.tsx +45 -0
- package/src/presentation/modals/components/ModalBox.tsx +74 -0
- package/src/presentation/modals/components/ModalPortal.tsx +31 -0
- package/src/presentation/modals/components/ModalStepper.tsx +319 -0
- package/src/presentation/modals/components/ModalWrapper.tsx +65 -0
- package/src/presentation/modals/components/index.tsx +5 -0
- package/src/presentation/modals/hooks/index.ts +2 -0
- package/src/presentation/modals/hooks/useModal.ts +38 -0
- package/src/presentation/modals/index.tsx +5 -0
- package/src/presentation/modals/stores/index.ts +2 -0
- package/src/presentation/modals/stores/useModalStore.ts +90 -0
- package/src/presentation/modals/types/index.ts +2 -0
- package/src/presentation/modals/types/modal.type.ts +33 -0
- package/src/presentation/module-menubar.tsx +300 -0
- package/src/presentation/module-widget.tsx +233 -0
- package/src/presentation/nav-documents.tsx +89 -0
- package/src/presentation/nav-main.tsx +62 -0
- package/src/presentation/nav-secondary.tsx +41 -0
- package/src/presentation/nav-user.tsx +109 -0
- package/src/presentation/permission-action-badge.tsx +35 -0
- package/src/presentation/reui/index.tsx +3 -0
- package/src/presentation/reui/stepper.tsx +508 -0
- package/src/presentation/reui/timeline.tsx +226 -0
- package/src/presentation/sheets/index.tsx +2 -0
- package/src/presentation/sheets/legacy-sheet-header.tsx +0 -0
- package/src/presentation/sheets/legacy-sheet.tsx +37 -0
- package/src/presentation/size.enum.ts +19 -0
- package/src/presentation/system/index.tsx +3 -0
- package/src/presentation/system/logo.theme.tsx +21 -0
- package/src/presentation/system/types.ts +10 -0
- package/src/presentation/theme/index.tsx +6 -0
- package/src/presentation/theme/prefer-color-scheme.tsx +50 -0
- package/src/presentation/theme/switch-color-scheme.tsx +16 -0
- package/src/presentation/theme/theme-switcher-button.tsx +20 -0
- package/src/presentation/theme/theme.enum.ts +4 -0
- package/src/presentation/theme/theme.store.ts +87 -0
- package/src/presentation/themes/index.tsx +2 -0
- package/src/presentation/themes/katon/dashboard-layout.tsx +1080 -0
- package/src/presentation/themes/katon/edge-section.tsx +19 -0
- package/src/presentation/themes/katon/header-menubar.tsx +270 -0
- package/src/presentation/themes/katon/header-modules-available.tsx +44 -0
- package/src/presentation/themes/katon/header-modules-recents.tsx +52 -0
- package/src/presentation/themes/katon/header-modules-store.tsx +25 -0
- package/src/presentation/themes/katon/header-options.tsx +13 -0
- package/src/presentation/themes/katon/header-organization-select.tsx +146 -0
- package/src/presentation/themes/katon/header-routines.tsx +74 -0
- package/src/presentation/themes/katon/header-tasks-connected-user.tsx +150 -0
- package/src/presentation/themes/katon/index.tsx +16 -0
- package/src/presentation/themes/katon/main-wrapper.tsx +34 -0
- package/src/presentation/themes/katon/module-item-link.tsx +32 -0
- package/src/presentation/themes/katon/view-frame.tsx +25 -0
- package/src/presentation/themes/katon/view-helmet.tsx +53 -0
- package/src/presentation/themes/katon/view-status.tsx +32 -0
- package/src/presentation/themes/katon/view-wrapper.tsx +15 -0
- package/src/presentation/themes/katon/view.tsx +42 -0
- package/src/presentation/ui/accordion-multiselect.tsx +206 -0
- package/src/presentation/ui/accordion.tsx +81 -0
- package/src/presentation/ui/alert-dialog.tsx +199 -0
- package/src/presentation/ui/alert.tsx +76 -0
- package/src/presentation/ui/aspect-ratio.tsx +11 -0
- package/src/presentation/ui/attachment.tsx +204 -0
- package/src/presentation/ui/avatar.tsx +112 -0
- package/src/presentation/ui/badge.tsx +49 -0
- package/src/presentation/ui/breadcrumb.tsx +122 -0
- package/src/presentation/ui/bubble.tsx +125 -0
- package/src/presentation/ui/button-group.tsx +83 -0
- package/src/presentation/ui/button.tsx +87 -0
- package/src/presentation/ui/calendar.tsx +222 -0
- package/src/presentation/ui/card.tsx +106 -0
- package/src/presentation/ui/carousel.tsx +242 -0
- package/src/presentation/ui/chart.tsx +373 -0
- package/src/presentation/ui/checkbox.tsx +33 -0
- package/src/presentation/ui/clickable.tsx +58 -0
- package/src/presentation/ui/collapsible.tsx +33 -0
- package/src/presentation/ui/color-swatch-selector.tsx +81 -0
- package/src/presentation/ui/combobox.tsx +299 -0
- package/src/presentation/ui/command.tsx +195 -0
- package/src/presentation/ui/context-menu.tsx +263 -0
- package/src/presentation/ui/dialog.tsx +168 -0
- package/src/presentation/ui/direction.tsx +22 -0
- package/src/presentation/ui/drawer.tsx +134 -0
- package/src/presentation/ui/dropdown-menu.tsx +269 -0
- package/src/presentation/ui/empty.tsx +104 -0
- package/src/presentation/ui/field.tsx +238 -0
- package/src/presentation/ui/granularity-selector.tsx +58 -0
- package/src/presentation/ui/hover-card.tsx +44 -0
- package/src/presentation/ui/index.tsx +74 -0
- package/src/presentation/ui/input-group.tsx +156 -0
- package/src/presentation/ui/input-otp.tsx +87 -0
- package/src/presentation/ui/input.tsx +19 -0
- package/src/presentation/ui/item.tsx +196 -0
- package/src/presentation/ui/kpi-card.tsx +203 -0
- package/src/presentation/ui/label-selector.tsx +100 -0
- package/src/presentation/ui/label.tsx +24 -0
- package/src/presentation/ui/legacy-birth-date-input.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/index.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.content.tsx +37 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.context.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.hex-input.tsx +97 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.picker.tsx +266 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.presets.ts +22 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.quick-list.tsx +49 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.recent.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.swatches.tsx +111 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.trigger.tsx +128 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.tsx +110 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.types.ts +1 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.utils.ts +114 -0
- package/src/presentation/ui/legacy-country-input.tsx +171 -0
- package/src/presentation/ui/legacy-gender-input.tsx +22 -0
- package/src/presentation/ui/legacy-input.tsx +106 -0
- package/src/presentation/ui/legacy-phone-input.tsx +213 -0
- package/src/presentation/ui/legacy-select-input.tsx +114 -0
- package/src/presentation/ui/legacy-text-area.tsx +111 -0
- package/src/presentation/ui/list-items.tsx +59 -0
- package/src/presentation/ui/marker.tsx +69 -0
- package/src/presentation/ui/media-player/index.tsx +12 -0
- package/src/presentation/ui/media-player/media-player.context.tsx +36 -0
- package/src/presentation/ui/media-player/media-player.tsx +167 -0
- package/src/presentation/ui/media-player/player-controls.tsx +207 -0
- package/src/presentation/ui/media-player/players/audio-player.tsx +78 -0
- package/src/presentation/ui/media-player/players/index.tsx +4 -0
- package/src/presentation/ui/media-player/players/video-player.tsx +193 -0
- package/src/presentation/ui/media-player/players/voice-note-player.tsx +108 -0
- package/src/presentation/ui/media-player/use-media-player.hook.ts +263 -0
- package/src/presentation/ui/menubar.tsx +281 -0
- package/src/presentation/ui/message.tsx +92 -0
- package/src/presentation/ui/navigation-menu.tsx +172 -0
- package/src/presentation/ui/pagination.tsx +129 -0
- package/src/presentation/ui/popover.tsx +89 -0
- package/src/presentation/ui/progress.tsx +31 -0
- package/src/presentation/ui/resizable.tsx +50 -0
- package/src/presentation/ui/select.tsx +192 -0
- package/src/presentation/ui/separator.tsx +28 -0
- package/src/presentation/ui/sheet.tsx +147 -0
- package/src/presentation/ui/sidebar.tsx +702 -0
- package/src/presentation/ui/skeleton.tsx +13 -0
- package/src/presentation/ui/slide-to-confirm.tsx +129 -0
- package/src/presentation/ui/slider.tsx +59 -0
- package/src/presentation/ui/sonner.tsx +58 -0
- package/src/presentation/ui/switch.tsx +33 -0
- package/src/presentation/ui/table.tsx +116 -0
- package/src/presentation/ui/tabs.tsx +90 -0
- package/src/presentation/ui/text-gradient.tsx +84 -0
- package/src/presentation/ui/textarea.tsx +18 -0
- package/src/presentation/ui/timeline-steps.tsx +235 -0
- package/src/presentation/ui/toggle-group.tsx +89 -0
- package/src/presentation/ui/toggle.tsx +47 -0
- package/src/presentation/ui/tooltip.tsx +57 -0
- package/src/presentation/uploading/index.tsx +3 -0
- package/src/presentation/uploading/media-upload-field.tsx +152 -0
- package/src/presentation/uploading/storage-media.tsx +210 -0
- package/src/styles.css +403 -0
- package/src/themes.css +1038 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
|
|
5
|
+
import { useRecentColors } from "../../../infrastructure/hooks/use-recent-colors"
|
|
6
|
+
import { Popover } from "../popover"
|
|
7
|
+
import { LegacyColorPickerProvider } from "./legacy-color-picker.context"
|
|
8
|
+
import { LegacyColorPickerContent } from "./legacy-color-picker.content"
|
|
9
|
+
import { DEFAULT_COLOR_PICKER_PRESETS } from "./legacy-color-picker.presets"
|
|
10
|
+
import { LegacyColorPickerOpenButton, LegacyColorPickerTrigger } from "./legacy-color-picker.trigger"
|
|
11
|
+
import { LegacyColorPickerQuickList } from "./legacy-color-picker.quick-list"
|
|
12
|
+
import type { LegacyColorPickerSize } from "./legacy-color-picker.types"
|
|
13
|
+
import { DEFAULT_COLOR, normalizeHex } from "./legacy-color-picker.utils"
|
|
14
|
+
|
|
15
|
+
export interface LegacyColorPickerProps
|
|
16
|
+
extends Omit<React.ComponentProps<typeof Popover>, "children"> {
|
|
17
|
+
value?: string
|
|
18
|
+
defaultValue?: string
|
|
19
|
+
onValueChange?: (value: string) => void
|
|
20
|
+
size?: LegacyColorPickerSize
|
|
21
|
+
presets?: string[]
|
|
22
|
+
disabled?: boolean
|
|
23
|
+
showQuickList?: boolean
|
|
24
|
+
quickListCount?: number
|
|
25
|
+
persistRecentColors?: boolean
|
|
26
|
+
children?: React.ReactNode
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function LegacyColorPicker({
|
|
30
|
+
value: valueProp,
|
|
31
|
+
defaultValue = DEFAULT_COLOR,
|
|
32
|
+
onValueChange,
|
|
33
|
+
size = "md",
|
|
34
|
+
presets = DEFAULT_COLOR_PICKER_PRESETS,
|
|
35
|
+
disabled = false,
|
|
36
|
+
showQuickList = true,
|
|
37
|
+
quickListCount = 7,
|
|
38
|
+
persistRecentColors = true,
|
|
39
|
+
children,
|
|
40
|
+
...popoverProps
|
|
41
|
+
}: LegacyColorPickerProps) {
|
|
42
|
+
const { recentColors, addRecentColor } = useRecentColors({ enabled: persistRecentColors })
|
|
43
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)
|
|
44
|
+
const value = valueProp ?? uncontrolledValue
|
|
45
|
+
|
|
46
|
+
const handleValueChange = React.useCallback(
|
|
47
|
+
(nextValue: string) => {
|
|
48
|
+
const normalized = normalizeHex(nextValue) ?? nextValue
|
|
49
|
+
if (valueProp === undefined) {
|
|
50
|
+
setUncontrolledValue(normalized)
|
|
51
|
+
}
|
|
52
|
+
onValueChange?.(normalized)
|
|
53
|
+
},
|
|
54
|
+
[valueProp, onValueChange]
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const handleCommit = React.useCallback(
|
|
58
|
+
(nextValue: string) => {
|
|
59
|
+
const normalized = normalizeHex(nextValue) ?? nextValue
|
|
60
|
+
if (valueProp === undefined) {
|
|
61
|
+
setUncontrolledValue(normalized)
|
|
62
|
+
}
|
|
63
|
+
onValueChange?.(normalized)
|
|
64
|
+
if (persistRecentColors) {
|
|
65
|
+
addRecentColor(normalized)
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[valueProp, onValueChange, persistRecentColors, addRecentColor]
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const contextValue = React.useMemo(
|
|
72
|
+
() => ({
|
|
73
|
+
value,
|
|
74
|
+
onValueChange: handleValueChange,
|
|
75
|
+
onCommit: handleCommit,
|
|
76
|
+
size,
|
|
77
|
+
disabled,
|
|
78
|
+
presets,
|
|
79
|
+
recentColors,
|
|
80
|
+
quickListCount,
|
|
81
|
+
}),
|
|
82
|
+
[value, handleValueChange, handleCommit, size, disabled, presets, recentColors, quickListCount]
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<LegacyColorPickerProvider value={contextValue}>
|
|
87
|
+
<Popover {...popoverProps}>
|
|
88
|
+
{children ?? (
|
|
89
|
+
showQuickList ? (
|
|
90
|
+
<>
|
|
91
|
+
<div
|
|
92
|
+
data-slot="color-picker-quick-container"
|
|
93
|
+
className="flex w-full items-center gap-1.5 rounded-full p-0"
|
|
94
|
+
>
|
|
95
|
+
<LegacyColorPickerQuickList />
|
|
96
|
+
<LegacyColorPickerOpenButton />
|
|
97
|
+
</div>
|
|
98
|
+
<LegacyColorPickerContent />
|
|
99
|
+
</>
|
|
100
|
+
) : (
|
|
101
|
+
<>
|
|
102
|
+
<LegacyColorPickerTrigger />
|
|
103
|
+
<LegacyColorPickerContent />
|
|
104
|
+
</>
|
|
105
|
+
)
|
|
106
|
+
)}
|
|
107
|
+
</Popover>
|
|
108
|
+
</LegacyColorPickerProvider>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type LegacyColorPickerSize = "xs" | "sm" | "md" | "lg" | "xl"
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export const DEFAULT_COLOR = "#3B82F6"
|
|
2
|
+
|
|
3
|
+
export interface RgbaColor {
|
|
4
|
+
r: number
|
|
5
|
+
g: number
|
|
6
|
+
b: number
|
|
7
|
+
a: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface HsvColor {
|
|
11
|
+
h: number
|
|
12
|
+
s: number
|
|
13
|
+
v: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function normalizeHex(value: string): string | null {
|
|
17
|
+
let hex = value.trim().replace(/^#/, "")
|
|
18
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
19
|
+
hex = hex
|
|
20
|
+
.split("")
|
|
21
|
+
.map((char) => char + char)
|
|
22
|
+
.join("")
|
|
23
|
+
}
|
|
24
|
+
return /^[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(hex) ? `#${hex.toLowerCase()}` : null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function toChannel(n: number): string {
|
|
28
|
+
return Math.max(0, Math.min(255, Math.round(n)))
|
|
29
|
+
.toString(16)
|
|
30
|
+
.padStart(2, "0")
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function hexToRgba(value: string): RgbaColor | null {
|
|
34
|
+
const normalized = normalizeHex(value)
|
|
35
|
+
if (!normalized) return null
|
|
36
|
+
const hex = normalized.slice(1)
|
|
37
|
+
const r = parseInt(hex.slice(0, 2), 16)
|
|
38
|
+
const g = parseInt(hex.slice(2, 4), 16)
|
|
39
|
+
const b = parseInt(hex.slice(4, 6), 16)
|
|
40
|
+
const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1
|
|
41
|
+
return { r, g, b, a }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function rgbaToHex(rgba: RgbaColor): string {
|
|
45
|
+
const { r, g, b, a } = rgba
|
|
46
|
+
if (a >= 1) {
|
|
47
|
+
return `#${toChannel(r)}${toChannel(g)}${toChannel(b)}`
|
|
48
|
+
}
|
|
49
|
+
return `#${toChannel(r)}${toChannel(g)}${toChannel(b)}${toChannel(a * 255)}`
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function rgbaToCss(rgba: RgbaColor): string {
|
|
53
|
+
return `rgba(${Math.round(rgba.r)}, ${Math.round(rgba.g)}, ${Math.round(rgba.b)}, ${rgba.a})`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function rgbToHsv(r: number, g: number, b: number): HsvColor {
|
|
57
|
+
const rf = r / 255
|
|
58
|
+
const gf = g / 255
|
|
59
|
+
const bf = b / 255
|
|
60
|
+
const max = Math.max(rf, gf, bf)
|
|
61
|
+
const min = Math.min(rf, gf, bf)
|
|
62
|
+
const d = max - min
|
|
63
|
+
let h = 0
|
|
64
|
+
if (d !== 0) {
|
|
65
|
+
switch (max) {
|
|
66
|
+
case rf:
|
|
67
|
+
h = ((gf - bf) / d) % 6
|
|
68
|
+
break
|
|
69
|
+
case gf:
|
|
70
|
+
h = (bf - rf) / d + 2
|
|
71
|
+
break
|
|
72
|
+
default:
|
|
73
|
+
h = (rf - gf) / d + 4
|
|
74
|
+
}
|
|
75
|
+
h *= 60
|
|
76
|
+
if (h < 0) {
|
|
77
|
+
h += 360
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
h,
|
|
82
|
+
s: max === 0 ? 0 : d / max,
|
|
83
|
+
v: max,
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function hsvToRgb(h: number, s: number, v: number): Omit<RgbaColor, "a"> {
|
|
88
|
+
const c = v * s
|
|
89
|
+
const x = c * (1 - Math.abs(((h / 60) % 2) - 1))
|
|
90
|
+
const m = v - c
|
|
91
|
+
let r = 0
|
|
92
|
+
let g = 0
|
|
93
|
+
let b = 0
|
|
94
|
+
if (h < 60) {
|
|
95
|
+
r = c
|
|
96
|
+
g = x
|
|
97
|
+
} else if (h < 120) {
|
|
98
|
+
r = x
|
|
99
|
+
g = c
|
|
100
|
+
} else if (h < 180) {
|
|
101
|
+
g = c
|
|
102
|
+
b = x
|
|
103
|
+
} else if (h < 240) {
|
|
104
|
+
g = x
|
|
105
|
+
b = c
|
|
106
|
+
} else if (h < 300) {
|
|
107
|
+
r = x
|
|
108
|
+
b = c
|
|
109
|
+
} else {
|
|
110
|
+
r = c
|
|
111
|
+
b = x
|
|
112
|
+
}
|
|
113
|
+
return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 }
|
|
114
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {cn} from "../../infrastructure/utilities/utils"
|
|
5
|
+
import {useMemo, useId, useState} from "react";
|
|
6
|
+
import {countriesConstant, CountryInterface} from "../../infrastructure/data/countries";
|
|
7
|
+
import {
|
|
8
|
+
InputGroup,
|
|
9
|
+
InputGroupAddon
|
|
10
|
+
} from "./input-group"
|
|
11
|
+
import {
|
|
12
|
+
Select,
|
|
13
|
+
SelectContent,
|
|
14
|
+
SelectItem,
|
|
15
|
+
SelectTrigger,
|
|
16
|
+
SelectValue,
|
|
17
|
+
} from "./select"
|
|
18
|
+
import type {LegacyInputColoring} from "./legacy-input"
|
|
19
|
+
import {Field, FieldDescription} from "./field";
|
|
20
|
+
import {useElasticInteraction, chainHandlers} from "../../infrastructure/hooks/use-elastic-interaction"
|
|
21
|
+
|
|
22
|
+
export interface LegacyCountryInputProps extends React.ComponentProps<"div"> {
|
|
23
|
+
label?: string;
|
|
24
|
+
icon?: React.ReactNode;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
value?: string;
|
|
27
|
+
defaultCountryCode?: string;
|
|
28
|
+
onValueChange?: (value: string) => void;
|
|
29
|
+
onCountryChange?: (country: CountryInterface) => void;
|
|
30
|
+
color?: LegacyInputColoring;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
description?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const coloringClassname: Record<LegacyInputColoring, string> = {
|
|
36
|
+
disabled: "bg-background/20 text-foreground-500 opacity-50",
|
|
37
|
+
info: "!bg-primary/20 !text-primary !border-primary",
|
|
38
|
+
success: "bg-green-500/20 text-green-500 !border-green-500",
|
|
39
|
+
warning: "bg-yellow-500/20 text-yellow-500 !border-yellow-500",
|
|
40
|
+
error: 'bg-red-800/20 text-red-800 !border-red-500',
|
|
41
|
+
ghost: 'bg-transparent text-foreground',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const LegacyCountryInput = React.forwardRef<HTMLDivElement, LegacyCountryInputProps>(
|
|
45
|
+
({
|
|
46
|
+
label,
|
|
47
|
+
description,
|
|
48
|
+
icon,
|
|
49
|
+
className,
|
|
50
|
+
id,
|
|
51
|
+
color,
|
|
52
|
+
placeholder = "Sélectionner un pays",
|
|
53
|
+
value: valueProp,
|
|
54
|
+
defaultCountryCode: defaultCountryCodeProp,
|
|
55
|
+
onValueChange,
|
|
56
|
+
onCountryChange,
|
|
57
|
+
required,
|
|
58
|
+
...props
|
|
59
|
+
}, ref) => {
|
|
60
|
+
const reactId = useId();
|
|
61
|
+
const _id = useMemo(() => id || label?.toLowerCase().replace(/ /g, '-') || reactId, [id, label, reactId]);
|
|
62
|
+
|
|
63
|
+
const sortedCountries = useMemo(() => {
|
|
64
|
+
return [...countriesConstant].sort((a, b) => a.name.localeCompare(b.name));
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
const defaultCountryCode = useMemo(() => {
|
|
68
|
+
if (defaultCountryCodeProp) return defaultCountryCodeProp;
|
|
69
|
+
|
|
70
|
+
if (typeof window === 'undefined') return 'CI';
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const locale = navigator.language;
|
|
74
|
+
const parts = locale.split('-');
|
|
75
|
+
const region = parts[parts.length - 1].toUpperCase();
|
|
76
|
+
if (region.length === 2 && countriesConstant.some(c => c.code === region)) {
|
|
77
|
+
return region;
|
|
78
|
+
}
|
|
79
|
+
} catch {}
|
|
80
|
+
|
|
81
|
+
return 'CI';
|
|
82
|
+
}, [defaultCountryCodeProp]);
|
|
83
|
+
|
|
84
|
+
const [internalValue, setInternalValue] = useState(defaultCountryCode);
|
|
85
|
+
const value = valueProp ?? internalValue;
|
|
86
|
+
|
|
87
|
+
const selectedCountry = useMemo(() => {
|
|
88
|
+
if (!value) return undefined;
|
|
89
|
+
return sortedCountries.find(c => c.code === value);
|
|
90
|
+
}, [value, sortedCountries]);
|
|
91
|
+
|
|
92
|
+
const handleValueChange = (countryCode: string) => {
|
|
93
|
+
setInternalValue(countryCode);
|
|
94
|
+
onValueChange?.(countryCode);
|
|
95
|
+
const country = sortedCountries.find(c => c.code === countryCode);
|
|
96
|
+
if (country) {
|
|
97
|
+
onCountryChange?.(country);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const elastic = useElasticInteraction({pressScale: 0.99, focusScale: 1.015});
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Field>
|
|
105
|
+
<InputGroup
|
|
106
|
+
{...props}
|
|
107
|
+
suppressHydrationWarning
|
|
108
|
+
className={cn(
|
|
109
|
+
"h-auto flex-col items-stretch rounded-md bg-background px-4 py-2.5",
|
|
110
|
+
coloringClassname[color || 'ghost'] || '',
|
|
111
|
+
className
|
|
112
|
+
)}
|
|
113
|
+
onPointerDown={chainHandlers(elastic.onPointerDown, props.onPointerDown)}
|
|
114
|
+
onPointerUp={chainHandlers(elastic.onPointerUp, props.onPointerUp)}
|
|
115
|
+
onPointerCancel={chainHandlers(elastic.onPointerCancel, props.onPointerCancel)}
|
|
116
|
+
onPointerLeave={chainHandlers(elastic.onPointerLeave, props.onPointerLeave)}
|
|
117
|
+
onFocus={chainHandlers(elastic.onFocus, props.onFocus)}
|
|
118
|
+
onBlur={chainHandlers(elastic.onBlur, props.onBlur)}
|
|
119
|
+
>
|
|
120
|
+
{label && (
|
|
121
|
+
<InputGroupAddon
|
|
122
|
+
align="block-start"
|
|
123
|
+
className="px-0 py-0 text-[10px] uppercase font-bold tracking-wider text-muted-foreground select-none"
|
|
124
|
+
>
|
|
125
|
+
{label}
|
|
126
|
+
{required && <span className="text-destructive">*</span>}
|
|
127
|
+
</InputGroupAddon>
|
|
128
|
+
)}
|
|
129
|
+
<div className="flex items-center justify-between gap-2 mt-0.5">
|
|
130
|
+
<Select value={value || ''} onValueChange={handleValueChange}>
|
|
131
|
+
<SelectTrigger
|
|
132
|
+
className="h-auto p-0 border-none bg-transparent! shadow-none! focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0 w-full min-w-0 data-[placeholder]:text-muted-foreground/30 [&_[data-slot=select-value]]:text-sm [&_[data-slot=select-value]]:font-normal">
|
|
133
|
+
<SelectValue placeholder={placeholder}>
|
|
134
|
+
{selectedCountry && (
|
|
135
|
+
<div className="flex items-center gap-1.5 text-sm font-medium">
|
|
136
|
+
<span className="text-base">{selectedCountry.flag}</span>
|
|
137
|
+
<span>{selectedCountry.name}</span>
|
|
138
|
+
{/*<span className="text-muted-foreground ml-auto">{selectedCountry.dialCode}</span>*/}
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
</SelectValue>
|
|
142
|
+
</SelectTrigger>
|
|
143
|
+
<SelectContent className="max-h-80">
|
|
144
|
+
{sortedCountries.map((country) => (
|
|
145
|
+
<SelectItem key={country.code} value={country.code} className="cursor-pointer">
|
|
146
|
+
<div className="flex items-center gap-2 w-full">
|
|
147
|
+
<span className="text-base">{country.flag}</span>
|
|
148
|
+
<span className="truncate flex-1">{country.name}</span>
|
|
149
|
+
<span className="text-muted-foreground text-xs">{country.dialCode}</span>
|
|
150
|
+
</div>
|
|
151
|
+
</SelectItem>
|
|
152
|
+
))}
|
|
153
|
+
</SelectContent>
|
|
154
|
+
</Select>
|
|
155
|
+
{icon && <InputGroupAddon
|
|
156
|
+
align="inline-end"
|
|
157
|
+
className="text-muted-foreground select-none px-0"
|
|
158
|
+
>
|
|
159
|
+
{icon}
|
|
160
|
+
</InputGroupAddon>}
|
|
161
|
+
</div>
|
|
162
|
+
</InputGroup>
|
|
163
|
+
{description && <FieldDescription className="mt-1">{description}</FieldDescription>}
|
|
164
|
+
</Field>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
LegacyCountryInput.displayName = "LegacyCountryInput"
|
|
170
|
+
|
|
171
|
+
export {LegacyCountryInput}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {LegacySelectInput, LegacySelectInputProps} from "./legacy-select-input";
|
|
2
|
+
import {UserGenderEnum} from "../../infrastructure/data/gender";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export function LegacyGenderInput(props: Omit<LegacySelectInputProps, 'options'>) {
|
|
6
|
+
return (
|
|
7
|
+
<LegacySelectInput
|
|
8
|
+
id="gender"
|
|
9
|
+
label="Genre"
|
|
10
|
+
placeholder="Sélectionner"
|
|
11
|
+
description={"Indiquez le genre pour plus de précision"}
|
|
12
|
+
{...props}
|
|
13
|
+
value={props.value || ''}
|
|
14
|
+
onValueChange={(value) => props.onValueChange?.(value as UserGenderEnum)}
|
|
15
|
+
options={[
|
|
16
|
+
{value: UserGenderEnum.MALE, label: 'Homme'},
|
|
17
|
+
{value: UserGenderEnum.FEMALE, label: 'Femme'},
|
|
18
|
+
{value: UserGenderEnum.OTHER, label: 'Autre'},
|
|
19
|
+
]}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {cn} from "../../infrastructure/utilities/utils"
|
|
5
|
+
import {useMemo, useId} from "react";
|
|
6
|
+
import {
|
|
7
|
+
InputGroup,
|
|
8
|
+
InputGroupInput,
|
|
9
|
+
InputGroupAddon
|
|
10
|
+
} from "./input-group"
|
|
11
|
+
import {FieldDescription, Field} from "./field"
|
|
12
|
+
import {useElasticInteraction, chainHandlers} from "../../infrastructure/hooks/use-elastic-interaction"
|
|
13
|
+
|
|
14
|
+
export type LegacyInputColoring = 'error' | 'success' | 'warning' | 'info' | 'disabled' | 'ghost';
|
|
15
|
+
|
|
16
|
+
export interface LegacyInputProps extends React.ComponentProps<"div"> {
|
|
17
|
+
label?: string;
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
input?: React.ComponentProps<"input">;
|
|
20
|
+
color?: LegacyInputColoring;
|
|
21
|
+
description?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const coloringClassname: Record<LegacyInputColoring, string> = {
|
|
25
|
+
disabled: "bg-background/20 text-foreground-500 opacity-50",
|
|
26
|
+
info: "!bg-primary/20 !text-primary !border-primary",
|
|
27
|
+
success: "bg-green-500/20 text-green-500 !border-green-500",
|
|
28
|
+
warning: "bg-yellow-500/20 text-yellow-500 !border-yellow-500",
|
|
29
|
+
error: 'bg-red-800/20 text-red-800 !border-red-500',
|
|
30
|
+
ghost: 'bg-transparent text-foreground',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const LegacyInput = React.forwardRef<HTMLInputElement, LegacyInputProps>(
|
|
35
|
+
({label, icon, className, id, input, color, description, ...props}, ref) => {
|
|
36
|
+
const reactId = useId();
|
|
37
|
+
const _id = useMemo(() => id || label?.toLowerCase().replace(/ /g, '-') || reactId, [id, label, reactId]);
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
type,
|
|
41
|
+
placeholder,
|
|
42
|
+
required,
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
className: inputClassName,
|
|
46
|
+
...inputProps
|
|
47
|
+
} = input || {};
|
|
48
|
+
|
|
49
|
+
const elastic = useElasticInteraction({pressScale: 0.99, focusScale: 1.015});
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Field>
|
|
53
|
+
<InputGroup
|
|
54
|
+
{...props}
|
|
55
|
+
suppressHydrationWarning
|
|
56
|
+
className={cn(
|
|
57
|
+
"h-auto flex-col items-stretch rounded-md bg-background px-4 py-2.5",
|
|
58
|
+
coloringClassname[color || 'ghost'] || '',
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
onPointerDown={chainHandlers(elastic.onPointerDown, props.onPointerDown)}
|
|
62
|
+
onPointerUp={chainHandlers(elastic.onPointerUp, props.onPointerUp)}
|
|
63
|
+
onPointerCancel={chainHandlers(elastic.onPointerCancel, props.onPointerCancel)}
|
|
64
|
+
onPointerLeave={chainHandlers(elastic.onPointerLeave, props.onPointerLeave)}
|
|
65
|
+
onFocus={chainHandlers(elastic.onFocus, props.onFocus)}
|
|
66
|
+
onBlur={chainHandlers(elastic.onBlur, props.onBlur)}
|
|
67
|
+
>
|
|
68
|
+
<InputGroupAddon
|
|
69
|
+
align="block-start"
|
|
70
|
+
className="px-0 py-0 text-[10px] uppercase font-bold tracking-wider text-muted-foreground select-none"
|
|
71
|
+
>
|
|
72
|
+
{label}
|
|
73
|
+
{required && <span className="text-destructive">*</span>}
|
|
74
|
+
</InputGroupAddon>
|
|
75
|
+
<div className="flex items-center justify-between gap-2 mt-0.5">
|
|
76
|
+
<InputGroupInput
|
|
77
|
+
ref={ref}
|
|
78
|
+
id={_id}
|
|
79
|
+
type={type}
|
|
80
|
+
placeholder={placeholder}
|
|
81
|
+
required={required}
|
|
82
|
+
value={value}
|
|
83
|
+
onChange={onChange}
|
|
84
|
+
className={cn(
|
|
85
|
+
"text-sm placeholder:text-muted-foreground/30 px-0!",
|
|
86
|
+
inputClassName,
|
|
87
|
+
)}
|
|
88
|
+
{...inputProps}
|
|
89
|
+
/>
|
|
90
|
+
{icon && <InputGroupAddon
|
|
91
|
+
align="inline-end"
|
|
92
|
+
className="text-muted-foreground select-none px-0"
|
|
93
|
+
>
|
|
94
|
+
{icon}
|
|
95
|
+
</InputGroupAddon>}
|
|
96
|
+
</div>
|
|
97
|
+
</InputGroup>
|
|
98
|
+
{description && <FieldDescription className="mt-1">{description}</FieldDescription>}
|
|
99
|
+
</Field>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
LegacyInput.displayName = "LegacyInput"
|
|
105
|
+
|
|
106
|
+
export {LegacyInput}
|