@nubase/frontend 0.1.21 → 0.1.23

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.d.mts CHANGED
@@ -513,6 +513,12 @@ type UseSchemaFiltersReturn<TSchema extends ObjectSchema<any>> = {
513
513
  filterDescriptors: FilterFieldDescriptor[];
514
514
  /** Get params for API call (removes empty/undefined values) */
515
515
  getRequestParams: () => Record<string, unknown>;
516
+ /** Global search value (if schema has "q" field) */
517
+ searchValue: string;
518
+ /** Update global search value */
519
+ setSearchValue: (value: string) => void;
520
+ /** Whether the schema supports global text search (has "q" field) */
521
+ hasTextSearch: boolean;
516
522
  };
517
523
  /**
518
524
  * Hook for managing schema-derived filter state.
@@ -2697,7 +2703,8 @@ declare const unorderedListCommand: MarkdownCommand;
2697
2703
  declare const orderedListCommand: MarkdownCommand;
2698
2704
  declare const checkListCommand: MarkdownCommand;
2699
2705
 
2700
- interface MarkdownTextAreaProps extends React__default.TextareaHTMLAttributes<HTMLTextAreaElement> {
2706
+ declare const markdownTextAreaVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
2707
+ interface MarkdownTextAreaProps extends React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, VariantProps<typeof markdownTextAreaVariants> {
2701
2708
  className?: string;
2702
2709
  }
2703
2710
  interface MarkdownTextAreaHandle {
package/dist/index.d.ts CHANGED
@@ -513,6 +513,12 @@ type UseSchemaFiltersReturn<TSchema extends ObjectSchema<any>> = {
513
513
  filterDescriptors: FilterFieldDescriptor[];
514
514
  /** Get params for API call (removes empty/undefined values) */
515
515
  getRequestParams: () => Record<string, unknown>;
516
+ /** Global search value (if schema has "q" field) */
517
+ searchValue: string;
518
+ /** Update global search value */
519
+ setSearchValue: (value: string) => void;
520
+ /** Whether the schema supports global text search (has "q" field) */
521
+ hasTextSearch: boolean;
516
522
  };
517
523
  /**
518
524
  * Hook for managing schema-derived filter state.
@@ -2697,7 +2703,8 @@ declare const unorderedListCommand: MarkdownCommand;
2697
2703
  declare const orderedListCommand: MarkdownCommand;
2698
2704
  declare const checkListCommand: MarkdownCommand;
2699
2705
 
2700
- interface MarkdownTextAreaProps extends React__default.TextareaHTMLAttributes<HTMLTextAreaElement> {
2706
+ declare const markdownTextAreaVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
2707
+ interface MarkdownTextAreaProps extends React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, VariantProps<typeof markdownTextAreaVariants> {
2701
2708
  className?: string;
2702
2709
  }
2703
2710
  interface MarkdownTextAreaHandle {
package/dist/index.js CHANGED
@@ -6163,7 +6163,7 @@ var textInputVariants = (0, import_class_variance_authority7.cva)([
6163
6163
  "selection:bg-primary selection:text-primary-foreground",
6164
6164
  // Focus State
6165
6165
  "focus-visible:border-ring",
6166
- "focus-visible:ring-ring/50",
6166
+ "focus-visible:ring-ring/50 focus-visible:ring-[3px]",
6167
6167
  // Invalid State
6168
6168
  "aria-invalid:border-destructive",
6169
6169
  "aria-invalid:ring-destructive/20",
@@ -6805,7 +6805,7 @@ var SchemaFormBody = ({
6805
6805
  " ",
6806
6806
  metadataError.message
6807
6807
  ] }),
6808
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-1 space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6808
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-1 space-y-4 pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6809
6809
  SchemaFormVerticalLayout,
6810
6810
  {
6811
6811
  layout,
@@ -7772,7 +7772,7 @@ var workbenchOpenResourceOperation = createCommand({
7772
7772
  });
7773
7773
 
7774
7774
  // src/commands/definitions/workbench.openResourceInModal.tsx
7775
- var import_core7 = require("@nubase/core");
7775
+ var import_core8 = require("@nubase/core");
7776
7776
  var import_lucide_react10 = require("lucide-react");
7777
7777
 
7778
7778
  // src/components/form/SchemaForm/useSchemaForm.ts
@@ -8020,6 +8020,7 @@ function useResourceViewQuery(resourceId, view, params, options) {
8020
8020
  }
8021
8021
 
8022
8022
  // src/hooks/useSchemaFilters.ts
8023
+ var import_core7 = require("@nubase/core");
8023
8024
  var import_react29 = require("react");
8024
8025
 
8025
8026
  // src/components/schema-filter-bar/introspect-schema.ts
@@ -8053,6 +8054,9 @@ function introspectSchemaForFilters(schema, config) {
8053
8054
  const descriptors = [];
8054
8055
  const shape = schema._shape;
8055
8056
  for (const [fieldName, fieldSchema] of Object.entries(shape)) {
8057
+ if (fieldName === import_core6.SEARCH_FIELD_NAME) {
8058
+ continue;
8059
+ }
8056
8060
  if (config?.excludeFields?.includes(fieldName)) {
8057
8061
  continue;
8058
8062
  }
@@ -8082,6 +8086,10 @@ function introspectSchemaForFilters(schema, config) {
8082
8086
 
8083
8087
  // src/hooks/useSchemaFilters.ts
8084
8088
  function useSchemaFilters(schema, options) {
8089
+ const hasTextSearch = (0, import_react29.useMemo)(() => {
8090
+ if (!schema) return false;
8091
+ return import_core7.SEARCH_FIELD_NAME in schema._shape;
8092
+ }, [schema]);
8085
8093
  const filterDescriptors = (0, import_react29.useMemo)(() => {
8086
8094
  if (!schema) return [];
8087
8095
  return introspectSchemaForFilters(schema, options);
@@ -8089,6 +8097,10 @@ function useSchemaFilters(schema, options) {
8089
8097
  const [filterState, setFilterState] = (0, import_react29.useState)(
8090
8098
  {}
8091
8099
  );
8100
+ const [searchValue, setSearchValueState] = (0, import_react29.useState)("");
8101
+ const setSearchValue = (0, import_react29.useCallback)((value) => {
8102
+ setSearchValueState(value);
8103
+ }, []);
8092
8104
  const setFilterValue = (0, import_react29.useCallback)((field, value) => {
8093
8105
  setFilterState((prev) => ({
8094
8106
  ...prev,
@@ -8106,8 +8118,12 @@ function useSchemaFilters(schema, options) {
8106
8118
  );
8107
8119
  const clearFilters = (0, import_react29.useCallback)(() => {
8108
8120
  setFilterState({});
8121
+ setSearchValueState("");
8109
8122
  }, []);
8110
8123
  const hasActiveFilters = (0, import_react29.useMemo)(() => {
8124
+ if (searchValue.trim() !== "") {
8125
+ return true;
8126
+ }
8111
8127
  return Object.entries(filterState).some(([, value]) => {
8112
8128
  if (value === void 0 || value === null || value === "") {
8113
8129
  return false;
@@ -8117,9 +8133,12 @@ function useSchemaFilters(schema, options) {
8117
8133
  }
8118
8134
  return true;
8119
8135
  });
8120
- }, [filterState]);
8136
+ }, [filterState, searchValue]);
8121
8137
  const getRequestParams = (0, import_react29.useCallback)(() => {
8122
8138
  const params = {};
8139
+ if (searchValue.trim() !== "") {
8140
+ params[import_core7.SEARCH_FIELD_NAME] = searchValue.trim();
8141
+ }
8123
8142
  for (const [key, value] of Object.entries(filterState)) {
8124
8143
  if (value === void 0 || value === null || value === "") {
8125
8144
  continue;
@@ -8130,7 +8149,7 @@ function useSchemaFilters(schema, options) {
8130
8149
  params[key] = value;
8131
8150
  }
8132
8151
  return params;
8133
- }, [filterState]);
8152
+ }, [filterState, searchValue]);
8134
8153
  return {
8135
8154
  filterState,
8136
8155
  setFilterValue,
@@ -8138,7 +8157,10 @@ function useSchemaFilters(schema, options) {
8138
8157
  clearFilters,
8139
8158
  hasActiveFilters,
8140
8159
  filterDescriptors,
8141
- getRequestParams
8160
+ getRequestParams,
8161
+ searchValue,
8162
+ setSearchValue,
8163
+ hasTextSearch
8142
8164
  };
8143
8165
  }
8144
8166
 
@@ -12186,12 +12208,12 @@ var ModalViewRenderer = (props) => {
12186
12208
 
12187
12209
  // src/commands/definitions/workbench.openResourceInModal.tsx
12188
12210
  var import_jsx_runtime70 = require("react/jsx-runtime");
12189
- var workbenchOpenResourceOperationInModalArgsSchema = import_core7.nu.object({
12190
- resourceId: import_core7.nu.string().withMeta({
12211
+ var workbenchOpenResourceOperationInModalArgsSchema = import_core8.nu.object({
12212
+ resourceId: import_core8.nu.string().withMeta({
12191
12213
  label: "Resource ID",
12192
12214
  description: "The ID of the resource to open"
12193
12215
  }).optional(),
12194
- operation: import_core7.nu.string().withMeta({
12216
+ operation: import_core8.nu.string().withMeta({
12195
12217
  label: "Operation",
12196
12218
  description: "The operation to perform on the resource"
12197
12219
  }).optional()
@@ -12344,11 +12366,11 @@ var workbenchRunCommand = createCommand({
12344
12366
  });
12345
12367
 
12346
12368
  // src/commands/definitions/workbench.setTheme.tsx
12347
- var import_core8 = require("@nubase/core");
12369
+ var import_core9 = require("@nubase/core");
12348
12370
  var import_lucide_react12 = require("lucide-react");
12349
12371
  var import_jsx_runtime72 = require("react/jsx-runtime");
12350
- var workbenchSetThemeArgsSchema = import_core8.nu.object({
12351
- themeId: import_core8.nu.string().withMeta({
12372
+ var workbenchSetThemeArgsSchema = import_core9.nu.object({
12373
+ themeId: import_core9.nu.string().withMeta({
12352
12374
  label: "Theme ID",
12353
12375
  description: "The ID of the theme to set"
12354
12376
  }).optional()
@@ -14571,6 +14593,7 @@ var checkListCommand = {
14571
14593
  };
14572
14594
 
14573
14595
  // src/components/markdown-textarea/MarkdownTextArea.tsx
14596
+ var import_class_variance_authority14 = require("class-variance-authority");
14574
14597
  var import_react64 = require("react");
14575
14598
 
14576
14599
  // src/components/markdown-textarea/text-controller.ts
@@ -14684,6 +14707,27 @@ function canManipulateViaTextNodes(input) {
14684
14707
 
14685
14708
  // src/components/markdown-textarea/MarkdownTextArea.tsx
14686
14709
  var import_jsx_runtime97 = require("react/jsx-runtime");
14710
+ var markdownTextAreaVariants = (0, import_class_variance_authority14.cva)([
14711
+ // Layout & Sizing
14712
+ "w-full min-h-[200px]",
14713
+ // Spacing & Borders
14714
+ "px-3 py-2 rounded-md border border-border",
14715
+ // Background & Text
14716
+ "bg-background text-foreground",
14717
+ "font-mono text-sm",
14718
+ // Resize behavior
14719
+ "resize-vertical",
14720
+ // Visual Effects
14721
+ "outline-none",
14722
+ // Placeholder
14723
+ "placeholder:text-muted-foreground",
14724
+ // Focus State
14725
+ "focus-visible:border-ring",
14726
+ "focus-visible:ring-ring/50 focus-visible:ring-[3px]",
14727
+ // Disabled State
14728
+ "disabled:opacity-50",
14729
+ "disabled:cursor-not-allowed"
14730
+ ]);
14687
14731
  var MarkdownTextArea = (0, import_react64.forwardRef)(({ className, ...props }, ref) => {
14688
14732
  const textAreaRef = (0, import_react64.useRef)(null);
14689
14733
  const textControllerRef = (0, import_react64.useRef)(void 0);
@@ -14712,17 +14756,7 @@ var MarkdownTextArea = (0, import_react64.forwardRef)(({ className, ...props },
14712
14756
  "textarea",
14713
14757
  {
14714
14758
  ref: textAreaRef,
14715
- className: cn(
14716
- "w-full min-h-[200px] px-3 py-2",
14717
- "bg-background text-foreground",
14718
- "border border-border rounded-md",
14719
- "resize-vertical",
14720
- "focus:outline-none focus:ring-2 focus:ring-ring/20 focus:border-primary",
14721
- "disabled:opacity-50 disabled:cursor-not-allowed",
14722
- "placeholder:text-muted-foreground",
14723
- "font-mono text-sm",
14724
- className
14725
- ),
14759
+ className: cn(markdownTextAreaVariants({ className })),
14726
14760
  ...props
14727
14761
  }
14728
14762
  );
@@ -14891,7 +14925,7 @@ var MainNav = (0, import_react66.forwardRef)(
14891
14925
  MainNav.displayName = "MainNav";
14892
14926
 
14893
14927
  // src/components/navigation/main-nav/NavItemComponent.tsx
14894
- var import_class_variance_authority14 = require("class-variance-authority");
14928
+ var import_class_variance_authority15 = require("class-variance-authority");
14895
14929
 
14896
14930
  // src/components/navigation/main-nav/SafeLink.tsx
14897
14931
  var import_jsx_runtime101 = require("react/jsx-runtime");
@@ -14913,7 +14947,7 @@ var SafeLink = ({ to, className, onClick, children }) => {
14913
14947
 
14914
14948
  // src/components/navigation/main-nav/NavItemComponent.tsx
14915
14949
  var import_jsx_runtime102 = require("react/jsx-runtime");
14916
- var navItemVariants = (0, import_class_variance_authority14.cva)(
14950
+ var navItemVariants = (0, import_class_variance_authority15.cva)(
14917
14951
  "flex items-center gap-3 px-3 py-2 text-sm font-medium transition-all duration-200 rounded-md group",
14918
14952
  {
14919
14953
  variants: {
@@ -15365,22 +15399,22 @@ var ResourceCreateViewRenderer = (props) => {
15365
15399
  };
15366
15400
 
15367
15401
  // src/components/views/ViewRenderer/screen/ResourceSearchViewRenderer.tsx
15368
- var import_core9 = require("@nubase/core");
15402
+ var import_core10 = require("@nubase/core");
15369
15403
  var import_react_router5 = require("@tanstack/react-router");
15370
15404
  var import_react69 = require("react");
15371
15405
 
15372
15406
  // src/components/search-controls/LookupSelectFilter.tsx
15373
- var import_class_variance_authority16 = require("class-variance-authority");
15407
+ var import_class_variance_authority17 = require("class-variance-authority");
15374
15408
  var import_lodash_es = require("lodash-es");
15375
15409
  var React9 = __toESM(require("react"));
15376
15410
 
15377
15411
  // src/components/search-controls/SearchFilterDropdown.tsx
15378
15412
  var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
15379
- var import_class_variance_authority15 = require("class-variance-authority");
15413
+ var import_class_variance_authority16 = require("class-variance-authority");
15380
15414
  var import_lucide_react17 = require("lucide-react");
15381
15415
  var React8 = __toESM(require("react"));
15382
15416
  var import_jsx_runtime110 = require("react/jsx-runtime");
15383
- var searchFilterTriggerVariants = (0, import_class_variance_authority15.cva)(
15417
+ var searchFilterTriggerVariants = (0, import_class_variance_authority16.cva)(
15384
15418
  [
15385
15419
  // Base - matching TextInput height/roundness
15386
15420
  "inline-flex items-center gap-1.5 h-9 px-3 rounded-md",
@@ -15402,7 +15436,7 @@ var searchFilterTriggerVariants = (0, import_class_variance_authority15.cva)(
15402
15436
  }
15403
15437
  }
15404
15438
  );
15405
- var searchFilterContentVariants = (0, import_class_variance_authority15.cva)([
15439
+ var searchFilterContentVariants = (0, import_class_variance_authority16.cva)([
15406
15440
  // Background & Border
15407
15441
  "bg-popover text-popover-foreground",
15408
15442
  "border rounded-md shadow-md",
@@ -15507,7 +15541,7 @@ SearchFilterDropdown.displayName = "SearchFilterDropdown";
15507
15541
 
15508
15542
  // src/components/search-controls/LookupSelectFilter.tsx
15509
15543
  var import_jsx_runtime111 = require("react/jsx-runtime");
15510
- var optionVariants3 = (0, import_class_variance_authority16.cva)(
15544
+ var optionVariants3 = (0, import_class_variance_authority17.cva)(
15511
15545
  [
15512
15546
  "flex items-center gap-2 px-3 py-2",
15513
15547
  "cursor-pointer select-none",
@@ -15803,13 +15837,13 @@ var LookupSelectFilter = React9.forwardRef(
15803
15837
  LookupSelectFilter.displayName = "LookupSelectFilter";
15804
15838
 
15805
15839
  // src/components/search-controls/SearchFilterBar.tsx
15806
- var import_class_variance_authority17 = require("class-variance-authority");
15840
+ var import_class_variance_authority18 = require("class-variance-authority");
15807
15841
  var import_lodash_es2 = require("lodash-es");
15808
15842
  var import_lucide_react18 = require("lucide-react");
15809
15843
  var React10 = __toESM(require("react"));
15810
15844
  var import_jsx_runtime112 = require("react/jsx-runtime");
15811
- var searchFilterBarVariants = (0, import_class_variance_authority17.cva)(["flex items-center gap-2", "flex-wrap"]);
15812
- var searchFilterBarInputVariants = (0, import_class_variance_authority17.cva)([
15845
+ var searchFilterBarVariants = (0, import_class_variance_authority18.cva)(["flex items-center gap-2", "flex-wrap"]);
15846
+ var searchFilterBarInputVariants = (0, import_class_variance_authority18.cva)([
15813
15847
  // Layout & Sizing
15814
15848
  "flex h-9 min-w-0",
15815
15849
  // Spacing & Borders (pl-10 for search icon)
@@ -15831,7 +15865,7 @@ var searchFilterBarInputVariants = (0, import_class_variance_authority17.cva)([
15831
15865
  "disabled:cursor-not-allowed",
15832
15866
  "disabled:opacity-50"
15833
15867
  ]);
15834
- var searchFilterBarClearButtonVariants = (0, import_class_variance_authority17.cva)([
15868
+ var searchFilterBarClearButtonVariants = (0, import_class_variance_authority18.cva)([
15835
15869
  "inline-flex items-center gap-1 h-9 px-3",
15836
15870
  "text-sm font-medium text-muted-foreground",
15837
15871
  "hover:text-foreground",
@@ -15929,10 +15963,10 @@ var SearchFilterBar = React10.forwardRef(
15929
15963
  SearchFilterBar.displayName = "SearchFilterBar";
15930
15964
 
15931
15965
  // src/components/search-controls/SelectFilter.tsx
15932
- var import_class_variance_authority18 = require("class-variance-authority");
15966
+ var import_class_variance_authority19 = require("class-variance-authority");
15933
15967
  var React11 = __toESM(require("react"));
15934
15968
  var import_jsx_runtime113 = require("react/jsx-runtime");
15935
- var optionVariants4 = (0, import_class_variance_authority18.cva)(
15969
+ var optionVariants4 = (0, import_class_variance_authority19.cva)(
15936
15970
  [
15937
15971
  // Layout
15938
15972
  "flex items-center gap-2 px-3 py-2",
@@ -16416,7 +16450,7 @@ var DEFAULT_COLUMN_WIDTHS = {
16416
16450
  // Will use the wrapped type's width
16417
16451
  };
16418
16452
  var getDefaultColumnWidth = (fieldSchema) => {
16419
- if (fieldSchema instanceof import_core9.OptionalSchema) {
16453
+ if (fieldSchema instanceof import_core10.OptionalSchema) {
16420
16454
  return getDefaultColumnWidth(fieldSchema.unwrap());
16421
16455
  }
16422
16456
  return DEFAULT_COLUMN_WIDTHS[fieldSchema.type] || 150;
@@ -16439,7 +16473,10 @@ var ResourceSearchViewRenderer = (props) => {
16439
16473
  clearFilters,
16440
16474
  hasActiveFilters,
16441
16475
  filterDescriptors,
16442
- getRequestParams
16476
+ getRequestParams,
16477
+ searchValue,
16478
+ setSearchValue,
16479
+ hasTextSearch
16443
16480
  } = useSchemaFilters(view.schemaFilter);
16444
16481
  const mergedParams = (0, import_react69.useMemo)(() => {
16445
16482
  const filterParams = getRequestParams();
@@ -16640,7 +16677,9 @@ var ResourceSearchViewRenderer = (props) => {
16640
16677
  filterState,
16641
16678
  onFilterChange: setFilterValue,
16642
16679
  onClearFilters: clearFilters,
16643
- showClearFilters: hasActiveFilters
16680
+ showClearFilters: hasActiveFilters,
16681
+ searchValue: hasTextSearch ? searchValue : "",
16682
+ onSearchChange: hasTextSearch ? setSearchValue : void 0
16644
16683
  }
16645
16684
  ),
16646
16685
  bulkActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(ActionBar, { actions: bulkActions }),