@bitrise/bitkit-v2 0.3.103 → 0.3.105

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.
@@ -0,0 +1,19 @@
1
+ import { FieldRootProps } from '@chakra-ui/react/field';
2
+ import { NativeSelectRootProps } from '@chakra-ui/react/native-select';
3
+ import { ReactNode } from 'react';
4
+ import { BitkitFieldProps } from '../BitkitField/BitkitField.tsx';
5
+ export interface BitkitNativeSelectProps extends FieldRootProps {
6
+ errorText?: BitkitFieldProps['errorText'];
7
+ helperText?: BitkitFieldProps['helperText'];
8
+ label?: BitkitFieldProps['label'];
9
+ optional?: BitkitFieldProps['optional'];
10
+ placeholder?: string;
11
+ selectProps?: NativeSelectRootProps;
12
+ size?: 'md' | 'lg';
13
+ state?: 'disabled' | 'error' | 'readOnly' | 'warning';
14
+ tooltip?: BitkitFieldProps['tooltip'];
15
+ warningText?: BitkitFieldProps['warningText'];
16
+ children: ReactNode;
17
+ }
18
+ declare const BitkitNativeSelect: import('react').ForwardRefExoticComponent<BitkitNativeSelectProps & import('react').RefAttributes<HTMLDivElement>>;
19
+ export default BitkitNativeSelect;
@@ -0,0 +1,54 @@
1
+ import { jsx as o, jsxs as x } from "react/jsx-runtime";
2
+ import { NativeSelect as n } from "@chakra-ui/react/native-select";
3
+ import { useSlotRecipe as S } from "@chakra-ui/react/styled-system";
4
+ import { forwardRef as y } from "react";
5
+ import N from "../../icons/16x16/IconErrorCircleFilled16.js";
6
+ import k from "../../icons/16x16/IconWarningYellow16.js";
7
+ import F from "../../icons/24x24/IconErrorCircleFilled24.js";
8
+ import b from "../../icons/24x24/IconSelectChevron24.js";
9
+ import B from "../../icons/24x24/IconWarningYellow24.js";
10
+ import C from "../BitkitField/BitkitField.js";
11
+ const R = y(
12
+ (a, d) => {
13
+ const {
14
+ errorText: l,
15
+ helperText: m,
16
+ label: p,
17
+ optional: f,
18
+ placeholder: g,
19
+ selectProps: I,
20
+ size: t = "md",
21
+ state: e,
22
+ tooltip: v,
23
+ warningText: c,
24
+ children: u,
25
+ ...h
26
+ } = a, r = S({ key: "nativeSelect" })(), w = e === "warning" || !!c, s = e === "error" || !!l;
27
+ let i;
28
+ return s ? i = t === "lg" ? /* @__PURE__ */ o(F, { css: r.statusIcon, color: "icon/negative" }) : /* @__PURE__ */ o(N, { css: r.statusIcon, color: "icon/negative" }) : w && (i = t === "lg" ? /* @__PURE__ */ o(B, { css: r.statusIcon, color: "icon/warning" }) : /* @__PURE__ */ o(k, { css: r.statusIcon, color: "icon/warning" })), /* @__PURE__ */ o(
29
+ C,
30
+ {
31
+ disabled: e === "disabled",
32
+ errorText: l,
33
+ helperText: m,
34
+ invalid: s,
35
+ label: p,
36
+ optional: f,
37
+ readOnly: e === "readOnly",
38
+ ref: d,
39
+ tooltip: v,
40
+ warningText: c,
41
+ ...h,
42
+ children: /* @__PURE__ */ x(n.Root, { size: t, ...I, className: "group", children: [
43
+ /* @__PURE__ */ o(n.Field, { placeholder: g, children: u }),
44
+ i,
45
+ /* @__PURE__ */ o(n.Indicator, { children: /* @__PURE__ */ o(b, {}) })
46
+ ] })
47
+ }
48
+ );
49
+ }
50
+ );
51
+ R.displayName = "BitkitNativeSelect";
52
+ export {
53
+ R as default
54
+ };
@@ -1,19 +1,36 @@
1
1
  import { FieldRootProps } from '@chakra-ui/react/field';
2
- import { NativeSelectRootProps } from '@chakra-ui/react/native-select';
3
- import { ReactNode } from 'react';
4
- import { BitkitFieldProps } from '../BitkitField/BitkitField';
5
- export interface BitkitSelectProps extends FieldRootProps {
2
+ import { SelectRootProps, SelectTriggerProps } from '@chakra-ui/react/select';
3
+ import { BitkitFieldProps } from '../BitkitField/BitkitField.tsx';
4
+ import { BitkitSelectContentProps } from '../BitkitSelectMenu/BitkitSelectMenu.tsx';
5
+ export type BitkitSelectTriggerProps = SelectTriggerProps;
6
+ export type BitkitSelectProps = FieldRootProps & {
7
+ contentProps?: BitkitSelectContentProps;
8
+ defaultValue?: string;
6
9
  errorText?: BitkitFieldProps['errorText'];
7
10
  helperText?: BitkitFieldProps['helperText'];
11
+ isLoading?: boolean;
12
+ items: Array<{
13
+ group?: string;
14
+ value: string;
15
+ label: string;
16
+ }>;
8
17
  label?: BitkitFieldProps['label'];
18
+ onValueChange?: (newVal: string) => void;
9
19
  optional?: BitkitFieldProps['optional'];
10
20
  placeholder?: string;
11
- selectProps?: NativeSelectRootProps;
21
+ selectProps?: Omit<SelectRootProps, 'collection' | 'defaultValue' | 'onValueChange' | 'value'>;
12
22
  size?: 'md' | 'lg';
13
23
  state?: 'disabled' | 'error' | 'readOnly' | 'warning';
14
24
  tooltip?: BitkitFieldProps['tooltip'];
25
+ triggerProps?: BitkitSelectTriggerProps;
26
+ value?: string;
15
27
  warningText?: BitkitFieldProps['warningText'];
16
- children: ReactNode;
17
- }
28
+ } & ({
29
+ hasSearch: true;
30
+ onSearchChange?: (searchText: string) => void;
31
+ } | {
32
+ hasSearch?: false;
33
+ onSearchChange?: never;
34
+ });
18
35
  declare const BitkitSelect: import('react').ForwardRefExoticComponent<BitkitSelectProps & import('react').RefAttributes<HTMLDivElement>>;
19
36
  export default BitkitSelect;
@@ -1,52 +1,95 @@
1
- import { jsx as o, jsxs as x } from "react/jsx-runtime";
2
- import { NativeSelect as n } from "@chakra-ui/react/native-select";
3
- import { useSlotRecipe as S } from "@chakra-ui/react/styled-system";
4
- import { forwardRef as y } from "react";
5
- import k from "../../icons/16x16/IconErrorCircleFilled16.js";
6
- import F from "../../icons/16x16/IconWarningYellow16.js";
7
- import b from "../../icons/24x24/IconErrorCircleFilled24.js";
8
- import B from "../../icons/24x24/IconSelectChevron24.js";
9
- import C from "../../icons/24x24/IconWarningYellow24.js";
10
- import N from "../BitkitField/BitkitField.js";
11
- const R = y((a, d) => {
1
+ import { jsx as r, jsxs as n } from "react/jsx-runtime";
2
+ import { Box as b } from "@chakra-ui/react/box";
3
+ import { createListCollection as F } from "@chakra-ui/react/collection";
4
+ import { Portal as O } from "@chakra-ui/react/portal";
5
+ import { Select as e } from "@chakra-ui/react/select";
6
+ import { forwardRef as j } from "react";
7
+ import D from "../../icons/16x16/IconChevronDown16.js";
8
+ import E from "../../icons/16x16/IconErrorCircleFilled16.js";
9
+ import L from "../../icons/16x16/IconWarningYellow16.js";
10
+ import R from "../../icons/24x24/IconChevronDown24.js";
11
+ import W from "../../icons/24x24/IconErrorCircleFilled24.js";
12
+ import Y from "../../icons/24x24/IconWarningYellow24.js";
13
+ import z from "../BitkitField/BitkitField.js";
14
+ import G from "../BitkitSelectMenu/BitkitSelectMenu.js";
15
+ const H = j((d, s) => {
12
16
  const {
13
- errorText: l,
14
- helperText: m,
15
- label: p,
16
- optional: f,
17
- placeholder: g,
18
- selectProps: I,
19
- size: t = "md",
20
- state: e,
21
- tooltip: u,
22
- warningText: c,
23
- children: h,
24
- ...v
25
- } = a, r = S({ key: "nativeSelect" })(), w = e === "warning" || !!c, s = e === "error" || !!l;
26
- let i;
27
- return s ? i = t === "lg" ? /* @__PURE__ */ o(b, { css: r.statusIcon, color: "icon/negative" }) : /* @__PURE__ */ o(k, { css: r.statusIcon, color: "icon/negative" }) : w && (i = t === "lg" ? /* @__PURE__ */ o(C, { css: r.statusIcon, color: "icon/warning" }) : /* @__PURE__ */ o(F, { css: r.statusIcon, color: "icon/warning" })), /* @__PURE__ */ o(
28
- N,
17
+ contentProps: h,
18
+ defaultValue: l,
19
+ errorText: a,
20
+ hasSearch: m,
21
+ helperText: p,
22
+ isLoading: g,
23
+ items: f,
24
+ label: u,
25
+ onSearchChange: v,
26
+ onValueChange: I,
27
+ optional: C,
28
+ placeholder: S,
29
+ selectProps: w,
30
+ size: o = "md",
31
+ state: t,
32
+ tooltip: x,
33
+ triggerProps: B,
34
+ value: c,
35
+ warningText: P,
36
+ ...T
37
+ } = d, V = t === "error" || !!a, k = F({
38
+ items: f,
39
+ groupBy: (i) => i.group || ""
40
+ });
41
+ return /* @__PURE__ */ r(
42
+ z,
29
43
  {
30
- disabled: e === "disabled",
31
- errorText: l,
32
- helperText: m,
33
- invalid: s,
34
- label: p,
35
- optional: f,
36
- readOnly: e === "readOnly",
37
- ref: d,
38
- tooltip: u,
39
- warningText: c,
40
- ...v,
41
- children: /* @__PURE__ */ x(n.Root, { size: t, ...I, className: "group", children: [
42
- /* @__PURE__ */ o(n.Field, { placeholder: g, children: h }),
43
- i,
44
- /* @__PURE__ */ o(n.Indicator, { children: /* @__PURE__ */ o(B, {}) })
45
- ] })
44
+ disabled: t === "disabled",
45
+ errorText: a,
46
+ helperText: p,
47
+ invalid: V,
48
+ label: u,
49
+ optional: C,
50
+ readOnly: t === "readOnly",
51
+ ref: s,
52
+ tooltip: x,
53
+ warningText: P,
54
+ ...T,
55
+ children: /* @__PURE__ */ n(
56
+ e.Root,
57
+ {
58
+ collection: k,
59
+ size: o,
60
+ ...w,
61
+ defaultValue: l ? [l] : void 0,
62
+ onValueChange: (i) => I?.(i.value[0]),
63
+ value: c ? [c] : void 0,
64
+ children: [
65
+ /* @__PURE__ */ r(e.HiddenSelect, {}),
66
+ /* @__PURE__ */ n(e.Control, { children: [
67
+ /* @__PURE__ */ r(e.Trigger, { ...B, children: /* @__PURE__ */ r(e.ValueText, { placeholder: S || "Select option" }) }),
68
+ /* @__PURE__ */ n(e.IndicatorGroup, { children: [
69
+ t === "error" && /* @__PURE__ */ r(e.Indicator, { children: o === "lg" ? /* @__PURE__ */ r(W, { color: "icon/negative" }) : /* @__PURE__ */ r(E, { color: "icon/negative", height: "16", width: "16" }) }),
70
+ t === "warning" && /* @__PURE__ */ r(e.Indicator, { children: o === "lg" ? /* @__PURE__ */ r(Y, {}) : /* @__PURE__ */ r(L, { height: "16", width: "16" }) }),
71
+ /* @__PURE__ */ r(e.Indicator, { children: /* @__PURE__ */ r(e.Context, { children: (i) => {
72
+ const y = i.open;
73
+ return /* @__PURE__ */ r(b, { transform: y ? "rotate(180deg)" : "rotate(0deg)", transition: "transform 0.2s ease", children: o === "lg" ? /* @__PURE__ */ r(R, {}) : /* @__PURE__ */ r(D, {}) });
74
+ } }) })
75
+ ] })
76
+ ] }),
77
+ /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(e.Positioner, { children: /* @__PURE__ */ r(
78
+ G,
79
+ {
80
+ contentProps: h,
81
+ isLoading: g,
82
+ ...m ? { hasSearch: !0, onSearchChange: v } : { hasSearch: !1 },
83
+ size: o
84
+ }
85
+ ) }) })
86
+ ]
87
+ }
88
+ )
46
89
  }
47
90
  );
48
91
  });
49
- R.displayName = "BitkitSelect";
92
+ H.displayName = "BitkitSelect";
50
93
  export {
51
- R as default
94
+ H as default
52
95
  };
@@ -0,0 +1,16 @@
1
+ import { SelectContentProps } from '@chakra-ui/react/select';
2
+ export type BitkitSelectMenuProps = {
3
+ contentProps?: BitkitSelectContentProps;
4
+ hasSearch?: boolean;
5
+ isLoading?: boolean;
6
+ size?: 'md' | 'lg';
7
+ } & ({
8
+ hasSearch: true;
9
+ onSearchChange?: (searchText: string) => void;
10
+ } | {
11
+ hasSearch?: false;
12
+ onSearchChange?: never;
13
+ });
14
+ export type BitkitSelectContentProps = SelectContentProps;
15
+ declare const BitkitSelectMenu: import('react').ForwardRefExoticComponent<BitkitSelectMenuProps & import('react').RefAttributes<HTMLDivElement>>;
16
+ export default BitkitSelectMenu;
@@ -0,0 +1,57 @@
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { Box as l } from "@chakra-ui/react/box";
3
+ import { Input as g } from "@chakra-ui/react/input";
4
+ import { InputGroup as S } from "@chakra-ui/react/input-group";
5
+ import { useSelectContext as x, Select as n } from "@chakra-ui/react/select";
6
+ import { Separator as y } from "@chakra-ui/react/separator";
7
+ import { useSlotRecipe as k } from "@chakra-ui/react/styled-system";
8
+ import { Text as s } from "@chakra-ui/react/text";
9
+ import { forwardRef as C } from "react";
10
+ import G from "../../icons/24x24/IconMagnifier24.js";
11
+ import b from "../../icons/16x16/IconMagnifier16.js";
12
+ import L from "../../icons/24x24/IconSpinnerPurple24.js";
13
+ import M from "../../icons/16x16/IconSpinnerPurple16.js";
14
+ import j from "../../icons/24x24/IconCheck24.js";
15
+ import v from "../../icons/16x16/IconCheck16.js";
16
+ const B = C((m, a) => {
17
+ const { contentProps: p = {}, hasSearch: f = !1, isLoading: d = !1, onSearchChange: h, size: i } = m, { collection: u } = x(), r = k({ key: "select" })({ size: i });
18
+ return /* @__PURE__ */ o(n.Content, { css: r.content, ref: a, ...p, children: [
19
+ f && /* @__PURE__ */ e(
20
+ S,
21
+ {
22
+ startElement: i === "lg" ? /* @__PURE__ */ e(G, { color: "icon/tertiary" }) : /* @__PURE__ */ e(b, { color: "icon/tertiary" }),
23
+ css: r.searchInputGroup,
24
+ children: /* @__PURE__ */ e(g, { placeholder: "Search...", css: r.searchInput, onChange: (t) => h?.(t.target.value) })
25
+ }
26
+ ),
27
+ /* @__PURE__ */ e(l, { overflowY: "auto", children: d ? /* @__PURE__ */ o(l, { display: "flex", alignItems: "center", gap: "12", justifyContent: "left", css: r.item, children: [
28
+ /* @__PURE__ */ e(
29
+ l,
30
+ {
31
+ style: {
32
+ animation: "spin 1s linear infinite",
33
+ "@keyframes spin": {
34
+ "0%": { transform: "rotate(0deg)" },
35
+ "100%": { transform: "rotate(360deg)" }
36
+ }
37
+ },
38
+ children: i === "lg" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(M, {})
39
+ }
40
+ ),
41
+ /* @__PURE__ */ e(s, { color: "text/secondary", textStyle: "body/md/regular", children: "Loading..." })
42
+ ] }) : u.group().map(([t, I]) => /* @__PURE__ */ o(n.ItemGroup, { children: [
43
+ t && /* @__PURE__ */ o(n.ItemGroupLabel, { css: r.itemGroupLabel, children: [
44
+ /* @__PURE__ */ e(s, { color: "text/tertiary", flexShrink: "0", textStyle: "heading/h6", children: t }),
45
+ /* @__PURE__ */ e(y, { flex: "1" })
46
+ ] }),
47
+ I.map((c) => /* @__PURE__ */ o(n.Item, { css: r.item, item: c, ref: a, children: [
48
+ c.label,
49
+ /* @__PURE__ */ e(n.ItemIndicator, { children: i === "lg" ? /* @__PURE__ */ e(j, { css: r.itemIndicator }) : /* @__PURE__ */ e(v, { css: r.itemIndicator }) })
50
+ ] }, c.value))
51
+ ] }, t)) })
52
+ ] });
53
+ });
54
+ B.displayName = "BitkitSelectMenu";
55
+ export {
56
+ B as default
57
+ };
@@ -11,9 +11,11 @@ export { default as BitkitEmptyState, type BitkitEmptyStateProps } from './Bitki
11
11
  export { default as BitkitExpandableCard, type BitkitExpandableCardProps, } from './BitkitExpandableCard/BitkitExpandableCard';
12
12
  export { default as BitkitField, type BitkitFieldProps } from './BitkitField/BitkitField';
13
13
  export { default as BitkitInteractiveTooltip, type BitkitInteractiveTooltipProps, } from './BitkitInteractiveTooltip/BitkitInteractiveTooltip';
14
+ export { default as BitkitNativeSelect, type BitkitNativeSelectProps } from './BitkitNativeSelect/BitkitNativeSelect';
14
15
  export { default as BitkitNotification, type BitkitNotificationProps } from './BitkitNotification/BitkitNotification';
15
16
  export { default as BitkitNumberInput, type BitkitNumberInputProps } from './BitkitNumberInput/BitkitNumberInput';
16
17
  export { default as BitkitSelect, type BitkitSelectProps } from './BitkitSelect/BitkitSelect';
18
+ export { default as BitkitSelectMenu, type BitkitSelectMenuProps } from './BitkitSelectMenu/BitkitSelectMenu';
17
19
  export { default as BitkitTabs } from './BitkitTabs/BitkitTabs';
18
20
  export { default as BitkitTag, type BitkitTagProps } from './BitkitTag/BitkitTag';
19
21
  export { default as BitkitTextInput, type BitkitTextInputProps } from './BitkitTextInput/BitkitTextInput';