@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,33 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../infrastructure/utilities/utils"
|
|
7
|
+
import { CheckIcon } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
function Checkbox({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxPrimitive.Root
|
|
15
|
+
data-slot="checkbox"
|
|
16
|
+
className={cn(
|
|
17
|
+
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<CheckboxPrimitive.Indicator
|
|
23
|
+
data-slot="checkbox-indicator"
|
|
24
|
+
className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
|
|
25
|
+
>
|
|
26
|
+
<CheckIcon
|
|
27
|
+
/>
|
|
28
|
+
</CheckboxPrimitive.Indicator>
|
|
29
|
+
</CheckboxPrimitive.Root>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Checkbox }
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {HTMLAttributes} from "react";
|
|
4
|
+
import {cn} from "../../infrastructure/utilities/utils";
|
|
5
|
+
import {ExternalLinkIcon} from "lucide-react";
|
|
6
|
+
import {useElasticInteraction, chainHandlers} from "../../infrastructure/hooks/use-elastic-interaction";
|
|
7
|
+
|
|
8
|
+
export type ClickableSizeIcon = "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
9
|
+
|
|
10
|
+
const SIZE_ICON_CLASS: Record<ClickableSizeIcon, string> = {
|
|
11
|
+
"3xs": "h-3 w-3",
|
|
12
|
+
"2xs": "h-3.5 w-3.5",
|
|
13
|
+
xs: "h-4 w-4",
|
|
14
|
+
sm: "h-5 w-5",
|
|
15
|
+
md: "h-6 w-6",
|
|
16
|
+
lg: "h-8 w-8",
|
|
17
|
+
xl: "h-10 w-10",
|
|
18
|
+
"2xl": "h-12 w-12",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export interface ClickableProps extends HTMLAttributes<HTMLButtonElement> {
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
sizeIcon?: ClickableSizeIcon;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function Clickable({
|
|
27
|
+
onClick,
|
|
28
|
+
sizeIcon = 'xs',
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
onPointerDown,
|
|
32
|
+
onPointerUp,
|
|
33
|
+
onPointerCancel,
|
|
34
|
+
onPointerLeave,
|
|
35
|
+
onFocus,
|
|
36
|
+
onBlur,
|
|
37
|
+
...props
|
|
38
|
+
}: ClickableProps) {
|
|
39
|
+
const elastic = useElasticInteraction({pressScale: 0.97, focusScale: 1.03});
|
|
40
|
+
|
|
41
|
+
return <button
|
|
42
|
+
{...props}
|
|
43
|
+
onClick={onClick}
|
|
44
|
+
onPointerDown={chainHandlers(elastic.onPointerDown, onPointerDown)}
|
|
45
|
+
onPointerUp={chainHandlers(elastic.onPointerUp, onPointerUp)}
|
|
46
|
+
onPointerCancel={chainHandlers(elastic.onPointerCancel, onPointerCancel)}
|
|
47
|
+
onPointerLeave={chainHandlers(elastic.onPointerLeave, onPointerLeave)}
|
|
48
|
+
onFocus={chainHandlers(elastic.onFocus, onFocus)}
|
|
49
|
+
onBlur={chainHandlers(elastic.onBlur, onBlur)}
|
|
50
|
+
className={cn(
|
|
51
|
+
" gap-2",
|
|
52
|
+
className,
|
|
53
|
+
"bg-transparent hover:text-primary flex flex-row justify-start items-center text-left cursor-pointer p-0!"
|
|
54
|
+
)}>
|
|
55
|
+
{children}
|
|
56
|
+
{sizeIcon && <ExternalLinkIcon strokeWidth={1} className={SIZE_ICON_CLASS[sizeIcon]}/>}
|
|
57
|
+
</button>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Collapsible as CollapsiblePrimitive } from "radix-ui"
|
|
4
|
+
|
|
5
|
+
function Collapsible({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
8
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function CollapsibleTrigger({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
14
|
+
return (
|
|
15
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
16
|
+
data-slot="collapsible-trigger"
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function CollapsibleContent({
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
25
|
+
return (
|
|
26
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
27
|
+
data-slot="collapsible-content"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../infrastructure/utilities/utils"
|
|
7
|
+
|
|
8
|
+
function ColorSwatchSelectorRoot({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
9
|
+
return (
|
|
10
|
+
<RadioGroupPrimitive.Root
|
|
11
|
+
data-slot="color-swatch-selector-root"
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex items-center justify-between gap-4 py-3 bg-muted dark:bg-muted/60 p-3 pl-5 rounded-full",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ColorSwatchSelectorLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
value: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function ColorSwatchSelectorLabel({ className, value, ...props }: ColorSwatchSelectorLabelProps) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-slot="color-swatch-selector-label"
|
|
29
|
+
className={cn("text-base font-normal leading-none", className)}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
{value}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ColorSwatchSelectorContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
38
|
+
return (
|
|
39
|
+
<div data-slot="color-swatch-selector-content" className={cn("flex items-center gap-2", className)} {...props} />
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface ColorSwatchSelectorItemProps extends React.ComponentProps<typeof RadioGroupPrimitive.Item> {
|
|
44
|
+
value: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function ColorSwatchSelectorItem({ className, value, ...props }: ColorSwatchSelectorItemProps) {
|
|
48
|
+
return (
|
|
49
|
+
<RadioGroupPrimitive.Item
|
|
50
|
+
data-slot="color-swatch-selector-item"
|
|
51
|
+
value={value}
|
|
52
|
+
className={cn(
|
|
53
|
+
"group relative h-8 w-8 shrink-0 cursor-pointer rounded-full outline-none transition-all",
|
|
54
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
55
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
56
|
+
className,
|
|
57
|
+
)}
|
|
58
|
+
style={{ backgroundColor: value, boxShadow: `1px 3px 4px 0px rgba(0, 0, 0, 0.25) inset` }}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{/* Selected indicator - white ring in the center */}
|
|
62
|
+
<div
|
|
63
|
+
className={cn(
|
|
64
|
+
"absolute inset-0 flex items-center justify-center",
|
|
65
|
+
"transition-all duration-200",
|
|
66
|
+
"opacity-0 scale-0",
|
|
67
|
+
"group-data-[state=checked]:opacity-100 group-data-[state=checked]:scale-100",
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
70
|
+
<div className="h-4 w-4 rounded-full border-[3px] bg-background" />
|
|
71
|
+
</div>
|
|
72
|
+
</RadioGroupPrimitive.Item>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const ColorSwatchSelector = {
|
|
77
|
+
Root: ColorSwatchSelectorRoot,
|
|
78
|
+
Label: ColorSwatchSelectorLabel,
|
|
79
|
+
Content: ColorSwatchSelectorContent,
|
|
80
|
+
Item: ColorSwatchSelectorItem,
|
|
81
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../infrastructure/utilities/utils"
|
|
7
|
+
import { Button } from "./button"
|
|
8
|
+
import {
|
|
9
|
+
InputGroup,
|
|
10
|
+
InputGroupAddon,
|
|
11
|
+
InputGroupButton,
|
|
12
|
+
InputGroupInput,
|
|
13
|
+
} from "./input-group"
|
|
14
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react"
|
|
15
|
+
|
|
16
|
+
const Combobox = ComboboxPrimitive.Root
|
|
17
|
+
|
|
18
|
+
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
19
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ComboboxTrigger({
|
|
23
|
+
className,
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}: ComboboxPrimitive.Trigger.Props) {
|
|
27
|
+
return (
|
|
28
|
+
<ComboboxPrimitive.Trigger
|
|
29
|
+
data-slot="combobox-trigger"
|
|
30
|
+
className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
35
|
+
</ComboboxPrimitive.Trigger>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
40
|
+
return (
|
|
41
|
+
<ComboboxPrimitive.Clear
|
|
42
|
+
data-slot="combobox-clear"
|
|
43
|
+
render={<InputGroupButton variant="ghost" size="icon-xs" />}
|
|
44
|
+
className={cn(className)}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
<XIcon className="pointer-events-none" />
|
|
48
|
+
</ComboboxPrimitive.Clear>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function ComboboxInput({
|
|
53
|
+
className,
|
|
54
|
+
children,
|
|
55
|
+
disabled = false,
|
|
56
|
+
showTrigger = true,
|
|
57
|
+
showClear = false,
|
|
58
|
+
...props
|
|
59
|
+
}: ComboboxPrimitive.Input.Props & {
|
|
60
|
+
showTrigger?: boolean
|
|
61
|
+
showClear?: boolean
|
|
62
|
+
}) {
|
|
63
|
+
return (
|
|
64
|
+
<InputGroup className={cn("w-auto", className)}>
|
|
65
|
+
<ComboboxPrimitive.Input
|
|
66
|
+
render={<InputGroupInput disabled={disabled} />}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
<InputGroupAddon align="inline-end">
|
|
70
|
+
{showTrigger && (
|
|
71
|
+
<InputGroupButton
|
|
72
|
+
size="icon-xs"
|
|
73
|
+
variant="ghost"
|
|
74
|
+
asChild
|
|
75
|
+
data-slot="input-group-button"
|
|
76
|
+
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
77
|
+
disabled={disabled}
|
|
78
|
+
>
|
|
79
|
+
<ComboboxTrigger />
|
|
80
|
+
</InputGroupButton>
|
|
81
|
+
)}
|
|
82
|
+
{showClear && <ComboboxClear disabled={disabled} />}
|
|
83
|
+
</InputGroupAddon>
|
|
84
|
+
{children}
|
|
85
|
+
</InputGroup>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function ComboboxContent({
|
|
90
|
+
className,
|
|
91
|
+
side = "bottom",
|
|
92
|
+
sideOffset = 6,
|
|
93
|
+
align = "start",
|
|
94
|
+
alignOffset = 0,
|
|
95
|
+
anchor,
|
|
96
|
+
...props
|
|
97
|
+
}: ComboboxPrimitive.Popup.Props &
|
|
98
|
+
Pick<
|
|
99
|
+
ComboboxPrimitive.Positioner.Props,
|
|
100
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
101
|
+
>) {
|
|
102
|
+
return (
|
|
103
|
+
<ComboboxPrimitive.Portal>
|
|
104
|
+
<ComboboxPrimitive.Positioner
|
|
105
|
+
side={side}
|
|
106
|
+
sideOffset={sideOffset}
|
|
107
|
+
align={align}
|
|
108
|
+
alignOffset={alignOffset}
|
|
109
|
+
anchor={anchor}
|
|
110
|
+
className="isolate z-50"
|
|
111
|
+
>
|
|
112
|
+
<ComboboxPrimitive.Popup
|
|
113
|
+
data-slot="combobox-content"
|
|
114
|
+
data-chips={!!anchor}
|
|
115
|
+
className={cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
</ComboboxPrimitive.Positioner>
|
|
119
|
+
</ComboboxPrimitive.Portal>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
124
|
+
return (
|
|
125
|
+
<ComboboxPrimitive.List
|
|
126
|
+
data-slot="combobox-list"
|
|
127
|
+
className={cn(
|
|
128
|
+
"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function ComboboxItem({
|
|
137
|
+
className,
|
|
138
|
+
children,
|
|
139
|
+
...props
|
|
140
|
+
}: ComboboxPrimitive.Item.Props) {
|
|
141
|
+
return (
|
|
142
|
+
<ComboboxPrimitive.Item
|
|
143
|
+
data-slot="combobox-item"
|
|
144
|
+
className={cn(
|
|
145
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
146
|
+
className
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
>
|
|
150
|
+
{children}
|
|
151
|
+
<ComboboxPrimitive.ItemIndicator
|
|
152
|
+
render={
|
|
153
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<CheckIcon className="pointer-events-none" />
|
|
157
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
158
|
+
</ComboboxPrimitive.Item>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
163
|
+
return (
|
|
164
|
+
<ComboboxPrimitive.Group
|
|
165
|
+
data-slot="combobox-group"
|
|
166
|
+
className={cn(className)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function ComboboxLabel({
|
|
173
|
+
className,
|
|
174
|
+
...props
|
|
175
|
+
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
176
|
+
return (
|
|
177
|
+
<ComboboxPrimitive.GroupLabel
|
|
178
|
+
data-slot="combobox-label"
|
|
179
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
180
|
+
{...props}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
186
|
+
return (
|
|
187
|
+
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
192
|
+
return (
|
|
193
|
+
<ComboboxPrimitive.Empty
|
|
194
|
+
data-slot="combobox-empty"
|
|
195
|
+
className={cn(
|
|
196
|
+
"hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
|
|
197
|
+
className
|
|
198
|
+
)}
|
|
199
|
+
{...props}
|
|
200
|
+
/>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function ComboboxSeparator({
|
|
205
|
+
className,
|
|
206
|
+
...props
|
|
207
|
+
}: ComboboxPrimitive.Separator.Props) {
|
|
208
|
+
return (
|
|
209
|
+
<ComboboxPrimitive.Separator
|
|
210
|
+
data-slot="combobox-separator"
|
|
211
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
212
|
+
{...props}
|
|
213
|
+
/>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function ComboboxChips({
|
|
218
|
+
className,
|
|
219
|
+
...props
|
|
220
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
221
|
+
ComboboxPrimitive.Chips.Props) {
|
|
222
|
+
return (
|
|
223
|
+
<ComboboxPrimitive.Chips
|
|
224
|
+
data-slot="combobox-chips"
|
|
225
|
+
className={cn(
|
|
226
|
+
"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40",
|
|
227
|
+
className
|
|
228
|
+
)}
|
|
229
|
+
{...props}
|
|
230
|
+
/>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function ComboboxChip({
|
|
235
|
+
className,
|
|
236
|
+
children,
|
|
237
|
+
showRemove = true,
|
|
238
|
+
...props
|
|
239
|
+
}: ComboboxPrimitive.Chip.Props & {
|
|
240
|
+
showRemove?: boolean
|
|
241
|
+
}) {
|
|
242
|
+
return (
|
|
243
|
+
<ComboboxPrimitive.Chip
|
|
244
|
+
data-slot="combobox-chip"
|
|
245
|
+
className={cn(
|
|
246
|
+
"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
|
|
247
|
+
className
|
|
248
|
+
)}
|
|
249
|
+
{...props}
|
|
250
|
+
>
|
|
251
|
+
{children}
|
|
252
|
+
{showRemove && (
|
|
253
|
+
<ComboboxPrimitive.ChipRemove
|
|
254
|
+
render={<Button variant="ghost" size="icon-xs" />}
|
|
255
|
+
className="-ml-1 opacity-50 hover:opacity-100"
|
|
256
|
+
data-slot="combobox-chip-remove"
|
|
257
|
+
>
|
|
258
|
+
<XIcon className="pointer-events-none" />
|
|
259
|
+
</ComboboxPrimitive.ChipRemove>
|
|
260
|
+
)}
|
|
261
|
+
</ComboboxPrimitive.Chip>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function ComboboxChipsInput({
|
|
266
|
+
className,
|
|
267
|
+
...props
|
|
268
|
+
}: ComboboxPrimitive.Input.Props) {
|
|
269
|
+
return (
|
|
270
|
+
<ComboboxPrimitive.Input
|
|
271
|
+
data-slot="combobox-chip-input"
|
|
272
|
+
className={cn("min-w-16 flex-1 outline-none", className)}
|
|
273
|
+
{...props}
|
|
274
|
+
/>
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function useComboboxAnchor() {
|
|
279
|
+
return React.useRef<HTMLDivElement | null>(null)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export {
|
|
283
|
+
Combobox,
|
|
284
|
+
ComboboxInput,
|
|
285
|
+
ComboboxContent,
|
|
286
|
+
ComboboxList,
|
|
287
|
+
ComboboxItem,
|
|
288
|
+
ComboboxGroup,
|
|
289
|
+
ComboboxLabel,
|
|
290
|
+
ComboboxCollection,
|
|
291
|
+
ComboboxEmpty,
|
|
292
|
+
ComboboxSeparator,
|
|
293
|
+
ComboboxChips,
|
|
294
|
+
ComboboxChip,
|
|
295
|
+
ComboboxChipsInput,
|
|
296
|
+
ComboboxTrigger,
|
|
297
|
+
ComboboxValue,
|
|
298
|
+
useComboboxAnchor,
|
|
299
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../infrastructure/utilities/utils"
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "./dialog"
|
|
14
|
+
import {
|
|
15
|
+
InputGroup,
|
|
16
|
+
InputGroupAddon,
|
|
17
|
+
} from "./input-group"
|
|
18
|
+
import { SearchIcon, CheckIcon } from "lucide-react"
|
|
19
|
+
|
|
20
|
+
function Command({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
24
|
+
return (
|
|
25
|
+
<CommandPrimitive
|
|
26
|
+
data-slot="command"
|
|
27
|
+
className={cn(
|
|
28
|
+
"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function CommandDialog({
|
|
37
|
+
title = "Command Palette",
|
|
38
|
+
description = "Search for a command to run...",
|
|
39
|
+
children,
|
|
40
|
+
className,
|
|
41
|
+
showCloseButton = false,
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
44
|
+
title?: string
|
|
45
|
+
description?: string
|
|
46
|
+
className?: string
|
|
47
|
+
showCloseButton?: boolean
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<Dialog {...props}>
|
|
51
|
+
<DialogHeader className="sr-only">
|
|
52
|
+
<DialogTitle>{title}</DialogTitle>
|
|
53
|
+
<DialogDescription>{description}</DialogDescription>
|
|
54
|
+
</DialogHeader>
|
|
55
|
+
<DialogContent
|
|
56
|
+
className={cn(
|
|
57
|
+
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
showCloseButton={showCloseButton}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
</DialogContent>
|
|
64
|
+
</Dialog>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function CommandInput({
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
72
|
+
return (
|
|
73
|
+
<div data-slot="command-input-wrapper" className="p-1 pb-0">
|
|
74
|
+
<InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
|
|
75
|
+
<CommandPrimitive.Input
|
|
76
|
+
data-slot="command-input"
|
|
77
|
+
className={cn(
|
|
78
|
+
"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
<InputGroupAddon>
|
|
84
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
85
|
+
</InputGroupAddon>
|
|
86
|
+
</InputGroup>
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function CommandList({
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
95
|
+
return (
|
|
96
|
+
<CommandPrimitive.List
|
|
97
|
+
data-slot="command-list"
|
|
98
|
+
className={cn(
|
|
99
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
100
|
+
className
|
|
101
|
+
)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function CommandEmpty({
|
|
108
|
+
className,
|
|
109
|
+
...props
|
|
110
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
111
|
+
return (
|
|
112
|
+
<CommandPrimitive.Empty
|
|
113
|
+
data-slot="command-empty"
|
|
114
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function CommandGroup({
|
|
121
|
+
className,
|
|
122
|
+
...props
|
|
123
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
124
|
+
return (
|
|
125
|
+
<CommandPrimitive.Group
|
|
126
|
+
data-slot="command-group"
|
|
127
|
+
className={cn(
|
|
128
|
+
"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function CommandSeparator({
|
|
137
|
+
className,
|
|
138
|
+
...props
|
|
139
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
140
|
+
return (
|
|
141
|
+
<CommandPrimitive.Separator
|
|
142
|
+
data-slot="command-separator"
|
|
143
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
144
|
+
{...props}
|
|
145
|
+
/>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function CommandItem({
|
|
150
|
+
className,
|
|
151
|
+
children,
|
|
152
|
+
...props
|
|
153
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
154
|
+
return (
|
|
155
|
+
<CommandPrimitive.Item
|
|
156
|
+
data-slot="command-item"
|
|
157
|
+
className={cn(
|
|
158
|
+
"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
|
|
159
|
+
className
|
|
160
|
+
)}
|
|
161
|
+
{...props}
|
|
162
|
+
>
|
|
163
|
+
{children}
|
|
164
|
+
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
165
|
+
</CommandPrimitive.Item>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function CommandShortcut({
|
|
170
|
+
className,
|
|
171
|
+
...props
|
|
172
|
+
}: React.ComponentProps<"span">) {
|
|
173
|
+
return (
|
|
174
|
+
<span
|
|
175
|
+
data-slot="command-shortcut"
|
|
176
|
+
className={cn(
|
|
177
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
|
|
178
|
+
className
|
|
179
|
+
)}
|
|
180
|
+
{...props}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export {
|
|
186
|
+
Command,
|
|
187
|
+
CommandDialog,
|
|
188
|
+
CommandInput,
|
|
189
|
+
CommandList,
|
|
190
|
+
CommandEmpty,
|
|
191
|
+
CommandGroup,
|
|
192
|
+
CommandItem,
|
|
193
|
+
CommandShortcut,
|
|
194
|
+
CommandSeparator,
|
|
195
|
+
}
|