@bitrise/bitkit-v2 0.3.174 → 0.3.176

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 (65) hide show
  1. package/dist/atoms/ImageCropper/ImageCropper.js +32 -0
  2. package/dist/components/BitkitCodeSnippet/BitkitCodeSnippet.d.ts +12 -4
  3. package/dist/components/BitkitCodeSnippet/BitkitCodeSnippet.js +59 -54
  4. package/dist/components/BitkitCollapsible/BitkitCollapsible.d.ts +23 -0
  5. package/dist/components/BitkitCollapsible/BitkitCollapsible.js +37 -0
  6. package/dist/components/BitkitCombobox/BitkitCombobox.d.ts +2 -9
  7. package/dist/components/BitkitCombobox/BitkitCombobox.js +24 -32
  8. package/dist/components/BitkitField/BitkitField.d.ts +3 -1
  9. package/dist/components/BitkitField/BitkitField.js +29 -41
  10. package/dist/components/BitkitFileInput/BitkitFileInput.d.ts +3 -4
  11. package/dist/components/BitkitFileInput/BitkitFileInput.js +112 -0
  12. package/dist/components/BitkitGroupHeading/BitkitGroupHeading.d.ts +8 -0
  13. package/dist/components/BitkitGroupHeading/BitkitGroupHeading.js +27 -0
  14. package/dist/components/BitkitLabel/BitkitLabel.d.ts +12 -0
  15. package/dist/components/BitkitLabel/BitkitLabel.js +58 -0
  16. package/dist/components/BitkitLink/BitkitLink.d.ts +3 -1
  17. package/dist/components/BitkitLink/BitkitLink.js +8 -5
  18. package/dist/components/BitkitNativeSelect/BitkitNativeSelect.d.ts +2 -9
  19. package/dist/components/BitkitNativeSelect/BitkitNativeSelect.js +14 -22
  20. package/dist/components/BitkitNumberInput/BitkitNumberInput.d.ts +1 -8
  21. package/dist/components/BitkitNumberInput/BitkitNumberInput.js +15 -23
  22. package/dist/components/BitkitPaginationLoadMore/BitkitPaginationLoadMore.d.ts +11 -0
  23. package/dist/components/BitkitPaginationLoadMore/BitkitPaginationLoadMore.js +41 -0
  24. package/dist/components/BitkitSectionHeading/BitkitSectionHeading.d.ts +12 -0
  25. package/dist/components/BitkitSectionHeading/BitkitSectionHeading.js +48 -0
  26. package/dist/components/BitkitSelect/BitkitSelect.d.ts +1 -8
  27. package/dist/components/BitkitSelect/BitkitSelect.js +22 -30
  28. package/dist/components/BitkitSelectableTag/BitkitSelectableTag.d.ts +17 -0
  29. package/dist/components/BitkitSelectableTag/BitkitSelectableTag.js +38 -0
  30. package/dist/components/BitkitTagsInput/BitkitTagsInput.d.ts +1 -8
  31. package/dist/components/BitkitTagsInput/BitkitTagsInput.js +24 -32
  32. package/dist/components/BitkitTextInput/BitkitTextInput.d.ts +1 -8
  33. package/dist/components/BitkitTextInput/BitkitTextInput.js +14 -22
  34. package/dist/components/BitkitToggle/components/BitkitToggleLabel.js +4 -4
  35. package/dist/components/index.d.ts +7 -0
  36. package/dist/main.js +44 -37
  37. package/dist/theme/recipes/Button.recipe.js +42 -42
  38. package/dist/theme/recipes/ControlButton.recipe.d.ts +16 -16
  39. package/dist/theme/recipes/ControlButton.recipe.js +16 -16
  40. package/dist/theme/recipes/SelectableTag.recipe.d.ts +2 -0
  41. package/dist/theme/recipes/SelectableTag.recipe.js +53 -0
  42. package/dist/theme/recipes/index.d.ts +17 -16
  43. package/dist/theme/recipes/index.js +14 -12
  44. package/dist/theme/semantic-tokens/semanticColors.js +20 -0
  45. package/dist/theme/slot-recipes/CodeSnippet.recipe.d.ts +4 -8
  46. package/dist/theme/slot-recipes/CodeSnippet.recipe.js +16 -5
  47. package/dist/theme/slot-recipes/Collapsible.recipe.d.ts +2 -0
  48. package/dist/theme/slot-recipes/Collapsible.recipe.js +56 -0
  49. package/dist/theme/slot-recipes/ExpandableCard.recipe.d.ts +1 -1
  50. package/dist/theme/slot-recipes/Field.recipe.js +2 -2
  51. package/dist/theme/slot-recipes/FileUpload.recipe.d.ts +1 -1
  52. package/dist/theme/slot-recipes/GroupHeading.recipe.d.ts +2 -0
  53. package/dist/theme/slot-recipes/GroupHeading.recipe.js +41 -0
  54. package/dist/theme/slot-recipes/InlineLoading.recipe.d.ts +3 -3
  55. package/dist/theme/slot-recipes/InlineLoading.recipe.js +3 -3
  56. package/dist/theme/slot-recipes/PaginationLoadMore.recipe.d.ts +41 -0
  57. package/dist/theme/slot-recipes/PaginationLoadMore.recipe.js +59 -0
  58. package/dist/theme/slot-recipes/SectionHeading.recipe.d.ts +2 -0
  59. package/dist/theme/slot-recipes/SectionHeading.recipe.js +52 -0
  60. package/dist/theme/slot-recipes/TagsInput.recipe.d.ts +1 -1
  61. package/dist/theme/slot-recipes/Tooltip.recipe.js +4 -1
  62. package/dist/theme/slot-recipes/index.d.ts +53 -14
  63. package/dist/theme/slot-recipes/index.js +60 -52
  64. package/dist/theme/tokens/sizesAndSpacing.js +3 -4
  65. package/package.json +8 -8
@@ -0,0 +1,32 @@
1
+ import { createSlotRecipeContext as e } from "@chakra-ui/react/styled-system";
2
+ import { ImageCropper as t, useImageCropperContext as n } from "@ark-ui/react/image-cropper";
3
+ //#region lib/atoms/ImageCropper/ImageCropper.tsx
4
+ var { withProvider: r, withContext: i, useStyles: a } = e({ key: "imageCropper" }), o = r(i(t.Root, "root", {
5
+ forwardAsChild: !0,
6
+ forwardProps: [
7
+ "aspectRatio",
8
+ "minWidth",
9
+ "minHeight",
10
+ "maxWidth",
11
+ "maxHeight"
12
+ ]
13
+ }), "root", { forwardProps: [
14
+ "aspectRatio",
15
+ "minWidth",
16
+ "minHeight",
17
+ "maxWidth",
18
+ "maxHeight"
19
+ ] }), s = i(t.Viewport, "viewport", { forwardAsChild: !0 }), c = i(t.Image, "image", { forwardAsChild: !0 }), l = i(t.Selection, "selection", { forwardAsChild: !0 }), u = i(t.Handle, "handle", {
20
+ forwardAsChild: !0,
21
+ forwardProps: ["position"]
22
+ }), d = i(t.Grid, "grid", { forwardAsChild: !0 }), f = {
23
+ handles: t.handles,
24
+ Root: o,
25
+ Viewport: s,
26
+ Image: c,
27
+ Selection: l,
28
+ Handle: u,
29
+ Grid: d
30
+ };
31
+ //#endregion
32
+ export { f as default, n as useImageCropperContext };
@@ -1,10 +1,18 @@
1
- export interface BitkitCodeSnippetProps {
1
+ interface BaseProps {
2
2
  children: string;
3
- disableTooltip?: boolean;
4
3
  size?: 'md' | 'lg';
5
- startingHeight?: number;
6
4
  textToCopy?: string;
7
- variant: 'inline' | 'multi' | 'single';
8
5
  }
6
+ interface InlineProps extends BaseProps {
7
+ interactive?: boolean;
8
+ startingHeight?: never;
9
+ variant: 'inline';
10
+ }
11
+ interface BlockProps extends BaseProps {
12
+ interactive?: never;
13
+ startingHeight?: number;
14
+ variant: 'multi' | 'single';
15
+ }
16
+ export type BitkitCodeSnippetProps = InlineProps | BlockProps;
9
17
  declare const BitkitCodeSnippet: import('react').ForwardRefExoticComponent<BitkitCodeSnippetProps & import('react').RefAttributes<HTMLElement>>;
10
18
  export default BitkitCodeSnippet;
@@ -3,80 +3,85 @@ import t from "../../icons/IconCheck.js";
3
3
  import n from "../../icons/IconCopy.js";
4
4
  import r from "../BitkitTooltip/BitkitTooltip.js";
5
5
  import { chakra as i, useSlotRecipe as a } from "@chakra-ui/react/styled-system";
6
- import { forwardRef as o, useCallback as s, useState as c } from "react";
7
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
- import { useClipboard as d } from "@ark-ui/react/clipboard";
6
+ import { forwardRef as o, useState as s } from "react";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ import { useClipboard as u } from "@ark-ui/react/clipboard";
9
9
  //#region lib/components/BitkitCodeSnippet/BitkitCodeSnippet.tsx
10
- var f = "Copy to clipboard", p = o((o, p) => {
11
- let { children: m, disableTooltip: h, size: g = "lg", startingHeight: _, textToCopy: v, variant: y } = o, b = _ !== void 0, [x, S] = c(!1), { copied: C, copy: w } = d({
10
+ var d = "Copy to clipboard", f = o((o, f) => {
11
+ let { children: p, interactive: m, size: h = "lg", startingHeight: g, textToCopy: _, variant: v } = o, y = g !== void 0, [b, x] = s(!1), { copied: S, copy: C } = u({
12
12
  timeout: 2e3,
13
- value: v ?? m
14
- }), T = a({ key: "codeSnippet" })({
15
- size: g,
16
- variant: y,
17
- hasShowMore: b,
18
- isExpanded: x
19
- }), E = s(() => {
20
- S((e) => !e);
21
- }, []), D = /* @__PURE__ */ l(i.button, {
22
- onClick: w,
23
- "aria-label": f,
24
- css: T.copyButton,
25
- children: l(C ? t : n, { size: "16" })
13
+ value: _ ?? p
14
+ }), w = a({ key: "codeSnippet" })({
15
+ size: h,
16
+ variant: v,
17
+ hasShowMore: y,
18
+ isExpanded: b,
19
+ interactive: m
20
+ }), T = () => {
21
+ x((e) => !e);
22
+ }, E = (e) => {
23
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), C());
24
+ }, D = /* @__PURE__ */ c(i.button, {
25
+ "aria-label": d,
26
+ css: w.copyButton,
27
+ onClick: C,
28
+ type: "button",
29
+ children: c(S ? t : n, { size: "16" })
26
30
  });
27
- if (y === "inline") return /* @__PURE__ */ l(r, {
28
- disabled: h,
29
- text: f,
30
- children: /* @__PURE__ */ l(i.code, {
31
- ref: p,
32
- css: T.root,
33
- onClick: w,
34
- onKeyDown: (e) => {
35
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), w());
36
- },
31
+ if (v === "inline") return m ? /* @__PURE__ */ c(r, {
32
+ text: d,
33
+ children: /* @__PURE__ */ c(i.code, {
34
+ ref: f,
35
+ css: w.root,
36
+ onClick: C,
37
+ onKeyDown: E,
37
38
  role: "button",
38
39
  tabIndex: 0,
39
- children: m
40
+ children: p
40
41
  })
42
+ }) : /* @__PURE__ */ c(i.code, {
43
+ ref: f,
44
+ css: w.root,
45
+ children: p
41
46
  });
42
- if (y === "single") return /* @__PURE__ */ u(i.div, {
43
- ref: p,
44
- css: T.root,
45
- children: [/* @__PURE__ */ l(i.code, {
46
- css: T.content,
47
+ if (v === "single") return /* @__PURE__ */ l(i.div, {
48
+ ref: f,
49
+ css: w.root,
50
+ children: [/* @__PURE__ */ c(i.code, {
51
+ css: w.content,
47
52
  tabIndex: -1,
48
- children: m
49
- }), /* @__PURE__ */ l(r, {
50
- text: f,
53
+ children: p
54
+ }), /* @__PURE__ */ c(r, {
55
+ text: d,
51
56
  children: D
52
57
  })]
53
58
  });
54
- let O = b && !x ? _ : void 0;
55
- return /* @__PURE__ */ u(i.div, {
56
- ref: p,
57
- css: T.root,
59
+ let O = y && !b ? g : void 0;
60
+ return /* @__PURE__ */ l(i.div, {
61
+ ref: f,
62
+ css: w.root,
58
63
  children: [
59
- /* @__PURE__ */ l(i.code, {
60
- css: T.content,
64
+ /* @__PURE__ */ c(i.code, {
65
+ css: w.content,
61
66
  maxHeight: O,
62
67
  tabIndex: -1,
63
- children: m
68
+ children: p
64
69
  }),
65
- /* @__PURE__ */ l(r, {
66
- text: f,
70
+ /* @__PURE__ */ c(r, {
71
+ text: d,
67
72
  children: D
68
73
  }),
69
- b && /* @__PURE__ */ u(i.div, {
70
- css: T.showMoreContainer,
71
- children: [!x && /* @__PURE__ */ l(i.div, { css: T.showMoreGradient }), /* @__PURE__ */ u(i.button, {
72
- onClick: E,
73
- css: T.showMoreButton,
74
- children: [x ? "Show less" : "Show more", /* @__PURE__ */ l(e, { "data-state": x ? "open" : "closed" })]
74
+ y && /* @__PURE__ */ l(i.div, {
75
+ css: w.showMoreContainer,
76
+ children: [!b && /* @__PURE__ */ c(i.div, { css: w.showMoreGradient }), /* @__PURE__ */ l(i.button, {
77
+ onClick: T,
78
+ css: w.showMoreButton,
79
+ children: [b ? "Show less" : "Show more", /* @__PURE__ */ c(e, { "data-state": b ? "open" : "closed" })]
75
80
  })]
76
81
  })
77
82
  ]
78
83
  });
79
84
  });
80
- p.displayName = "BitkitCodeSnippet";
85
+ f.displayName = "BitkitCodeSnippet";
81
86
  //#endregion
82
- export { p as default };
87
+ export { f as default };
@@ -0,0 +1,23 @@
1
+ import { CollapsibleRootProps } from '@chakra-ui/react/collapsible';
2
+ import { ReactNode } from 'react';
3
+ import { BitkitLabelProps } from '../BitkitLabel/BitkitLabel';
4
+ type UncontrolledProps = {
5
+ defaultOpen?: boolean;
6
+ open?: never;
7
+ onOpenChange?: never;
8
+ };
9
+ type ControlledProps = {
10
+ defaultOpen?: never;
11
+ onOpenChange: (open: boolean) => void;
12
+ open: boolean;
13
+ };
14
+ export type BitkitCollapsibleProps = Omit<CollapsibleRootProps, 'collapsedHeight' | 'defaultOpen' | 'onOpenChange' | 'open'> & {
15
+ children: ReactNode;
16
+ closedLabel?: string;
17
+ collapsedHeight?: string;
18
+ label?: string;
19
+ labelProps?: Omit<BitkitLabelProps, 'children'>;
20
+ openLabel?: string;
21
+ } & (UncontrolledProps | ControlledProps);
22
+ declare const BitkitCollapsible: import('react').ForwardRefExoticComponent<BitkitCollapsibleProps & import('react').RefAttributes<HTMLDivElement>>;
23
+ export default BitkitCollapsible;
@@ -0,0 +1,37 @@
1
+ import e from "../../icons/IconChevronDown.js";
2
+ import t from "../../icons/IconChevronUp.js";
3
+ import n from "../BitkitLabel/BitkitLabel.js";
4
+ import { useSlotRecipe as r } from "@chakra-ui/react/styled-system";
5
+ import { forwardRef as i } from "react";
6
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import { Collapsible as c } from "@chakra-ui/react/collapsible";
8
+ //#region lib/components/BitkitCollapsible/BitkitCollapsible.tsx
9
+ var l = i((i, l) => {
10
+ let { children: u, closedLabel: d = "Show less", collapsedHeight: f = "48px", defaultOpen: p, label: m, labelProps: h, onOpenChange: g, open: _, openLabel: v = "Show more", ...y } = i, b = r({ key: "collapsible" })(), x = g ? (e) => g(e.open) : void 0;
11
+ return /* @__PURE__ */ s(c.Root, {
12
+ ref: l,
13
+ collapsedHeight: f,
14
+ css: b.root,
15
+ defaultOpen: p,
16
+ onOpenChange: x,
17
+ open: _,
18
+ ...y,
19
+ children: [
20
+ m && /* @__PURE__ */ o(n, {
21
+ ...h,
22
+ children: m
23
+ }),
24
+ /* @__PURE__ */ o(c.Content, {
25
+ css: b.content,
26
+ children: u
27
+ }),
28
+ /* @__PURE__ */ o(c.Trigger, {
29
+ css: b.trigger,
30
+ children: /* @__PURE__ */ o(c.Context, { children: (n) => /* @__PURE__ */ s(a, { children: [n.open ? d : v, n.open ? /* @__PURE__ */ o(t, { size: "16" }) : /* @__PURE__ */ o(e, { size: "16" })] }) })
31
+ })
32
+ ]
33
+ });
34
+ });
35
+ l.displayName = "BitkitCollapsible";
36
+ //#endregion
37
+ export { l as default };
@@ -1,21 +1,14 @@
1
1
  import { ComboboxRootProps } from '@chakra-ui/react/combobox';
2
- import { FieldRootProps } from '@chakra-ui/react/field';
3
2
  import { BitkitFieldProps } from '../BitkitField/BitkitField';
4
3
  import { BitkitSelectContentProps, BitkitSelectMenuCreateItemProps, BitkitSelectMenuItemProps, BitkitSelectMenuSearchProps } from '../BitkitSelectMenu/BitkitSelectMenu';
5
- export type BitkitComboboxProps = FieldRootProps & {
4
+ export type BitkitComboboxProps = Omit<BitkitFieldProps, 'children' | 'state'> & {
6
5
  comboboxProps?: ComboboxRootProps;
7
6
  contentProps?: BitkitSelectContentProps;
8
- errorText?: BitkitFieldProps['errorText'];
9
- helperText?: BitkitFieldProps['helperText'];
10
7
  isLoading?: boolean;
11
8
  items: Array<BitkitSelectMenuItemProps>;
12
- label?: BitkitFieldProps['label'];
13
- optional?: BitkitFieldProps['optional'];
14
9
  placeholder?: string;
15
10
  size?: 'md' | 'lg';
16
- state?: 'default' | 'disabled' | 'error' | 'readOnly' | 'warning';
17
- tooltip?: BitkitFieldProps['tooltip'];
18
- warningText?: BitkitFieldProps['warningText'];
11
+ state?: 'disabled' | 'error' | 'readOnly' | 'warning';
19
12
  } & BitkitSelectMenuCreateItemProps & BitkitSelectMenuSearchProps;
20
13
  declare const BitkitCombobox: import('react').ForwardRefExoticComponent<BitkitComboboxProps & import('react').RefAttributes<HTMLDivElement>>;
21
14
  export default BitkitCombobox;
@@ -14,64 +14,56 @@ import { useListCollection as p } from "@chakra-ui/react/hooks";
14
14
  import { useFilter as m } from "@chakra-ui/react/locale";
15
15
  //#region lib/components/BitkitCombobox/BitkitCombobox.tsx
16
16
  var h = c((c, h) => {
17
- let { comboboxProps: g, contentProps: _, createItemHref: v, createItemLabel: y, createItemProps: b, errorText: x, hasSearch: S, helperText: C, isLoading: w, items: T, label: E, onCreateItem: D, onSearchChange: O, optional: k, placeholder: A = "Enter a value or select", size: j, state: M, tooltip: N, warningText: P, ...F } = c, { contains: I } = m({ sensitivity: "base" }), { collection: L, filter: R } = p({
18
- initialItems: T,
19
- filter: (e, t, n) => I(n.label, t)
20
- }), z = o({ key: "combobox" })({ size: j }), B = M === "warning" || !!P, V = M === "error" || !!x, H = j === "md" ? "16" : "24", U;
21
- return V ? U = /* @__PURE__ */ l(t, {
22
- size: H,
17
+ let { comboboxProps: g, contentProps: _, createItemHref: v, createItemLabel: y, createItemProps: b, hasSearch: x, isLoading: S, items: C, onCreateItem: w, onSearchChange: T, placeholder: E = "Enter a value or select", size: D, state: O, ...k } = c, { contains: A } = m({ sensitivity: "base" }), { collection: j, filter: M } = p({
18
+ initialItems: C,
19
+ filter: (e, t, n) => A(n.label, t)
20
+ }), N = o({ key: "combobox" })({ size: D }), P = O === "warning" || !!k.warningText, F = O === "error" || !!k.errorText, I = D === "md" ? "16" : "24", L;
21
+ return F ? L = /* @__PURE__ */ l(t, {
22
+ size: I,
23
23
  color: "icon/negative"
24
- }) : B && (U = /* @__PURE__ */ l(n, { size: H })), /* @__PURE__ */ l(a, {
25
- disabled: M === "disabled",
26
- errorText: x,
27
- helperText: C,
28
- invalid: V,
29
- label: E,
30
- optional: k,
31
- readOnly: M === "readOnly",
24
+ }) : P && (L = /* @__PURE__ */ l(n, { size: I })), /* @__PURE__ */ l(a, {
32
25
  ref: h,
33
- tooltip: N,
34
- warningText: P,
35
- ...F,
26
+ state: O,
27
+ ...k,
36
28
  children: /* @__PURE__ */ u(f.Root, {
37
29
  ...g,
38
- collection: L,
39
- disabled: M === "disabled",
40
- invalid: V,
30
+ collection: j,
31
+ disabled: O === "disabled",
32
+ invalid: F,
41
33
  onInputValueChange: (e) => {
42
- R(e.inputValue);
34
+ M(e.inputValue);
43
35
  },
44
- readOnly: M === "readOnly",
45
- size: j,
36
+ readOnly: O === "readOnly",
37
+ size: D,
46
38
  children: [/* @__PURE__ */ u(f.Control, {
47
39
  className: "group",
48
- children: [/* @__PURE__ */ l(f.Input, { placeholder: A }), /* @__PURE__ */ u(f.IndicatorGroup, { children: [
40
+ children: [/* @__PURE__ */ l(f.Input, { placeholder: E }), /* @__PURE__ */ u(f.IndicatorGroup, { children: [
49
41
  /* @__PURE__ */ l(f.ClearTrigger, {
50
42
  asChild: !0,
51
43
  children: /* @__PURE__ */ l(r, { size: "sm" })
52
44
  }),
53
- U,
45
+ L,
54
46
  /* @__PURE__ */ l(f.Trigger, {
55
47
  asChild: !0,
56
48
  children: /* @__PURE__ */ l(e, {})
57
49
  })
58
50
  ] })]
59
51
  }), /* @__PURE__ */ l(d, { children: /* @__PURE__ */ l(f.Positioner, { children: /* @__PURE__ */ u(f.Content, { children: [/* @__PURE__ */ u(f.Empty, { children: ["No items found ", /* @__PURE__ */ l(s, {
60
- css: z.emptyHelperText,
52
+ css: N.emptyHelperText,
61
53
  children: "Enter custom value"
62
54
  })] }), /* @__PURE__ */ l(i, {
63
- collection: L,
55
+ collection: j,
64
56
  createItemHref: v,
65
57
  createItemLabel: y,
66
58
  createItemProps: b,
67
59
  contentProps: _,
68
- isLoading: w,
69
- onCreateItem: D,
70
- size: j,
60
+ isLoading: S,
61
+ onCreateItem: w,
62
+ size: D,
71
63
  variant: "combobox",
72
- ...S ? {
64
+ ...x ? {
73
65
  hasSearch: !0,
74
- onSearchChange: O
66
+ onSearchChange: T
75
67
  } : { hasSearch: !1 }
76
68
  })] }) }) })]
77
69
  })
@@ -1,12 +1,14 @@
1
1
  import { Field } from '@chakra-ui/react/field';
2
2
  import { ReactNode } from 'react';
3
- export interface BitkitFieldProps extends Field.RootProps {
3
+ export interface BitkitFieldProps extends Omit<Field.RootProps, 'disabled' | 'invalid' | 'readOnly'> {
4
+ badge?: ReactNode;
4
5
  children: ReactNode;
5
6
  counterText?: string;
6
7
  errorText?: ReactNode;
7
8
  helperText?: ReactNode;
8
9
  label?: string;
9
10
  optional?: boolean;
11
+ state?: 'disabled' | 'error' | 'readOnly' | 'warning';
10
12
  tooltip?: string;
11
13
  warningText?: ReactNode;
12
14
  }
@@ -1,50 +1,38 @@
1
- import e from "../../icons/IconInfoCircle.js";
2
- import t from "../BitkitTooltip/BitkitTooltip.js";
3
- import { Text as n } from "@chakra-ui/react/text";
4
- import { forwardRef as r } from "react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import { Field as o } from "@chakra-ui/react/field";
1
+ import e from "../BitkitLabel/BitkitLabel.js";
2
+ import { forwardRef as t } from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { Field as i } from "@chakra-ui/react/field";
7
5
  //#region lib/components/BitkitField/BitkitField.tsx
8
- var s = r((r, s) => {
9
- let { counterText: c, children: l, disabled: u, errorText: d, helperText: f, label: p, optional: m, tooltip: h, warningText: g, ..._ } = r;
10
- return /* @__PURE__ */ a(o.Root, {
11
- disabled: u,
12
- required: !m,
13
- ref: s,
14
- ..._,
6
+ var a = t((t, a) => {
7
+ let { badge: o, counterText: s, children: c, errorText: l, helperText: u, label: d, optional: f, state: p, tooltip: m, warningText: h, ...g } = t, _ = p === "error" || !!l;
8
+ return /* @__PURE__ */ r(i.Root, {
9
+ disabled: p === "disabled",
10
+ invalid: _,
11
+ readOnly: p === "readOnly",
12
+ required: !f,
13
+ ref: a,
14
+ ...g,
15
15
  children: [
16
- p || c ? /* @__PURE__ */ a(o.Label, { children: [
17
- p,
18
- " ",
19
- m && /* @__PURE__ */ i(o.RequiredIndicator, { fallback: /* @__PURE__ */ i(n, {
20
- as: "span",
21
- textStyle: "body/md/regular",
22
- children: "(optional)"
23
- }) }),
24
- !!h && /* @__PURE__ */ i(t, {
25
- text: h ?? "",
26
- children: /* @__PURE__ */ i(e, {
27
- size: "16",
28
- color: "icon/tertiary"
29
- })
30
- }),
31
- c && /* @__PURE__ */ i(n, {
32
- as: "span",
33
- marginInlineStart: "auto",
34
- textStyle: "comp/input/helperText",
35
- children: c
16
+ d || o || s ? /* @__PURE__ */ n(i.Label, {
17
+ asChild: !0,
18
+ children: /* @__PURE__ */ n(e, {
19
+ badge: o,
20
+ counterText: s,
21
+ optional: f,
22
+ tooltip: m,
23
+ children: d
36
24
  })
37
- ] }) : null,
38
- l,
39
- !!f && !d && !g && /* @__PURE__ */ i(o.HelperText, { children: f }),
40
- !!g && !d && /* @__PURE__ */ i(o.HelperText, {
25
+ }) : null,
26
+ c,
27
+ !!u && !l && !h && /* @__PURE__ */ n(i.HelperText, { children: u }),
28
+ !!h && !l && /* @__PURE__ */ n(i.HelperText, {
41
29
  color: "text/body",
42
- children: g
30
+ children: h
43
31
  }),
44
- !!d && /* @__PURE__ */ i(o.ErrorText, { children: d })
32
+ !!l && /* @__PURE__ */ n(i.ErrorText, { children: l })
45
33
  ]
46
34
  });
47
35
  });
48
- s.displayName = "BitkitField";
36
+ a.displayName = "BitkitField";
49
37
  //#endregion
50
- export { s as default };
38
+ export { a as default };
@@ -1,10 +1,9 @@
1
1
  import { FileUpload } from '@chakra-ui/react/file-upload';
2
- declare const BitkitFileInput: import('react').ForwardRefExoticComponent<Omit<FileUpload.RootProps, "disabled" | "invalid"> & {
3
- state?: "error" | "disabled";
4
- errorText?: string;
5
- helperText?: string;
2
+ import { BitkitFieldProps } from '../BitkitField/BitkitField';
3
+ declare const BitkitFileInput: import('react').ForwardRefExoticComponent<Omit<BitkitFieldProps, "children" | "state"> & Omit<FileUpload.RootProps, "disabled" | "invalid"> & {
6
4
  aspectRatio?: number;
7
5
  onCropChange?: (file: File) => void;
8
6
  onFileAccepted?: (file: File) => void;
7
+ state?: "error" | "disabled";
9
8
  } & import('react').RefAttributes<HTMLDivElement>>;
10
9
  export default BitkitFileInput;
@@ -0,0 +1,112 @@
1
+ import e from "../../icons/IconMinusCircle.js";
2
+ import t from "../../icons/IconUpload.js";
3
+ import n from "../BitkitButton/BitkitButton.js";
4
+ import r from "../BitkitCard/BitkitCard.js";
5
+ import i from "../BitkitField/BitkitField.js";
6
+ import a, { useImageCropperContext as o } from "../../atoms/ImageCropper/ImageCropper.js";
7
+ import { Text as s } from "@chakra-ui/react/text";
8
+ import { forwardRef as c, useEffect as l, useMemo as u } from "react";
9
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
10
+ import { FileUpload as m, useFileUploadContext as h } from "@chakra-ui/react/file-upload";
11
+ import { VStack as g } from "@chakra-ui/react/stack";
12
+ import { splitProps as _ } from "@zag-js/file-upload";
13
+ //#region lib/components/BitkitFileInput/BitkitFileInput.tsx
14
+ var v = () => {
15
+ let { disabled: e } = h(), n = e ? "Cannot upload file" : "Drag and drop file here or click to select";
16
+ return /* @__PURE__ */ f(m.Dropzone, { children: /* @__PURE__ */ p(m.DropzoneContent, { children: [/* @__PURE__ */ f(t, {}), /* @__PURE__ */ f(s, {
17
+ as: "span",
18
+ children: n
19
+ })] }) });
20
+ }, y = (e) => {
21
+ let { onCropChange: t } = e, { acceptedFiles: n } = h(), { dragging: r, getCroppedImage: i } = o(), s = n[0], c = u(() => s ? URL.createObjectURL(s) : void 0, [s]);
22
+ return l(() => () => {
23
+ c && URL.revokeObjectURL(c);
24
+ }, [c]), l(() => {
25
+ if (!t || r || !s) return;
26
+ let e = !1;
27
+ return i().then((n) => {
28
+ !e && n instanceof Blob && t(new File([n], s.name, { type: n.type }));
29
+ }), () => {
30
+ e = !0;
31
+ };
32
+ }, [
33
+ i,
34
+ s,
35
+ t,
36
+ r
37
+ ]), /* @__PURE__ */ p(a.Viewport, { children: [/* @__PURE__ */ f(a.Image, { src: c }), /* @__PURE__ */ f(a.Selection, { children: a.handles.map((e) => /* @__PURE__ */ f(a.Handle, {
38
+ position: e,
39
+ children: /* @__PURE__ */ f("div", {})
40
+ }, e)) })] });
41
+ }, b = (e) => {
42
+ let { aspectRatio: t, onCropChange: n } = e;
43
+ return /* @__PURE__ */ f(a.Root, {
44
+ aspectRatio: t,
45
+ height: "100%",
46
+ children: /* @__PURE__ */ f(y, { onCropChange: n })
47
+ });
48
+ }, x = () => {
49
+ let t = h(), i = t.acceptedFiles[0];
50
+ return /* @__PURE__ */ p(r, {
51
+ display: "flex",
52
+ elevation: !1,
53
+ paddingBlock: "20",
54
+ paddingInline: "24",
55
+ alignItems: "center",
56
+ flex: "1",
57
+ children: [/* @__PURE__ */ p(g, {
58
+ gap: "4",
59
+ alignItems: "flex-start",
60
+ flex: "1",
61
+ minWidth: "0",
62
+ children: [/* @__PURE__ */ f(s, {
63
+ textStyle: "comp/input/label",
64
+ children: "Selected file"
65
+ }), /* @__PURE__ */ f(s, {
66
+ whiteSpace: "nowrap",
67
+ textOverflow: "ellipsis",
68
+ overflow: "hidden",
69
+ maxWidth: "100%",
70
+ children: i.name
71
+ })]
72
+ }), /* @__PURE__ */ f(n, {
73
+ icon: e,
74
+ variant: "secondary",
75
+ size: "md",
76
+ onClick: t.clearFiles,
77
+ children: "Remove"
78
+ })]
79
+ });
80
+ }, S = (e) => {
81
+ let { variant: t, aspectRatio: n, onCropChange: r } = e, i = h().acceptedFiles[0];
82
+ return /* @__PURE__ */ p(d, { children: [
83
+ !i && /* @__PURE__ */ f(v, {}),
84
+ i && t === "image" && /* @__PURE__ */ f(b, {
85
+ aspectRatio: n,
86
+ onCropChange: r
87
+ }),
88
+ i && t !== "image" && /* @__PURE__ */ f(x, {})
89
+ ] });
90
+ }, C = c((e, t) => {
91
+ let { aspectRatio: n, onCropChange: r, onFileAccept: a, onFileAccepted: o, state: s, variant: c, ...l } = e, [u, d] = _(l), h = (e) => {
92
+ a?.(e), o?.(e.files[0]);
93
+ }, g = {
94
+ variant: c,
95
+ aspectRatio: n,
96
+ onCropChange: r
97
+ };
98
+ return /* @__PURE__ */ f(i, {
99
+ ref: t,
100
+ state: s,
101
+ ...d,
102
+ children: /* @__PURE__ */ p(m.Root, {
103
+ variant: c,
104
+ onFileAccept: h,
105
+ ...u,
106
+ children: [/* @__PURE__ */ f(m.HiddenInput, {}), /* @__PURE__ */ f(S, { ...g })]
107
+ })
108
+ });
109
+ });
110
+ C.displayName = "BitkitFileInput";
111
+ //#endregion
112
+ export { C as default };
@@ -0,0 +1,8 @@
1
+ import { BoxProps } from '@chakra-ui/react/box';
2
+ import { BitkitIconComponent } from '../../icons';
3
+ export interface BitkitGroupHeadingProps extends Omit<BoxProps, 'icon'> {
4
+ icon?: BitkitIconComponent;
5
+ label: string;
6
+ }
7
+ declare const BitkitGroupHeading: import('react').ForwardRefExoticComponent<BitkitGroupHeadingProps & import('react').RefAttributes<HTMLDivElement>>;
8
+ export default BitkitGroupHeading;
@@ -0,0 +1,27 @@
1
+ import { Box as e } from "@chakra-ui/react/box";
2
+ import { chakra as t, useSlotRecipe as n } from "@chakra-ui/react/styled-system";
3
+ import { forwardRef as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { Separator as o } from "@chakra-ui/react/separator";
6
+ //#region lib/components/BitkitGroupHeading/BitkitGroupHeading.tsx
7
+ var s = r((r, s) => {
8
+ let { icon: c, label: l, ...u } = r, d = n({ key: "groupHeading" })();
9
+ return /* @__PURE__ */ a(e, {
10
+ css: d.root,
11
+ ref: s,
12
+ ...u,
13
+ children: [/* @__PURE__ */ a(t.div, {
14
+ css: d.titleBlock,
15
+ children: [c && /* @__PURE__ */ i(c, {
16
+ css: d.icon,
17
+ size: "16"
18
+ }), /* @__PURE__ */ i(t.span, {
19
+ css: d.label,
20
+ children: l
21
+ })]
22
+ }), /* @__PURE__ */ i(o, { css: d.separator })]
23
+ });
24
+ });
25
+ s.displayName = "BitkitGroupHeading";
26
+ //#endregion
27
+ export { s as default };
@@ -0,0 +1,12 @@
1
+ import { HTMLChakraProps } from '@chakra-ui/react/styled-system';
2
+ import { ReactNode } from 'react';
3
+ export interface BitkitLabelProps extends Omit<HTMLChakraProps<'label'>, 'children'> {
4
+ badge?: ReactNode;
5
+ counterText?: string;
6
+ disabled?: boolean;
7
+ children?: string;
8
+ optional?: boolean;
9
+ tooltip?: string;
10
+ }
11
+ declare const BitkitLabel: import('react').ForwardRefExoticComponent<BitkitLabelProps & import('react').RefAttributes<HTMLLabelElement>>;
12
+ export default BitkitLabel;