@kud/ink-ui 0.10.1 → 0.12.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,11 +212,21 @@ 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;
226
+ color?: string;
227
+ trackColor?: string;
218
228
  };
219
- declare const ProgressBar: ({ value, width }: ProgressBarProps) => React.JSX.Element;
229
+ declare const ProgressBar: ({ value, width, color, trackColor, }: ProgressBarProps) => React.JSX.Element;
220
230
 
221
231
  type StatusVariant = "success" | "error" | "warning" | "info";
222
232
 
@@ -269,4 +279,4 @@ declare const spacing: {
269
279
  };
270
280
  type Spacing = (typeof spacing)[keyof typeof spacing];
271
281
 
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 };
282
+ 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
@@ -583,12 +583,35 @@ var Toggle = ({ label, on, color = colors.accent }) => /* @__PURE__ */ jsxs(Text
583
583
  " ",
584
584
  on ? "\u25CF" : "\u25CB"
585
585
  ] });
586
- var ProgressBar = ({ value, width = 20 }) => {
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
+ };
604
+ var ProgressBar = ({
605
+ value,
606
+ width = 20,
607
+ color = colors.accent,
608
+ trackColor = "#2b323d"
609
+ }) => {
587
610
  const clamped = Math.max(0, Math.min(100, value));
588
611
  const filled = Math.round(clamped / 100 * width);
589
612
  return /* @__PURE__ */ jsxs(Text, { children: [
590
- /* @__PURE__ */ jsx(Text, { color: colors.accent, children: "\u2588".repeat(filled) }),
591
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(width - filled) })
613
+ /* @__PURE__ */ jsx(Text, { color, children: "\u2588".repeat(filled) }),
614
+ /* @__PURE__ */ jsx(Text, { color: trackColor, children: "\u2588".repeat(width - filled) })
592
615
  ] });
593
616
  };
594
617
 
@@ -692,4 +715,4 @@ var notify = (message, options = {}) => {
692
715
  child.unref();
693
716
  };
694
717
 
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 };
718
+ 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.1",
3
+ "version": "0.12.0",
4
4
  "description": "React component library for Ink CLIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",