@kilnonedre/foundation 0.0.10 → 0.0.11

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.ts CHANGED
@@ -136,16 +136,16 @@ type SemanticColorToken = {
136
136
  };
137
137
  declare const getSemanticColor: (semanticColor: EnumSemanticColor, variant: EnumVariant) => SemanticColorToken;
138
138
 
139
- interface ConfigProp$g {
139
+ interface ConfigProp$h {
140
140
  semanticColor?: EnumSemanticColor;
141
141
  variant?: EnumVariant;
142
142
  children?: ReactNode;
143
143
  className?: string;
144
144
  }
145
145
 
146
- declare const Badge: ({ semanticColor, variant, children, className, }: ConfigProp$g) => react_jsx_runtime.JSX.Element;
146
+ declare const Badge: ({ semanticColor, variant, children, className, }: ConfigProp$h) => react_jsx_runtime.JSX.Element;
147
147
 
148
- interface ConfigProp$f {
148
+ interface ConfigProp$g {
149
149
  semanticColor?: EnumSemanticColor;
150
150
  variant?: EnumVariant;
151
151
  children?: ReactNode;
@@ -157,15 +157,15 @@ interface ConfigProp$f {
157
157
  type?: 'button' | 'submit' | 'reset';
158
158
  }
159
159
 
160
- declare const Button: ({ semanticColor, variant, children, className, onClick, disabled, type, size, loading, }: ConfigProp$f) => react_jsx_runtime.JSX.Element;
160
+ declare const Button: ({ semanticColor, variant, children, className, onClick, disabled, type, size, loading, }: ConfigProp$g) => react_jsx_runtime.JSX.Element;
161
161
 
162
- interface ConfigProp$e {
162
+ interface ConfigProp$f {
163
163
  options: Array<CommonOption>;
164
164
  value?: string | null;
165
165
  onChange: (_v: string) => void;
166
166
  }
167
167
 
168
- declare const CheckboxSingleList: (props: ConfigProp$e) => react_jsx_runtime.JSX.Element;
168
+ declare const CheckboxSingleList: (props: ConfigProp$f) => react_jsx_runtime.JSX.Element;
169
169
 
170
170
  interface ConfigListRespT<T> {
171
171
  items: Array<T>;
@@ -193,7 +193,7 @@ type AdvancedFilterCtx = {
193
193
  draftFilters: Record<string, unknown>;
194
194
  setDraftFilters: (_updater: (_prev: Record<string, unknown>) => Record<string, unknown>) => void;
195
195
  };
196
- type ConfigProp$d<T, P> = {
196
+ type ConfigProp$e<T, P> = {
197
197
  columns: Array<ColumnDef<T>>;
198
198
  renderList: (_params: P) => Promise<ConfigApiRespT<ConfigListRespT<T>>>;
199
199
  getRowId?: (_row: T) => string;
@@ -221,7 +221,7 @@ declare const KeywordSearchBar: (props: ConfigProps$1) => react_jsx_runtime.JSX.
221
221
 
222
222
  declare const TableEmpty: () => react_jsx_runtime.JSX.Element;
223
223
 
224
- interface ConfigProp$c {
224
+ interface ConfigProp$d {
225
225
  id?: string;
226
226
  mode: EnumFormMode;
227
227
  children: ReactNode;
@@ -235,16 +235,16 @@ interface ConfigProp$c {
235
235
  onOpenChange: (_nextOpen: boolean) => void;
236
236
  }
237
237
 
238
- declare const TableFormDialog: (props: ConfigProp$c) => react_jsx_runtime.JSX.Element;
238
+ declare const TableFormDialog: (props: ConfigProp$d) => react_jsx_runtime.JSX.Element;
239
239
 
240
- interface ConfigProp$b {
240
+ interface ConfigProp$c {
241
241
  text: string;
242
242
  className?: ClassValue;
243
243
  }
244
244
 
245
- declare const TableHeaderText: (props: ConfigProp$b) => react_jsx_runtime.JSX.Element;
245
+ declare const TableHeaderText: (props: ConfigProp$c) => react_jsx_runtime.JSX.Element;
246
246
 
247
- interface ConfigProp$a {
247
+ interface ConfigProp$b {
248
248
  totalPage: number;
249
249
  size: number;
250
250
  sizeList: Array<number>;
@@ -253,18 +253,18 @@ interface ConfigProp$a {
253
253
  onUpdateSize: (_size: number) => void;
254
254
  }
255
255
 
256
- declare const TablePagination: (props: ConfigProp$a) => react_jsx_runtime.JSX.Element;
256
+ declare const TablePagination: (props: ConfigProp$b) => react_jsx_runtime.JSX.Element;
257
257
 
258
- interface ConfigProp$9 {
258
+ interface ConfigProp$a {
259
259
  text?: string | number;
260
260
  wrap?: boolean;
261
261
  }
262
262
 
263
- declare const TableText: (props: ConfigProp$9) => react_jsx_runtime.JSX.Element;
263
+ declare const TableText: (props: ConfigProp$a) => react_jsx_runtime.JSX.Element;
264
264
 
265
- declare const DataTable: <T, P>(props: ConfigProp$d<T, P>) => react_jsx_runtime.JSX.Element;
265
+ declare const DataTable: <T, P>(props: ConfigProp$e<T, P>) => react_jsx_runtime.JSX.Element;
266
266
 
267
- interface ConfigProp$8 {
267
+ interface ConfigProp$9 {
268
268
  children: ReactNode;
269
269
  title?: string;
270
270
  content?: ReactNode;
@@ -273,9 +273,9 @@ interface ConfigProp$8 {
273
273
  onConfirm?: () => void | Promise<void>;
274
274
  }
275
275
 
276
- declare const Dialog: (props: ConfigProp$8) => react_jsx_runtime.JSX.Element;
276
+ declare const Dialog: (props: ConfigProp$9) => react_jsx_runtime.JSX.Element;
277
277
 
278
- interface ConfigProp$7<T> {
278
+ interface ConfigProp$8<T> {
279
279
  columns: Array<ColumnDef<T>>;
280
280
  list?: Array<T>;
281
281
  enableRowSelection?: boolean;
@@ -284,7 +284,7 @@ interface ConfigProp$7<T> {
284
284
  navigate?: (_id: UUID) => void;
285
285
  }
286
286
 
287
- declare const DisplayTable: <T>(props: ConfigProp$7<T>) => react_jsx_runtime.JSX.Element;
287
+ declare const DisplayTable: <T>(props: ConfigProp$8<T>) => react_jsx_runtime.JSX.Element;
288
288
 
289
289
  interface ConfigCascaderOption {
290
290
  label: string;
@@ -321,7 +321,7 @@ declare const DropdownCascaderMulti: ({ value, ...props }: ConfigDropdownCascade
321
321
 
322
322
  declare const DropdownCascaderSingle: (props: ConfigDropdownCascaderSingleProp) => react_jsx_runtime.JSX.Element;
323
323
 
324
- interface ConfigProp$6<T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>> {
324
+ interface ConfigProp$7<T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>> {
325
325
  id: string;
326
326
  name: TName;
327
327
  label: string;
@@ -336,16 +336,16 @@ interface ConfigProp$6<T extends FieldValues, TName extends FieldPath<T> = Field
336
336
  }) => ReactNode;
337
337
  }
338
338
 
339
- declare const FieldController: <T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>>({ required, ...props }: ConfigProp$6<T, TName>) => react_jsx_runtime.JSX.Element;
339
+ declare const FieldController: <T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>>({ required, ...props }: ConfigProp$7<T, TName>) => react_jsx_runtime.JSX.Element;
340
340
 
341
- interface ConfigProp$5 {
341
+ interface ConfigProp$6 {
342
342
  className?: string;
343
343
  children: ReactNode;
344
344
  }
345
345
 
346
- declare const FieldGroup: (props: ConfigProp$5) => react_jsx_runtime.JSX.Element;
346
+ declare const FieldGroup: (props: ConfigProp$6) => react_jsx_runtime.JSX.Element;
347
347
 
348
- interface ConfigProp$4 {
348
+ interface ConfigProp$5 {
349
349
  id: string;
350
350
  name: string;
351
351
  required?: boolean;
@@ -356,9 +356,9 @@ interface ConfigProp$4 {
356
356
  children?: ReactNode;
357
357
  }
358
358
 
359
- declare const FieldPlain: ({ required, mode, ...props }: ConfigProp$4) => react_jsx_runtime.JSX.Element;
359
+ declare const FieldPlain: ({ required, mode, ...props }: ConfigProp$5) => react_jsx_runtime.JSX.Element;
360
360
 
361
- interface ConfigProp$3 {
361
+ interface ConfigProp$4 {
362
362
  id?: string;
363
363
  name: string;
364
364
  value?: string | number | null;
@@ -367,9 +367,9 @@ interface ConfigProp$3 {
367
367
  render?: ReactNode;
368
368
  }
369
369
 
370
- declare const FieldText: ({ id, name, value, placeholder, required, render, }: ConfigProp$3) => react_jsx_runtime.JSX.Element;
370
+ declare const FieldText: ({ id, name, value, placeholder, required, render, }: ConfigProp$4) => react_jsx_runtime.JSX.Element;
371
371
 
372
- interface ConfigProp$2 {
372
+ interface ConfigProp$3 {
373
373
  value: string;
374
374
  onValueChange: (_val: string) => void;
375
375
  onLabelChange?: (_val: string) => void;
@@ -377,9 +377,9 @@ interface ConfigProp$2 {
377
377
  optionList: Array<CommonOption>;
378
378
  }
379
379
 
380
- declare const FormSelect: (props: ConfigProp$2) => react_jsx_runtime.JSX.Element;
380
+ declare const FormSelect: (props: ConfigProp$3) => react_jsx_runtime.JSX.Element;
381
381
 
382
- interface ConfigProp$1 {
382
+ interface ConfigProp$2 {
383
383
  value?: Date;
384
384
  onChange: (_value?: Date) => void;
385
385
  id?: string;
@@ -388,7 +388,7 @@ interface ConfigProp$1 {
388
388
  timePlaceholder?: string;
389
389
  }
390
390
 
391
- declare const FormTimePicker: (props: ConfigProp$1) => react_jsx_runtime.JSX.Element;
391
+ declare const FormTimePicker: (props: ConfigProp$2) => react_jsx_runtime.JSX.Element;
392
392
 
393
393
  interface ConfigProps {
394
394
  value?: Array<string>;
@@ -409,12 +409,20 @@ declare const Provider: ({ children }: {
409
409
  children: React.ReactNode;
410
410
  }) => react_jsx_runtime.JSX.Element;
411
411
 
412
- interface ConfigProp {
412
+ interface ConfigProp$1 {
413
413
  children: ReactNode;
414
414
  className?: ClassValue;
415
415
  }
416
416
 
417
- declare const Text: (props: ConfigProp) => react_jsx_runtime.JSX.Element;
417
+ declare const Text: (props: ConfigProp$1) => react_jsx_runtime.JSX.Element;
418
+
419
+ interface ConfigProp<T extends Record<string, unknown>, K extends keyof T> {
420
+ key: K;
421
+ label: string;
422
+ render?: (_value: T[K], _row: T) => ReactNode;
423
+ }
424
+
425
+ declare const buildColumn: <T extends Record<string, unknown>, K extends keyof T>(props: ConfigProp<T, K>) => ColumnDef<T>;
418
426
 
419
427
  interface ConfigRenderBase<T extends FieldValues> {
420
428
  mode?: EnumFormMode;
@@ -488,4 +496,4 @@ declare const zCoerceNumberOptional: (label: string, min?: number, max?: number)
488
496
  declare const zDecimal: (label: string, min?: number, max?: number) => z.ZodString;
489
497
  declare const zDecimalOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
490
498
 
491
- export { Badge, Button, CheckboxSingleList, type CommonObject, type CommonOption, type ConfigCascaderOption, type ConfigDropdownCascaderMultiProp, type ConfigDropdownCascaderSingleProp, type ConfigRenderBase, type ConfigRenderPasswordInput, DataTable, Dialog, DisplayTable, DropdownCascaderMulti, DropdownCascaderSingle, EnumApprovalStatus, EnumApprovalStatusLabel, EnumApprovalView, EnumApprovalViewLabel, EnumEntityStatus, EnumEntityStatusLabel, EnumFormMode, EnumFormModeLabel, EnumGenderType, EnumGenderTypeLabel, EnumMapProvider, EnumMapProviderLabel, EnumOrderStatus, EnumOrderStatusLabel, EnumPublishMethod, EnumPublishMethodLabel, EnumSemanticColor, EnumSemanticColorLabel, EnumStorageMethod, EnumStorageMethodLabel, EnumVariant, EnumVariantLabel, FieldController, FieldGroup, FieldPlain, FieldText, FormSelect, FormTimePicker, KeywordSearchBar, MediaUploader, Provider, type SemanticColorToken, TableEmpty, TableFormDialog, TableHeaderText, TablePagination, TableText, Text, type UUID, boolToText, cn, emptyToUndefined, enumApprovalStatusOptions, enumApprovalViewOptions, enumEntityStatusOptions, enumFormModeOptions, enumGenderTypeOptions, enumMapProviderOptions, enumOrderStatusOptions, enumPublishMethodOptions, enumSemanticColorOptions, enumStorageMethodOptions, enumToOptions, enumValues, enumVariantOptions, formatDateTime, formatDecimal, genUuid, getOptionMap, getSemanticColor, getSuccessMessage, isEmpty, isFormData, isValidEmail, isValidURL, renderBody, renderCascaderNodes, renderConfirmFooter, renderFooter, renderInput, renderPasswordInput, renderTextarea, zBool, zCoerceNumber, zCoerceNumberOptional, zDate, zDateOptional, zDecimal, zDecimalOptional, zEmail, zEnumNullable, zEnumNullableOptional, zEnumNullableRequired, zEnumOptional, zEnumRequired, zId, zIdCard, zIdCardOptional, zIds, zImageId, zImageIdRequired, zImageIds, zImageIdsOptional, zNumber, zNumberOptional, zPhone, zTextOptional, zTextRequired, zTexts };
499
+ export { Badge, Button, CheckboxSingleList, type CommonObject, type CommonOption, type ConfigCascaderOption, type ConfigDropdownCascaderMultiProp, type ConfigDropdownCascaderSingleProp, type ConfigRenderBase, type ConfigRenderPasswordInput, DataTable, Dialog, DisplayTable, DropdownCascaderMulti, DropdownCascaderSingle, EnumApprovalStatus, EnumApprovalStatusLabel, EnumApprovalView, EnumApprovalViewLabel, EnumEntityStatus, EnumEntityStatusLabel, EnumFormMode, EnumFormModeLabel, EnumGenderType, EnumGenderTypeLabel, EnumMapProvider, EnumMapProviderLabel, EnumOrderStatus, EnumOrderStatusLabel, EnumPublishMethod, EnumPublishMethodLabel, EnumSemanticColor, EnumSemanticColorLabel, EnumStorageMethod, EnumStorageMethodLabel, EnumVariant, EnumVariantLabel, FieldController, FieldGroup, FieldPlain, FieldText, FormSelect, FormTimePicker, KeywordSearchBar, MediaUploader, Provider, type SemanticColorToken, TableEmpty, TableFormDialog, TableHeaderText, TablePagination, TableText, Text, type UUID, boolToText, buildColumn, cn, emptyToUndefined, enumApprovalStatusOptions, enumApprovalViewOptions, enumEntityStatusOptions, enumFormModeOptions, enumGenderTypeOptions, enumMapProviderOptions, enumOrderStatusOptions, enumPublishMethodOptions, enumSemanticColorOptions, enumStorageMethodOptions, enumToOptions, enumValues, enumVariantOptions, formatDateTime, formatDecimal, genUuid, getOptionMap, getSemanticColor, getSuccessMessage, isEmpty, isFormData, isValidEmail, isValidURL, renderBody, renderCascaderNodes, renderConfirmFooter, renderFooter, renderInput, renderPasswordInput, renderTextarea, zBool, zCoerceNumber, zCoerceNumberOptional, zDate, zDateOptional, zDecimal, zDecimalOptional, zEmail, zEnumNullable, zEnumNullableOptional, zEnumNullableRequired, zEnumOptional, zEnumRequired, zId, zIdCard, zIdCardOptional, zIds, zImageId, zImageIdRequired, zImageIds, zImageIdsOptional, zNumber, zNumberOptional, zPhone, zTextOptional, zTextRequired, zTexts };
package/dist/index.js CHANGED
@@ -3391,6 +3391,23 @@ import { jsx as jsx47 } from "react/jsx-runtime";
3391
3391
  var Provider = ({ children }) => {
3392
3392
  return /* @__PURE__ */ jsx47(TooltipProvider, { children });
3393
3393
  };
3394
+
3395
+ // src/render/column/build-column/index.tsx
3396
+ import { jsx as jsx48 } from "react/jsx-runtime";
3397
+ var buildColumn = (props) => {
3398
+ const { key, label, render } = props;
3399
+ return {
3400
+ accessorKey: key,
3401
+ header: () => /* @__PURE__ */ jsx48(TableHeaderText, { text: label }),
3402
+ cell: ({ row }) => {
3403
+ const value = row.original[key];
3404
+ return render ? render(value, row.original) : /* @__PURE__ */ jsx48(TableText, { text: String(value ?? "") });
3405
+ },
3406
+ meta: {
3407
+ label
3408
+ }
3409
+ };
3410
+ };
3394
3411
  export {
3395
3412
  Badge2 as Badge,
3396
3413
  Button2 as Button,
@@ -3438,6 +3455,7 @@ export {
3438
3455
  TableText,
3439
3456
  Text,
3440
3457
  boolToText,
3458
+ buildColumn,
3441
3459
  cn2 as cn,
3442
3460
  emptyToUndefined,
3443
3461
  enumApprovalStatusOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kilnonedre/foundation",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "description": "Kilnonedre frontend foundation package",
6
6
  "type": "module",