@keboola/design 4.2.1 → 4.3.0

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/AGENTS.md CHANGED
@@ -465,7 +465,7 @@ import { ThemeProvider } from '@keboola/design';
465
465
  ```
466
466
 
467
467
  - **`brand`** — the active brand decides the chrome. **argo styling is brand-driven**: any non-`keboola-legacy` brand renders argo chrome automatically (`renderArgo = !isLegacy`), so a default `keboola` / `example-customer` brand needs no per-component flags. The `keboola-legacy` brand renders the pre-modernization chrome. With no `brand` prop, `ThemeProvider` defaults to the canonical `keboola` brand.
468
- - **`colorScheme`** — `"light"` (default) / `"dark"` / `"system"`. Dark mode is set **here, on the root provider** — not per component. `"system"` follows the OS preference.
468
+ - **`colorScheme`** — `"light"` (default) / `"dark"` / `"system"`. Dark mode is set **here, on the root provider** — not per component. `"system"` follows the OS preference. Render the user-facing light/dark/system control with the **`ColorModeSwitch`** block (`<ColorModeSwitch value={scheme} onValueChange={setScheme} />`) — a controlled icon-button + dropdown; feed the same state to `ThemeProvider`'s `colorScheme`.
469
469
 
470
470
  Chrome is driven **entirely** by the active brand — there is no per-call-site `argo` prop or `variant="argo"` escape hatch. To render a subtree under a different brand (e.g. an argo section inside a `keboola-legacy` app), wrap it in a nested `<ThemeProvider brand={…}>`; `useIsLegacyBrand()` reads the nearest provider, so the override is scoped to that subtree.
471
471
 
package/dist/index.cjs CHANGED
@@ -12637,6 +12637,43 @@ var ColorInput = ({
12637
12637
  }
12638
12638
  );
12639
12639
  };
12640
+ var OPTIONS = [
12641
+ { value: "light", label: "Light", icon: icons_exports.Sun },
12642
+ { value: "dark", label: "Dark", icon: icons_exports.Moon },
12643
+ { value: "system", label: "System", icon: icons_exports.Monitor }
12644
+ ];
12645
+ var triggerSizeMap = { small: "icon-sm", medium: "icon" };
12646
+ var ColorModeSwitch = ({ value, onValueChange, size = "small", className }) => {
12647
+ const active = OPTIONS.find((option) => option.value === value);
12648
+ const ActiveIcon = active?.icon ?? icons_exports.Monitor;
12649
+ const activeLabel = active?.label ?? "System";
12650
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
12651
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
12652
+ Button,
12653
+ {
12654
+ type: "button",
12655
+ variant: "outline",
12656
+ size: triggerSizeMap[size],
12657
+ "aria-label": `Color mode: ${activeLabel}`,
12658
+ title: `Color mode: ${activeLabel}`,
12659
+ className,
12660
+ children: /* @__PURE__ */ jsxRuntime.jsx(ActiveIcon, { className: "tw-size-4" })
12661
+ }
12662
+ ) }),
12663
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Content, { align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.RadioGroup, { value, onValueChange, children: OPTIONS.map(({ value: option, label, icon: Icon2 }) => /* @__PURE__ */ jsxRuntime.jsx(
12664
+ DropdownMenu.RadioItem,
12665
+ {
12666
+ value: option,
12667
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icon2, {}),
12668
+ indicator: "check",
12669
+ indicatorAlign: "end",
12670
+ closeOnSelect: true,
12671
+ children: label
12672
+ },
12673
+ option
12674
+ )) }) })
12675
+ ] });
12676
+ };
12640
12677
  var toNumberOrNull = (event) => Number.isNaN(event.target.valueAsNumber) ? null : event.target.valueAsNumber;
12641
12678
  var NumberInput = ({
12642
12679
  ref,
@@ -22198,6 +22235,7 @@ exports.Collapsible = Collapsible;
22198
22235
  exports.CollapsiblePanel = CollapsiblePanel;
22199
22236
  exports.CollapsibleStepHeader = CollapsibleStepHeader;
22200
22237
  exports.ColorInput = ColorInput;
22238
+ exports.ColorModeSwitch = ColorModeSwitch;
22201
22239
  exports.Combobox = Combobox;
22202
22240
  exports.Command = Command;
22203
22241
  exports.CommandGroup = CommandGroup;