@bitrise/bitkit-v2 0.3.140 → 0.3.142

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 (28) hide show
  1. package/dist/components/BitkitCombobox/BitkitCombobox.d.ts +21 -0
  2. package/dist/components/BitkitCombobox/BitkitCombobox.js +107 -0
  3. package/dist/components/BitkitControlButton/BitkitControlButton.d.ts +14 -0
  4. package/dist/components/BitkitControlButton/BitkitControlButton.js +23 -0
  5. package/dist/components/BitkitSelect/BitkitSelect.js +20 -20
  6. package/dist/components/BitkitSelectMenu/BitkitSelectMenu.js +16 -16
  7. package/dist/components/index.d.ts +2 -0
  8. package/dist/main.js +582 -578
  9. package/dist/theme/common/ComboboxAndSelect.common.d.ts +3 -0
  10. package/dist/theme/common/ComboboxAndSelect.common.js +85 -0
  11. package/dist/theme/{recipes/common → common}/InputAndTextarea.common.js +1 -1
  12. package/dist/theme/recipes/ControlButton.recipe.d.ts +50 -0
  13. package/dist/theme/recipes/ControlButton.recipe.js +67 -0
  14. package/dist/theme/recipes/Input.recipe.js +1 -1
  15. package/dist/theme/recipes/Textarea.recipe.js +1 -1
  16. package/dist/theme/recipes/index.d.ts +49 -0
  17. package/dist/theme/recipes/index.js +18 -16
  18. package/dist/theme/slot-recipes/Combobox.recipe.d.ts +11 -0
  19. package/dist/theme/slot-recipes/Combobox.recipe.js +53 -0
  20. package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +1 -18
  21. package/dist/theme/slot-recipes/NativeSelect.recipe.js +10 -22
  22. package/dist/theme/slot-recipes/Select.recipe.d.ts +3 -19
  23. package/dist/theme/slot-recipes/Select.recipe.js +25 -91
  24. package/dist/theme/slot-recipes/index.d.ts +14 -37
  25. package/dist/theme/slot-recipes/index.js +36 -34
  26. package/dist/utilities/AssetSelectChevron.js +21 -13
  27. package/package.json +8 -8
  28. /package/dist/theme/{recipes/common → common}/InputAndTextarea.common.d.ts +0 -0
@@ -0,0 +1,21 @@
1
+ import { ComboboxRootProps } from '@chakra-ui/react/combobox';
2
+ import { FieldRootProps } from '@chakra-ui/react/field';
3
+ import { BitkitFieldProps } from '../BitkitField/BitkitField';
4
+ import { BitkitSelectContentProps, BitkitSelectMenuCreateItemProps, BitkitSelectMenuItemProps, BitkitSelectMenuSearchProps } from '../BitkitSelectMenu/BitkitSelectMenu';
5
+ export type BitkitComboboxProps = FieldRootProps & {
6
+ comboboxProps?: ComboboxRootProps;
7
+ contentProps?: BitkitSelectContentProps;
8
+ errorText?: BitkitFieldProps['errorText'];
9
+ helperText?: BitkitFieldProps['helperText'];
10
+ isLoading?: boolean;
11
+ items: Array<BitkitSelectMenuItemProps>;
12
+ label?: BitkitFieldProps['label'];
13
+ optional?: BitkitFieldProps['optional'];
14
+ placeholder?: string;
15
+ size?: 'md' | 'lg';
16
+ state?: 'default' | 'disabled' | 'error' | 'readOnly' | 'warning';
17
+ tooltip?: BitkitFieldProps['tooltip'];
18
+ warningText?: BitkitFieldProps['warningText'];
19
+ } & BitkitSelectMenuCreateItemProps & BitkitSelectMenuSearchProps;
20
+ declare const BitkitCombobox: import('react').ForwardRefExoticComponent<BitkitComboboxProps & import('react').RefAttributes<HTMLDivElement>>;
21
+ export default BitkitCombobox;
@@ -0,0 +1,107 @@
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { Combobox as o } from "@chakra-ui/react/combobox";
3
+ import { useListCollection as j } from "@chakra-ui/react/hooks";
4
+ import { useFilter as H } from "@chakra-ui/react/locale";
5
+ import { Portal as V } from "@chakra-ui/react/portal";
6
+ import { useSlotRecipe as W } from "@chakra-ui/react/styled-system";
7
+ import { Text as A } from "@chakra-ui/react/text";
8
+ import { forwardRef as G } from "react";
9
+ import M from "../../icons/IconErrorCircleFilled.js";
10
+ import Y from "../../icons/IconWarningYellow.js";
11
+ import _ from "../../utilities/AssetSelectChevron.js";
12
+ import q from "../BitkitCloseButton/BitkitCloseButton.js";
13
+ import D from "../BitkitField/BitkitField.js";
14
+ import J from "../BitkitSelectMenu/BitkitSelectMenu.js";
15
+ const K = G((p, h) => {
16
+ const {
17
+ comboboxProps: b,
18
+ contentProps: f,
19
+ createItemHref: u,
20
+ createItemLabel: x,
21
+ createItemProps: C,
22
+ errorText: s,
23
+ hasSearch: g,
24
+ helperText: I,
25
+ isLoading: y,
26
+ items: v,
27
+ label: S,
28
+ onCreateItem: T,
29
+ onSearchChange: k,
30
+ optional: B,
31
+ placeholder: z = "Enter a value or select",
32
+ size: i,
33
+ state: t,
34
+ tooltip: P,
35
+ warningText: a,
36
+ ...R
37
+ } = p, { contains: w } = H({ sensitivity: "base" }), { collection: c, filter: E } = j({
38
+ initialItems: v,
39
+ filter: (d, L, N) => w(N.label, L)
40
+ }), O = W({ key: "combobox" })({ size: i }), F = t === "warning" || !!a, n = t === "error" || !!s, m = i === "md" ? "16" : "24";
41
+ let l;
42
+ return n ? l = /* @__PURE__ */ e(M, { size: m, color: "icon/negative" }) : F && (l = /* @__PURE__ */ e(Y, { size: m })), /* @__PURE__ */ e(
43
+ D,
44
+ {
45
+ disabled: t === "disabled",
46
+ errorText: s,
47
+ helperText: I,
48
+ invalid: n,
49
+ label: S,
50
+ optional: B,
51
+ readOnly: t === "readOnly",
52
+ ref: h,
53
+ tooltip: P,
54
+ warningText: a,
55
+ ...R,
56
+ children: /* @__PURE__ */ r(
57
+ o.Root,
58
+ {
59
+ ...b,
60
+ collection: c,
61
+ disabled: t === "disabled",
62
+ invalid: n,
63
+ onInputValueChange: (d) => {
64
+ E(d.inputValue);
65
+ },
66
+ readOnly: t === "readOnly",
67
+ size: i,
68
+ children: [
69
+ /* @__PURE__ */ r(o.Control, { className: "group", children: [
70
+ /* @__PURE__ */ e(o.Input, { placeholder: z }),
71
+ /* @__PURE__ */ r(o.IndicatorGroup, { children: [
72
+ /* @__PURE__ */ e(o.ClearTrigger, { asChild: !0, children: /* @__PURE__ */ e(q, { size: "sm" }) }),
73
+ l,
74
+ /* @__PURE__ */ e(o.Trigger, { asChild: !0, children: /* @__PURE__ */ e(_, {}) })
75
+ ] })
76
+ ] }),
77
+ /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(o.Positioner, { children: /* @__PURE__ */ r(o.Content, { children: [
78
+ /* @__PURE__ */ r(o.Empty, { children: [
79
+ "No items found ",
80
+ /* @__PURE__ */ e(A, { css: O.emptyHelperText, children: "Enter custom value" })
81
+ ] }),
82
+ /* @__PURE__ */ e(
83
+ J,
84
+ {
85
+ collection: c,
86
+ createItemHref: u,
87
+ createItemLabel: x,
88
+ createItemProps: C,
89
+ contentProps: f,
90
+ isLoading: y,
91
+ onCreateItem: T,
92
+ size: i,
93
+ variant: "combobox",
94
+ ...g ? { hasSearch: !0, onSearchChange: k } : { hasSearch: !1 }
95
+ }
96
+ )
97
+ ] }) }) })
98
+ ]
99
+ }
100
+ )
101
+ }
102
+ );
103
+ });
104
+ K.displayName = "BitkitCombobox";
105
+ export {
106
+ K as default
107
+ };
@@ -0,0 +1,14 @@
1
+ import { HTMLChakraProps } from '@chakra-ui/react/styled-system';
2
+ import { BitkitIconComponent } from '../../icons';
3
+ import { BitkitTooltipProps } from '../BitkitTooltip/BitkitTooltip';
4
+ type ControlButtonSize = 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
5
+ export interface BitkitControlButtonProps extends Omit<HTMLChakraProps<'button'>, 'children' | 'disabled' | 'size'> {
6
+ icon: BitkitIconComponent;
7
+ isDanger?: boolean;
8
+ label: string;
9
+ size?: ControlButtonSize;
10
+ state?: 'disabled' | 'skeleton';
11
+ tooltipProps?: Partial<Omit<BitkitTooltipProps, 'children' | 'text'>>;
12
+ }
13
+ declare const BitkitControlButton: import('react').ForwardRefExoticComponent<BitkitControlButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
14
+ export default BitkitControlButton;
@@ -0,0 +1,23 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Skeleton as d } from "@chakra-ui/react/skeleton";
3
+ import { useRecipe as f, chakra as k } from "@chakra-ui/react/styled-system";
4
+ import { forwardRef as u } from "react";
5
+ import x from "../BitkitTooltip/BitkitTooltip.js";
6
+ const B = u((r, n) => {
7
+ const { icon: s, isDanger: l, label: i, size: o = "sm", state: e, tooltipProps: a, ...c } = r, m = f({ key: "controlButton" }), p = o === "xxs" || o === "xs" ? "16" : "24";
8
+ return /* @__PURE__ */ t(x, { text: i, ...a, children: /* @__PURE__ */ t(
9
+ k.button,
10
+ {
11
+ ref: n,
12
+ "aria-label": i,
13
+ disabled: e === "disabled" || e === "skeleton",
14
+ ...c,
15
+ css: m({ isDanger: l, size: o }),
16
+ children: /* @__PURE__ */ t(d, { loading: e === "skeleton", children: /* @__PURE__ */ t(s, { size: p }) })
17
+ }
18
+ ) });
19
+ });
20
+ B.displayName = "BitkitControlButton";
21
+ export {
22
+ B as default
23
+ };
@@ -3,25 +3,25 @@ import { Box as L } from "@chakra-ui/react/box";
3
3
  import { createListCollection as j } from "@chakra-ui/react/collection";
4
4
  import { Portal as F } from "@chakra-ui/react/portal";
5
5
  import { Select as r, useSelectContext as H } from "@chakra-ui/react/select";
6
- import { forwardRef as R } from "react";
7
- import A from "../../utilities/AssetSelectChevron.js";
8
- import E from "../BitkitField/BitkitField.js";
9
- import G from "../BitkitSelectMenu/BitkitSelectMenu.js";
10
- import M from "../../icons/IconErrorCircleFilled.js";
11
- import N from "../../icons/IconWarningYellow.js";
6
+ import { forwardRef as N } from "react";
7
+ import R from "../../utilities/AssetSelectChevron.js";
8
+ import A from "../BitkitField/BitkitField.js";
9
+ import E from "../BitkitSelectMenu/BitkitSelectMenu.js";
10
+ import G from "../../icons/IconErrorCircleFilled.js";
11
+ import M from "../../icons/IconWarningYellow.js";
12
12
  const W = ({ placeholder: i, state: n, size: m }) => {
13
- const o = H().selectedItems, c = o[0]?.icon, a = o[0]?.label, s = m === "md" ? "16" : "24";
13
+ const o = H().selectedItems, a = o[0]?.icon, c = o[0]?.label, s = m === "md" ? "16" : "24";
14
14
  return o[0] ? /* @__PURE__ */ e(r.ValueText, { placeholder: i || n === "readOnly" ? "(not selected)" : "Select an option", children: /* @__PURE__ */ d(L, { display: "flex", alignItems: "center", gap: "8", children: [
15
- c && /* @__PURE__ */ e(c, { size: s }),
16
- a
15
+ a && /* @__PURE__ */ e(a, { size: s }),
16
+ c
17
17
  ] }) }) : /* @__PURE__ */ e(r.ValueText, { placeholder: i ?? (n === "readOnly" ? "(not selected)" : "Select an option") });
18
- }, Y = R((i, n) => {
18
+ }, Y = N((i, n) => {
19
19
  const {
20
20
  contentProps: m,
21
21
  createItemHref: h,
22
22
  createItemLabel: o,
23
- createItemProps: c,
24
- defaultValue: a,
23
+ createItemProps: a,
24
+ defaultValue: c,
25
25
  errorText: s,
26
26
  hasSearch: g,
27
27
  helperText: S,
@@ -46,7 +46,7 @@ const W = ({ placeholder: i, state: n, size: m }) => {
46
46
  groupBy: (p) => p.group || ""
47
47
  });
48
48
  return /* @__PURE__ */ e(
49
- E,
49
+ A,
50
50
  {
51
51
  disabled: t === "disabled",
52
52
  errorText: s,
@@ -65,26 +65,26 @@ const W = ({ placeholder: i, state: n, size: m }) => {
65
65
  collection: f,
66
66
  size: l,
67
67
  ...P,
68
- defaultValue: a ? [a] : void 0,
68
+ defaultValue: c ? [c] : void 0,
69
69
  onValueChange: (p) => V?.(p.value[0]),
70
70
  value: u ? [u] : void 0,
71
71
  children: [
72
72
  /* @__PURE__ */ e(r.HiddenSelect, {}),
73
- /* @__PURE__ */ d(r.Control, { children: [
73
+ /* @__PURE__ */ d(r.Control, { className: "group", children: [
74
74
  /* @__PURE__ */ e(r.Trigger, { ...z, children: /* @__PURE__ */ e(W, { placeholder: B, size: l, state: t }) }),
75
75
  /* @__PURE__ */ d(r.IndicatorGroup, { children: [
76
- t === "error" && /* @__PURE__ */ e(r.Indicator, { children: /* @__PURE__ */ e(M, { size: l === "lg" ? "24" : "16", color: "icon/negative" }) }),
77
- t === "warning" && /* @__PURE__ */ e(r.Indicator, { children: /* @__PURE__ */ e(N, { size: l === "lg" ? "24" : "16" }) }),
78
- /* @__PURE__ */ e(r.Indicator, { asChild: !0, children: /* @__PURE__ */ e(A, {}) })
76
+ t === "error" && /* @__PURE__ */ e(r.Indicator, { children: /* @__PURE__ */ e(G, { size: l === "lg" ? "24" : "16", color: "icon/negative" }) }),
77
+ t === "warning" && /* @__PURE__ */ e(r.Indicator, { children: /* @__PURE__ */ e(M, { size: l === "lg" ? "24" : "16" }) }),
78
+ /* @__PURE__ */ e(r.Indicator, { asChild: !0, children: /* @__PURE__ */ e(R, {}) })
79
79
  ] })
80
80
  ] }),
81
81
  /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(r.Positioner, { children: /* @__PURE__ */ e(
82
- G,
82
+ E,
83
83
  {
84
84
  collection: f,
85
85
  createItemHref: h,
86
86
  createItemLabel: o,
87
- createItemProps: c,
87
+ createItemProps: a,
88
88
  contentProps: m,
89
89
  isLoading: I,
90
90
  onCreateItem: v,
@@ -16,26 +16,26 @@ const E = P((f, h) => {
16
16
  const {
17
17
  collection: u,
18
18
  contentProps: I = {},
19
- hasSearch: x = !1,
20
- isLoading: S = !1,
21
- onSearchChange: g,
22
- size: s,
23
- variant: y = "select",
24
- createItemLabel: b = "Create item",
25
- onCreateItem: m,
26
19
  createItemHref: n,
27
- createItemProps: C
28
- } = f, o = y === "combobox" ? z : L, r = M({ key: "select" })({ size: s }), i = s === "md" ? "16" : "24";
20
+ createItemLabel: x = "Create item",
21
+ createItemProps: S,
22
+ hasSearch: g = !1,
23
+ isLoading: y = !1,
24
+ onCreateItem: s,
25
+ onSearchChange: b,
26
+ size: m,
27
+ variant: C = "select"
28
+ } = f, o = C === "combobox" ? z : L, r = M({ key: "select" })({ size: m }), i = m === "md" ? "16" : "24";
29
29
  return /* @__PURE__ */ t(o.Content, { css: r.content, ref: h, ...I, children: [
30
- x && /* @__PURE__ */ e(
30
+ g && /* @__PURE__ */ e(
31
31
  G,
32
32
  {
33
33
  startElement: /* @__PURE__ */ e(w, { size: i, color: "icon/tertiary" }),
34
34
  css: r.searchInputGroup,
35
- children: /* @__PURE__ */ e(v, { placeholder: "Search...", css: r.searchInput, onChange: (c) => g?.(c.target.value) })
35
+ children: /* @__PURE__ */ e(v, { placeholder: "Search...", css: r.searchInput, onChange: (c) => b?.(c.target.value) })
36
36
  }
37
37
  ),
38
- /* @__PURE__ */ e(l, { overflowY: "auto", children: S ? /* @__PURE__ */ t(l, { display: "flex", alignItems: "center", gap: "12", justifyContent: "left", css: r.item, children: [
38
+ /* @__PURE__ */ e(l, { overflowY: "auto", children: y ? /* @__PURE__ */ t(l, { display: "flex", alignItems: "center", gap: "12", justifyContent: "left", css: r.item, children: [
39
39
  /* @__PURE__ */ e(B, { variant: "purple" }),
40
40
  /* @__PURE__ */ e(d, { color: "text/secondary", textStyle: "body/md/regular", children: "Loading..." })
41
41
  ] }) : u.group().map(([c, k]) => /* @__PURE__ */ t(o.ItemGroup, { children: [
@@ -54,17 +54,17 @@ const E = P((f, h) => {
54
54
  ] }, a.value);
55
55
  })
56
56
  ] }, c)) }),
57
- (n || m) && /* @__PURE__ */ t(
57
+ (n || s) && /* @__PURE__ */ t(
58
58
  l,
59
59
  {
60
60
  as: n ? "a" : "button",
61
61
  css: r.createItem,
62
62
  ...n ? { href: n } : {},
63
- onClick: m,
64
- ...C,
63
+ onClick: s,
64
+ ...S,
65
65
  children: [
66
66
  /* @__PURE__ */ e(R, { size: i, color: "button/secondary/icon" }),
67
- b
67
+ x
68
68
  ]
69
69
  }
70
70
  )
@@ -10,6 +10,8 @@ export { default as BitkitCheckbox, type BitkitCheckboxProps } from './BitkitChe
10
10
  export { default as BitkitCheckboxGroup, type BitkitCheckboxGroupProps, } from './BitkitCheckboxGroup/BitkitCheckboxGroup';
11
11
  export { default as BitkitCloseButton, type BitkitCloseButtonProps } from './BitkitCloseButton/BitkitCloseButton';
12
12
  export { default as BitkitColorButton, type BitkitColorButtonProps } from './BitkitColorButton/BitkitColorButton';
13
+ export { default as BitkitCombobox, type BitkitComboboxProps } from './BitkitCombobox/BitkitCombobox';
14
+ export { default as BitkitControlButton, type BitkitControlButtonProps, } from './BitkitControlButton/BitkitControlButton';
13
15
  export { default as BitkitDefinitionTooltip, type BitkitDefinitionTooltipProps, } from './BitkitDefinitionTooltip/BitkitDefinitionTooltip';
14
16
  export { default as BitkitEmptyState, type BitkitEmptyStateProps } from './BitkitEmptyState/BitkitEmptyState';
15
17
  export { default as BitkitExpandableCard, type BitkitExpandableCardProps, } from './BitkitExpandableCard/BitkitExpandableCard';