@rebasepro/core 0.6.0 → 0.6.1

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/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, lazy, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
2
- import { Alert, AlertTriangleIcon, ArrowLeftIcon, Avatar, BooleanSwitch, Button, CHIP_COLORS, CenteredView, CheckIcon, Checkbox, ChevronDownIcon, ChevronsLeftIcon, ChevronsRightIcon, Chip, CircleUserIcon, CircularProgress, Container, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, FolderIcon, IconButton, LanguagesIcon, LoadingButton, LogOutIcon, MailIcon, Menu, MenuItem, MoonIcon, MultiSelect, MultiSelectItem, Paper, PencilIcon, PlusIcon, Popover, SearchBar, Select, SelectItem, Separator, SettingsIcon, Skeleton, SunIcon, SunMoonIcon, Tab, Table, TableBody, TableCell, TableHeader, TableRow, Tabs, TagIcon, TextField, Tooltip, Trash2Icon, Typography, UserIcon, Wand2Icon, cls, colorClassesMapping, coolIconKeys, defaultBorderMixin, getColorSchemeForSeed, iconKeys, iconSize, lucideIcons } from "@rebasepro/ui";
2
+ import { Alert, AlertCircleIcon, AlertTriangleIcon, AppWindow, ArrowLeftIcon, Avatar, BooleanSwitch, Button, CHIP_COLORS, CenteredView, CheckIcon, Checkbox, ChevronDownIcon, ChevronsLeftIcon, ChevronsRightIcon, Chip, CircleUserIcon, CircularProgress, ColumnsIcon, Container, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, FileIcon, FileTextIcon, FilterChip, FilterIcon, FolderIcon, IconButton, LanguagesIcon, ListIcon, LoadingButton, LogOutIcon, MailIcon, Menu, MenuItem, MoonIcon, MultiSelect, MultiSelectItem, PanelLeftIcon, Paper, PencilIcon, PlusIcon, Popover, SearchBar, Select, SelectItem, Separator, SettingsIcon, Skeleton, SunIcon, SunMoonIcon, Tab, Table, TableBody, TableCell, TableHeader, TableRow, Tabs, TagIcon, TextField, Tooltip, Trash2Icon, TypeIcon, Typography, UserIcon, Wand2Icon, cls, colorClassesMapping, coolIconKeys, defaultBorderMixin, getColorSchemeForSeed, iconKeys, iconSize, lucideIcons } from "@rebasepro/ui";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
5
5
  import { EntityReference, EntityRelation, GeoPoint, Vector, isLazyComponentRef } from "@rebasepro/types";
@@ -2932,70 +2932,79 @@ var UIStyleGuide = () => {
2932
2932
  var SECTIONS = [
2933
2933
  {
2934
2934
  id: "drawer",
2935
- label: "Drawer"
2935
+ label: "Drawer",
2936
+ icon: PanelLeftIcon
2936
2937
  },
2937
2938
  {
2938
2939
  id: "appbar",
2939
- label: "App Bar"
2940
+ label: "App Bar",
2941
+ icon: AppWindow
2940
2942
  },
2941
2943
  {
2942
2944
  id: "tabs",
2943
- label: "Tabs"
2945
+ label: "Tabs",
2946
+ icon: ListIcon
2944
2947
  },
2945
2948
  {
2946
2949
  id: "editor-sidebar",
2947
- label: "Editor Sidebar"
2950
+ label: "Editor Sidebar",
2951
+ icon: ColumnsIcon
2948
2952
  },
2949
2953
  {
2950
2954
  id: "empty-states",
2951
- label: "Empty States"
2955
+ label: "Empty States",
2956
+ icon: FileIcon
2952
2957
  },
2953
2958
  {
2954
2959
  id: "typography",
2955
- label: "Typography"
2960
+ label: "Typography",
2961
+ icon: TypeIcon
2956
2962
  },
2957
2963
  {
2958
2964
  id: "buttons",
2959
- label: "Buttons"
2965
+ label: "Buttons",
2966
+ icon: PlusIcon
2960
2967
  },
2961
2968
  {
2962
2969
  id: "inputs",
2963
- label: "Form Inputs"
2970
+ label: "Form Inputs",
2971
+ icon: FileTextIcon
2964
2972
  },
2965
2973
  {
2966
2974
  id: "chips-alerts",
2967
- label: "Chips & Alerts"
2975
+ label: "Chips & Alerts",
2976
+ icon: AlertCircleIcon
2968
2977
  },
2969
2978
  {
2970
2979
  id: "users",
2971
- label: "Users View"
2980
+ label: "Users View",
2981
+ icon: UserIcon
2972
2982
  },
2973
2983
  {
2974
2984
  id: "user-dialog",
2975
- label: "User Dialog"
2976
- },
2977
- {
2978
- id: "roles",
2979
- label: "Roles View"
2980
- },
2981
- {
2982
- id: "role-dialog",
2983
- label: "Role Dialog"
2985
+ label: "User Dialog",
2986
+ icon: CircleUserIcon
2984
2987
  }
2985
2988
  ];
2986
2989
  function UIReferenceView() {
2987
2990
  const [activeSection, setActiveSection] = useState("drawer");
2991
+ const scrollContainerRef = React.useRef(null);
2988
2992
  const scrollTo = (id) => {
2989
- document.getElementById(id)?.scrollIntoView({
2990
- behavior: "smooth",
2991
- block: "start"
2992
- });
2993
+ const el = document.getElementById(id);
2994
+ const container = scrollContainerRef.current;
2995
+ if (el && container) {
2996
+ const offsetTop = el.offsetTop - container.offsetTop;
2997
+ container.scrollTo({
2998
+ top: offsetTop,
2999
+ behavior: "smooth"
3000
+ });
3001
+ }
2993
3002
  setActiveSection(id);
2994
3003
  };
2995
3004
  return /* @__PURE__ */ jsxs("div", {
2996
- className: "flex h-full w-full overflow-hidden",
3005
+ className: "flex w-full",
2997
3006
  children: [/* @__PURE__ */ jsxs("div", {
2998
- className: cls("flex flex-col h-full relative grow-0 shrink-0 w-[200px] border-r", defaultBorderMixin),
3007
+ className: cls("flex flex-col sticky top-0 h-screen grow-0 shrink-0 w-[200px] border-r", defaultBorderMixin),
2999
3008
  children: [
3000
3009
  /* @__PURE__ */ jsxs("div", {
3001
3010
  className: "flex flex-row items-center shrink-0 pt-4 pb-2 px-2",
@@ -3029,17 +3038,20 @@ function UIReferenceView() {
3029
3038
  })]
3030
3039
  }), /* @__PURE__ */ jsx("div", {
3031
3040
  className: "overflow-hidden bg-surface-50 dark:bg-surface-950/30 rounded-b-lg",
3032
- children: SECTIONS.map((s) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
3033
- onClick: () => scrollTo(s.id),
3034
- className: cls("rounded-lg truncate", "hover:bg-surface-accent-300/75 dark:hover:bg-surface-accent-800/75 text-text-primary dark:text-surface-200 hover:text-surface-900 dark:hover:text-white", "flex flex-row items-center", "pr-4 h-10", "font-semibold text-xs cursor-pointer", activeSection === s.id ? "bg-surface-accent-200/60 dark:bg-surface-950 dark:bg-opacity-50" : ""),
3035
- children: [/* @__PURE__ */ jsx("div", {
3036
- className: "shrink-0 flex items-center justify-center w-[56px] h-[40px] text-text-secondary dark:text-text-secondary-dark",
3037
- children: /* @__PURE__ */ jsx(SettingsIcon, { size: iconSize.small })
3038
- }), /* @__PURE__ */ jsx("div", {
3039
- className: "text-text-primary dark:text-surface-200 opacity-100 font-inherit truncate space-x-2",
3040
- children: s.label.toUpperCase()
3041
- })]
3042
- }) }, s.id))
3041
+ children: SECTIONS.map((s) => {
3042
+ const IconComponent = s.icon;
3043
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
3044
+ onClick: () => scrollTo(s.id),
3045
+ className: cls("rounded-lg truncate group/nav", "hover:bg-primary/5 dark:hover:bg-primary/5 text-text-primary dark:text-surface-200 hover:text-surface-900 dark:hover:text-white", "flex flex-row items-center", "pr-4 h-10", "font-medium text-xs cursor-pointer", activeSection === s.id ? "bg-primary/8 dark:bg-primary/10 text-primary dark:text-primary" : ""),
3046
+ children: [/* @__PURE__ */ jsx("div", {
3047
+ className: cls("shrink-0 flex items-center justify-center w-[56px] h-[40px] text-surface-500 dark:text-text-secondary-dark transition-colors duration-150 group-hover/nav:text-primary", activeSection === s.id && "text-primary dark:text-primary"),
3048
+ children: /* @__PURE__ */ jsx(IconComponent, { size: iconSize.small })
3049
+ }), /* @__PURE__ */ jsx("div", {
3050
+ className: "text-text-primary dark:text-surface-200 opacity-100 font-inherit truncate space-x-2",
3051
+ children: s.label.toUpperCase()
3052
+ })]
3053
+ }) }, s.id);
3054
+ })
3043
3055
  })]
3044
3056
  })
3045
3057
  }),
@@ -3059,7 +3071,8 @@ function UIReferenceView() {
3059
3071
  })
3060
3072
  ]
3061
3073
  }), /* @__PURE__ */ jsxs("div", {
3062
- className: "flex-1 overflow-y-auto",
3074
+ ref: scrollContainerRef,
3075
+ className: "flex-1",
3063
3076
  children: [
3064
3077
  /* @__PURE__ */ jsxs(SectionBlock, {
3065
3078
  id: "drawer",
@@ -3094,7 +3107,7 @@ function UIReferenceView() {
3094
3107
  className: "block mb-1",
3095
3108
  children: "Collapsed (72px)"
3096
3109
  }), /* @__PURE__ */ jsxs("div", {
3097
- className: cls("flex flex-col h-72 relative w-[72px] border rounded-lg overflow-hidden", defaultBorderMixin),
3110
+ className: cls("flex flex-col h-72 relative w-[72px] border rounded-lg overflow-hidden bg-white dark:bg-surface-900", defaultBorderMixin),
3098
3111
  children: [
3099
3112
  /* @__PURE__ */ jsx("div", {
3100
3113
  className: "flex flex-row items-center shrink-0 pt-4 pb-2 px-2",
@@ -3117,7 +3130,7 @@ function UIReferenceView() {
3117
3130
  /* @__PURE__ */ jsx(UserIcon, { size: iconSize.small }, "user"),
3118
3131
  /* @__PURE__ */ jsx(TagIcon, { size: iconSize.small }, "tag")
3119
3132
  ].map((icon, i) => /* @__PURE__ */ jsx("div", {
3120
- className: "rounded-lg truncate hover:bg-surface-accent-300/75 dark:hover:bg-surface-accent-800/75 flex flex-row items-center h-10",
3133
+ className: "rounded-lg truncate hover:bg-primary/5 dark:hover:bg-primary/5 flex flex-row items-center h-10",
3121
3134
  children: /* @__PURE__ */ jsx("div", {
3122
3135
  className: "shrink-0 flex items-center justify-center w-[56px] h-[40px] text-text-secondary dark:text-text-secondary-dark",
3123
3136
  children: icon
@@ -3143,7 +3156,7 @@ function UIReferenceView() {
3143
3156
  className: "block mb-1",
3144
3157
  children: "Expanded (280px)"
3145
3158
  }), /* @__PURE__ */ jsxs("div", {
3146
- className: cls("flex flex-col h-72 relative w-[280px] border rounded-lg overflow-hidden", defaultBorderMixin),
3159
+ className: cls("flex flex-col h-72 relative w-[280px] border rounded-lg overflow-hidden bg-white dark:bg-surface-900", defaultBorderMixin),
3147
3160
  children: [
3148
3161
  /* @__PURE__ */ jsxs("div", {
3149
3162
  className: "flex flex-row items-center shrink-0 pt-4 pb-2 px-2",
@@ -3197,9 +3210,9 @@ function UIReferenceView() {
3197
3210
  active: false
3198
3211
  }
3199
3212
  ].map(({ label, icon, active }) => /* @__PURE__ */ jsxs("div", {
3200
- className: cls("rounded-lg truncate hover:bg-surface-accent-300/75 dark:hover:bg-surface-accent-800/75 text-text-primary dark:text-surface-200 hover:text-surface-900 dark:hover:text-white flex flex-row items-center pr-4 h-10 font-semibold text-xs cursor-pointer", active ? "bg-surface-accent-200/60 dark:bg-surface-950 dark:bg-opacity-50" : ""),
3213
+ className: cls("rounded-lg truncate hover:bg-primary/5 dark:hover:bg-primary/5 text-text-primary dark:text-surface-200 hover:text-surface-900 dark:hover:text-white flex flex-row items-center pr-4 h-10 font-medium text-xs cursor-pointer", active ? "bg-primary/8 dark:bg-primary/10 text-primary dark:text-primary" : ""),
3201
3214
  children: [/* @__PURE__ */ jsx("div", {
3202
- className: "shrink-0 flex items-center justify-center w-[56px] h-[40px] text-text-secondary dark:text-text-secondary-dark",
3215
+ className: cls("shrink-0 flex items-center justify-center w-[56px] h-[40px] transition-colors duration-150", active ? "text-primary dark:text-primary" : "text-surface-500 dark:text-text-secondary-dark"),
3203
3216
  children: icon
3204
3217
  }), /* @__PURE__ */ jsx("div", {
3205
3218
  className: "text-text-primary dark:text-surface-200 font-inherit truncate",
@@ -3950,29 +3963,70 @@ function UIReferenceView() {
3950
3963
  variant: "caption",
3951
3964
  color: "secondary",
3952
3965
  className: "block mb-2 font-mono",
3953
- children: "IconButton"
3966
+ children: "IconButton — sizes"
3954
3967
  }), /* @__PURE__ */ jsxs("div", {
3955
3968
  className: "flex flex-wrap gap-3 items-center",
3956
3969
  children: [
3957
3970
  [
3958
- "primary",
3959
- "secondary",
3960
- "inherit"
3961
- ].map((c) => /* @__PURE__ */ jsx(IconButton, {
3962
- color: c,
3963
- children: /* @__PURE__ */ jsx(PencilIcon, {})
3964
- }, c)),
3965
- [
3966
- "small",
3967
- "medium",
3968
- "large"
3969
- ].map((s) => /* @__PURE__ */ jsx(IconButton, {
3970
- size: s,
3971
- children: /* @__PURE__ */ jsx(Trash2Icon, {})
3971
+ {
3972
+ s: "smallest",
3973
+ icon: /* @__PURE__ */ jsx(PencilIcon, { size: 14 })
3974
+ },
3975
+ {
3976
+ s: "small",
3977
+ icon: /* @__PURE__ */ jsx(PencilIcon, { size: 16 })
3978
+ },
3979
+ {
3980
+ s: "medium",
3981
+ icon: /* @__PURE__ */ jsx(PencilIcon, { size: 20 })
3982
+ },
3983
+ {
3984
+ s: "large",
3985
+ icon: /* @__PURE__ */ jsx(PencilIcon, { size: 24 })
3986
+ }
3987
+ ].map(({ s, icon }) => /* @__PURE__ */ jsxs("div", {
3988
+ className: "flex flex-col items-center gap-1",
3989
+ children: [/* @__PURE__ */ jsx(IconButton, {
3990
+ size: s,
3991
+ children: icon
3992
+ }), /* @__PURE__ */ jsx(Typography, {
3993
+ variant: "caption",
3994
+ color: "secondary",
3995
+ children: s
3996
+ })]
3972
3997
  }, s)),
3973
- /* @__PURE__ */ jsx(IconButton, {
3974
- disabled: true,
3975
- children: /* @__PURE__ */ jsx(PlusIcon, {})
3998
+ /* @__PURE__ */ jsxs("div", {
3999
+ className: "flex flex-col items-center gap-1",
4000
+ children: [/* @__PURE__ */ jsx(IconButton, {
4001
+ disabled: true,
4002
+ children: /* @__PURE__ */ jsx(Trash2Icon, { size: 20 })
4003
+ }), /* @__PURE__ */ jsx(Typography, {
4004
+ variant: "caption",
4005
+ color: "secondary",
4006
+ children: "disabled"
4007
+ })]
4008
+ }),
4009
+ /* @__PURE__ */ jsxs("div", {
4010
+ className: "flex flex-col items-center gap-1",
4011
+ children: [/* @__PURE__ */ jsx(IconButton, {
4012
+ variant: "filled",
4013
+ children: /* @__PURE__ */ jsx(PlusIcon, { size: 20 })
4014
+ }), /* @__PURE__ */ jsx(Typography, {
4015
+ variant: "caption",
4016
+ color: "secondary",
4017
+ children: "filled"
4018
+ })]
4019
+ }),
4020
+ /* @__PURE__ */ jsxs("div", {
4021
+ className: "flex flex-col items-center gap-1",
4022
+ children: [/* @__PURE__ */ jsx(IconButton, {
4023
+ shape: "square",
4024
+ children: /* @__PURE__ */ jsx(SettingsIcon, { size: 20 })
4025
+ }), /* @__PURE__ */ jsx(Typography, {
4026
+ variant: "caption",
4027
+ color: "secondary",
4028
+ children: "square"
4029
+ })]
3976
4030
  })
3977
4031
  ]
3978
4032
  })] }),
@@ -4177,42 +4231,123 @@ function UIReferenceView() {
4177
4231
  variant: "caption",
4178
4232
  color: "secondary",
4179
4233
  className: "block mb-2 font-mono",
4180
- children: "Chip — colorScheme × size"
4234
+ children: "Chip — colorScheme"
4181
4235
  }),
4182
4236
  /* @__PURE__ */ jsx("div", {
4183
4237
  className: "flex flex-wrap gap-2 mb-4",
4184
4238
  children: [
4185
- "grayLight",
4186
- "grayDark",
4187
- "redLight",
4188
- "redDark",
4189
- "blueDark",
4190
- "blueLight",
4191
- "greenDark",
4192
- "greenLight",
4193
- "yellowLight",
4194
- "yellowDark",
4195
- "orangeLight",
4196
- "purpleDark",
4197
- "pinkLight"
4239
+ "blue",
4240
+ "teal",
4241
+ "red",
4242
+ "green",
4243
+ "yellow",
4244
+ "orange",
4245
+ "purple",
4246
+ "pink",
4247
+ "cyan",
4248
+ "indigo",
4249
+ "violet",
4250
+ "fuchsia",
4251
+ "rose",
4252
+ "emerald",
4253
+ "gray"
4198
4254
  ].map((s) => /* @__PURE__ */ jsx(Chip, {
4199
4255
  colorScheme: s,
4200
- size: "small",
4201
4256
  children: s
4202
4257
  }, s))
4203
4258
  }),
4259
+ /* @__PURE__ */ jsx(Typography, {
4260
+ variant: "caption",
4261
+ color: "secondary",
4262
+ className: "block mb-2 font-mono",
4263
+ children: "Chip — sizes"
4264
+ }),
4204
4265
  /* @__PURE__ */ jsx("div", {
4205
- className: "flex flex-wrap gap-2 mb-6",
4266
+ className: "flex flex-wrap gap-2 items-center mb-4",
4206
4267
  children: [
4207
4268
  "smallest",
4208
4269
  "small",
4209
- "medium"
4270
+ "medium",
4271
+ "large"
4210
4272
  ].map((sz) => /* @__PURE__ */ jsx(Chip, {
4211
- colorScheme: "blueDark",
4273
+ colorScheme: "blue",
4212
4274
  size: sz,
4213
4275
  children: sz
4214
4276
  }, sz))
4215
4277
  }),
4278
+ /* @__PURE__ */ jsx(Typography, {
4279
+ variant: "caption",
4280
+ color: "secondary",
4281
+ className: "block mb-2 font-mono",
4282
+ children: "Chip — outlined, error, clickable, icon"
4283
+ }),
4284
+ /* @__PURE__ */ jsxs("div", {
4285
+ className: "flex flex-wrap gap-2 items-center mb-4",
4286
+ children: [
4287
+ /* @__PURE__ */ jsx(Chip, {
4288
+ colorScheme: "red",
4289
+ outlined: true,
4290
+ children: "Outlined Red"
4291
+ }),
4292
+ /* @__PURE__ */ jsx(Chip, {
4293
+ colorScheme: "blue",
4294
+ outlined: true,
4295
+ children: "Outlined Blue"
4296
+ }),
4297
+ /* @__PURE__ */ jsx(Chip, {
4298
+ error: true,
4299
+ children: "Error"
4300
+ }),
4301
+ /* @__PURE__ */ jsx(Chip, {
4302
+ error: true,
4303
+ outlined: true,
4304
+ children: "Error Outlined"
4305
+ }),
4306
+ /* @__PURE__ */ jsx(Chip, {
4307
+ onClick: () => {},
4308
+ children: "Clickable"
4309
+ }),
4310
+ /* @__PURE__ */ jsx(Chip, {
4311
+ icon: /* @__PURE__ */ jsx(TagIcon, { size: 12 }),
4312
+ colorScheme: "teal",
4313
+ children: "With Icon"
4314
+ }),
4315
+ /* @__PURE__ */ jsx(Chip, { children: "Default (no scheme)" }),
4316
+ /* @__PURE__ */ jsx(Chip, {
4317
+ outlined: true,
4318
+ children: "Default Outlined"
4319
+ })
4320
+ ]
4321
+ }),
4322
+ /* @__PURE__ */ jsx(Typography, {
4323
+ variant: "caption",
4324
+ color: "secondary",
4325
+ className: "block mb-2 font-mono",
4326
+ children: "FilterChip"
4327
+ }),
4328
+ /* @__PURE__ */ jsxs("div", {
4329
+ className: "flex flex-wrap gap-2 items-center mb-6",
4330
+ children: [
4331
+ /* @__PURE__ */ jsx(FilterChip, {
4332
+ active: true,
4333
+ children: "Active"
4334
+ }),
4335
+ /* @__PURE__ */ jsx(FilterChip, { children: "Inactive" }),
4336
+ /* @__PURE__ */ jsx(FilterChip, {
4337
+ icon: /* @__PURE__ */ jsx(FilterIcon, { size: 12 }),
4338
+ active: true,
4339
+ children: "With Icon"
4340
+ }),
4341
+ /* @__PURE__ */ jsx(FilterChip, {
4342
+ size: "small",
4343
+ children: "Small"
4344
+ }),
4345
+ /* @__PURE__ */ jsx(FilterChip, {
4346
+ disabled: true,
4347
+ children: "Disabled"
4348
+ })
4349
+ ]
4350
+ }),
4216
4351
  /* @__PURE__ */ jsx(Typography, {
4217
4352
  variant: "caption",
4218
4353
  color: "secondary",
@@ -4510,271 +4645,6 @@ function UIReferenceView() {
4510
4645
  })
4511
4646
  ]
4512
4647
  })]
4513
- }),
4514
- /* @__PURE__ */ jsxs(SectionBlock, {
4515
- id: "roles",
4516
- title: "Roles View — RolesView.tsx",
4517
- children: [
4518
- /* @__PURE__ */ jsxs(Typography, {
4519
- variant: "body2",
4520
- color: "secondary",
4521
- className: "mb-4",
4522
- children: [
4523
- "Layout from ",
4524
- /* @__PURE__ */ jsx("code", {
4525
- className: "font-mono text-xs",
4526
- children: "RolesView"
4527
- }),
4528
- ": same header pattern, table, and ",
4529
- /* @__PURE__ */ jsx("code", {
4530
- className: "font-mono text-xs",
4531
- children: "CollectionPermissionsMatrix"
4532
- }),
4533
- " with ",
4534
- /* @__PURE__ */ jsx("code", {
4535
- className: "font-mono text-xs",
4536
- children: "defaultBorderMixin"
4537
- }),
4538
- "."
4539
- ]
4540
- }),
4541
- /* @__PURE__ */ jsxs("div", {
4542
- className: "flex items-center mt-12",
4543
- children: [/* @__PURE__ */ jsx(Typography, {
4544
- gutterBottom: true,
4545
- variant: "h4",
4546
- className: "grow",
4547
- component: "h4",
4548
- children: "Roles"
4549
- }), /* @__PURE__ */ jsx(Button, {
4550
- startIcon: /* @__PURE__ */ jsx(PlusIcon, {}),
4551
- children: "Add role"
4552
- })]
4553
- }),
4554
- /* @__PURE__ */ jsx("div", {
4555
- className: "w-full overflow-auto",
4556
- children: /* @__PURE__ */ jsxs(Table, {
4557
- className: "w-full",
4558
- children: [/* @__PURE__ */ jsxs(TableHeader, { children: [
4559
- /* @__PURE__ */ jsx(TableCell, {
4560
- header: true,
4561
- className: "w-16"
4562
- }),
4563
- /* @__PURE__ */ jsx(TableCell, {
4564
- header: true,
4565
- children: "Role"
4566
- }),
4567
- /* @__PURE__ */ jsx(TableCell, {
4568
- header: true,
4569
- className: "items-center",
4570
- children: "Is Admin"
4571
- })
4572
- ] }), /* @__PURE__ */ jsx(TableBody, { children: [
4573
- {
4574
- id: "admin",
4575
- name: "Admin",
4576
- isAdmin: true
4577
- },
4578
- {
4579
- id: "editor",
4580
- name: "Editor",
4581
- isAdmin: false
4582
- },
4583
- {
4584
- id: "viewer",
4585
- name: "Viewer",
4586
- isAdmin: false
4587
- }
4588
- ].map((role) => /* @__PURE__ */ jsxs(TableRow, { children: [
4589
- /* @__PURE__ */ jsx(TableCell, {
4590
- style: { width: "64px" },
4591
- children: !role.isAdmin && /* @__PURE__ */ jsx(Tooltip, {
4592
- asChild: true,
4593
- title: "Delete this role",
4594
- children: /* @__PURE__ */ jsx(IconButton, {
4595
- size: "small",
4596
- children: /* @__PURE__ */ jsx(Trash2Icon, {})
4597
- })
4598
- })
4599
- }),
4600
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Chip, {
4601
- colorScheme: role.isAdmin ? "purpleDark" : "blueDark",
4602
- size: "small",
4603
- children: role.name
4604
- }) }),
4605
- /* @__PURE__ */ jsx(TableCell, {
4606
- className: "items-center",
4607
- children: /* @__PURE__ */ jsx(Checkbox, {
4608
- checked: role.isAdmin ?? false,
4609
- disabled: true
4610
- })
4611
- })
4612
- ] }, role.id)) })]
4613
- })
4614
- }),
4615
- /* @__PURE__ */ jsxs("div", {
4616
- className: "mt-4",
4617
- children: [/* @__PURE__ */ jsx(Typography, {
4618
- variant: "label",
4619
- className: "mb-2 block text-surface-500 dark:text-surface-400 uppercase tracking-wide text-xs",
4620
- children: "Collection permissions"
4621
- }), /* @__PURE__ */ jsx("div", {
4622
- className: `rounded-lg overflow-hidden border w-full ${defaultBorderMixin}`,
4623
- children: /* @__PURE__ */ jsxs(Table, {
4624
- className: "w-full",
4625
- children: [/* @__PURE__ */ jsxs(TableHeader, { children: [/* @__PURE__ */ jsx(TableCell, {
4626
- header: true,
4627
- children: "Collection"
4628
- }), [
4629
- "Read",
4630
- "Create",
4631
- "Edit",
4632
- "Delete"
4633
- ].map((op) => /* @__PURE__ */ jsx(TableCell, {
4634
- header: true,
4635
- align: "center",
4636
- className: "w-20",
4637
- children: op
4638
- }, op))] }), /* @__PURE__ */ jsx(TableBody, { children: [{
4639
- name: "Posts",
4640
- slug: "posts"
4641
- }, {
4642
- name: "Authors",
4643
- slug: "authors"
4644
- }].map((col) => /* @__PURE__ */ jsxs(TableRow, { children: [/* @__PURE__ */ jsxs(TableCell, { children: [/* @__PURE__ */ jsxs("div", {
4645
- className: "flex items-center gap-1.5",
4646
- children: [/* @__PURE__ */ jsx("span", {
4647
- className: "font-medium",
4648
- children: col.name
4649
- }), /* @__PURE__ */ jsx(Tooltip, {
4650
- title: "No security rules defined — all operations unrestricted",
4651
- children: /* @__PURE__ */ jsx(Chip, {
4652
- size: "smallest",
4653
- colorScheme: "gray",
4654
- children: "no rules"
4655
- })
4656
- })]
4657
- }), /* @__PURE__ */ jsx("span", {
4658
- className: "text-xs text-surface-400 font-mono",
4659
- children: col.slug
4660
- })] }), [
4661
- "select",
4662
- "insert",
4663
- "update",
4664
- "delete"
4665
- ].map((op) => /* @__PURE__ */ jsx(TableCell, {
4666
- align: "center",
4667
- className: "w-20",
4668
- children: /* @__PURE__ */ jsx("span", {
4669
- className: "text-green-500 dark:text-green-400 font-bold",
4670
- children: "✓"
4671
- })
4672
- }, op))] }, col.slug)) })]
4673
- })
4674
- })]
4675
- })
4676
- ]
4677
- }),
4678
- /* @__PURE__ */ jsxs(SectionBlock, {
4679
- id: "role-dialog",
4680
- title: "Role Dialog — RoleDetailsForm",
4681
- children: [/* @__PURE__ */ jsxs(Typography, {
4682
- variant: "body2",
4683
- color: "secondary",
4684
- className: "mb-4",
4685
- children: [
4686
- "Exact structure of ",
4687
- /* @__PURE__ */ jsx("code", {
4688
- className: "font-mono text-xs",
4689
- children: "RoleDetailsForm"
4690
- }),
4691
- ": ",
4692
- /* @__PURE__ */ jsx("code", {
4693
- className: "font-mono text-xs",
4694
- children: "col-span-4"
4695
- }),
4696
- " grid, Role ID + Name + Is Admin checkbox."
4697
- ]
4698
- }), /* @__PURE__ */ jsxs("div", {
4699
- className: `rounded-lg border w-full max-w-xl ${defaultBorderMixin}`,
4700
- children: [
4701
- /* @__PURE__ */ jsx("div", {
4702
- className: "px-6 pt-6 pb-2",
4703
- children: /* @__PURE__ */ jsx(Typography, {
4704
- variant: "h4",
4705
- children: "Role"
4706
- })
4707
- }),
4708
- /* @__PURE__ */ jsx("div", {
4709
- className: "px-6 py-4",
4710
- children: /* @__PURE__ */ jsxs("div", {
4711
- className: "grid grid-cols-12 gap-4",
4712
- children: [
4713
- /* @__PURE__ */ jsx("div", {
4714
- className: "col-span-12 sm:col-span-4",
4715
- children: /* @__PURE__ */ jsx(TextField, {
4716
- name: "id",
4717
- required: true,
4718
- value: "editor",
4719
- onChange: () => {},
4720
- label: "Role ID",
4721
- disabled: true
4722
- })
4723
- }),
4724
- /* @__PURE__ */ jsx("div", {
4725
- className: "col-span-12 sm:col-span-4",
4726
- children: /* @__PURE__ */ jsx(TextField, {
4727
- name: "name",
4728
- required: true,
4729
- value: "Editor",
4730
- onChange: () => {},
4731
- label: "Role Name"
4732
- })
4733
- }),
4734
- /* @__PURE__ */ jsx("div", {
4735
- className: "col-span-12 sm:col-span-4 flex items-start pt-2",
4736
- children: /* @__PURE__ */ jsxs("label", {
4737
- className: "flex items-center gap-2 cursor-pointer mt-3",
4738
- children: [/* @__PURE__ */ jsx(Checkbox, {
4739
- checked: false,
4740
- onCheckedChange: () => {}
4741
- }), /* @__PURE__ */ jsx("span", {
4742
- className: "font-medium",
4743
- children: "Is Admin"
4744
- })]
4745
- })
4746
- })
4747
- ]
4748
- })
4749
- }),
4750
- /* @__PURE__ */ jsxs("div", {
4751
- className: "flex items-center justify-end gap-2 px-6 pb-6",
4752
- children: [/* @__PURE__ */ jsx(Button, {
4753
- variant: "text",
4754
- children: "Cancel"
4755
- }), /* @__PURE__ */ jsx(LoadingButton, {
4756
- variant: "filled",
4757
- loading: false,
4758
- children: "Update"
4759
- })]
4760
- })
4761
- ]
4762
- })]
4763
- }),
4764
- /* @__PURE__ */ jsx("div", {
4765
- className: "px-6 py-8",
4766
- children: /* @__PURE__ */ jsxs(Typography, {
4767
- variant: "caption",
4768
- color: "secondary",
4769
- children: [
4770
- "Hidden debug reference — ",
4771
- /* @__PURE__ */ jsx("code", {
4772
- className: "font-mono text-xs",
4773
- children: "/debug/ui"
4774
- }),
4775
- ". Not linked from sidebar."
4776
- ]
4777
- })
4778
4648
  })
4779
4649
  ]
4780
4650
  })]
@@ -5652,7 +5522,7 @@ function LoginView({ logo, authController, noUserComponent, disableSignupScreen
5652
5522
  })
5653
5523
  ] })]
5654
5524
  }),
5655
- additionalComponent && /* @__PURE__ */ jsx("div", {
5525
+ additionalComponent && mode === "buttons" && /* @__PURE__ */ jsx("div", {
5656
5526
  className: "w-full",
5657
5527
  children: additionalComponent
5658
5528
  })