kz-design-system 0.0.14 → 0.0.15

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
@@ -11,7 +11,7 @@ export { Sidesheet, SidesheetProps } from './sidesheet.mjs';
11
11
  export { SideMenu, SideMenuFlyoutSide, SideMenuGroupItem, SideMenuGroupItemSubItem, SideMenuGroupNode, SideMenuLinkNode, SideMenuNavigatePayload, SideMenuNode, SideMenuProps, SideMenuSectionNode } from './sidemenu.mjs';
12
12
  export { Tooltip, TooltipProps } from './tooltip.mjs';
13
13
  export { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsSize, TabsTrigger, TabsTriggerProps, TabsVariant } from './tabs.mjs';
14
- export { SortDirection, Table, TableAlign, TableColumn, TablePaginationState, TableProps, TableSize, TableSortState } from './table.mjs';
14
+ export { SortDirection, Table, TableAlign, TableCellChange, TableColumn, TablePaginationState, TableProps, TableSize, TableSortState } from './table.mjs';
15
15
  export { Icon, IconProps, IconSizeKey, iconSize, iconSize as size } from './icon.mjs';
16
16
  export { Dropdown, DropdownButton, DropdownButtonItem, DropdownButtonProps, DropdownButtonTrigger, DropdownCheckboxItem, DropdownContent, DropdownItem, DropdownLabel, DropdownRadioGroup, DropdownRadioItem, DropdownSeparator, DropdownSub, DropdownSubContent, DropdownSubTrigger, DropdownTrigger, DropdownTriggerProps } from './dropdown.mjs';
17
17
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from './dialog.mjs';
@@ -29,6 +29,8 @@ export { FormGroup, FormGroupDirection, FormGroupProps } from './form-group.mjs'
29
29
  export { Modal, ModalProps, ModalSize, ModalTrigger } from './modal.mjs';
30
30
  export { ToastContextValue, ToastData, ToastProvider, Toaster, ToasterProps, useToast } from './toast.mjs';
31
31
  export { Card, CardPadding, CardProps, CardSize } from './card.mjs';
32
+ export { SqlEditor, SqlEditorProps, SqlEditorQueryResult, SqlEditorSize } from './sql-editor.mjs';
33
+ export { QrErrorCorrectionLevel, QrPatternStyle, QrRenderer, QrRendererDataProps, QrRendererDebugInfo, QrRendererImageProps, QrRendererProps } from './qr-renderer.mjs';
32
34
  export { I as IconName, i as iconRegistry } from './icon-registry-YZFYW-mt.mjs';
33
35
  import 'react';
34
36
  import 'class-variance-authority/types';
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { Sidesheet, SidesheetProps } from './sidesheet.js';
11
11
  export { SideMenu, SideMenuFlyoutSide, SideMenuGroupItem, SideMenuGroupItemSubItem, SideMenuGroupNode, SideMenuLinkNode, SideMenuNavigatePayload, SideMenuNode, SideMenuProps, SideMenuSectionNode } from './sidemenu.js';
12
12
  export { Tooltip, TooltipProps } from './tooltip.js';
13
13
  export { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsProps, TabsSize, TabsTrigger, TabsTriggerProps, TabsVariant } from './tabs.js';
14
- export { SortDirection, Table, TableAlign, TableColumn, TablePaginationState, TableProps, TableSize, TableSortState } from './table.js';
14
+ export { SortDirection, Table, TableAlign, TableCellChange, TableColumn, TablePaginationState, TableProps, TableSize, TableSortState } from './table.js';
15
15
  export { Icon, IconProps, IconSizeKey, iconSize, iconSize as size } from './icon.js';
16
16
  export { Dropdown, DropdownButton, DropdownButtonItem, DropdownButtonProps, DropdownButtonTrigger, DropdownCheckboxItem, DropdownContent, DropdownItem, DropdownLabel, DropdownRadioGroup, DropdownRadioItem, DropdownSeparator, DropdownSub, DropdownSubContent, DropdownSubTrigger, DropdownTrigger, DropdownTriggerProps } from './dropdown.js';
17
17
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from './dialog.js';
@@ -29,6 +29,8 @@ export { FormGroup, FormGroupDirection, FormGroupProps } from './form-group.js';
29
29
  export { Modal, ModalProps, ModalSize, ModalTrigger } from './modal.js';
30
30
  export { ToastContextValue, ToastData, ToastProvider, Toaster, ToasterProps, useToast } from './toast.js';
31
31
  export { Card, CardPadding, CardProps, CardSize } from './card.js';
32
+ export { SqlEditor, SqlEditorProps, SqlEditorQueryResult, SqlEditorSize } from './sql-editor.js';
33
+ export { QrErrorCorrectionLevel, QrPatternStyle, QrRenderer, QrRendererDataProps, QrRendererDebugInfo, QrRendererImageProps, QrRendererProps } from './qr-renderer.js';
32
34
  export { I as IconName, i as iconRegistry } from './icon-registry-YZFYW-mt.js';
33
35
  import 'react';
34
36
  import 'class-variance-authority/types';
package/dist/index.js CHANGED
@@ -83,6 +83,7 @@ __export(src_exports, {
83
83
  ModalTrigger: () => ModalTrigger,
84
84
  NumberInput: () => NumberInput,
85
85
  OverrideMode: () => OverrideMode,
86
+ QrRenderer: () => QrRenderer,
86
87
  RadioButton: () => RadioButton,
87
88
  RadioSize: () => RadioSize,
88
89
  Select: () => Select,
@@ -90,6 +91,7 @@ __export(src_exports, {
90
91
  SidePanel: () => SidePanel,
91
92
  SidePanelTrigger: () => SidePanelTrigger,
92
93
  Sidesheet: () => Sidesheet,
94
+ SqlEditor: () => SqlEditor,
93
95
  TOKEN_KEYS: () => TOKEN_KEYS,
94
96
  Table: () => Table,
95
97
  Tabs: () => Tabs,
@@ -2855,6 +2857,9 @@ function TableInner({
2855
2857
  onEditingCellChange,
2856
2858
  onSave,
2857
2859
  onCancel,
2860
+ editingCells,
2861
+ onEditingCellsChange,
2862
+ onSaveAll,
2858
2863
  className,
2859
2864
  tableClassName,
2860
2865
  headerClassName,
@@ -2937,8 +2942,10 @@ function TableInner({
2937
2942
  endItem: Math.min(page * pageSize, total)
2938
2943
  };
2939
2944
  }, [pagination]);
2945
+ const isMultiCellMode = editingCells != null;
2940
2946
  const [draftValue, setDraftValue] = React15.useState(null);
2941
2947
  React15.useEffect(() => {
2948
+ if (isMultiCellMode) return;
2942
2949
  if (editingCell == null) {
2943
2950
  setDraftValue(null);
2944
2951
  return;
@@ -2956,23 +2963,90 @@ function TableInner({
2956
2963
  val = "";
2957
2964
  }
2958
2965
  setDraftValue(val ?? "");
2959
- }, [editingCell, data, columns, getRowId]);
2966
+ }, [editingCell, data, columns, getRowId, isMultiCellMode]);
2967
+ const [draftValues, setDraftValues] = React15.useState({});
2968
+ const seedDraft = React15.useCallback(
2969
+ (rowId, columnKey) => {
2970
+ const row = data.find((r, i) => getRowId(r, i) === rowId);
2971
+ if (!row) return;
2972
+ const col = columns.find((c) => c.key === columnKey);
2973
+ if (!col) return;
2974
+ let val;
2975
+ if (col.getEditValue) {
2976
+ val = col.getEditValue(row);
2977
+ } else if (col.accessor) {
2978
+ val = col.accessor(row);
2979
+ } else {
2980
+ val = "";
2981
+ }
2982
+ setDraftValues((prev) => ({
2983
+ ...prev,
2984
+ [rowId]: { ...prev[rowId], [columnKey]: val ?? "" }
2985
+ }));
2986
+ },
2987
+ [data, columns, getRowId]
2988
+ );
2960
2989
  const handleEditCellClick = React15.useCallback(
2961
2990
  (rowId, columnKey) => {
2962
- onEditingCellChange?.({ rowId, columnKey });
2991
+ if (isMultiCellMode) {
2992
+ const next = {
2993
+ ...editingCells,
2994
+ [rowId]: { ...editingCells[rowId], [columnKey]: true }
2995
+ };
2996
+ onEditingCellsChange?.(next);
2997
+ seedDraft(rowId, columnKey);
2998
+ } else {
2999
+ onEditingCellChange?.({ rowId, columnKey });
3000
+ }
2963
3001
  },
2964
- [onEditingCellChange]
3002
+ [
3003
+ isMultiCellMode,
3004
+ editingCells,
3005
+ onEditingCellsChange,
3006
+ onEditingCellChange,
3007
+ seedDraft
3008
+ ]
2965
3009
  );
2966
3010
  const handleCellSave = React15.useCallback(() => {
2967
- if (editingCell != null && draftValue != null) {
2968
- onSave?.(editingCell.rowId, editingCell.columnKey, draftValue);
2969
- onEditingCellChange?.(null);
3011
+ if (isMultiCellMode) {
3012
+ const changes = [];
3013
+ for (const rowId of Object.keys(draftValues)) {
3014
+ for (const columnKey of Object.keys(draftValues[rowId])) {
3015
+ changes.push({
3016
+ rowId,
3017
+ columnKey,
3018
+ value: draftValues[rowId][columnKey]
3019
+ });
3020
+ }
3021
+ }
3022
+ onSaveAll?.(changes);
3023
+ onEditingCellsChange?.({});
3024
+ setDraftValues({});
3025
+ } else {
3026
+ if (editingCell != null && draftValue != null) {
3027
+ onSave?.(editingCell.rowId, editingCell.columnKey, draftValue);
3028
+ onEditingCellChange?.(null);
3029
+ }
2970
3030
  }
2971
- }, [editingCell, draftValue, onSave, onEditingCellChange]);
3031
+ }, [
3032
+ isMultiCellMode,
3033
+ draftValues,
3034
+ onSaveAll,
3035
+ onEditingCellsChange,
3036
+ editingCell,
3037
+ draftValue,
3038
+ onSave,
3039
+ onEditingCellChange
3040
+ ]);
2972
3041
  const handleCellCancel = React15.useCallback(() => {
3042
+ if (isMultiCellMode) {
3043
+ onEditingCellsChange?.({});
3044
+ setDraftValues({});
3045
+ } else {
3046
+ onEditingCellChange?.(null);
3047
+ }
2973
3048
  onCancel?.();
2974
- onEditingCellChange?.(null);
2975
- }, [onCancel, onEditingCellChange]);
3049
+ }, [isMultiCellMode, onEditingCellsChange, onEditingCellChange, onCancel]);
2976
3050
  const handleDeleteSelected = React15.useCallback(() => {
2977
3051
  if (!onDeleteSelected) return;
2978
3052
  const ids = Object.keys(selectedRowIds).filter((id) => selectedRowIds[id]);
@@ -3007,12 +3081,12 @@ function TableInner({
3007
3081
  ]
3008
3082
  }
3009
3083
  );
3010
- const sizeClasses = {
3084
+ const sizeClasses2 = {
3011
3085
  sm: "py-1.5 px-2 text-xs",
3012
3086
  md: "py-2 px-3 text-sm",
3013
3087
  lg: "py-3 px-4 text-base"
3014
3088
  };
3015
- const sizeClass = sizeClasses[size];
3089
+ const sizeClass = sizeClasses2[size];
3016
3090
  const alignClasses = {
3017
3091
  left: "text-left",
3018
3092
  center: "text-center",
@@ -3052,7 +3126,7 @@ function TableInner({
3052
3126
  id: tableId,
3053
3127
  "aria-describedby": caption ? captionId : void 0,
3054
3128
  className: cn(
3055
- "border-collapse bg-[var(--kz-component-table-surface)]",
3129
+ "border-separate border-spacing-0 bg-[var(--kz-component-table-surface)]",
3056
3130
  horizontalScroll ? "min-w-full w-max" : "w-full",
3057
3131
  tableClassName
3058
3132
  ),
@@ -3190,7 +3264,9 @@ function TableInner({
3190
3264
  const rowId = getRowId(row, index);
3191
3265
  const isSelected = !!selectedRowIds[rowId];
3192
3266
  const isSticky = getRowSticky?.(row, index) ?? false;
3193
- const hasEditingCell = editingCell != null && editingCell.rowId === rowId;
3267
+ const hasEditingCell = isMultiCellMode ? editingCells[rowId] != null && Object.keys(editingCells[rowId]).some(
3268
+ (k) => editingCells[rowId][k]
3269
+ ) : editingCell != null && editingCell.rowId === rowId;
3194
3270
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3195
3271
  "tr",
3196
3272
  {
@@ -3226,9 +3302,19 @@ function TableInner({
3226
3302
  if (col.minWidth) style.minWidth = col.minWidth;
3227
3303
  if (col.maxWidth) style.maxWidth = col.maxWidth;
3228
3304
  const align = col.align ?? "left";
3229
- const isCellEditing = editingCell != null && editingCell.rowId === rowId && editingCell.columnKey === col.key;
3305
+ const isCellEditing = isMultiCellMode ? !!editingCells[rowId]?.[col.key] : editingCell != null && editingCell.rowId === rowId && editingCell.columnKey === col.key;
3230
3306
  if (isCellEditing) {
3231
- const onChange = (v) => setDraftValue(v);
3307
+ const cellDraft = isMultiCellMode ? draftValues[rowId]?.[col.key] ?? "" : draftValue ?? "";
3308
+ const onChange = (v) => {
3309
+ if (isMultiCellMode) {
3310
+ setDraftValues((prev) => ({
3311
+ ...prev,
3312
+ [rowId]: { ...prev[rowId], [col.key]: v }
3313
+ }));
3314
+ } else {
3315
+ setDraftValue(v);
3316
+ }
3317
+ };
3232
3318
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3233
3319
  "td",
3234
3320
  {
@@ -3238,17 +3324,13 @@ function TableInner({
3238
3324
  alignClasses[align]
3239
3325
  ),
3240
3326
  style,
3241
- children: col.editCell ? col.editCell(
3242
- row,
3243
- draftValue ?? "",
3244
- onChange
3245
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3327
+ children: col.editCell ? col.editCell(row, cellDraft, onChange) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3246
3328
  TextInput,
3247
3329
  {
3248
3330
  label: "",
3249
3331
  placeHolder: "",
3250
- value: String(draftValue ?? ""),
3251
- onValueChange: (v) => setDraftValue(v),
3332
+ value: String(cellDraft ?? ""),
3333
+ onValueChange: (v) => onChange(v),
3252
3334
  size: "sm" /* Sm */,
3253
3335
  variant: "default" /* Default */
3254
3336
  }
@@ -3312,7 +3394,9 @@ function TableInner({
3312
3394
  )
3313
3395
  }
3314
3396
  ),
3315
- (pagination && pageRange && onPageChange || someSelected && onDeleteSelected || editingCell != null) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "kz-table-footer flex items-center border-t border-[var(--kz-component-table-row-border)] bg-[var(--kz-component-table-footer-bg)] px-[var(--kz-space-4)] py-[var(--kz-space-3)]", children: [
3397
+ (pagination && pageRange && onPageChange || someSelected && onDeleteSelected || editingCell != null || isMultiCellMode && Object.keys(editingCells).some(
3398
+ (rid) => Object.values(editingCells[rid]).some(Boolean)
3399
+ )) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "kz-table-footer flex items-center border-t border-[var(--kz-component-table-row-border)] bg-[var(--kz-component-table-footer-bg)] px-[var(--kz-space-4)] py-[var(--kz-space-3)]", children: [
3316
3400
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center gap-[var(--kz-space-2)] shrink-0", children: someSelected && onDeleteSelected && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3317
3401
  Button,
3318
3402
  {
@@ -3426,7 +3510,9 @@ function TableInner({
3426
3510
  }
3427
3511
  )
3428
3512
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex-1" }),
3429
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center gap-[var(--kz-space-2)] shrink-0 ml-[var(--kz-space-3)]", children: editingCell != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
3513
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center gap-[var(--kz-space-2)] shrink-0 ml-[var(--kz-space-3)]", children: (editingCell != null || isMultiCellMode && Object.keys(editingCells).some(
3514
+ (rid) => Object.values(editingCells[rid]).some(Boolean)
3515
+ )) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
3430
3516
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3431
3517
  Button,
3432
3518
  {
@@ -6552,6 +6638,303 @@ var Card = React31.forwardRef(
6552
6638
  );
6553
6639
  Card.displayName = "Card";
6554
6640
 
6641
+ // src/components/sql-editor/SqlEditor.tsx
6642
+ var React32 = __toESM(require("react"));
6643
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6644
+ var sizeClasses = {
6645
+ sm: {
6646
+ toolbar: "px-2 py-1",
6647
+ textarea: "px-2 py-1.5 text-xs leading-4",
6648
+ status: "px-2 py-1 text-[11px]",
6649
+ result: "text-xs",
6650
+ resultCell: "px-2 py-1"
6651
+ },
6652
+ md: {
6653
+ toolbar: "px-3 py-1.5",
6654
+ textarea: "px-3 py-3 text-sm leading-[22px]",
6655
+ status: "px-3 py-1 text-xs",
6656
+ result: "text-[13px]",
6657
+ resultCell: "px-3 py-1.5"
6658
+ },
6659
+ lg: {
6660
+ toolbar: "px-4 py-2",
6661
+ textarea: "px-4 py-3.5 text-base leading-6",
6662
+ status: "px-4 py-1.5 text-sm",
6663
+ result: "text-sm",
6664
+ resultCell: "px-4 py-2"
6665
+ }
6666
+ };
6667
+ function SqlEditorInner({
6668
+ value,
6669
+ onValueChange,
6670
+ onExecute,
6671
+ result,
6672
+ placeholder = "SELECT * FROM ...",
6673
+ toolbarLabel = "Query",
6674
+ runButtonLabel = "Run",
6675
+ rows = 5,
6676
+ size = "md",
6677
+ disabled = false,
6678
+ loading = false,
6679
+ resultsMaxHeight = "300px",
6680
+ toolbarRight,
6681
+ className
6682
+ }, ref) {
6683
+ const textareaRef = React32.useRef(null);
6684
+ const sc = sizeClasses[size];
6685
+ const handleRun = React32.useCallback(() => {
6686
+ if (!disabled && !loading) {
6687
+ onExecute(value);
6688
+ }
6689
+ }, [value, onExecute, disabled, loading]);
6690
+ const handleKeyDown = React32.useCallback(
6691
+ (e) => {
6692
+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
6693
+ e.preventDefault();
6694
+ handleRun();
6695
+ }
6696
+ if (e.key === "Tab") {
6697
+ e.preventDefault();
6698
+ const textarea = e.currentTarget;
6699
+ const start = textarea.selectionStart;
6700
+ const end = textarea.selectionEnd;
6701
+ const newValue = value.substring(0, start) + " " + value.substring(end);
6702
+ onValueChange(newValue);
6703
+ requestAnimationFrame(() => {
6704
+ textarea.selectionStart = textarea.selectionEnd = start + 2;
6705
+ });
6706
+ }
6707
+ },
6708
+ [handleRun, value, onValueChange]
6709
+ );
6710
+ const hasResult = result != null;
6711
+ const hasRows = hasResult && !result.error && result.rows.length > 0;
6712
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref, className: cn("kz-sql-editor-root", className), children: [
6713
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cn("kz-sql-editor-toolbar", sc.toolbar), children: [
6714
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "kz-sql-editor-toolbar-label", children: toolbarLabel }),
6715
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
6716
+ toolbarRight,
6717
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6718
+ Button,
6719
+ {
6720
+ variant: "primary" /* Primary */,
6721
+ size: size === "lg" ? "md" /* Md */ : "sm" /* Sm */,
6722
+ onClick: handleRun,
6723
+ disabled: disabled || loading,
6724
+ children: [
6725
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "chevron-right" /* ChevronRight */, size: 14, color: "currentColor" }),
6726
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ml-1", children: loading ? "Running\u2026" : runButtonLabel })
6727
+ ]
6728
+ }
6729
+ )
6730
+ ] })
6731
+ ] }),
6732
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6733
+ "textarea",
6734
+ {
6735
+ ref: textareaRef,
6736
+ className: cn("kz-sql-editor-textarea", sc.textarea),
6737
+ value,
6738
+ onChange: (e) => onValueChange(e.target.value),
6739
+ onKeyDown: handleKeyDown,
6740
+ placeholder,
6741
+ spellCheck: false,
6742
+ autoCapitalize: "off",
6743
+ autoCorrect: "off",
6744
+ rows,
6745
+ disabled
6746
+ }
6747
+ ),
6748
+ hasResult && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cn("kz-sql-editor-status", sc.status), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6749
+ "span",
6750
+ {
6751
+ className: cn(
6752
+ "kz-sql-editor-status-text",
6753
+ result.error && "kz-sql-editor-status-text--error",
6754
+ !result.error && "kz-sql-editor-status-text--success"
6755
+ ),
6756
+ children: result.message
6757
+ }
6758
+ ) }),
6759
+ hasRows && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6760
+ "div",
6761
+ {
6762
+ className: "kz-sql-editor-results",
6763
+ style: { maxHeight: resultsMaxHeight },
6764
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("table", { children: [
6765
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: result.columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("th", { className: sc.resultCell, children: col }, col)) }) }),
6766
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tbody", { children: result.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: result.columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: sc.resultCell, children: row[col] == null ? "" : String(row[col]) }, col)) }, i)) })
6767
+ ] })
6768
+ }
6769
+ ),
6770
+ hasResult && !result.error && result.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "kz-sql-editor-empty", children: "No rows returned" })
6771
+ ] });
6772
+ }
6773
+ var SqlEditor = React32.forwardRef(SqlEditorInner);
6774
+ SqlEditor.displayName = "SqlEditor";
6775
+
6776
+ // src/components/qr-renderer/QrRenderer.tsx
6777
+ var React33 = __toESM(require("react"));
6778
+ var import_qrcode = __toESM(require("qrcode"));
6779
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6780
+ function resolveImageSrc(image) {
6781
+ if (image.startsWith("data:") || image.startsWith("http")) {
6782
+ return image;
6783
+ }
6784
+ return `data:image/png;base64,${image}`;
6785
+ }
6786
+ function QrRendererInner(props, ref) {
6787
+ const {
6788
+ size = 200,
6789
+ alt = "QR Code",
6790
+ logo,
6791
+ logoScale = 0.2,
6792
+ label,
6793
+ caption,
6794
+ debug,
6795
+ showDebug = false,
6796
+ foregroundColor = "#000000",
6797
+ backgroundColor = "#ffffff",
6798
+ downloadable = false,
6799
+ downloadFilename = "qr-code.png",
6800
+ className
6801
+ } = props;
6802
+ const [generatedSrc, setGeneratedSrc] = React33.useState(null);
6803
+ const isDataMode = "data" in props && !!props.data;
6804
+ const data = isDataMode ? props.data : void 0;
6805
+ const image = !isDataMode && "image" in props ? props.image : void 0;
6806
+ const errorCorrectionLevel = isDataMode && "errorCorrectionLevel" in props ? props.errorCorrectionLevel : void 0;
6807
+ React33.useEffect(() => {
6808
+ if (!isDataMode || !data) {
6809
+ setGeneratedSrc(null);
6810
+ return;
6811
+ }
6812
+ let cancelled = false;
6813
+ import_qrcode.default.toDataURL(data, {
6814
+ width: size,
6815
+ margin: 1,
6816
+ errorCorrectionLevel: errorCorrectionLevel || "M",
6817
+ color: {
6818
+ dark: foregroundColor,
6819
+ light: backgroundColor
6820
+ }
6821
+ }).then((url) => {
6822
+ if (!cancelled) setGeneratedSrc(url);
6823
+ }).catch(() => {
6824
+ if (!cancelled) setGeneratedSrc(null);
6825
+ });
6826
+ return () => {
6827
+ cancelled = true;
6828
+ };
6829
+ }, [
6830
+ data,
6831
+ size,
6832
+ foregroundColor,
6833
+ backgroundColor,
6834
+ errorCorrectionLevel,
6835
+ isDataMode
6836
+ ]);
6837
+ const imgSrc = isDataMode ? generatedSrc : image ? resolveImageSrc(image) : null;
6838
+ const logoSize = Math.round(size * logoScale);
6839
+ const handleDownload = React33.useCallback(() => {
6840
+ if (!imgSrc) return;
6841
+ const link = document.createElement("a");
6842
+ link.href = imgSrc;
6843
+ link.download = downloadFilename;
6844
+ document.body.appendChild(link);
6845
+ link.click();
6846
+ document.body.removeChild(link);
6847
+ }, [imgSrc, downloadFilename]);
6848
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { ref, className: cn("kz-qr-renderer-root", className), children: [
6849
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6850
+ "div",
6851
+ {
6852
+ className: "kz-qr-renderer-image-container",
6853
+ style: {
6854
+ width: size,
6855
+ height: size,
6856
+ backgroundColor: backgroundColor || void 0
6857
+ },
6858
+ children: [
6859
+ imgSrc ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6860
+ "img",
6861
+ {
6862
+ src: imgSrc,
6863
+ alt,
6864
+ width: size,
6865
+ height: size,
6866
+ className: "kz-qr-renderer-image",
6867
+ style: {
6868
+ width: size,
6869
+ height: size
6870
+ }
6871
+ }
6872
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6873
+ "div",
6874
+ {
6875
+ style: {
6876
+ width: size,
6877
+ height: size,
6878
+ display: "flex",
6879
+ alignItems: "center",
6880
+ justifyContent: "center",
6881
+ color: "var(--kz-component-input-placeholder)",
6882
+ fontSize: 12
6883
+ },
6884
+ children: isDataMode ? "Generating\u2026" : "No image"
6885
+ }
6886
+ ),
6887
+ logo && imgSrc && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6888
+ "div",
6889
+ {
6890
+ className: "kz-qr-renderer-logo",
6891
+ style: {
6892
+ width: logoSize,
6893
+ height: logoSize
6894
+ },
6895
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6896
+ "img",
6897
+ {
6898
+ src: resolveImageSrc(logo),
6899
+ alt: "Logo",
6900
+ width: logoSize,
6901
+ height: logoSize,
6902
+ className: "kz-qr-renderer-logo-img"
6903
+ }
6904
+ )
6905
+ }
6906
+ )
6907
+ ]
6908
+ }
6909
+ ),
6910
+ (label || caption || downloadable) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kz-qr-renderer-footer", children: [
6911
+ label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kz-qr-renderer-label", children: label }),
6912
+ caption && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kz-qr-renderer-caption", children: caption }),
6913
+ downloadable && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6914
+ Button,
6915
+ {
6916
+ variant: "outline" /* Outline */,
6917
+ size: "sm" /* Sm */,
6918
+ onClick: handleDownload,
6919
+ children: [
6920
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "arrow-down" /* ArrowDown */, size: 14, color: "currentColor" }),
6921
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ml-1", children: "Download" })
6922
+ ]
6923
+ }
6924
+ )
6925
+ ] }),
6926
+ showDebug && debug && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kz-qr-renderer-debug", children: [
6927
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kz-qr-renderer-debug-title", children: "Debug Info" }),
6928
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kz-qr-renderer-debug-grid", children: Object.entries(debug).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(React33.Fragment, { children: [
6929
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kz-qr-renderer-debug-key", children: key }),
6930
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kz-qr-renderer-debug-value", children: typeof value === "boolean" ? value ? "true" : "false" : String(value) })
6931
+ ] }, key)) })
6932
+ ] })
6933
+ ] });
6934
+ }
6935
+ var QrRenderer = React33.forwardRef(QrRendererInner);
6936
+ QrRenderer.displayName = "QrRenderer";
6937
+
6555
6938
  // src/tokens/contract/token-keys.ts
6556
6939
  var TOKEN_KEYS = [
6557
6940
  // Brand
@@ -6966,6 +7349,7 @@ var TOKEN_KEYS = [
6966
7349
  ModalTrigger,
6967
7350
  NumberInput,
6968
7351
  OverrideMode,
7352
+ QrRenderer,
6969
7353
  RadioButton,
6970
7354
  RadioSize,
6971
7355
  Select,
@@ -6973,6 +7357,7 @@ var TOKEN_KEYS = [
6973
7357
  SidePanel,
6974
7358
  SidePanelTrigger,
6975
7359
  Sidesheet,
7360
+ SqlEditor,
6976
7361
  TOKEN_KEYS,
6977
7362
  Table,
6978
7363
  Tabs,