@keboola/design 4.3.0 → 4.3.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.cjs CHANGED
@@ -1649,6 +1649,9 @@ var argoVariants = classVarianceAuthority.cva(
1649
1649
  outline: [
1650
1650
  "!tw-border-input",
1651
1651
  "tw-bg-background",
1652
+ // Semantic base text color so the label/icon flips in dark mode
1653
+ // (matches `invisible`); previously unset → inherited a fixed dark color.
1654
+ "tw-text-foreground",
1652
1655
  "hover:not-disabled:tw-bg-accent",
1653
1656
  "hover:not-disabled:tw-text-accent-foreground",
1654
1657
  "hover:active:tw-bg-background",
@@ -9353,198 +9356,6 @@ var TextInput = ({
9353
9356
  }
9354
9357
  );
9355
9358
  };
9356
- var TimePickerButton = ({
9357
- ref,
9358
- className,
9359
- children,
9360
- ...rest
9361
- }) => /* @__PURE__ */ jsxRuntime.jsx(
9362
- "button",
9363
- {
9364
- ...rest,
9365
- ref,
9366
- type: "button",
9367
- className: cn(
9368
- "tailwindcss-preflight",
9369
- "tw-flex",
9370
- "tw-items-center",
9371
- "tw-justify-center",
9372
- "tw-size-10",
9373
- "tw-rounded",
9374
- "tw-transition-colors",
9375
- "tw-select-none",
9376
- "hover:tw-bg-accent",
9377
- "focus-visible:tw-outline",
9378
- "focus-visible:tw-outline-2",
9379
- "focus-visible:tw-outline-primary",
9380
- "aria-selected:tw-bg-primary",
9381
- "aria-selected:tw-text-primary-foreground",
9382
- className
9383
- ),
9384
- children
9385
- }
9386
- );
9387
-
9388
- // src/components/TimePicker/utils.ts
9389
- var pad = (n) => n.toString().padStart(2, "0");
9390
- var parseTime = (time) => {
9391
- if (!time) return { hour: null, minute: null };
9392
- const match2 = /^(\d{1,2}):(\d{1,2})$/.exec(time.trim());
9393
- if (!match2) return { hour: null, minute: null };
9394
- const hour = Number(match2[1]);
9395
- const minute = Number(match2[2]);
9396
- if (Number.isNaN(hour) || Number.isNaN(minute) || hour < 0 || hour > 23 || minute < 0 || minute > 59)
9397
- return { hour: null, minute: null };
9398
- return { hour, minute };
9399
- };
9400
- var scrollToSelected = (viewport) => {
9401
- if (!viewport) return;
9402
- requestAnimationFrame(() => {
9403
- const selected = viewport.querySelector('[aria-selected="true"]');
9404
- selected?.scrollIntoView({ block: "center" });
9405
- });
9406
- };
9407
- var HOURS = Array.from({ length: 24 }, (_, i) => i);
9408
- var MINUTES = Array.from({ length: 60 }, (_, i) => i);
9409
- var TimePicker = ({
9410
- align = "end",
9411
- alignOffset = -18,
9412
- children,
9413
- defaultOpen,
9414
- defaultSelected,
9415
- onOpenChange,
9416
- onSelect,
9417
- open,
9418
- selected,
9419
- sideOffset = 12
9420
- }) => {
9421
- const [internalSelected, setInternalSelected] = React27.useState(defaultSelected ?? null);
9422
- const isControlled = selected !== void 0;
9423
- const currentValue = isControlled ? selected : internalSelected;
9424
- const parsed = parseTime(currentValue);
9425
- const hour = parsed.hour ?? null;
9426
- const minute = parsed.minute ?? null;
9427
- const handleSelect = (time) => {
9428
- if (!isControlled) {
9429
- setInternalSelected(time);
9430
- }
9431
- onSelect?.(time);
9432
- };
9433
- const handleHourSelect = (h) => {
9434
- const m = minute ?? 0;
9435
- handleSelect(`${pad(h)}:${pad(m)}`);
9436
- };
9437
- const handleMinuteSelect = (m) => {
9438
- const h = hour ?? 0;
9439
- handleSelect(`${pad(h)}:${pad(m)}`);
9440
- };
9441
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { defaultOpen, onOpenChange, open, children: [
9442
- /* @__PURE__ */ jsxRuntime.jsx(Popover.Trigger, { asChild: true, children }),
9443
- /* @__PURE__ */ jsxRuntime.jsxs(
9444
- Popover.Content,
9445
- {
9446
- align,
9447
- alignOffset,
9448
- sideOffset,
9449
- className: "tw-flex tw-flex-row",
9450
- children: [
9451
- /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { type: "always", ref: scrollToSelected, viewPortClassName: "tw-h-60 tw-px-3", children: HOURS.map((value) => /* @__PURE__ */ jsxRuntime.jsx(
9452
- TimePickerButton,
9453
- {
9454
- onClick: () => handleHourSelect(value),
9455
- "aria-selected": value === hour,
9456
- children: pad(value)
9457
- },
9458
- value
9459
- )) }),
9460
- /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { type: "always", ref: scrollToSelected, viewPortClassName: "tw-h-60 tw-px-3", children: MINUTES.map((value) => /* @__PURE__ */ jsxRuntime.jsx(
9461
- TimePickerButton,
9462
- {
9463
- onClick: () => handleMinuteSelect(value),
9464
- "aria-selected": value === minute,
9465
- children: pad(value)
9466
- },
9467
- value
9468
- )) })
9469
- ]
9470
- }
9471
- )
9472
- ] });
9473
- };
9474
- var TimeInput = ({
9475
- ref,
9476
- defaultValue,
9477
- disabled,
9478
- onBlur,
9479
- onChange,
9480
- onValueBlur,
9481
- onValueChange,
9482
- placeholder = "Select time",
9483
- readOnly,
9484
- value,
9485
- variant,
9486
- className,
9487
- ...props
9488
- }) => {
9489
- const [isOpen, setIsOpen] = React27.useState(false);
9490
- const [internalValue, setInternalValue] = React27.useState(defaultValue ?? null);
9491
- const isControlled = value !== void 0;
9492
- const currentValue = isControlled ? value : internalValue;
9493
- const handleChange = (event) => {
9494
- const newValue = event.target.value || null;
9495
- onChange?.(event);
9496
- onValueChange?.(newValue);
9497
- if (!isControlled) {
9498
- setInternalValue(newValue);
9499
- }
9500
- };
9501
- const handleBlur = (event) => {
9502
- const newValue = event.target.value || null;
9503
- onBlur?.(event);
9504
- onValueBlur?.(newValue);
9505
- if (!isControlled) {
9506
- setInternalValue(newValue);
9507
- }
9508
- };
9509
- const handleTimePickerSelect = (time) => {
9510
- if (!isControlled) setInternalValue(time);
9511
- onValueChange?.(time);
9512
- };
9513
- const handleClear = () => {
9514
- if (!isControlled) setInternalValue(null);
9515
- onValueChange?.(null);
9516
- };
9517
- const handleOpenChange = (open) => {
9518
- setIsOpen(open);
9519
- };
9520
- return /* @__PURE__ */ jsxRuntime.jsx(
9521
- Input,
9522
- {
9523
- ...props,
9524
- ref,
9525
- type: "time",
9526
- disabled,
9527
- readOnly,
9528
- placeholder,
9529
- className: cn("[&_input::-webkit-calendar-picker-indicator]:tw-hidden", className),
9530
- value: currentValue,
9531
- variant,
9532
- onChange: handleChange,
9533
- onBlur: handleBlur,
9534
- onClear: currentValue ? handleClear : void 0,
9535
- rightSuffix: !disabled && !readOnly ? /* @__PURE__ */ jsxRuntime.jsx(
9536
- TimePicker,
9537
- {
9538
- open: isOpen,
9539
- onOpenChange: handleOpenChange,
9540
- onSelect: handleTimePickerSelect,
9541
- selected: currentValue,
9542
- children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Select Time", variant: "inline", size: "icon-3xs", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Clock, { className: "tw-size-4" }) })
9543
- }
9544
- ) : void 0
9545
- }
9546
- );
9547
- };
9548
9359
  var CommandInput = ({
9549
9360
  ref,
9550
9361
  className,
@@ -9803,6 +9614,97 @@ var DateRangePicker = ({
9803
9614
  ] }) })
9804
9615
  ] });
9805
9616
  DateRangePicker.displayName = "DateRangePicker";
9617
+
9618
+ // src/components/TimePicker/utils.ts
9619
+ var pad = (n) => n.toString().padStart(2, "0");
9620
+ var parseTime = (time) => {
9621
+ if (!time) return { hour: null, minute: null };
9622
+ const match2 = /^(\d{1,2}):(\d{1,2})$/.exec(time.trim());
9623
+ if (!match2) return { hour: null, minute: null };
9624
+ const hour = Number(match2[1]);
9625
+ const minute = Number(match2[2]);
9626
+ if (Number.isNaN(hour) || Number.isNaN(minute) || hour < 0 || hour > 23 || minute < 0 || minute > 59)
9627
+ return { hour: null, minute: null };
9628
+ return { hour, minute };
9629
+ };
9630
+ var scrollToSelected = (viewport) => {
9631
+ if (!viewport) return;
9632
+ requestAnimationFrame(() => {
9633
+ const selected = viewport.querySelector('[aria-pressed="true"]');
9634
+ selected?.scrollIntoView({ block: "center" });
9635
+ });
9636
+ };
9637
+ var HOURS = Array.from({ length: 24 }, (_, i) => i);
9638
+ var MINUTES = Array.from({ length: 60 }, (_, i) => i);
9639
+ var TimePicker = ({
9640
+ align = "end",
9641
+ alignOffset = -18,
9642
+ children,
9643
+ defaultOpen,
9644
+ defaultSelected,
9645
+ onOpenChange,
9646
+ onSelect,
9647
+ open,
9648
+ selected,
9649
+ sideOffset = 12
9650
+ }) => {
9651
+ const [internalSelected, setInternalSelected] = React27.useState(defaultSelected ?? null);
9652
+ const isControlled = selected !== void 0;
9653
+ const currentValue = isControlled ? selected : internalSelected;
9654
+ const parsed = parseTime(currentValue);
9655
+ const hour = parsed.hour ?? null;
9656
+ const minute = parsed.minute ?? null;
9657
+ const handleSelect = (time) => {
9658
+ if (!isControlled) {
9659
+ setInternalSelected(time);
9660
+ }
9661
+ onSelect?.(time);
9662
+ };
9663
+ const handleHourSelect = (h) => {
9664
+ const m = minute ?? 0;
9665
+ handleSelect(`${pad(h)}:${pad(m)}`);
9666
+ };
9667
+ const handleMinuteSelect = (m) => {
9668
+ const h = hour ?? 0;
9669
+ handleSelect(`${pad(h)}:${pad(m)}`);
9670
+ };
9671
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { defaultOpen, onOpenChange, open, children: [
9672
+ /* @__PURE__ */ jsxRuntime.jsx(Popover.Trigger, { asChild: true, children }),
9673
+ /* @__PURE__ */ jsxRuntime.jsxs(
9674
+ Popover.Content,
9675
+ {
9676
+ align,
9677
+ alignOffset,
9678
+ sideOffset,
9679
+ className: "tw-flex tw-flex-row",
9680
+ children: [
9681
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { type: "always", ref: scrollToSelected, viewPortClassName: "tw-h-60 tw-p-3", children: HOURS.map((value) => /* @__PURE__ */ jsxRuntime.jsx(
9682
+ Toggle,
9683
+ {
9684
+ variant: "ghost",
9685
+ className: "tw-size-10 tw-p-0",
9686
+ pressed: value === hour,
9687
+ onPressedChange: () => handleHourSelect(value),
9688
+ children: pad(value)
9689
+ },
9690
+ value
9691
+ )) }),
9692
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { type: "always", ref: scrollToSelected, viewPortClassName: "tw-h-60 tw-p-3", children: MINUTES.map((value) => /* @__PURE__ */ jsxRuntime.jsx(
9693
+ Toggle,
9694
+ {
9695
+ variant: "ghost",
9696
+ className: "tw-size-10 tw-p-0",
9697
+ pressed: value === minute,
9698
+ onPressedChange: () => handleMinuteSelect(value),
9699
+ children: pad(value)
9700
+ },
9701
+ value
9702
+ )) })
9703
+ ]
9704
+ }
9705
+ )
9706
+ ] });
9707
+ };
9806
9708
  var Optional = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("tw-text-muted-foreground", className), children: "(optional)" });
9807
9709
  var Label2 = ({ className, children, id, htmlFor, ...rest }) => {
9808
9710
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -11124,10 +11026,10 @@ var variants4 = classVarianceAuthority.cva(
11124
11026
  ]
11125
11027
  },
11126
11028
  sizing: {
11127
- // border-inclusive heights: 40 / 36 / 34 px
11029
+ // border-inclusive heights: 40 / 36 / 32 px (small matches Button small)
11128
11030
  default: ["tw-px-4", "tw-py-2.5", "tw-text-sm/[18px]", "tw-h-10", "tw-min-h-10"],
11129
11031
  medium: ["tw-px-4", "tw-py-2", "tw-text-sm/[18px]", "tw-h-9", "tw-min-h-9"],
11130
- small: ["tw-px-4", "tw-py-2", "tw-text-sm/[16px]", "tw-h-[34px]", "tw-min-h-[34px]"]
11032
+ small: ["tw-px-4", "tw-py-2", "tw-text-sm/[16px]", "tw-h-8", "tw-min-h-8"]
11131
11033
  },
11132
11034
  state: {
11133
11035
  default: [
@@ -12850,6 +12752,107 @@ var PasswordInput = ({
12850
12752
  }
12851
12753
  );
12852
12754
  };
12755
+ var TimeInput = ({
12756
+ ref,
12757
+ // group props
12758
+ state,
12759
+ variant,
12760
+ focusVariant,
12761
+ sizing,
12762
+ className,
12763
+ // own props
12764
+ value: valueProp,
12765
+ defaultValue,
12766
+ onValueChange,
12767
+ onValueBlur,
12768
+ onChange,
12769
+ onBlur,
12770
+ allowClear = false,
12771
+ // input props
12772
+ disabled,
12773
+ readOnly,
12774
+ placeholder = "Select time",
12775
+ ...restInputProps
12776
+ }) => {
12777
+ const inputRef = React27.useRef(null);
12778
+ const [isOpen, setIsOpen] = React27.useState(false);
12779
+ const [internalValue, setInternalValue] = React27.useState(defaultValue ?? null);
12780
+ const isControlled = valueProp !== void 0;
12781
+ const value = isControlled ? valueProp ?? null : internalValue;
12782
+ const setValue = (next) => {
12783
+ if (!isControlled) setInternalValue(next);
12784
+ onValueChange?.(next);
12785
+ };
12786
+ const canClear = allowClear && !!value && !disabled && !readOnly;
12787
+ const showPicker2 = !disabled && !readOnly;
12788
+ const handleChange = (event) => {
12789
+ setValue(event.target.value || null);
12790
+ onChange?.(event);
12791
+ };
12792
+ const handleBlur = (event) => {
12793
+ const newValue = event.target.value || null;
12794
+ if (!isControlled) setInternalValue(newValue);
12795
+ onValueBlur?.(newValue);
12796
+ onBlur?.(event);
12797
+ };
12798
+ const handleTimePickerSelect = (time) => {
12799
+ setValue(time);
12800
+ };
12801
+ const handleClear = () => {
12802
+ if (!inputRef.current) return;
12803
+ inputRef.current.value = "";
12804
+ setValue(null);
12805
+ onChange?.(createChangeInputEvent(inputRef.current));
12806
+ };
12807
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12808
+ InputGroup,
12809
+ {
12810
+ state,
12811
+ variant,
12812
+ sizing,
12813
+ focusVariant,
12814
+ className,
12815
+ children: [
12816
+ /* @__PURE__ */ jsxRuntime.jsx(
12817
+ InputGroup.Input,
12818
+ {
12819
+ ...restInputProps,
12820
+ ref: mergeRefs(ref ?? null, inputRef),
12821
+ type: "time",
12822
+ className: "[&::-webkit-calendar-picker-indicator]:tw-hidden [&::-webkit-datetime-edit-fields-wrapper]:tw-py-0",
12823
+ value: value ?? "",
12824
+ placeholder,
12825
+ onChange: handleChange,
12826
+ onBlur: handleBlur,
12827
+ disabled,
12828
+ readOnly
12829
+ }
12830
+ ),
12831
+ (canClear || showPicker2) && /* @__PURE__ */ jsxRuntime.jsxs(InputGroup.Addon, { align: "inline-end", children: [
12832
+ canClear && /* @__PURE__ */ jsxRuntime.jsx(
12833
+ InputGroup.Button,
12834
+ {
12835
+ "aria-label": "Clear time",
12836
+ onMouseDown: (event) => event.preventDefault(),
12837
+ onClick: handleClear,
12838
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.X, { className: "tw-size-4" })
12839
+ }
12840
+ ),
12841
+ showPicker2 && /* @__PURE__ */ jsxRuntime.jsx(
12842
+ TimePicker,
12843
+ {
12844
+ open: isOpen,
12845
+ onOpenChange: setIsOpen,
12846
+ onSelect: handleTimePickerSelect,
12847
+ selected: value,
12848
+ children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup.Button, { "aria-label": "Select time", children: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Clock, { className: "tw-size-4" }) })
12849
+ }
12850
+ )
12851
+ ] })
12852
+ ]
12853
+ }
12854
+ );
12855
+ };
12853
12856
  var InputOtpVariantContext = React27.createContext({
12854
12857
  sizing: "md",
12855
12858
  state: "default"
@@ -17497,7 +17500,7 @@ var ThemeProvider = ({
17497
17500
  }, [brand, resolvedMode]);
17498
17501
  return /* @__PURE__ */ jsxRuntime.jsxs(ThemeContext, { value: { brand, setBrand, colorScheme, resolvedMode }, children: [
17499
17502
  isRoot && /* @__PURE__ */ jsxRuntime.jsx(AIGradientsSvg, {}),
17500
- children
17503
+ isRoot ? /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children }) : children
17501
17504
  ] });
17502
17505
  };
17503
17506
  var useTheme = () => {
@@ -20371,7 +20374,9 @@ var Table = ({
20371
20374
  "table",
20372
20375
  {
20373
20376
  className: cn(
20374
- "tw-w-full tw-caption-bottom tw-text-sm",
20377
+ // `tw-text-foreground` (a semantic token) so header + cell text flips
20378
+ // under `[data-theme='dark']` instead of inheriting a fixed dark color.
20379
+ "tw-w-full tw-caption-bottom tw-text-sm tw-text-foreground",
20375
20380
  borderCollapsed ? "tw-border-collapse" : "tw-border-separate tw-border-spacing-y-1",
20376
20381
  className
20377
20382
  ),