@k3-universe/react-kit 0.0.43 → 0.0.45

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.js CHANGED
@@ -9195,7 +9195,7 @@ function TableHead({ className, ...props2 }) {
9195
9195
  {
9196
9196
  "data-slot": "table-head",
9197
9197
  className: cn$1(
9198
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
9198
+ "bg-primary text-white h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
9199
9199
  className
9200
9200
  ),
9201
9201
  ...props2
@@ -22532,6 +22532,15 @@ function DateField({
22532
22532
  onChange,
22533
22533
  className
22534
22534
  }) {
22535
+ const parseDateValueForInput = (date2) => {
22536
+ if (date2 instanceof Date) {
22537
+ return date2.toISOString().split("T")[0];
22538
+ }
22539
+ if (typeof date2 === "string") {
22540
+ return parseDateValueForInput(new Date(date2));
22541
+ }
22542
+ return "";
22543
+ };
22535
22544
  return /* @__PURE__ */ jsx(
22536
22545
  Input,
22537
22546
  {
@@ -22539,7 +22548,10 @@ function DateField({
22539
22548
  disabled: field.disabled || field.readOnly,
22540
22549
  placeholder: field.placeholder,
22541
22550
  type: "date",
22542
- value: value ? new Date(value).toISOString().split("T")[0] : "",
22551
+ value: parseDateValueForInput(value),
22552
+ defaultValue: parseDateValueForInput(value),
22553
+ min: parseDateValueForInput(field.minDate),
22554
+ max: parseDateValueForInput(field.maxDate),
22543
22555
  onChange: (e2) => onChange(e2.target.value ? new Date(e2.target.value) : null)
22544
22556
  }
22545
22557
  );
@@ -26771,7 +26783,7 @@ function DatePicker({
26771
26783
  disabled,
26772
26784
  variant: buttonVariant,
26773
26785
  className: cn$1(
26774
- "w-[240px] justify-start text-left font-normal",
26786
+ "w-full justify-start text-left font-normal",
26775
26787
  !value && "text-muted-foreground"
26776
26788
  ),
26777
26789
  children: [
@@ -27480,7 +27492,7 @@ function MonthInput({
27480
27492
  disabled,
27481
27493
  variant: buttonVariant,
27482
27494
  className: cn$1(
27483
- "w-[240px] justify-start text-left font-normal",
27495
+ "w-full justify-start text-left font-normal",
27484
27496
  !value && "text-muted-foreground"
27485
27497
  ),
27486
27498
  children: [
@@ -28101,7 +28113,7 @@ function TimePicker({
28101
28113
  disabled,
28102
28114
  variant: buttonVariant,
28103
28115
  className: cn$1(
28104
- "w-[240px] justify-start text-left font-normal",
28116
+ "w-full justify-start text-left font-normal",
28105
28117
  !value && "text-muted-foreground"
28106
28118
  ),
28107
28119
  children: [
@@ -28753,7 +28765,7 @@ function DateTimePicker({
28753
28765
  disabled,
28754
28766
  variant: buttonVariant,
28755
28767
  className: cn$1(
28756
- "w-[280px] justify-start text-left font-normal",
28768
+ "w-full flex justify-start text-left font-normal",
28757
28769
  !value && "text-muted-foreground"
28758
28770
  ),
28759
28771
  children: [
@@ -38375,12 +38387,12 @@ function DataTablePagination({
38375
38387
  }
38376
38388
  )
38377
38389
  ] }),
38378
- /* @__PURE__ */ jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
38390
+ /* @__PURE__ */ jsx("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: table.getRowCount() > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
38379
38391
  "Page ",
38380
38392
  pagination.pageIndex + 1,
38381
38393
  " of ",
38382
38394
  table.getPageCount()
38383
- ] }),
38395
+ ] }) : "Page 0 of 0" }),
38384
38396
  /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
38385
38397
  /* @__PURE__ */ jsxs(
38386
38398
  Button$1,
@@ -1 +1 @@
1
- {"version":3,"file":"DataTablePagination.d.ts","sourceRoot":"","sources":["../../../../../src/kit/builder/data-table/components/DataTablePagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,MAAM,WAAW,wBAAwB,CAAC,KAAK;IAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,EACzC,KAAK,EACL,iBAA0B,GAC3B,EAAE,wBAAwB,CAAC,KAAK,CAAC,2CAuFjC"}
1
+ {"version":3,"file":"DataTablePagination.d.ts","sourceRoot":"","sources":["../../../../../src/kit/builder/data-table/components/DataTablePagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,MAAM,WAAW,wBAAwB,CAAC,KAAK;IAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,EACzC,KAAK,EACL,iBAA0B,GAC3B,EAAE,wBAAwB,CAAC,KAAK,CAAC,2CA2FjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../../../../src/kit/builder/form/components/fields/DateField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,gBAAgB,2CAiBlB"}
1
+ {"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../../../../src/kit/builder/form/components/fields/DateField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,gBAAgB,2CA4BlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k3-universe/react-kit",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -58,7 +58,11 @@ export function DataTablePagination<TData>({
58
58
  </div>
59
59
  )}
60
60
  <div className="flex w-[100px] items-center justify-center text-sm font-medium">
61
- Page {pagination.pageIndex + 1} of {table.getPageCount()}
61
+ {table.getRowCount() > 0
62
+ ? (
63
+ <>Page {pagination.pageIndex + 1} of {table.getPageCount()}</>
64
+ )
65
+ : "Page 0 of 0"}
62
66
  </div>
63
67
  <div className="flex items-center space-x-2">
64
68
  <Button
@@ -7,17 +7,28 @@ export function DateField({
7
7
  onChange,
8
8
  className,
9
9
  }: FieldRenderProps) {
10
+ const parseDateValueForInput = (date: unknown) => {
11
+ if (date instanceof Date) {
12
+ return date.toISOString().split('T')[0];
13
+ }
14
+
15
+ if (typeof date === 'string') {
16
+ return parseDateValueForInput(new Date(date));
17
+ }
18
+
19
+ return '';
20
+ }
21
+
10
22
  return (
11
23
  <Input
12
24
  className={className}
13
25
  disabled={field.disabled || field.readOnly}
14
26
  placeholder={field.placeholder}
15
27
  type="date"
16
- value={
17
- value
18
- ? new Date(value as Date | string).toISOString().split('T')[0]
19
- : ''
20
- }
28
+ value={parseDateValueForInput(value)}
29
+ defaultValue={parseDateValueForInput(value)}
30
+ min={parseDateValueForInput(field.minDate)}
31
+ max={parseDateValueForInput(field.maxDate)}
21
32
  onChange={(e) =>
22
33
  onChange(e.target.value ? new Date(e.target.value) : null)
23
34
  }
@@ -114,7 +114,7 @@ export function DatePicker({
114
114
  disabled={disabled}
115
115
  variant={buttonVariant}
116
116
  className={cn(
117
- 'w-[240px] justify-start text-left font-normal',
117
+ 'w-full justify-start text-left font-normal',
118
118
  !value && 'text-muted-foreground',
119
119
  )}
120
120
  >
@@ -312,7 +312,7 @@ export function DateTimePicker({
312
312
  disabled={disabled}
313
313
  variant={buttonVariant}
314
314
  className={cn(
315
- 'w-[280px] justify-start text-left font-normal',
315
+ 'w-full flex justify-start text-left font-normal',
316
316
  !value && 'text-muted-foreground',
317
317
  )}
318
318
  >
@@ -73,7 +73,7 @@ export function MonthInput({
73
73
  disabled={disabled}
74
74
  variant={buttonVariant}
75
75
  className={cn(
76
- 'w-[240px] justify-start text-left font-normal',
76
+ 'w-full justify-start text-left font-normal',
77
77
  !value && 'text-muted-foreground',
78
78
  )}
79
79
  >
@@ -169,7 +169,7 @@ export function TimePicker({
169
169
  disabled={disabled}
170
170
  variant={buttonVariant}
171
171
  className={cn(
172
- 'w-[240px] justify-start text-left font-normal',
172
+ 'w-full justify-start text-left font-normal',
173
173
  !value && 'text-muted-foreground',
174
174
  )}
175
175
  >
@@ -70,7 +70,7 @@ function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
70
70
  <th
71
71
  data-slot="table-head"
72
72
  className={cn(
73
- 'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
73
+ 'bg-primary text-white h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
74
74
  className,
75
75
  )}
76
76
  {...props}