@rangka/client 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +7 -1
- package/dist/App.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +20 -0
- package/dist/main.js.map +1 -1
- package/dist/shell/assets/index-63v1sBS3.css +1 -0
- package/dist/shell/assets/index-Dh7K40cQ.js +8634 -0
- package/dist/shell/assets/vendor-query-B2cydN5j.js +1 -0
- package/dist/shell/assets/vendor-radix-BJxYPxPb.js +69 -0
- package/dist/shell/assets/vendor-router-ET_myMt5.js +17 -0
- package/dist/shell/index.html +5 -2
- package/dist/theme.css +82 -0
- package/dist/widgets/components/lazy-manifest.d.ts +11 -0
- package/dist/widgets/components/lazy-manifest.d.ts.map +1 -0
- package/dist/widgets/components/lazy-manifest.js +32 -0
- package/dist/widgets/components/lazy-manifest.js.map +1 -0
- package/dist/widgets/components/register.js +12 -12
- package/dist/widgets/components/register.js.map +1 -1
- package/dist/widgets/loader.d.ts +3 -0
- package/dist/widgets/loader.d.ts.map +1 -0
- package/dist/widgets/loader.js +73 -0
- package/dist/widgets/loader.js.map +1 -0
- package/dist/widgets/renderer/LazyWidget.d.ts +8 -0
- package/dist/widgets/renderer/LazyWidget.d.ts.map +1 -0
- package/dist/widgets/renderer/LazyWidget.js +31 -0
- package/dist/widgets/renderer/LazyWidget.js.map +1 -0
- package/dist/widgets/renderer/WidgetErrorBoundary.d.ts +17 -0
- package/dist/widgets/renderer/WidgetErrorBoundary.d.ts.map +1 -0
- package/dist/widgets/renderer/WidgetErrorBoundary.js +18 -0
- package/dist/widgets/renderer/WidgetErrorBoundary.js.map +1 -0
- package/dist/widgets/renderer/WidgetRenderer.d.ts.map +1 -1
- package/dist/widgets/renderer/WidgetRenderer.js +8 -6
- package/dist/widgets/renderer/WidgetRenderer.js.map +1 -1
- package/package.json +7 -4
- package/.claude/skills/add-widget/SKILL.md +0 -101
- package/.turbo/turbo-build.log +0 -29
- package/CHANGELOG.md +0 -25
- package/CLAUDE.md +0 -236
- package/components.json +0 -25
- package/dist/components/ui/chart.d.ts +0 -45
- package/dist/components/ui/chart.d.ts.map +0 -1
- package/dist/components/ui/chart.js +0 -119
- package/dist/components/ui/chart.js.map +0 -1
- package/dist/shell/assets/index--35CAvcP.js +0 -8715
- package/dist/shell/assets/index-COLmoPYo.css +0 -1
- package/index.html +0 -12
- package/src/App.tsx +0 -44
- package/src/__tests__/setup.ts +0 -1
- package/src/api/auth.ts +0 -41
- package/src/api/boot.ts +0 -10
- package/src/api/client.ts +0 -26
- package/src/api/paths.ts +0 -3
- package/src/api/token.ts +0 -13
- package/src/auth/LoginForm.tsx +0 -67
- package/src/auth/SessionExpired.tsx +0 -24
- package/src/auth/SetupForm.tsx +0 -76
- package/src/boot/BootGate.tsx +0 -35
- package/src/boot/BootProvider.tsx +0 -28
- package/src/boot/types.ts +0 -9
- package/src/boot/useBoot.ts +0 -111
- package/src/components/Icon.tsx +0 -17
- package/src/components/ui/accordion.tsx +0 -82
- package/src/components/ui/alert-dialog.tsx +0 -180
- package/src/components/ui/alert.tsx +0 -76
- package/src/components/ui/aspect-ratio.tsx +0 -9
- package/src/components/ui/avatar.tsx +0 -94
- package/src/components/ui/badge.tsx +0 -45
- package/src/components/ui/breadcrumb.tsx +0 -104
- package/src/components/ui/button-group.tsx +0 -78
- package/src/components/ui/button.tsx +0 -65
- package/src/components/ui/calendar.tsx +0 -187
- package/src/components/ui/card.tsx +0 -85
- package/src/components/ui/carousel.tsx +0 -229
- package/src/components/ui/chart.tsx +0 -339
- package/src/components/ui/checkbox.tsx +0 -27
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/combobox.tsx +0 -275
- package/src/components/ui/command.tsx +0 -178
- package/src/components/ui/context-menu.tsx +0 -242
- package/src/components/ui/dialog.tsx +0 -146
- package/src/components/ui/direction.tsx +0 -20
- package/src/components/ui/drawer.tsx +0 -118
- package/src/components/ui/dropdown-menu.tsx +0 -247
- package/src/components/ui/empty.tsx +0 -94
- package/src/components/ui/field.tsx +0 -224
- package/src/components/ui/hover-card.tsx +0 -36
- package/src/components/ui/input-group.tsx +0 -142
- package/src/components/ui/input-otp.tsx +0 -86
- package/src/components/ui/input.tsx +0 -19
- package/src/components/ui/item.tsx +0 -182
- package/src/components/ui/kbd.tsx +0 -26
- package/src/components/ui/label.tsx +0 -19
- package/src/components/ui/menubar.tsx +0 -260
- package/src/components/ui/native-select.tsx +0 -55
- package/src/components/ui/navigation-menu.tsx +0 -160
- package/src/components/ui/pagination.tsx +0 -112
- package/src/components/ui/popover.tsx +0 -74
- package/src/components/ui/progress.tsx +0 -31
- package/src/components/ui/radio-group.tsx +0 -42
- package/src/components/ui/resizable.tsx +0 -42
- package/src/components/ui/scroll-area.tsx +0 -53
- package/src/components/ui/select.tsx +0 -185
- package/src/components/ui/separator.tsx +0 -26
- package/src/components/ui/sheet.tsx +0 -128
- package/src/components/ui/sidebar.tsx +0 -669
- package/src/components/ui/skeleton.tsx +0 -13
- package/src/components/ui/slider.tsx +0 -54
- package/src/components/ui/sonner.tsx +0 -43
- package/src/components/ui/spinner.tsx +0 -16
- package/src/components/ui/switch.tsx +0 -33
- package/src/components/ui/table.tsx +0 -87
- package/src/components/ui/tabs.tsx +0 -80
- package/src/components/ui/textarea.tsx +0 -18
- package/src/components/ui/toggle-group.tsx +0 -86
- package/src/components/ui/toggle.tsx +0 -44
- package/src/components/ui/tooltip.tsx +0 -53
- package/src/context/MetaContext.tsx +0 -22
- package/src/context/ModuleContext.tsx +0 -62
- package/src/context/PermissionsContext.tsx +0 -39
- package/src/context/ShellProviders.tsx +0 -33
- package/src/context/UserContext.tsx +0 -16
- package/src/data/QueryProvider.tsx +0 -7
- package/src/data/queryClient.ts +0 -18
- package/src/data/useModelMeta.ts +0 -17
- package/src/data/useMutation.ts +0 -60
- package/src/data/useRecord.ts +0 -29
- package/src/data/useSource.ts +0 -112
- package/src/hooks/use-mobile.ts +0 -19
- package/src/index.css +0 -260
- package/src/index.ts +0 -16
- package/src/lib/utils.ts +0 -6
- package/src/main.tsx +0 -17
- package/src/router/NotFound.tsx +0 -8
- package/src/router/RouterProvider.tsx +0 -7
- package/src/router/buildRouteTree.tsx +0 -63
- package/src/router/createShellRouter.ts +0 -9
- package/src/router/hooks.ts +0 -43
- package/src/shell/CommandPalette.tsx +0 -76
- package/src/shell/ConfirmDialog.tsx +0 -34
- package/src/shell/ConfirmProvider.tsx +0 -56
- package/src/shell/DrawerContext.tsx +0 -44
- package/src/shell/HeaderActions.tsx +0 -31
- package/src/shell/ModuleSelectorPage.tsx +0 -149
- package/src/shell/PageOutlet.tsx +0 -21
- package/src/shell/ShellContext.tsx +0 -45
- package/src/shell/ShellDevTools.tsx +0 -153
- package/src/shell/ShellLayout.tsx +0 -231
- package/src/shell/Toast.tsx +0 -58
- package/src/shell/ToastProvider.tsx +0 -60
- package/src/shell/app-sidebar/AppSidebar.tsx +0 -44
- package/src/shell/app-sidebar/ModuleSwitcher.tsx +0 -87
- package/src/shell/app-sidebar/NavMain.tsx +0 -64
- package/src/shell/app-sidebar/NavUser.tsx +0 -97
- package/src/shell/app-sidebar/SearchMenu.tsx +0 -22
- package/src/shell/app-sidebar/index.ts +0 -8
- package/src/shell/app-sidebar/types.ts +0 -38
- package/src/shell/types.ts +0 -6
- package/src/shell/useBreadcrumbs.ts +0 -42
- package/src/studio/bridge.ts +0 -125
- package/src/studio/index.ts +0 -3
- package/src/studio/overlay.ts +0 -47
- package/src/studio/types.ts +0 -32
- package/src/studio/walker.ts +0 -48
- package/src/vite-env.d.ts +0 -1
- package/src/widgets/__tests__/action-edge-cases.test.ts +0 -281
- package/src/widgets/__tests__/action.test.ts +0 -236
- package/src/widgets/__tests__/attachment-widget.test.tsx +0 -85
- package/src/widgets/__tests__/attachments-widget.test.tsx +0 -109
- package/src/widgets/__tests__/binding.test.ts +0 -76
- package/src/widgets/__tests__/button-widget.test.tsx +0 -145
- package/src/widgets/__tests__/checkbox-widget.test.tsx +0 -158
- package/src/widgets/__tests__/code-widget.test.tsx +0 -64
- package/src/widgets/__tests__/computed-widget.test.tsx +0 -62
- package/src/widgets/__tests__/condition-edge-cases.test.ts +0 -120
- package/src/widgets/__tests__/condition.test.ts +0 -221
- package/src/widgets/__tests__/context.test.ts +0 -99
- package/src/widgets/__tests__/data-widget.test.tsx +0 -204
- package/src/widgets/__tests__/datepicker-widget.test.tsx +0 -66
- package/src/widgets/__tests__/datetime-widget.test.tsx +0 -67
- package/src/widgets/__tests__/drawer-widget.test.tsx +0 -149
- package/src/widgets/__tests__/dynamic-link-widget.test.tsx +0 -52
- package/src/widgets/__tests__/edge-cases.test.ts +0 -232
- package/src/widgets/__tests__/evaluator.test.ts +0 -107
- package/src/widgets/__tests__/functions.test.ts +0 -147
- package/src/widgets/__tests__/grid-widget.test.tsx +0 -137
- package/src/widgets/__tests__/hooks.test.tsx +0 -249
- package/src/widgets/__tests__/icon-widget.test.tsx +0 -129
- package/src/widgets/__tests__/input-widget.test.tsx +0 -264
- package/src/widgets/__tests__/integration.test.ts +0 -116
- package/src/widgets/__tests__/json-widget.test.tsx +0 -70
- package/src/widgets/__tests__/link-widget.test.tsx +0 -92
- package/src/widgets/__tests__/many-to-many-widget.test.tsx +0 -93
- package/src/widgets/__tests__/modal-widget.test.tsx +0 -148
- package/src/widgets/__tests__/money-widget.test.tsx +0 -97
- package/src/widgets/__tests__/parser.test.ts +0 -171
- package/src/widgets/__tests__/reactive-variables.test.ts +0 -383
- package/src/widgets/__tests__/renderer.test.tsx +0 -300
- package/src/widgets/__tests__/repeat-widget.test.tsx +0 -229
- package/src/widgets/__tests__/select-widget.test.tsx +0 -231
- package/src/widgets/__tests__/sequence-widget.test.tsx +0 -58
- package/src/widgets/__tests__/shell-integration.test.tsx +0 -1343
- package/src/widgets/__tests__/split-widget.test.tsx +0 -133
- package/src/widgets/__tests__/state-edge-cases.test.ts +0 -118
- package/src/widgets/__tests__/state.test.ts +0 -106
- package/src/widgets/__tests__/table-data-binding.test.tsx +0 -482
- package/src/widgets/__tests__/table-filter-popover.test.tsx +0 -486
- package/src/widgets/__tests__/table-search.test.tsx +0 -305
- package/src/widgets/__tests__/table-widget.test.tsx +0 -509
- package/src/widgets/__tests__/textarea-widget.test.tsx +0 -105
- package/src/widgets/__tests__/tracker-validator-edge-cases.test.ts +0 -242
- package/src/widgets/__tests__/tracker.test.ts +0 -133
- package/src/widgets/__tests__/tree-widget.test.tsx +0 -97
- package/src/widgets/__tests__/use-model-source.test.ts +0 -67
- package/src/widgets/__tests__/validator.test.ts +0 -208
- package/src/widgets/action/dispatcher.ts +0 -334
- package/src/widgets/action/index.ts +0 -2
- package/src/widgets/binding/index.ts +0 -2
- package/src/widgets/binding/resolver.ts +0 -61
- package/src/widgets/components/AttachmentWidget.tsx +0 -111
- package/src/widgets/components/AttachmentsWidget.tsx +0 -121
- package/src/widgets/components/BadgeWidget.tsx +0 -35
- package/src/widgets/components/ButtonWidget.tsx +0 -43
- package/src/widgets/components/CardWidget.tsx +0 -68
- package/src/widgets/components/CheckboxWidget.tsx +0 -39
- package/src/widgets/components/CodeWidget.tsx +0 -44
- package/src/widgets/components/ColumnWidget.tsx +0 -22
- package/src/widgets/components/ComputedWidget.tsx +0 -49
- package/src/widgets/components/DataWidget.tsx +0 -189
- package/src/widgets/components/DatePickerWidget.tsx +0 -73
- package/src/widgets/components/DatetimeWidget.tsx +0 -160
- package/src/widgets/components/DividerWidget.tsx +0 -37
- package/src/widgets/components/DrawerWidget.tsx +0 -52
- package/src/widgets/components/DynamicLinkWidget.tsx +0 -130
- package/src/widgets/components/GridWidget.tsx +0 -134
- package/src/widgets/components/GroupWidget.tsx +0 -111
- package/src/widgets/components/IconWidget.tsx +0 -29
- package/src/widgets/components/ImageWidget.tsx +0 -28
- package/src/widgets/components/InputWidget.tsx +0 -70
- package/src/widgets/components/JsonWidget.tsx +0 -78
- package/src/widgets/components/LinkWidget.tsx +0 -99
- package/src/widgets/components/ManyToManyWidget.tsx +0 -125
- package/src/widgets/components/ModalWidget.tsx +0 -52
- package/src/widgets/components/MoneyWidget.tsx +0 -80
- package/src/widgets/components/RepeatWidget.tsx +0 -66
- package/src/widgets/components/ScrollAreaWidget.tsx +0 -40
- package/src/widgets/components/SectionWidget.tsx +0 -78
- package/src/widgets/components/SelectWidget.tsx +0 -63
- package/src/widgets/components/SequenceWidget.tsx +0 -32
- package/src/widgets/components/SpacerWidget.tsx +0 -29
- package/src/widgets/components/SplitWidget.tsx +0 -60
- package/src/widgets/components/StackWidget.tsx +0 -44
- package/src/widgets/components/TableWidget.tsx +0 -366
- package/src/widgets/components/TextWidget.tsx +0 -44
- package/src/widgets/components/TextareaWidget.tsx +0 -49
- package/src/widgets/components/TreeWidget.tsx +0 -109
- package/src/widgets/components/index.ts +0 -30
- package/src/widgets/components/register.ts +0 -93
- package/src/widgets/components/table/CellRenderers.tsx +0 -83
- package/src/widgets/components/table/TablePagination.tsx +0 -45
- package/src/widgets/components/table/TableToolbar.tsx +0 -285
- package/src/widgets/components/table/filter-operators.ts +0 -134
- package/src/widgets/components/table/index.ts +0 -11
- package/src/widgets/condition/evaluator.ts +0 -57
- package/src/widgets/condition/index.ts +0 -1
- package/src/widgets/context/builder.ts +0 -99
- package/src/widgets/context/index.ts +0 -8
- package/src/widgets/context/types.ts +0 -37
- package/src/widgets/data/index.ts +0 -5
- package/src/widgets/data/useModelQuery.ts +0 -116
- package/src/widgets/data/useModelRecord.ts +0 -37
- package/src/widgets/expression/evaluator.ts +0 -100
- package/src/widgets/expression/functions.ts +0 -131
- package/src/widgets/expression/index.ts +0 -13
- package/src/widgets/expression/parser.ts +0 -229
- package/src/widgets/expression/types.ts +0 -45
- package/src/widgets/form/FormContext.ts +0 -29
- package/src/widgets/form/FormProvider.tsx +0 -84
- package/src/widgets/form/FormWidget.tsx +0 -42
- package/src/widgets/form/index.ts +0 -4
- package/src/widgets/form/useFormState.ts +0 -127
- package/src/widgets/form/useFormSubmit.ts +0 -90
- package/src/widgets/form/useFormValidation.ts +0 -62
- package/src/widgets/hooks/index.ts +0 -8
- package/src/widgets/hooks/useAction.ts +0 -83
- package/src/widgets/hooks/useBind.ts +0 -34
- package/src/widgets/hooks/useCondition.ts +0 -21
- package/src/widgets/hooks/useDataQuery.ts +0 -48
- package/src/widgets/hooks/useExpression.ts +0 -14
- package/src/widgets/hooks/usePageState.ts +0 -21
- package/src/widgets/hooks/useSurfaceContext.ts +0 -11
- package/src/widgets/hooks/useWidgetContext.ts +0 -14
- package/src/widgets/index.ts +0 -80
- package/src/widgets/lib/layout-props.ts +0 -135
- package/src/widgets/reactivity/index.ts +0 -11
- package/src/widgets/reactivity/tracker.ts +0 -139
- package/src/widgets/reactivity/variables.ts +0 -213
- package/src/widgets/registry.ts +0 -41
- package/src/widgets/renderer/SlotRenderer.tsx +0 -47
- package/src/widgets/renderer/WidgetRenderer.tsx +0 -191
- package/src/widgets/renderer/index.ts +0 -4
- package/src/widgets/shell/WidgetSlotRenderer.tsx +0 -73
- package/src/widgets/shell/index.ts +0 -4
- package/src/widgets/shell/useActionHandlers.ts +0 -170
- package/src/widgets/state/index.ts +0 -2
- package/src/widgets/state/store.ts +0 -96
- package/src/widgets/types.ts +0 -28
- package/src/widgets/validation/index.ts +0 -2
- package/src/widgets/validation/validator.ts +0 -140
- package/tsconfig.json +0 -27
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.ts +0 -21
- package/vitest.config.ts +0 -16
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@/lib/utils';
|
|
7
|
-
|
|
8
|
-
function Slider({
|
|
9
|
-
className,
|
|
10
|
-
defaultValue,
|
|
11
|
-
value,
|
|
12
|
-
min = 0,
|
|
13
|
-
max = 100,
|
|
14
|
-
...props
|
|
15
|
-
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
|
16
|
-
const _values = React.useMemo(
|
|
17
|
-
() => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]),
|
|
18
|
-
[value, defaultValue, min, max],
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<SliderPrimitive.Root
|
|
23
|
-
data-slot="slider"
|
|
24
|
-
defaultValue={defaultValue}
|
|
25
|
-
value={value}
|
|
26
|
-
min={min}
|
|
27
|
-
max={max}
|
|
28
|
-
className={cn(
|
|
29
|
-
'relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col',
|
|
30
|
-
className,
|
|
31
|
-
)}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
<SliderPrimitive.Track
|
|
35
|
-
data-slot="slider-track"
|
|
36
|
-
className="relative grow overflow-hidden rounded-none bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
|
|
37
|
-
>
|
|
38
|
-
<SliderPrimitive.Range
|
|
39
|
-
data-slot="slider-range"
|
|
40
|
-
className="absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
41
|
-
/>
|
|
42
|
-
</SliderPrimitive.Track>
|
|
43
|
-
{Array.from({ length: _values.length }, (_, index) => (
|
|
44
|
-
<SliderPrimitive.Thumb
|
|
45
|
-
data-slot="slider-thumb"
|
|
46
|
-
key={index}
|
|
47
|
-
className="relative block size-3 shrink-0 rounded-none border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-1 focus-visible:ring-1 focus-visible:outline-hidden active:ring-1 disabled:pointer-events-none disabled:opacity-50"
|
|
48
|
-
/>
|
|
49
|
-
))}
|
|
50
|
-
</SliderPrimitive.Root>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { Slider };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useTheme } from 'next-themes';
|
|
2
|
-
import { Toaster as Sonner, type ToasterProps } from 'sonner';
|
|
3
|
-
import {
|
|
4
|
-
CircleCheckIcon,
|
|
5
|
-
InfoIcon,
|
|
6
|
-
TriangleAlertIcon,
|
|
7
|
-
OctagonXIcon,
|
|
8
|
-
Loader2Icon,
|
|
9
|
-
} from 'lucide-react';
|
|
10
|
-
|
|
11
|
-
const Toaster = ({ ...props }: ToasterProps) => {
|
|
12
|
-
const { theme = 'system' } = useTheme();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Sonner
|
|
16
|
-
theme={theme as ToasterProps['theme']}
|
|
17
|
-
className="toaster group"
|
|
18
|
-
icons={{
|
|
19
|
-
success: <CircleCheckIcon className="size-4" />,
|
|
20
|
-
info: <InfoIcon className="size-4" />,
|
|
21
|
-
warning: <TriangleAlertIcon className="size-4" />,
|
|
22
|
-
error: <OctagonXIcon className="size-4" />,
|
|
23
|
-
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
24
|
-
}}
|
|
25
|
-
style={
|
|
26
|
-
{
|
|
27
|
-
'--normal-bg': 'var(--popover)',
|
|
28
|
-
'--normal-text': 'var(--popover-foreground)',
|
|
29
|
-
'--normal-border': 'var(--border)',
|
|
30
|
-
'--border-radius': 'var(--radius)',
|
|
31
|
-
} as React.CSSProperties
|
|
32
|
-
}
|
|
33
|
-
toastOptions={{
|
|
34
|
-
classNames: {
|
|
35
|
-
toast: 'cn-toast',
|
|
36
|
-
},
|
|
37
|
-
}}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export { Toaster };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/lib/utils';
|
|
2
|
-
import { Loader2Icon } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
function Spinner({ className, ...props }: React.ComponentProps<'svg'>) {
|
|
5
|
-
return (
|
|
6
|
-
<Loader2Icon
|
|
7
|
-
data-slot="spinner"
|
|
8
|
-
role="status"
|
|
9
|
-
aria-label="Loading"
|
|
10
|
-
className={cn('size-4 animate-spin', className)}
|
|
11
|
-
{...props}
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { Spinner };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Switch as SwitchPrimitive } from 'radix-ui';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@/lib/utils';
|
|
7
|
-
|
|
8
|
-
function Switch({
|
|
9
|
-
className,
|
|
10
|
-
size = 'default',
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
13
|
-
size?: 'sm' | 'default';
|
|
14
|
-
}) {
|
|
15
|
-
return (
|
|
16
|
-
<SwitchPrimitive.Root
|
|
17
|
-
data-slot="switch"
|
|
18
|
-
data-size={size}
|
|
19
|
-
className={cn(
|
|
20
|
-
'peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50',
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
<SwitchPrimitive.Thumb
|
|
26
|
-
data-slot="switch-thumb"
|
|
27
|
-
className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
|
|
28
|
-
/>
|
|
29
|
-
</SwitchPrimitive.Root>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { Switch };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
function Table({ className, ...props }: React.ComponentProps<'table'>) {
|
|
6
|
-
return (
|
|
7
|
-
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
|
8
|
-
<table
|
|
9
|
-
data-slot="table"
|
|
10
|
-
className={cn('w-full caption-bottom text-xs', className)}
|
|
11
|
-
{...props}
|
|
12
|
-
/>
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
|
18
|
-
return <thead data-slot="table-header" className={cn('[&_tr]:border-b', className)} {...props} />;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
|
|
22
|
-
return (
|
|
23
|
-
<tbody
|
|
24
|
-
data-slot="table-body"
|
|
25
|
-
className={cn('[&_tr:last-child]:border-0', className)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
|
32
|
-
return (
|
|
33
|
-
<tfoot
|
|
34
|
-
data-slot="table-footer"
|
|
35
|
-
className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
|
42
|
-
return (
|
|
43
|
-
<tr
|
|
44
|
-
data-slot="table-row"
|
|
45
|
-
className={cn(
|
|
46
|
-
'border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted',
|
|
47
|
-
className,
|
|
48
|
-
)}
|
|
49
|
-
{...props}
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
|
|
55
|
-
return (
|
|
56
|
-
<th
|
|
57
|
-
data-slot="table-head"
|
|
58
|
-
className={cn(
|
|
59
|
-
'h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0',
|
|
60
|
-
className,
|
|
61
|
-
)}
|
|
62
|
-
{...props}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
|
68
|
-
return (
|
|
69
|
-
<td
|
|
70
|
-
data-slot="table-cell"
|
|
71
|
-
className={cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)}
|
|
72
|
-
{...props}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
|
|
78
|
-
return (
|
|
79
|
-
<caption
|
|
80
|
-
data-slot="table-caption"
|
|
81
|
-
className={cn('mt-4 text-xs text-muted-foreground', className)}
|
|
82
|
-
{...props}
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
|
-
import { Tabs as TabsPrimitive } from 'radix-ui';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
|
|
9
|
-
function Tabs({
|
|
10
|
-
className,
|
|
11
|
-
orientation = 'horizontal',
|
|
12
|
-
...props
|
|
13
|
-
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
|
14
|
-
return (
|
|
15
|
-
<TabsPrimitive.Root
|
|
16
|
-
data-slot="tabs"
|
|
17
|
-
data-orientation={orientation}
|
|
18
|
-
className={cn('group/tabs flex gap-2 data-horizontal:flex-col', className)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const tabsListVariants = cva(
|
|
25
|
-
'group/tabs-list inline-flex w-fit items-center justify-center rounded-none p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none',
|
|
26
|
-
{
|
|
27
|
-
variants: {
|
|
28
|
-
variant: {
|
|
29
|
-
default: 'bg-muted',
|
|
30
|
-
line: 'gap-1 bg-transparent',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
defaultVariants: {
|
|
34
|
-
variant: 'default',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
function TabsList({
|
|
40
|
-
className,
|
|
41
|
-
variant = 'default',
|
|
42
|
-
...props
|
|
43
|
-
}: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>) {
|
|
44
|
-
return (
|
|
45
|
-
<TabsPrimitive.List
|
|
46
|
-
data-slot="tabs-list"
|
|
47
|
-
data-variant={variant}
|
|
48
|
-
className={cn(tabsListVariants({ variant }), className)}
|
|
49
|
-
{...props}
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
55
|
-
return (
|
|
56
|
-
<TabsPrimitive.Trigger
|
|
57
|
-
data-slot="tabs-trigger"
|
|
58
|
-
className={cn(
|
|
59
|
-
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-none border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
60
|
-
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
|
|
61
|
-
'data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground',
|
|
62
|
-
'after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100',
|
|
63
|
-
className,
|
|
64
|
-
)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
71
|
-
return (
|
|
72
|
-
<TabsPrimitive.Content
|
|
73
|
-
data-slot="tabs-content"
|
|
74
|
-
className={cn('flex-1 text-xs/relaxed outline-none', className)}
|
|
75
|
-
{...props}
|
|
76
|
-
/>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
|
6
|
-
return (
|
|
7
|
-
<textarea
|
|
8
|
-
data-slot="textarea"
|
|
9
|
-
className={cn(
|
|
10
|
-
'flex field-sizing-content min-h-16 w-full rounded-none border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
|
|
11
|
-
className,
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { Textarea };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
5
|
-
import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
import { toggleVariants } from '@/components/ui/toggle';
|
|
9
|
-
|
|
10
|
-
const ToggleGroupContext = React.createContext<
|
|
11
|
-
VariantProps<typeof toggleVariants> & {
|
|
12
|
-
spacing?: number;
|
|
13
|
-
orientation?: 'horizontal' | 'vertical';
|
|
14
|
-
}
|
|
15
|
-
>({
|
|
16
|
-
size: 'default',
|
|
17
|
-
variant: 'default',
|
|
18
|
-
spacing: 2,
|
|
19
|
-
orientation: 'horizontal',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function ToggleGroup({
|
|
23
|
-
className,
|
|
24
|
-
variant,
|
|
25
|
-
size,
|
|
26
|
-
spacing = 2,
|
|
27
|
-
orientation = 'horizontal',
|
|
28
|
-
children,
|
|
29
|
-
...props
|
|
30
|
-
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
31
|
-
VariantProps<typeof toggleVariants> & {
|
|
32
|
-
spacing?: number;
|
|
33
|
-
orientation?: 'horizontal' | 'vertical';
|
|
34
|
-
}) {
|
|
35
|
-
return (
|
|
36
|
-
<ToggleGroupPrimitive.Root
|
|
37
|
-
data-slot="toggle-group"
|
|
38
|
-
data-variant={variant}
|
|
39
|
-
data-size={size}
|
|
40
|
-
data-spacing={spacing}
|
|
41
|
-
data-orientation={orientation}
|
|
42
|
-
style={{ '--gap': spacing } as React.CSSProperties}
|
|
43
|
-
className={cn(
|
|
44
|
-
'group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-none data-[size=sm]:rounded-none data-vertical:flex-col data-vertical:items-stretch',
|
|
45
|
-
className,
|
|
46
|
-
)}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
<ToggleGroupContext.Provider value={{ variant, size, spacing, orientation }}>
|
|
50
|
-
{children}
|
|
51
|
-
</ToggleGroupContext.Provider>
|
|
52
|
-
</ToggleGroupPrimitive.Root>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function ToggleGroupItem({
|
|
57
|
-
className,
|
|
58
|
-
children,
|
|
59
|
-
variant = 'default',
|
|
60
|
-
size = 'default',
|
|
61
|
-
...props
|
|
62
|
-
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>) {
|
|
63
|
-
const context = React.useContext(ToggleGroupContext);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<ToggleGroupPrimitive.Item
|
|
67
|
-
data-slot="toggle-group-item"
|
|
68
|
-
data-variant={context.variant || variant}
|
|
69
|
-
data-size={context.size || size}
|
|
70
|
-
data-spacing={context.spacing}
|
|
71
|
-
className={cn(
|
|
72
|
-
'shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-none group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-none group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-none group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-none group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t',
|
|
73
|
-
toggleVariants({
|
|
74
|
-
variant: context.variant || variant,
|
|
75
|
-
size: context.size || size,
|
|
76
|
-
}),
|
|
77
|
-
className,
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
>
|
|
81
|
-
{children}
|
|
82
|
-
</ToggleGroupPrimitive.Item>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { Toggle as TogglePrimitive } from 'radix-ui';
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils';
|
|
6
|
-
|
|
7
|
-
const toggleVariants = cva(
|
|
8
|
-
"group/toggle inline-flex items-center justify-center gap-1 rounded-none text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: 'bg-transparent',
|
|
13
|
-
outline: 'border border-input bg-transparent hover:bg-muted',
|
|
14
|
-
},
|
|
15
|
-
size: {
|
|
16
|
-
default:
|
|
17
|
-
'h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
18
|
-
sm: 'h-7 min-w-7 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5',
|
|
19
|
-
lg: 'h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
variant: 'default',
|
|
24
|
-
size: 'default',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
function Toggle({
|
|
30
|
-
className,
|
|
31
|
-
variant = 'default',
|
|
32
|
-
size = 'default',
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>) {
|
|
35
|
-
return (
|
|
36
|
-
<TogglePrimitive.Root
|
|
37
|
-
data-slot="toggle"
|
|
38
|
-
className={cn(toggleVariants({ variant, size, className }))}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { Toggle, toggleVariants };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Tooltip as TooltipPrimitive } from 'radix-ui';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@/lib/utils';
|
|
7
|
-
|
|
8
|
-
function TooltipProvider({
|
|
9
|
-
delayDuration = 0,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
12
|
-
return (
|
|
13
|
-
<TooltipPrimitive.Provider
|
|
14
|
-
data-slot="tooltip-provider"
|
|
15
|
-
delayDuration={delayDuration}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
22
|
-
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
26
|
-
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function TooltipContent({
|
|
30
|
-
className,
|
|
31
|
-
sideOffset = 0,
|
|
32
|
-
children,
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
35
|
-
return (
|
|
36
|
-
<TooltipPrimitive.Portal>
|
|
37
|
-
<TooltipPrimitive.Content
|
|
38
|
-
data-slot="tooltip-content"
|
|
39
|
-
sideOffset={sideOffset}
|
|
40
|
-
className={cn(
|
|
41
|
-
'z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-none bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-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=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-none data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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',
|
|
42
|
-
className,
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
>
|
|
46
|
-
{children}
|
|
47
|
-
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-none bg-foreground fill-foreground" />
|
|
48
|
-
</TooltipPrimitive.Content>
|
|
49
|
-
</TooltipPrimitive.Portal>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, type ReactNode } from 'react';
|
|
2
|
-
import type { NavigationTree, PageDefinition, ModelMeta } from '@rangka/shared';
|
|
3
|
-
|
|
4
|
-
export interface MetaData {
|
|
5
|
-
navigation: NavigationTree[];
|
|
6
|
-
pages: PageDefinition[];
|
|
7
|
-
models: Record<string, ModelMeta>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const MetaContext = createContext<MetaData | null>(null);
|
|
11
|
-
|
|
12
|
-
export function MetaProvider({ meta, children }: { meta: MetaData; children: ReactNode }) {
|
|
13
|
-
return <MetaContext.Provider value={meta}>{children}</MetaContext.Provider>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function useMeta(): MetaData {
|
|
17
|
-
const ctx = useContext(MetaContext);
|
|
18
|
-
if (!ctx) {
|
|
19
|
-
throw new Error('useMeta must be used within a MetaProvider');
|
|
20
|
-
}
|
|
21
|
-
return ctx;
|
|
22
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, useState, useCallback, useEffect, type ReactNode } from 'react';
|
|
2
|
-
import type { NavigationTree } from '@rangka/shared';
|
|
3
|
-
|
|
4
|
-
const STORAGE_KEY = 'rangka:active-module';
|
|
5
|
-
|
|
6
|
-
interface ModuleContextValue {
|
|
7
|
-
activeModule: string | null;
|
|
8
|
-
setActiveModule: (name: string) => void;
|
|
9
|
-
clearActiveModule: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const ModuleContext = createContext<ModuleContextValue | null>(null);
|
|
13
|
-
|
|
14
|
-
export function ModuleProvider({
|
|
15
|
-
navigation,
|
|
16
|
-
children,
|
|
17
|
-
}: {
|
|
18
|
-
navigation: NavigationTree[];
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
}) {
|
|
21
|
-
const [activeModule, setActiveModuleState] = useState<string | null>(() => {
|
|
22
|
-
const pathModule = window.location.pathname.split('/').filter(Boolean)[0];
|
|
23
|
-
if (pathModule && navigation.some((n) => n.module === pathModule)) {
|
|
24
|
-
return pathModule;
|
|
25
|
-
}
|
|
26
|
-
const stored = localStorage.getItem(STORAGE_KEY);
|
|
27
|
-
if (stored && navigation.some((n) => n.module === stored)) {
|
|
28
|
-
return stored;
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (activeModule) {
|
|
35
|
-
localStorage.setItem(STORAGE_KEY, activeModule);
|
|
36
|
-
} else {
|
|
37
|
-
localStorage.removeItem(STORAGE_KEY);
|
|
38
|
-
}
|
|
39
|
-
}, [activeModule]);
|
|
40
|
-
|
|
41
|
-
const setActiveModule = useCallback((name: string) => {
|
|
42
|
-
setActiveModuleState(name);
|
|
43
|
-
}, []);
|
|
44
|
-
|
|
45
|
-
const clearActiveModule = useCallback(() => {
|
|
46
|
-
setActiveModuleState(null);
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<ModuleContext.Provider value={{ activeModule, setActiveModule, clearActiveModule }}>
|
|
51
|
-
{children}
|
|
52
|
-
</ModuleContext.Provider>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function useModule(): ModuleContextValue {
|
|
57
|
-
const ctx = useContext(ModuleContext);
|
|
58
|
-
if (!ctx) {
|
|
59
|
-
throw new Error('useModule must be used within a ModuleProvider');
|
|
60
|
-
}
|
|
61
|
-
return ctx;
|
|
62
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo, type ReactNode } from 'react';
|
|
2
|
-
import type { BootPermissions } from '@rangka/shared';
|
|
3
|
-
|
|
4
|
-
export interface PermissionsApi {
|
|
5
|
-
canRead: (model: string) => boolean;
|
|
6
|
-
canCreate: (model: string) => boolean;
|
|
7
|
-
canAccessPage: (pageKey: string) => boolean;
|
|
8
|
-
raw: BootPermissions;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const PermissionsContext = createContext<PermissionsApi | null>(null);
|
|
12
|
-
|
|
13
|
-
export function PermissionsProvider({
|
|
14
|
-
permissions,
|
|
15
|
-
children,
|
|
16
|
-
}: {
|
|
17
|
-
permissions: BootPermissions;
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
}) {
|
|
20
|
-
const api = useMemo<PermissionsApi>(
|
|
21
|
-
() => ({
|
|
22
|
-
canRead: (model: string) => !!permissions.models[model]?.read,
|
|
23
|
-
canCreate: (model: string) => !!permissions.models[model]?.create,
|
|
24
|
-
canAccessPage: (pageKey: string) => permissions.pages.includes(pageKey),
|
|
25
|
-
raw: permissions,
|
|
26
|
-
}),
|
|
27
|
-
[permissions],
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return <PermissionsContext.Provider value={api}>{children}</PermissionsContext.Provider>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function usePermissions(): PermissionsApi {
|
|
34
|
-
const ctx = useContext(PermissionsContext);
|
|
35
|
-
if (!ctx) {
|
|
36
|
-
throw new Error('usePermissions must be used within a PermissionsProvider');
|
|
37
|
-
}
|
|
38
|
-
return ctx;
|
|
39
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { BootResponse } from '@rangka/shared';
|
|
3
|
-
import { TooltipProvider } from '@/components/ui/tooltip';
|
|
4
|
-
import { UserProvider } from './UserContext.js';
|
|
5
|
-
import { PermissionsProvider } from './PermissionsContext.js';
|
|
6
|
-
import { MetaProvider } from './MetaContext.js';
|
|
7
|
-
import { ModuleProvider } from './ModuleContext.js';
|
|
8
|
-
import { ToastProvider } from '../shell/ToastProvider.js';
|
|
9
|
-
import { ConfirmProvider } from '../shell/ConfirmProvider.js';
|
|
10
|
-
|
|
11
|
-
export function ShellProviders({ data, children }: { data: BootResponse; children: ReactNode }) {
|
|
12
|
-
return (
|
|
13
|
-
<TooltipProvider>
|
|
14
|
-
<UserProvider user={data.user}>
|
|
15
|
-
<PermissionsProvider permissions={data.permissions}>
|
|
16
|
-
<MetaProvider
|
|
17
|
-
meta={{
|
|
18
|
-
navigation: data.navigation,
|
|
19
|
-
pages: data.pages,
|
|
20
|
-
models: data.models,
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<ModuleProvider navigation={data.navigation}>
|
|
24
|
-
<ToastProvider>
|
|
25
|
-
<ConfirmProvider>{children}</ConfirmProvider>
|
|
26
|
-
</ToastProvider>
|
|
27
|
-
</ModuleProvider>
|
|
28
|
-
</MetaProvider>
|
|
29
|
-
</PermissionsProvider>
|
|
30
|
-
</UserProvider>
|
|
31
|
-
</TooltipProvider>
|
|
32
|
-
);
|
|
33
|
-
}
|