@kud/ink-ui 0.11.0 → 0.13.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
@@ -220,11 +220,24 @@ type ToggleSwitchProps = {
220
220
  };
221
221
  declare const ToggleSwitch: ({ on, label, onColor, offColor, }: ToggleSwitchProps) => React.JSX.Element;
222
222
 
223
+ type UpdateBannerProps = {
224
+ name: string;
225
+ current: string;
226
+ latest: string;
227
+ command: string;
228
+ onConfirm: () => void;
229
+ onDecline: () => void;
230
+ focused?: boolean;
231
+ };
232
+ declare const UpdateBanner: ({ name, current, latest, command, onConfirm, onDecline, focused, }: UpdateBannerProps) => React.JSX.Element;
233
+
223
234
  type ProgressBarProps = {
224
235
  value: number;
225
236
  width?: number;
237
+ color?: string;
238
+ trackColor?: string;
226
239
  };
227
- declare const ProgressBar: ({ value, width }: ProgressBarProps) => React.JSX.Element;
240
+ declare const ProgressBar: ({ value, width, color, trackColor, }: ProgressBarProps) => React.JSX.Element;
228
241
 
229
242
  type StatusVariant = "success" | "error" | "warning" | "info";
230
243
 
@@ -277,4 +290,4 @@ declare const spacing: {
277
290
  };
278
291
  type Spacing = (typeof spacing)[keyof typeof spacing];
279
292
 
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 };
293
+ 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, UpdateBanner, colors, getIconMode, notify, setIconMode, spacing };
package/dist/index.js CHANGED
@@ -601,12 +601,67 @@ var ToggleSwitch = ({
601
601
  label !== void 0 && /* @__PURE__ */ jsx(Text, { color: on ? onColor : void 0, dimColor: !on, children: label })
602
602
  ] });
603
603
  };
604
- var ProgressBar = ({ value, width = 20 }) => {
604
+ var UpdateBanner = ({
605
+ name,
606
+ current: current2,
607
+ latest,
608
+ command,
609
+ onConfirm,
610
+ onDecline,
611
+ focused = true
612
+ }) => {
613
+ useInput(
614
+ (input, key) => {
615
+ if (key.return || /^y$/i.test(input)) onConfirm();
616
+ else if (key.escape || /^n$/i.test(input)) onDecline();
617
+ },
618
+ { isActive: focused }
619
+ );
620
+ return /* @__PURE__ */ jsxs(
621
+ Box,
622
+ {
623
+ flexDirection: "column",
624
+ borderStyle: "round",
625
+ borderColor: colors.accent,
626
+ paddingX: 2,
627
+ paddingY: 1,
628
+ rowGap: 1,
629
+ children: [
630
+ /* @__PURE__ */ jsxs(Box, { columnGap: 1, children: [
631
+ /* @__PURE__ */ jsx(Text, { bold: true, color: colors.accent, children: "Update available" }),
632
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: name })
633
+ ] }),
634
+ /* @__PURE__ */ jsxs(Box, { columnGap: 1, children: [
635
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: current2 }),
636
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2192" }),
637
+ /* @__PURE__ */ jsx(Text, { bold: true, color: colors.success, children: latest })
638
+ ] }),
639
+ /* @__PURE__ */ jsxs(Box, { columnGap: 1, children: [
640
+ /* @__PURE__ */ jsx(Text, { backgroundColor: colors.accent, color: "black", bold: true, children: " Y " }),
641
+ /* @__PURE__ */ jsx(Text, { children: "upgrade now" }),
642
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\xB7" }),
643
+ /* @__PURE__ */ jsx(Text, { backgroundColor: "#2b323d", color: "#8fa3ad", children: " N " }),
644
+ /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
645
+ "later \u2014 run ",
646
+ command,
647
+ " yourself"
648
+ ] })
649
+ ] })
650
+ ]
651
+ }
652
+ );
653
+ };
654
+ var ProgressBar = ({
655
+ value,
656
+ width = 20,
657
+ color = colors.accent,
658
+ trackColor = "#2b323d"
659
+ }) => {
605
660
  const clamped = Math.max(0, Math.min(100, value));
606
661
  const filled = Math.round(clamped / 100 * width);
607
662
  return /* @__PURE__ */ jsxs(Text, { children: [
608
- /* @__PURE__ */ jsx(Text, { color: colors.accent, children: "\u2588".repeat(filled) }),
609
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2591".repeat(width - filled) })
663
+ /* @__PURE__ */ jsx(Text, { color, children: "\u2588".repeat(filled) }),
664
+ /* @__PURE__ */ jsx(Text, { color: trackColor, children: "\u2588".repeat(width - filled) })
610
665
  ] });
611
666
  };
612
667
 
@@ -710,4 +765,4 @@ var notify = (message, options = {}) => {
710
765
  child.unref();
711
766
  };
712
767
 
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 };
768
+ 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, UpdateBanner, colors, getIconMode, notify, setIconMode, spacing };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/ink-ui",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "React component library for Ink CLIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",