@kud/ink-ui 0.10.0 → 0.11.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/dist/index.d.ts CHANGED
@@ -212,6 +212,14 @@ type ToggleProps = {
212
212
  };
213
213
  declare const Toggle: ({ label, on, color }: ToggleProps) => React.JSX.Element;
214
214
 
215
+ type ToggleSwitchProps = {
216
+ on: boolean;
217
+ label?: string;
218
+ onColor?: string;
219
+ offColor?: string;
220
+ };
221
+ declare const ToggleSwitch: ({ on, label, onColor, offColor, }: ToggleSwitchProps) => React.JSX.Element;
222
+
215
223
  type ProgressBarProps = {
216
224
  value: number;
217
225
  width?: number;
@@ -269,4 +277,4 @@ declare const spacing: {
269
277
  };
270
278
  type Spacing = (typeof spacing)[keyof typeof spacing];
271
279
 
272
- export { Alert, Badge, type BadgeVariant, Banner, type Color, type Column, Columns, ConfirmInput, EmailInput, FooterHints, Header, type Hint, type IconMode, KeyValue, LoadingScreen, MultiSelect, type NotifyOptions, OrderedList, Panel, PasswordInput, ProgressBar, ScrollView, Select, type SelectOption, SelectableRow, type Spacing, type Span, Spinner, StatusMessage, type StatusVariant, type StyledLine, Switch, type SwitchValue, type TabItem, Table, Tabs, TextInput, Toast, Toggle, UnorderedList, colors, getIconMode, notify, setIconMode, spacing };
280
+ export { Alert, Badge, type BadgeVariant, Banner, type Color, type Column, Columns, ConfirmInput, EmailInput, FooterHints, Header, type Hint, type IconMode, KeyValue, LoadingScreen, MultiSelect, type NotifyOptions, OrderedList, Panel, PasswordInput, ProgressBar, ScrollView, Select, type SelectOption, SelectableRow, type Spacing, type Span, Spinner, StatusMessage, type StatusVariant, type StyledLine, Switch, type SwitchValue, type TabItem, Table, Tabs, TextInput, Toast, Toggle, ToggleSwitch, UnorderedList, colors, getIconMode, notify, setIconMode, spacing };
package/dist/index.js CHANGED
@@ -63,7 +63,7 @@ var Table = ({
63
63
  /* @__PURE__ */ jsx(Box, { gap: 2, children: columns.map((col) => /* @__PURE__ */ jsx(Box, { width: col.width, minWidth: col.width, children: /* @__PURE__ */ jsx(Text, { bold: true, color: colors.muted, children: col.header }) }, col.key)) }),
64
64
  data.map((row, i) => /* @__PURE__ */ jsx(Box, { gap: 2, children: columns.map((col) => /* @__PURE__ */ jsx(Box, { width: col.width, minWidth: col.width, children: /* @__PURE__ */ jsx(Text, { wrap: "truncate-end", children: String(row[col.key] ?? "") }) }, col.key)) }, i))
65
65
  ] });
66
- var FooterHints = ({ hints }) => /* @__PURE__ */ jsx(Box, { gap: 2, flexWrap: "wrap", children: hints.map(([key, label]) => /* @__PURE__ */ jsxs(Box, { children: [
66
+ var FooterHints = ({ hints }) => /* @__PURE__ */ jsx(Box, { columnGap: 2, rowGap: 0, flexWrap: "wrap", children: hints.map(([key, label]) => /* @__PURE__ */ jsxs(Box, { children: [
67
67
  /* @__PURE__ */ jsx(Text, { color: "white", children: key }),
68
68
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: " " + label })
69
69
  ] }, key)) });
@@ -583,6 +583,24 @@ var Toggle = ({ label, on, color = colors.accent }) => /* @__PURE__ */ jsxs(Text
583
583
  " ",
584
584
  on ? "\u25CF" : "\u25CB"
585
585
  ] });
586
+ var CAP_LEFT = "\uE0B6";
587
+ var CAP_RIGHT = "\uE0B4";
588
+ var ToggleSwitch = ({
589
+ on,
590
+ label,
591
+ onColor = colors.success,
592
+ offColor = "gray"
593
+ }) => {
594
+ const track = on ? onColor : offColor;
595
+ return /* @__PURE__ */ jsxs(Box, { columnGap: 1, children: [
596
+ /* @__PURE__ */ jsxs(Text, { children: [
597
+ /* @__PURE__ */ jsx(Text, { color: track, children: CAP_LEFT }),
598
+ /* @__PURE__ */ jsx(Text, { backgroundColor: track, color: "black", children: on ? " \u25CF" : "\u25CF " }),
599
+ /* @__PURE__ */ jsx(Text, { color: track, children: CAP_RIGHT })
600
+ ] }),
601
+ label !== void 0 && /* @__PURE__ */ jsx(Text, { color: on ? onColor : void 0, dimColor: !on, children: label })
602
+ ] });
603
+ };
586
604
  var ProgressBar = ({ value, width = 20 }) => {
587
605
  const clamped = Math.max(0, Math.min(100, value));
588
606
  const filled = Math.round(clamped / 100 * width);
@@ -692,4 +710,4 @@ var notify = (message, options = {}) => {
692
710
  child.unref();
693
711
  };
694
712
 
695
- export { Alert, Badge, Banner, Columns, ConfirmInput, EmailInput, FooterHints, Header, KeyValue, LoadingScreen, MultiSelect, OrderedList, Panel, PasswordInput, ProgressBar, ScrollView, Select, SelectableRow, Spinner, StatusMessage, Switch, Table, Tabs, TextInput, Toast, Toggle, UnorderedList, colors, getIconMode, notify, setIconMode, spacing };
713
+ export { Alert, Badge, Banner, Columns, ConfirmInput, EmailInput, FooterHints, Header, KeyValue, LoadingScreen, MultiSelect, OrderedList, Panel, PasswordInput, ProgressBar, ScrollView, Select, SelectableRow, Spinner, StatusMessage, Switch, Table, Tabs, TextInput, Toast, Toggle, ToggleSwitch, UnorderedList, colors, getIconMode, notify, setIconMode, spacing };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/ink-ui",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "React component library for Ink CLIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",