@bitrise/bitkit-v2 0.3.62 → 0.3.64

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.
Files changed (23) hide show
  1. package/dist/components/BitkitField/BitkitField.js +3 -3
  2. package/dist/components/BitkitNumberInput/BitkitNumberInput.js +14 -14
  3. package/dist/components/BitkitTextField/BitkitTextField.js +7 -7
  4. package/dist/components/BitkitToggle/BitkitToggle.d.ts +3 -0
  5. package/dist/components/BitkitToggle/BitkitToggle.js +80 -0
  6. package/dist/components/BitkitToggle/BitkitToggle.types.d.ts +22 -0
  7. package/dist/components/BitkitToggle/BitkitToggle.utils.d.ts +3 -0
  8. package/dist/components/BitkitToggle/BitkitToggle.utils.js +6 -0
  9. package/dist/components/BitkitToggle/components/BitkitToggleHelperText.d.ts +3 -0
  10. package/dist/components/BitkitToggle/components/BitkitToggleHelperText.js +20 -0
  11. package/dist/components/BitkitToggle/components/BitkitToggleLabel.d.ts +3 -0
  12. package/dist/components/BitkitToggle/components/BitkitToggleLabel.js +33 -0
  13. package/dist/components/BitkitToggle/components/BitkitToggleReadOnly.d.ts +4 -0
  14. package/dist/components/BitkitToggle/components/BitkitToggleReadOnly.js +10 -0
  15. package/dist/components/BitkitToggle/components/BitkitToggleValueText.d.ts +3 -0
  16. package/dist/components/BitkitToggle/components/BitkitToggleValueText.js +15 -0
  17. package/dist/components/BitkitToggle/index.d.ts +2 -0
  18. package/dist/components/DataDisplay/BitkitBadge/BitkitBadge.js +23 -0
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/main.js +1054 -1052
  21. package/dist/theme/slot-recipes/Switch.recipe.d.ts +1 -1
  22. package/dist/theme/slot-recipes/index.d.ts +1 -1
  23. package/package.json +3 -5
@@ -2,8 +2,8 @@ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
2
  import { Field as t } from "@chakra-ui/react/field";
3
3
  import { Text as d } from "@chakra-ui/react/text";
4
4
  import { forwardRef as f } from "react";
5
- import u from "../BitkitTooltip/BitkitTooltip.js";
6
- import T from "../../icons/16x16/IconInfoCircle16.js";
5
+ import u from "../../icons/16x16/IconInfoCircle16.js";
6
+ import T from "../BitkitTooltip/BitkitTooltip.js";
7
7
  const y = f((x, m) => {
8
8
  const { counterText: o, children: h, errorText: r, helperText: l, label: n, optional: p, tooltip: a, warningText: i, ...s } = x;
9
9
  return /* @__PURE__ */ c(t.Root, { required: !p, ref: m, ...s, children: [
@@ -16,7 +16,7 @@ const y = f((x, m) => {
16
16
  fallback: /* @__PURE__ */ e(d, { as: "span", color: "input/text/helper", textStyle: "body/md/regular", children: "(optional)" })
17
17
  }
18
18
  ),
19
- !!a && /* @__PURE__ */ e(u, { text: a ?? "", children: /* @__PURE__ */ e(T, { color: "icon/tertiary" }) }),
19
+ !!a && /* @__PURE__ */ e(T, { text: a ?? "", children: /* @__PURE__ */ e(u, { color: "icon/tertiary" }) }),
20
20
  o && /* @__PURE__ */ e(d, { as: "span", color: "input/text/helper", marginInlineStart: "auto", textStyle: "comp/input/helperText", children: o })
21
21
  ] }) : null,
22
22
  h,
@@ -2,15 +2,15 @@ import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
2
  import { Box as w } from "@chakra-ui/react/box";
3
3
  import { NumberInput as i } from "@chakra-ui/react/number-input";
4
4
  import { forwardRef as b } from "react";
5
- import { triggerSeparatorStyle as v } from "../../theme/slot-recipes/NumberInput.recipe.js";
6
- import { rem as y } from "../../theme/themeUtils.js";
7
- import T from "../BitkitField/BitkitField.js";
8
- import B from "../../icons/16x16/IconMinus16.js";
9
- import C from "../../icons/16x16/IconPlus16.js";
10
- import N from "../../icons/24x24/IconErrorCircleFilled24.js";
11
- import j from "../../icons/16x16/IconErrorCircleFilled16.js";
12
- import k from "../../icons/24x24/IconWarningYellow24.js";
13
- import F from "../../icons/16x16/IconWarningYellow16.js";
5
+ import v from "../../icons/16x16/IconErrorCircleFilled16.js";
6
+ import y from "../../icons/16x16/IconMinus16.js";
7
+ import T from "../../icons/16x16/IconPlus16.js";
8
+ import B from "../../icons/16x16/IconWarningYellow16.js";
9
+ import C from "../../icons/24x24/IconErrorCircleFilled24.js";
10
+ import N from "../../icons/24x24/IconWarningYellow24.js";
11
+ import { triggerSeparatorStyle as j } from "../../theme/slot-recipes/NumberInput.recipe.js";
12
+ import { rem as k } from "../../theme/themeUtils.js";
13
+ import F from "../BitkitField/BitkitField.js";
14
14
  const W = b((a, d) => {
15
15
  const {
16
16
  defaultValue: p,
@@ -26,8 +26,8 @@ const W = b((a, d) => {
26
26
  ...h
27
27
  } = a, x = e === "warning" || !!l, m = e === "error" || !!t;
28
28
  let o;
29
- return m ? o = n === "lg" ? /* @__PURE__ */ r(N, { color: "icon/negative" }) : /* @__PURE__ */ r(j, { color: "icon/negative" }) : x && (o = n === "lg" ? /* @__PURE__ */ r(k, { color: "icon/warning" }) : /* @__PURE__ */ r(F, { color: "icon/warning" })), /* @__PURE__ */ r(
30
- T,
29
+ return m ? o = n === "lg" ? /* @__PURE__ */ r(C, { color: "icon/negative" }) : /* @__PURE__ */ r(v, { color: "icon/negative" }) : x && (o = n === "lg" ? /* @__PURE__ */ r(N, { color: "icon/warning" }) : /* @__PURE__ */ r(B, { color: "icon/warning" })), /* @__PURE__ */ r(
30
+ F,
31
31
  {
32
32
  disabled: e === "disabled",
33
33
  errorText: t,
@@ -43,15 +43,15 @@ const W = b((a, d) => {
43
43
  children: /* @__PURE__ */ c(
44
44
  i.Root,
45
45
  {
46
- css: o ? { "--control-width": y(150) } : void 0,
46
+ css: o ? { "--control-width": k(150) } : void 0,
47
47
  defaultValue: p,
48
48
  size: n,
49
49
  ...f,
50
50
  children: [
51
51
  /* @__PURE__ */ c(i.Control, { children: [
52
52
  o && /* @__PURE__ */ r(w, { paddingInline: "12px", display: "flex", alignItems: "center", justifyContent: "center", children: o }),
53
- /* @__PURE__ */ r(i.DecrementTrigger, { _before: o ? v : void 0, children: /* @__PURE__ */ r(B, {}) }),
54
- /* @__PURE__ */ r(i.IncrementTrigger, { children: /* @__PURE__ */ r(C, {}) })
53
+ /* @__PURE__ */ r(i.DecrementTrigger, { _before: o ? j : void 0, children: /* @__PURE__ */ r(y, {}) }),
54
+ /* @__PURE__ */ r(i.IncrementTrigger, { children: /* @__PURE__ */ r(T, {}) })
55
55
  ] }),
56
56
  /* @__PURE__ */ r(i.Input, {})
57
57
  ]
@@ -2,12 +2,12 @@ import { jsx as r } from "react/jsx-runtime";
2
2
  import { Input as T } from "@chakra-ui/react/input";
3
3
  import { InputGroup as E } from "@chakra-ui/react/input-group";
4
4
  import { forwardRef as F } from "react";
5
- import { rem as m } from "../../theme/themeUtils.js";
6
- import b from "../BitkitField/BitkitField.js";
7
- import k from "../../icons/24x24/IconErrorCircleFilled24.js";
8
- import y from "../../icons/16x16/IconErrorCircleFilled16.js";
5
+ import b from "../../icons/16x16/IconErrorCircleFilled16.js";
6
+ import k from "../../icons/16x16/IconWarningYellow16.js";
7
+ import y from "../../icons/24x24/IconErrorCircleFilled24.js";
9
8
  import B from "../../icons/24x24/IconWarningYellow24.js";
10
- import W from "../../icons/16x16/IconWarningYellow16.js";
9
+ import { rem as m } from "../../theme/themeUtils.js";
10
+ import W from "../BitkitField/BitkitField.js";
11
11
  const C = F((c, p) => {
12
12
  const {
13
13
  counter: s,
@@ -25,10 +25,10 @@ const C = F((c, p) => {
25
25
  ...I
26
26
  } = c, h = i === "warning" || !!a, d = i === "error" || !!l;
27
27
  let t;
28
- d ? t = o === "lg" ? /* @__PURE__ */ r(k, { color: "icon/negative" }) : /* @__PURE__ */ r(y, { color: "icon/negative" }) : h && (t = o === "lg" ? /* @__PURE__ */ r(B, { color: "icon/warning" }) : /* @__PURE__ */ r(W, { color: "icon/warning" }));
28
+ d ? t = o === "lg" ? /* @__PURE__ */ r(y, { color: "icon/negative" }) : /* @__PURE__ */ r(b, { color: "icon/negative" }) : h && (t = o === "lg" ? /* @__PURE__ */ r(B, { color: "icon/warning" }) : /* @__PURE__ */ r(k, { color: "icon/warning" }));
29
29
  const w = s && n && e?.value !== void 0 ? `${e.value.toString().length}/${n}` : void 0;
30
30
  return /* @__PURE__ */ r(
31
- b,
31
+ W,
32
32
  {
33
33
  counterText: w,
34
34
  disabled: i === "disabled",
@@ -0,0 +1,3 @@
1
+ import { BitkitToggleProps } from './BitkitToggle.types';
2
+ declare const BitkitToggle: import('react').ForwardRefExoticComponent<BitkitToggleProps & import('react').RefAttributes<HTMLInputElement>>;
3
+ export default BitkitToggle;
@@ -0,0 +1,80 @@
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
+ import { Box as f } from "@chakra-ui/react/box";
3
+ import { Skeleton as b } from "@chakra-ui/react/skeleton";
4
+ import { useSlotRecipe as y } from "@chakra-ui/react/styled-system";
5
+ import { Switch as i } from "@chakra-ui/react/switch";
6
+ import { forwardRef as g } from "react";
7
+ import T from "../../icons/16x16/IconCheck16.js";
8
+ import x from "../../icons/16x16/IconCross16.js";
9
+ import I from "../../icons/24x24/IconCheck24.js";
10
+ import B from "../../icons/24x24/IconCross24.js";
11
+ import C from "./components/BitkitToggleHelperText.js";
12
+ import R from "./components/BitkitToggleLabel.js";
13
+ import w from "./components/BitkitToggleReadOnly.js";
14
+ import j from "./components/BitkitToggleValueText.js";
15
+ const L = g(
16
+ (a, s) => {
17
+ const { label: l, optional: r, tooltip: m, helperText: d, valueText: n, size: t = "md", state: o = "default", ...k } = a, p = y({ key: "switch" })({ size: t }), h = t === "sm" ? x : B, D = t === "sm" ? T : I;
18
+ return /* @__PURE__ */ c(
19
+ i.Root,
20
+ {
21
+ gap: "4",
22
+ size: t,
23
+ required: !r,
24
+ flexDirection: "column",
25
+ alignItems: "flex-start",
26
+ readOnly: o === "readOnly",
27
+ disabled: o === "disabled" || o === "disabledInput" || o === "skeleton",
28
+ ...k,
29
+ children: [
30
+ /* @__PURE__ */ e(i.HiddenInput, { ref: s }),
31
+ /* @__PURE__ */ e(R, { label: l, state: o, tooltip: m, optional: r }),
32
+ /* @__PURE__ */ c(f, { css: p.root, children: [
33
+ /* @__PURE__ */ e(w, { state: o, children: /* @__PURE__ */ e(b, { loading: o === "skeleton", borderRadius: "12", height: t === "sm" ? "16" : "24", children: /* @__PURE__ */ c(i.Control, { children: [
34
+ /* @__PURE__ */ e(i.Thumb, {}),
35
+ /* @__PURE__ */ e(i.Indicator, { fallback: /* @__PURE__ */ e(h, {}), children: /* @__PURE__ */ e(D, {}) })
36
+ ] }) }) }),
37
+ /* @__PURE__ */ e(j, { size: t, state: o, valueText: n })
38
+ ] }),
39
+ /* @__PURE__ */ e(C, { state: o, helperText: d })
40
+ ]
41
+ }
42
+ );
43
+ }
44
+ );
45
+ L.displayName = "BitkitToggleDynamicLabel";
46
+ const O = g((a, s) => {
47
+ const { label: l, optional: r, tooltip: m, helperText: d, size: n = "sm", state: t = "default", ...o } = a, u = y({ key: "switch" })({ size: n }), p = n === "sm" ? x : B, h = n === "sm" ? T : I;
48
+ return /* @__PURE__ */ c(
49
+ i.Root,
50
+ {
51
+ size: n,
52
+ display: "flex",
53
+ required: !r,
54
+ justifyContent: "space-between",
55
+ readOnly: t === "readOnly",
56
+ disabled: t === "disabled" || t === "disabledInput" || t === "skeleton",
57
+ ...o,
58
+ children: [
59
+ /* @__PURE__ */ e(i.HiddenInput, { ref: s }),
60
+ (l || d) && /* @__PURE__ */ c(f, { display: "flex", flexDirection: "column", gap: "4", mr: "24", children: [
61
+ /* @__PURE__ */ e(R, { label: l, state: t, tooltip: m, optional: r }),
62
+ /* @__PURE__ */ e(C, { state: t, helperText: d })
63
+ ] }),
64
+ /* @__PURE__ */ e(f, { css: u.root, children: /* @__PURE__ */ e(w, { state: t, children: /* @__PURE__ */ e(b, { loading: t === "skeleton", borderRadius: "12", height: n === "sm" ? "16" : "24", children: /* @__PURE__ */ c(i.Control, { children: [
65
+ /* @__PURE__ */ e(i.Thumb, {}),
66
+ /* @__PURE__ */ e(i.Indicator, { fallback: /* @__PURE__ */ e(p, {}), children: /* @__PURE__ */ e(h, {}) })
67
+ ] }) }) }) })
68
+ ]
69
+ }
70
+ );
71
+ });
72
+ O.displayName = "BitkitToggleFixedLabel";
73
+ const v = g((a, s) => {
74
+ const { variant: l, ...r } = a;
75
+ return l === "dynamic-label" || l === void 0 ? /* @__PURE__ */ e(L, { ref: s, ...r }) : /* @__PURE__ */ e(O, { ref: s, ...r });
76
+ });
77
+ v.displayName = "BitkitToggle";
78
+ export {
79
+ v as default
80
+ };
@@ -0,0 +1,22 @@
1
+ import { SwitchRootProps } from '@chakra-ui/react/switch';
2
+ import { ReactNode } from 'react';
3
+ export type OnOff = {
4
+ on: ReactNode;
5
+ off: ReactNode;
6
+ };
7
+ export interface BitkitToggleDynamicLabelProps extends Omit<SwitchRootProps, 'disabled' | 'readOnly' | 'required'> {
8
+ variant?: 'dynamic-label';
9
+ tooltip?: string;
10
+ optional?: boolean;
11
+ valueText?: ReactNode | OnOff;
12
+ helperText?: ReactNode | OnOff;
13
+ state?: 'default' | 'disabled' | 'disabledInput' | 'readOnly' | 'skeleton';
14
+ }
15
+ export interface BitkitToggleFixedLabelProps extends Omit<SwitchRootProps, 'disabled' | 'readOnly' | 'required'> {
16
+ variant?: 'fixed-label';
17
+ tooltip?: string;
18
+ optional?: boolean;
19
+ helperText?: ReactNode | OnOff;
20
+ state?: 'default' | 'disabled' | 'disabledInput' | 'readOnly' | 'skeleton';
21
+ }
22
+ export type BitkitToggleProps = BitkitToggleDynamicLabelProps | BitkitToggleFixedLabelProps;
@@ -0,0 +1,3 @@
1
+ import { ReactNode } from 'react';
2
+ import { OnOff } from './BitkitToggle.types';
3
+ export declare function isOnOff(obj: ReactNode | OnOff): obj is OnOff;
@@ -0,0 +1,6 @@
1
+ function f(n) {
2
+ return typeof n == "object" && n !== null && "on" in n && "off" in n;
3
+ }
4
+ export {
5
+ f as isOnOff
6
+ };
@@ -0,0 +1,3 @@
1
+ import { BitkitToggleProps } from '../BitkitToggle.types';
2
+ declare const BitkitToggleHelperText: ({ state, helperText }: Pick<BitkitToggleProps, "state" | "helperText">) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default BitkitToggleHelperText;
@@ -0,0 +1,20 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Skeleton as l } from "@chakra-ui/react/skeleton";
3
+ import { useSwitchContext as d } from "@chakra-ui/react/switch";
4
+ import { Text as r } from "@chakra-ui/react/text";
5
+ import { isOnOff as f } from "../BitkitToggle.utils.js";
6
+ const b = ({ state: e, helperText: t }) => {
7
+ const { checked: n, disabled: s } = d();
8
+ if (e === "skeleton")
9
+ return /* @__PURE__ */ o(l, { height: "12", width: "128", my: "2" });
10
+ if (!t)
11
+ return null;
12
+ const i = {
13
+ textStyle: "comp/input/helperText",
14
+ color: s && e !== "disabledInput" ? "text/disabled" : "input/text/helper"
15
+ };
16
+ return f(t) ? /* @__PURE__ */ o(r, { ...i, children: n ? t.on : t.off }) : /* @__PURE__ */ o(r, { ...i, children: t });
17
+ };
18
+ export {
19
+ b as default
20
+ };
@@ -0,0 +1,3 @@
1
+ import { BitkitToggleProps } from '../BitkitToggle.types';
2
+ declare const BitkitToggleLabel: ({ label, state, tooltip, optional, }: Pick<BitkitToggleProps, "label" | "state" | "tooltip" | "optional">) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default BitkitToggleLabel;
@@ -0,0 +1,33 @@
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { Flex as m } from "@chakra-ui/react/flex";
3
+ import { useSwitchContext as a } from "@chakra-ui/react/switch";
4
+ import { Text as l } from "@chakra-ui/react/text";
5
+ import c from "../../../icons/16x16/IconInfoCircle16.js";
6
+ import p from "../../BitkitTooltip/BitkitTooltip.js";
7
+ const g = ({
8
+ label: e,
9
+ state: o,
10
+ tooltip: r,
11
+ optional: n
12
+ }) => {
13
+ const { disabled: d } = a();
14
+ if (!e)
15
+ return null;
16
+ const i = d && o !== "disabledInput" && o !== "skeleton";
17
+ return /* @__PURE__ */ s(m, { gap: "4", alignItems: "center", children: [
18
+ /* @__PURE__ */ t(l, { as: "span", textStyle: "body/md/semibold", color: i ? "text/disabled" : "text/body", children: e }),
19
+ !!n && /* @__PURE__ */ t(
20
+ l,
21
+ {
22
+ as: "span",
23
+ textStyle: "body/md/regular",
24
+ color: i ? "text/disabled" : "input/text/helper",
25
+ children: "(optional)"
26
+ }
27
+ ),
28
+ !!r && /* @__PURE__ */ t(p, { text: r, children: /* @__PURE__ */ t(c, { color: "icon/tertiary" }) })
29
+ ] });
30
+ };
31
+ export {
32
+ g as default
33
+ };
@@ -0,0 +1,4 @@
1
+ import { BitkitToggleProps } from '../BitkitToggle.types';
2
+ type Props = Pick<BitkitToggleProps, 'state' | 'children'>;
3
+ declare const BitkitToggleReadOnly: ({ state, children }: Props) => string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
4
+ export default BitkitToggleReadOnly;
@@ -0,0 +1,10 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useSwitchContext as n } from "@chakra-ui/react";
3
+ import i from "../../DataDisplay/BitkitBadge/BitkitBadge.js";
4
+ const d = ({ state: e, children: o }) => {
5
+ const { checked: r } = n();
6
+ return e === "readOnly" && r ? /* @__PURE__ */ t(i, { colorScheme: "positive", variant: "subtle", children: "ON" }) : e === "readOnly" && !r ? /* @__PURE__ */ t(i, { colorScheme: "neutral", variant: "subtle", children: "OFF" }) : o;
7
+ };
8
+ export {
9
+ d as default
10
+ };
@@ -0,0 +1,3 @@
1
+ import { BitkitToggleDynamicLabelProps } from '../BitkitToggle.types';
2
+ declare const BitkitToggleValueText: ({ size, state, valueText, }: Pick<BitkitToggleDynamicLabelProps, "size" | "state" | "valueText">) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default BitkitToggleValueText;
@@ -0,0 +1,15 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Skeleton as f } from "@chakra-ui/react/skeleton";
3
+ import { useSwitchContext as m, Switch as i } from "@chakra-ui/react/switch";
4
+ import { isOnOff as c } from "../BitkitToggle.utils.js";
5
+ const p = ({
6
+ size: o,
7
+ state: n,
8
+ valueText: r
9
+ }) => {
10
+ const { checked: e } = m();
11
+ return n === "skeleton" ? /* @__PURE__ */ t(f, { height: o === "sm" ? "12" : "16", width: o === "sm" ? "64" : "128" }) : r ? c(r) ? /* @__PURE__ */ t(i.Label, { children: e ? r.on : r.off }) : /* @__PURE__ */ t(i.Label, { children: r }) : null;
12
+ };
13
+ export {
14
+ p as default
15
+ };
@@ -0,0 +1,2 @@
1
+ export { default } from './BitkitToggle';
2
+ export type { BitkitToggleProps } from './BitkitToggle.types';
@@ -0,0 +1,23 @@
1
+ import { jsxs as n } from "react/jsx-runtime";
2
+ import { Badge as a } from "@chakra-ui/react/badge";
3
+ import { forwardRef as o } from "react";
4
+ const m = o((t, d) => {
5
+ const { children: i, icon: r, ...e } = t;
6
+ return /* @__PURE__ */ n(
7
+ a,
8
+ {
9
+ ref: d,
10
+ ...e,
11
+ paddingInlineStart: i && !r ? "8" : "4",
12
+ paddingInlineEnd: i ? "8" : "4",
13
+ children: [
14
+ r,
15
+ i
16
+ ]
17
+ }
18
+ );
19
+ });
20
+ m.displayName = "BitkitBadge";
21
+ export {
22
+ m as default
23
+ };
@@ -2,4 +2,5 @@ export { default as BitkitButton, type BitkitButtonProps } from './BitkitButton/
2
2
  export { default as BitkitField, type BitkitFieldProps } from './BitkitField/BitkitField';
3
3
  export { default as BitkitNumberInput, type BitkitNumberInputProps } from './BitkitNumberInput/BitkitNumberInput';
4
4
  export { default as BitkitTextField, type BitkitTextFieldProps } from './BitkitTextField/BitkitTextField';
5
+ export { default as BitkitToggle, type BitkitToggleProps } from './BitkitToggle';
5
6
  export { default as BitkitTooltip, type BitkitTooltipProps } from './BitkitTooltip/BitkitTooltip';