@kud/ink-ui 0.4.0 → 0.5.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
@@ -133,6 +133,22 @@ type TabsProps<T extends string> = {
133
133
  };
134
134
  declare const Tabs: <T extends string>({ active, items }: TabsProps<T>) => React.JSX.Element;
135
135
 
136
+ type SwitchValue = "left" | "right";
137
+ type SwitchProps = {
138
+ left: string;
139
+ right: string;
140
+ value: SwitchValue;
141
+ color?: string;
142
+ };
143
+ declare const Switch: ({ left, right, value, color, }: SwitchProps) => React.JSX.Element;
144
+
145
+ type ToggleProps = {
146
+ label: string;
147
+ on: boolean;
148
+ color?: string;
149
+ };
150
+ declare const Toggle: ({ label, on, color }: ToggleProps) => React.JSX.Element;
151
+
136
152
  type ProgressBarProps = {
137
153
  value: number;
138
154
  width?: number;
@@ -190,4 +206,4 @@ declare const spacing: {
190
206
  };
191
207
  type Spacing = (typeof spacing)[keyof typeof spacing];
192
208
 
193
- export { Alert, Badge, type BadgeVariant, Banner, type Color, type Column, ConfirmInput, FooterHints, Header, type Hint, type IconMode, KeyValue, LoadingScreen, MultiSelect, type NotifyOptions, ProgressBar, ScrollView, Select, type SelectOption, SelectableRow, type Spacing, type Span, Spinner, StatusMessage, type StatusVariant, type StyledLine, type TabItem, Table, Tabs, TextInput, Toast, colors, getIconMode, notify, setIconMode, spacing };
209
+ export { Alert, Badge, type BadgeVariant, Banner, type Color, type Column, ConfirmInput, FooterHints, Header, type Hint, type IconMode, KeyValue, LoadingScreen, MultiSelect, type NotifyOptions, 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, colors, getIconMode, notify, setIconMode, spacing };
package/dist/index.js CHANGED
@@ -326,6 +326,44 @@ var Tabs = ({ active, items }) => {
326
326
  /* @__PURE__ */ jsx(Box, { gap: 2, children: cells.map((cell) => /* @__PURE__ */ jsx(Text, { color: colors.accent, children: cell.isActive ? "\u2500".repeat(cell.text.length) : " ".repeat(cell.text.length) }, cell.key)) })
327
327
  ] });
328
328
  };
329
+ var Switch = ({
330
+ left,
331
+ right,
332
+ value,
333
+ color = colors.accent
334
+ }) => {
335
+ const leftActive = value === "left";
336
+ return /* @__PURE__ */ jsxs(Text, { children: [
337
+ /* @__PURE__ */ jsx(
338
+ Text,
339
+ {
340
+ color: leftActive ? color : void 0,
341
+ bold: leftActive,
342
+ dimColor: !leftActive,
343
+ children: left
344
+ }
345
+ ),
346
+ /* @__PURE__ */ jsx(Text, { children: " " }),
347
+ /* @__PURE__ */ jsx(Text, { color: leftActive ? color : colors.muted, children: leftActive ? "\u25CF" : "\u25CB" }),
348
+ /* @__PURE__ */ jsx(Text, { color: colors.muted, children: "\u2500" }),
349
+ /* @__PURE__ */ jsx(Text, { color: !leftActive ? color : colors.muted, children: !leftActive ? "\u25CF" : "\u25CB" }),
350
+ /* @__PURE__ */ jsx(Text, { children: " " }),
351
+ /* @__PURE__ */ jsx(
352
+ Text,
353
+ {
354
+ color: !leftActive ? color : void 0,
355
+ bold: !leftActive,
356
+ dimColor: leftActive,
357
+ children: right
358
+ }
359
+ )
360
+ ] });
361
+ };
362
+ var Toggle = ({ label, on, color = colors.accent }) => /* @__PURE__ */ jsxs(Text, { color: on ? color : void 0, dimColor: !on, children: [
363
+ label,
364
+ " ",
365
+ on ? "\u25CF" : "\u25CB"
366
+ ] });
329
367
  var ProgressBar = ({ value, width = 20 }) => {
330
368
  const clamped = Math.max(0, Math.min(100, value));
331
369
  const filled = Math.round(clamped / 100 * width);
@@ -435,4 +473,4 @@ var notify = (message, options = {}) => {
435
473
  child.unref();
436
474
  };
437
475
 
438
- export { Alert, Badge, Banner, ConfirmInput, FooterHints, Header, KeyValue, LoadingScreen, MultiSelect, ProgressBar, ScrollView, Select, SelectableRow, Spinner, StatusMessage, Table, Tabs, TextInput, Toast, colors, getIconMode, notify, setIconMode, spacing };
476
+ export { Alert, Badge, Banner, ConfirmInput, FooterHints, Header, KeyValue, LoadingScreen, MultiSelect, ProgressBar, ScrollView, Select, SelectableRow, Spinner, StatusMessage, Switch, Table, Tabs, TextInput, Toast, Toggle, colors, getIconMode, notify, setIconMode, spacing };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/ink-ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "React component library for Ink CLIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",