@bitrise/bitkit-v2 0.3.308 → 0.3.310

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.
@@ -7,6 +7,12 @@ export interface BitkitFieldProps extends Omit<Field.RootProps, 'disabled' | 'in
7
7
  errorText?: ReactNode;
8
8
  helperText?: ReactNode;
9
9
  label?: string;
10
+ /**
11
+ * Keep the label in the accessibility tree (associated with the control) but hide it visually.
12
+ * For fields whose purpose is already visually obvious — e.g. a search input with a magnifier icon.
13
+ * Badge, counter and tooltip are omitted in this mode, since they are purely visual.
14
+ */
15
+ labelHidden?: boolean;
10
16
  optional?: boolean;
11
17
  state?: 'disabled' | 'error' | 'readOnly' | 'warning';
12
18
  tooltip?: string;
@@ -2,10 +2,26 @@ import BitkitLabel from "../BitkitLabel/BitkitLabel.js";
2
2
  import { forwardRef } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Field } from "@chakra-ui/react/field";
5
+ import { VisuallyHidden } from "@chakra-ui/react/visually-hidden";
5
6
  //#region lib/components/BitkitField/BitkitField.tsx
6
7
  var BitkitField = forwardRef((props, ref) => {
7
- const { badge, counterText, children, errorText, helperText, label, optional, state, tooltip, warningText, ...rest } = props;
8
+ const { badge, counterText, children, errorText, helperText, label, labelHidden, optional, state, tooltip, warningText, ...rest } = props;
8
9
  const isInvalid = state === "error" || !!errorText;
10
+ let labelNode = null;
11
+ if (labelHidden) labelNode = label ? /* @__PURE__ */ jsx(VisuallyHidden, {
12
+ asChild: true,
13
+ children: /* @__PURE__ */ jsx(Field.Label, { children: label })
14
+ }) : null;
15
+ else if (label || badge || counterText) labelNode = /* @__PURE__ */ jsx(Field.Label, {
16
+ asChild: true,
17
+ children: /* @__PURE__ */ jsx(BitkitLabel, {
18
+ badge,
19
+ counterText,
20
+ optional,
21
+ tooltip,
22
+ children: label
23
+ })
24
+ });
9
25
  return /* @__PURE__ */ jsxs(Field.Root, {
10
26
  disabled: state === "disabled",
11
27
  invalid: isInvalid,
@@ -14,16 +30,7 @@ var BitkitField = forwardRef((props, ref) => {
14
30
  ref,
15
31
  ...rest,
16
32
  children: [
17
- !!label || !!badge || !!counterText ? /* @__PURE__ */ jsx(Field.Label, {
18
- asChild: true,
19
- children: /* @__PURE__ */ jsx(BitkitLabel, {
20
- badge,
21
- counterText,
22
- optional,
23
- tooltip,
24
- children: label
25
- })
26
- }) : null,
33
+ labelNode,
27
34
  children,
28
35
  !!helperText && !errorText && !warningText && /* @__PURE__ */ jsx(Field.HelperText, { children: helperText }),
29
36
  !!warningText && !errorText && /* @__PURE__ */ jsx(Field.HelperText, {
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitField.js","names":[],"sources":["../../../lib/components/BitkitField/BitkitField.tsx"],"sourcesContent":["import { Field } from '@chakra-ui/react/field';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport BitkitLabel from '../BitkitLabel/BitkitLabel';\n\nexport interface BitkitFieldProps extends Omit<Field.RootProps, 'disabled' | 'invalid' | 'readOnly'> {\n badge?: ReactNode;\n children: ReactNode;\n counterText?: string;\n errorText?: ReactNode;\n helperText?: ReactNode;\n label?: string;\n optional?: boolean;\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n tooltip?: string;\n warningText?: ReactNode;\n}\n\nconst BitkitField = forwardRef<HTMLDivElement, BitkitFieldProps>((props, ref) => {\n const { badge, counterText, children, errorText, helperText, label, optional, state, tooltip, warningText, ...rest } =\n props;\n\n const isInvalid = state === 'error' || !!errorText;\n\n return (\n <Field.Root\n disabled={state === 'disabled'}\n invalid={isInvalid}\n readOnly={state === 'readOnly'}\n required={!optional}\n ref={ref}\n {...rest}\n >\n {!!label || !!badge || !!counterText ? (\n <Field.Label asChild>\n <BitkitLabel badge={badge} counterText={counterText} optional={optional} tooltip={tooltip}>\n {label}\n </BitkitLabel>\n </Field.Label>\n ) : null}\n {children}\n {!!helperText && !errorText && !warningText && <Field.HelperText>{helperText}</Field.HelperText>}\n {!!warningText && !errorText && <Field.HelperText color=\"text/body\">{warningText}</Field.HelperText>}\n {!!errorText && <Field.ErrorText>{errorText}</Field.ErrorText>}\n </Field.Root>\n );\n});\n\nBitkitField.displayName = 'BitkitField';\n\nexport default BitkitField;\n"],"mappings":";;;;;AAkBA,IAAM,cAAc,YAA8C,OAAO,QAAQ;CAC/E,MAAM,EAAE,OAAO,aAAa,UAAU,WAAW,YAAY,OAAO,UAAU,OAAO,SAAS,aAAa,GAAG,SAC5G;CAEF,MAAM,YAAY,UAAU,WAAW,CAAC,CAAC;CAEzC,OACE,qBAAC,MAAM,MAAP;EACE,UAAU,UAAU;EACpB,SAAS;EACT,UAAU,UAAU;EACpB,UAAU,CAAC;EACN;EACL,GAAI;YANN;GAQG,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,cACvB,oBAAC,MAAM,OAAP;IAAa,SAAA;cACX,oBAAC,aAAD;KAAoB;KAAoB;KAAuB;KAAmB;eAC/E;IACU,CAAA;GACF,CAAA,IACX;GACH;GACA,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,eAAe,oBAAC,MAAM,YAAP,EAAA,UAAmB,WAA6B,CAAA;GAC9F,CAAC,CAAC,eAAe,CAAC,aAAa,oBAAC,MAAM,YAAP;IAAkB,OAAM;cAAa;GAA8B,CAAA;GAClG,CAAC,CAAC,aAAa,oBAAC,MAAM,WAAP,EAAA,UAAkB,UAA2B,CAAA;EACnD;;AAEhB,CAAC;AAED,YAAY,cAAc"}
1
+ {"version":3,"file":"BitkitField.js","names":[],"sources":["../../../lib/components/BitkitField/BitkitField.tsx"],"sourcesContent":["import { Field } from '@chakra-ui/react/field';\nimport { VisuallyHidden } from '@chakra-ui/react/visually-hidden';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport BitkitLabel from '../BitkitLabel/BitkitLabel';\n\nexport interface BitkitFieldProps extends Omit<Field.RootProps, 'disabled' | 'invalid' | 'readOnly'> {\n badge?: ReactNode;\n children: ReactNode;\n counterText?: string;\n errorText?: ReactNode;\n helperText?: ReactNode;\n label?: string;\n /**\n * Keep the label in the accessibility tree (associated with the control) but hide it visually.\n * For fields whose purpose is already visually obvious — e.g. a search input with a magnifier icon.\n * Badge, counter and tooltip are omitted in this mode, since they are purely visual.\n */\n labelHidden?: boolean;\n optional?: boolean;\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n tooltip?: string;\n warningText?: ReactNode;\n}\n\nconst BitkitField = forwardRef<HTMLDivElement, BitkitFieldProps>((props, ref) => {\n const {\n badge,\n counterText,\n children,\n errorText,\n helperText,\n label,\n labelHidden,\n optional,\n state,\n tooltip,\n warningText,\n ...rest\n } = props;\n\n const isInvalid = state === 'error' || !!errorText;\n\n let labelNode: ReactNode = null;\n if (labelHidden) {\n // Field.Label still wires `htmlFor` to the control; VisuallyHidden only strips it from view.\n labelNode = label ? (\n <VisuallyHidden asChild>\n <Field.Label>{label}</Field.Label>\n </VisuallyHidden>\n ) : null;\n } else if (label || badge || counterText) {\n labelNode = (\n <Field.Label asChild>\n <BitkitLabel badge={badge} counterText={counterText} optional={optional} tooltip={tooltip}>\n {label}\n </BitkitLabel>\n </Field.Label>\n );\n }\n\n return (\n <Field.Root\n disabled={state === 'disabled'}\n invalid={isInvalid}\n readOnly={state === 'readOnly'}\n required={!optional}\n ref={ref}\n {...rest}\n >\n {labelNode}\n {children}\n {!!helperText && !errorText && !warningText && <Field.HelperText>{helperText}</Field.HelperText>}\n {!!warningText && !errorText && <Field.HelperText color=\"text/body\">{warningText}</Field.HelperText>}\n {!!errorText && <Field.ErrorText>{errorText}</Field.ErrorText>}\n </Field.Root>\n );\n});\n\nBitkitField.displayName = 'BitkitField';\n\nexport default BitkitField;\n"],"mappings":";;;;;;AAyBA,IAAM,cAAc,YAA8C,OAAO,QAAQ;CAC/E,MAAM,EACJ,OACA,aACA,UACA,WACA,YACA,OACA,aACA,UACA,OACA,SACA,aACA,GAAG,SACD;CAEJ,MAAM,YAAY,UAAU,WAAW,CAAC,CAAC;CAEzC,IAAI,YAAuB;CAC3B,IAAI,aAEF,YAAY,QACV,oBAAC,gBAAD;EAAgB,SAAA;YACd,oBAAC,MAAM,OAAP,EAAA,UAAc,MAAmB,CAAA;CACnB,CAAA,IACd;MACC,IAAI,SAAS,SAAS,aAC3B,YACE,oBAAC,MAAM,OAAP;EAAa,SAAA;YACX,oBAAC,aAAD;GAAoB;GAAoB;GAAuB;GAAmB;aAC/E;EACU,CAAA;CACF,CAAA;CAIjB,OACE,qBAAC,MAAM,MAAP;EACE,UAAU,UAAU;EACpB,SAAS;EACT,UAAU,UAAU;EACpB,UAAU,CAAC;EACN;EACL,GAAI;YANN;GAQG;GACA;GACA,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,eAAe,oBAAC,MAAM,YAAP,EAAA,UAAmB,WAA6B,CAAA;GAC9F,CAAC,CAAC,eAAe,CAAC,aAAa,oBAAC,MAAM,YAAP;IAAkB,OAAM;cAAa;GAA8B,CAAA;GAClG,CAAC,CAAC,aAAa,oBAAC,MAAM,WAAP,EAAA,UAAkB,UAA2B,CAAA;EACnD;;AAEhB,CAAC;AAED,YAAY,cAAc"}
@@ -1,6 +1,6 @@
1
1
  import { TagsInput } from '@chakra-ui/react/tags-input';
2
2
  import { BitkitFieldProps } from '../BitkitField/BitkitField';
3
- export interface BitkitTagsInputProps extends Omit<BitkitFieldProps, 'children' | 'state'> {
3
+ export interface BitkitTagsInputProps extends Omit<BitkitFieldProps, 'children' | 'counterText' | 'state'> {
4
4
  addOnPaste?: TagsInput.RootProps['addOnPaste'];
5
5
  blurBehavior?: TagsInput.RootProps['blurBehavior'];
6
6
  defaultValue?: string[];
@@ -13,5 +13,11 @@ export interface BitkitTagsInputProps extends Omit<BitkitFieldProps, 'children'
13
13
  validate?: TagsInput.RootProps['validate'];
14
14
  value?: string[];
15
15
  }
16
+ /**
17
+ * A field for entering a list of short string tags: type and commit a tag with Enter or a delimiter
18
+ * (comma or whitespace by default); pasting splits on the same delimiter. Tags can be removed one at
19
+ * a time or cleared all at once, and empty/whitespace-only input is rejected. Pass `max` to cap the
20
+ * number of tags — a live counter is then shown next to the label.
21
+ */
16
22
  declare const BitkitTagsInput: import('react').ForwardRefExoticComponent<BitkitTagsInputProps & import('react').RefAttributes<HTMLDivElement>>;
17
23
  export default BitkitTagsInput;
@@ -1,6 +1,7 @@
1
1
  import IconCross from "../../icons/IconCross.js";
2
2
  import IconErrorCircleFilled from "../../icons/IconErrorCircleFilled.js";
3
3
  import IconWarningYellow from "../../icons/IconWarningYellow.js";
4
+ import BitkitLabel from "../BitkitLabel/BitkitLabel.js";
4
5
  import BitkitField from "../BitkitField/BitkitField.js";
5
6
  import { chakra, useSlotRecipe } from "@chakra-ui/react/styled-system";
6
7
  import { forwardRef } from "react";
@@ -8,8 +9,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { TagsInput } from "@chakra-ui/react/tags-input";
9
10
  //#region lib/components/BitkitTagsInput/BitkitTagsInput.tsx
10
11
  var rejectEmpty = ({ inputValue }) => inputValue.trim().length > 0;
12
+ /**
13
+ * A field for entering a list of short string tags: type and commit a tag with Enter or a delimiter
14
+ * (comma or whitespace by default); pasting splits on the same delimiter. Tags can be removed one at
15
+ * a time or cleared all at once, and empty/whitespace-only input is rejected. Pass `max` to cap the
16
+ * number of tags — a live counter is then shown next to the label.
17
+ */
11
18
  var BitkitTagsInput = forwardRef((props, ref) => {
12
- const { addOnPaste = true, blurBehavior = "add", defaultValue, delimiter = /[\s,]+/, max, onValueChange, placeholder, size = "lg", state, validate, value, ...fieldProps } = props;
19
+ const { addOnPaste = true, blurBehavior = "add", defaultValue, delimiter = /[\s,]+/, max, onValueChange, placeholder, size = "lg", state, validate, value, badge, label, optional, tooltip, ...fieldProps } = props;
13
20
  const effectiveValidate = (details) => rejectEmpty(details) && (validate?.(details) ?? true);
14
21
  const styles = useSlotRecipe({ key: "tagsInput" })({ size });
15
22
  const hasWarning = state === "warning" || !!fieldProps.warningText;
@@ -36,24 +43,38 @@ var BitkitTagsInput = forwardRef((props, ref) => {
36
43
  validate: effectiveValidate,
37
44
  value,
38
45
  children: /* @__PURE__ */ jsx(TagsInput.Context, { children: ({ value: tagValues }) => /* @__PURE__ */ jsxs(BitkitField, {
39
- counterText: max !== void 0 ? `${tagValues.length}/${max}` : void 0,
46
+ optional,
40
47
  ref,
41
48
  state,
42
49
  ...fieldProps,
43
- children: [/* @__PURE__ */ jsxs(TagsInput.Control, { children: [/* @__PURE__ */ jsxs(chakra.div, {
44
- css: styles.tagsBlock,
45
- children: [tagValues.map((tagValue, index) => /* @__PURE__ */ jsxs(TagsInput.Item, {
46
- index,
47
- value: tagValue,
48
- children: [/* @__PURE__ */ jsxs(TagsInput.ItemPreview, { children: [/* @__PURE__ */ jsx(TagsInput.ItemText, { children: tagValue }), !isReadOnly && /* @__PURE__ */ jsx(TagsInput.ItemDeleteTrigger, { children: /* @__PURE__ */ jsx(IconCross, { size: "16" }) })] }), /* @__PURE__ */ jsx(TagsInput.ItemInput, {})]
49
- }, tagValue)), /* @__PURE__ */ jsx(TagsInput.Input, { placeholder })]
50
- }), (statusIcon || tagValues.length > 0 && !isDisabled && !isReadOnly) && /* @__PURE__ */ jsxs(chakra.div, {
51
- css: styles.suffixBlock,
52
- children: [statusIcon, tagValues.length > 0 && !isDisabled && !isReadOnly && /* @__PURE__ */ jsx(TagsInput.ClearTrigger, {
53
- css: styles.clearTrigger,
54
- children: /* @__PURE__ */ jsx(IconCross, { size: size === "lg" ? "24" : "16" })
55
- })]
56
- })] }), /* @__PURE__ */ jsx(TagsInput.HiddenInput, {})]
50
+ counterText: void 0,
51
+ children: [
52
+ (!!label || !!badge || max !== void 0) && /* @__PURE__ */ jsx(TagsInput.Label, {
53
+ asChild: true,
54
+ children: /* @__PURE__ */ jsx(BitkitLabel, {
55
+ badge,
56
+ counterText: max !== void 0 ? `${tagValues.length}/${max}` : void 0,
57
+ optional,
58
+ tooltip,
59
+ children: label
60
+ })
61
+ }),
62
+ /* @__PURE__ */ jsxs(TagsInput.Control, { children: [/* @__PURE__ */ jsxs(chakra.div, {
63
+ css: styles.tagsBlock,
64
+ children: [tagValues.map((tagValue, index) => /* @__PURE__ */ jsxs(TagsInput.Item, {
65
+ index,
66
+ value: tagValue,
67
+ children: [/* @__PURE__ */ jsxs(TagsInput.ItemPreview, { children: [/* @__PURE__ */ jsx(TagsInput.ItemText, { children: tagValue }), !isReadOnly && /* @__PURE__ */ jsx(TagsInput.ItemDeleteTrigger, { children: /* @__PURE__ */ jsx(IconCross, { size: "16" }) })] }), /* @__PURE__ */ jsx(TagsInput.ItemInput, {})]
68
+ }, tagValue)), /* @__PURE__ */ jsx(TagsInput.Input, { placeholder })]
69
+ }), (statusIcon || tagValues.length > 0 && !isDisabled && !isReadOnly) && /* @__PURE__ */ jsxs(chakra.div, {
70
+ css: styles.suffixBlock,
71
+ children: [statusIcon, tagValues.length > 0 && !isDisabled && !isReadOnly && /* @__PURE__ */ jsx(TagsInput.ClearTrigger, {
72
+ css: styles.clearTrigger,
73
+ children: /* @__PURE__ */ jsx(IconCross, { size: size === "lg" ? "24" : "16" })
74
+ })]
75
+ })] }),
76
+ /* @__PURE__ */ jsx(TagsInput.HiddenInput, {})
77
+ ]
57
78
  }) })
58
79
  });
59
80
  });
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitTagsInput.js","names":[],"sources":["../../../lib/components/BitkitTagsInput/BitkitTagsInput.tsx"],"sourcesContent":["import { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { TagsInput } from '@chakra-ui/react/tags-input';\nimport { forwardRef } from 'react';\n\nimport { IconCross, IconErrorCircleFilled, IconWarningYellow } from '../../icons';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField';\n\nexport interface BitkitTagsInputProps extends Omit<BitkitFieldProps, 'children' | 'state'> {\n addOnPaste?: TagsInput.RootProps['addOnPaste'];\n blurBehavior?: TagsInput.RootProps['blurBehavior'];\n defaultValue?: string[];\n delimiter?: TagsInput.RootProps['delimiter'];\n max?: number;\n onValueChange?: TagsInput.RootProps['onValueChange'];\n placeholder?: string;\n size?: 'md' | 'lg';\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n validate?: TagsInput.RootProps['validate'];\n value?: string[];\n}\n\nconst rejectEmpty: NonNullable<TagsInput.RootProps['validate']> = ({ inputValue }) => inputValue.trim().length > 0;\n\nconst BitkitTagsInput = forwardRef<HTMLDivElement, BitkitTagsInputProps>((props, ref) => {\n const {\n addOnPaste = true,\n blurBehavior = 'add',\n defaultValue,\n // Greedy `+` collapses runs of whitespace/commas into a single delimiter so pasting\n // \"alpha, beta\" doesn't spawn an empty tag between the alpha and beta.\n delimiter = /[\\s,]+/,\n max,\n onValueChange,\n placeholder,\n size = 'lg',\n state,\n validate,\n value,\n ...fieldProps\n } = props;\n\n // Always reject empty/whitespace-only input (covers leading/trailing delimiters on paste\n // and blurBehavior=\"add\" with an empty input). Chain with a user-supplied validate if any.\n const effectiveValidate: NonNullable<TagsInput.RootProps['validate']> = (details) =>\n rejectEmpty(details) && (validate?.(details) ?? true);\n\n const styles = useSlotRecipe({ key: 'tagsInput' })({ size });\n\n const hasWarning = state === 'warning' || !!fieldProps.warningText;\n const isInvalid = state === 'error' || !!fieldProps.errorText;\n const isDisabled = state === 'disabled';\n const isReadOnly = state === 'readOnly';\n\n let statusIcon = undefined;\n if (isInvalid) {\n statusIcon = <IconErrorCircleFilled color=\"icon/negative\" size={size === 'lg' ? '24' : '16'} />;\n } else if (hasWarning) {\n statusIcon = <IconWarningYellow size={size === 'lg' ? '24' : '16'} />;\n }\n\n return (\n <TagsInput.Root\n addOnPaste={addOnPaste}\n blurBehavior={blurBehavior}\n defaultValue={defaultValue}\n delimiter={delimiter}\n disabled={isDisabled}\n invalid={isInvalid}\n max={max}\n onValueChange={onValueChange}\n readOnly={isReadOnly}\n size={size}\n validate={effectiveValidate}\n value={value}\n >\n <TagsInput.Context>\n {({ value: tagValues }) => (\n <BitkitField\n counterText={max !== undefined ? `${tagValues.length}/${max}` : undefined}\n ref={ref}\n state={state}\n {...fieldProps}\n >\n <TagsInput.Control>\n <chakra.div css={styles.tagsBlock}>\n {tagValues.map((tagValue, index) => (\n <TagsInput.Item index={index} key={tagValue} value={tagValue}>\n <TagsInput.ItemPreview>\n <TagsInput.ItemText>{tagValue}</TagsInput.ItemText>\n {!isReadOnly && (\n <TagsInput.ItemDeleteTrigger>\n <IconCross size=\"16\" />\n </TagsInput.ItemDeleteTrigger>\n )}\n </TagsInput.ItemPreview>\n <TagsInput.ItemInput />\n </TagsInput.Item>\n ))}\n <TagsInput.Input placeholder={placeholder} />\n </chakra.div>\n {(statusIcon || (tagValues.length > 0 && !isDisabled && !isReadOnly)) && (\n <chakra.div css={styles.suffixBlock}>\n {statusIcon}\n {tagValues.length > 0 && !isDisabled && !isReadOnly && (\n <TagsInput.ClearTrigger css={styles.clearTrigger}>\n <IconCross size={size === 'lg' ? '24' : '16'} />\n </TagsInput.ClearTrigger>\n )}\n </chakra.div>\n )}\n </TagsInput.Control>\n <TagsInput.HiddenInput />\n </BitkitField>\n )}\n </TagsInput.Context>\n </TagsInput.Root>\n );\n});\n\nBitkitTagsInput.displayName = 'BitkitTagsInput';\nexport default BitkitTagsInput;\n"],"mappings":";;;;;;;;;AAqBA,IAAM,eAA6D,EAAE,iBAAiB,WAAW,KAAK,CAAC,CAAC,SAAS;AAEjH,IAAM,kBAAkB,YAAkD,OAAO,QAAQ;CACvF,MAAM,EACJ,aAAa,MACb,eAAe,OACf,cAGA,YAAY,UACZ,KACA,eACA,aACA,OAAO,MACP,OACA,UACA,OACA,GAAG,eACD;CAIJ,MAAM,qBAAmE,YACvE,YAAY,OAAO,MAAM,WAAW,OAAO,KAAK;CAElD,MAAM,SAAS,cAAc,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;CAE3D,MAAM,aAAa,UAAU,aAAa,CAAC,CAAC,WAAW;CACvD,MAAM,YAAY,UAAU,WAAW,CAAC,CAAC,WAAW;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,OAAO,KAAO,CAAA;IACzB,CAAA,CAEhB;KAEG,EAAA,CAAA,GACnB,oBAAC,UAAU,aAAX,CAAwB,CAAA,CACb;KAEE,CAAA;CACL,CAAA;AAEpB,CAAC;AAED,gBAAgB,cAAc"}
1
+ {"version":3,"file":"BitkitTagsInput.js","names":[],"sources":["../../../lib/components/BitkitTagsInput/BitkitTagsInput.tsx"],"sourcesContent":["import { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { TagsInput } from '@chakra-ui/react/tags-input';\nimport { forwardRef } from 'react';\n\nimport { IconCross, IconErrorCircleFilled, IconWarningYellow } from '../../icons';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField';\nimport BitkitLabel from '../BitkitLabel/BitkitLabel';\n\n// `counterText` is derived from `max`, so it isn't a public prop here.\nexport interface BitkitTagsInputProps extends Omit<BitkitFieldProps, 'children' | 'counterText' | 'state'> {\n addOnPaste?: TagsInput.RootProps['addOnPaste'];\n blurBehavior?: TagsInput.RootProps['blurBehavior'];\n defaultValue?: string[];\n delimiter?: TagsInput.RootProps['delimiter'];\n max?: number;\n onValueChange?: TagsInput.RootProps['onValueChange'];\n placeholder?: string;\n size?: 'md' | 'lg';\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n validate?: TagsInput.RootProps['validate'];\n value?: string[];\n}\n\nconst rejectEmpty: NonNullable<TagsInput.RootProps['validate']> = ({ inputValue }) => inputValue.trim().length > 0;\n\n/**\n * A field for entering a list of short string tags: type and commit a tag with Enter or a delimiter\n * (comma or whitespace by default); pasting splits on the same delimiter. Tags can be removed one at\n * a time or cleared all at once, and empty/whitespace-only input is rejected. Pass `max` to cap the\n * number of tags — a live counter is then shown next to the label.\n */\nconst BitkitTagsInput = forwardRef<HTMLDivElement, BitkitTagsInputProps>((props, ref) => {\n const {\n addOnPaste = true,\n blurBehavior = 'add',\n defaultValue,\n // Greedy `+` collapses runs of whitespace/commas into a single delimiter so pasting\n // \"alpha, beta\" doesn't spawn an empty tag between the alpha and beta.\n delimiter = /[\\s,]+/,\n max,\n onValueChange,\n placeholder,\n size = 'lg',\n state,\n validate,\n value,\n // Label chrome is rendered via TagsInput.Label (see below), not BitkitField, so it\n // associates with TagsInput.Input. Pull these out of the props forwarded to BitkitField.\n badge,\n label,\n optional,\n tooltip,\n ...fieldProps\n } = props;\n\n // Always reject empty/whitespace-only input (covers leading/trailing delimiters on paste\n // and blurBehavior=\"add\" with an empty input). Chain with a user-supplied validate if any.\n const effectiveValidate: NonNullable<TagsInput.RootProps['validate']> = (details) =>\n rejectEmpty(details) && (validate?.(details) ?? true);\n\n const styles = useSlotRecipe({ key: 'tagsInput' })({ size });\n\n const hasWarning = state === 'warning' || !!fieldProps.warningText;\n const isInvalid = state === 'error' || !!fieldProps.errorText;\n const isDisabled = state === 'disabled';\n const isReadOnly = state === 'readOnly';\n\n let statusIcon = undefined;\n if (isInvalid) {\n statusIcon = <IconErrorCircleFilled color=\"icon/negative\" size={size === 'lg' ? '24' : '16'} />;\n } else if (hasWarning) {\n statusIcon = <IconWarningYellow size={size === 'lg' ? '24' : '16'} />;\n }\n\n return (\n <TagsInput.Root\n addOnPaste={addOnPaste}\n blurBehavior={blurBehavior}\n defaultValue={defaultValue}\n delimiter={delimiter}\n disabled={isDisabled}\n invalid={isInvalid}\n max={max}\n onValueChange={onValueChange}\n readOnly={isReadOnly}\n size={size}\n validate={effectiveValidate}\n value={value}\n >\n <TagsInput.Context>\n {({ value: tagValues }) => (\n // Strip any stray runtime `counterText` (not a public prop) so it can't slip through\n // `fieldProps` into BitkitField and resurrect an orphaned Field.Label; the counter is\n // rendered via TagsInput.Label instead.\n <BitkitField optional={optional} ref={ref} state={state} {...fieldProps} counterText={undefined}>\n {(!!label || !!badge || max !== undefined) && (\n // Chakra's Field.Label wires htmlFor to the Field machine's control, which the\n // TagsInput input never claims (separate Ark machine). TagsInput.Label is the\n // documented composition — it associates with TagsInput.Input.\n <TagsInput.Label asChild>\n <BitkitLabel\n badge={badge}\n counterText={max !== undefined ? `${tagValues.length}/${max}` : undefined}\n optional={optional}\n tooltip={tooltip}\n >\n {label}\n </BitkitLabel>\n </TagsInput.Label>\n )}\n <TagsInput.Control>\n <chakra.div css={styles.tagsBlock}>\n {tagValues.map((tagValue, index) => (\n <TagsInput.Item index={index} key={tagValue} value={tagValue}>\n <TagsInput.ItemPreview>\n <TagsInput.ItemText>{tagValue}</TagsInput.ItemText>\n {!isReadOnly && (\n <TagsInput.ItemDeleteTrigger>\n <IconCross size=\"16\" />\n </TagsInput.ItemDeleteTrigger>\n )}\n </TagsInput.ItemPreview>\n <TagsInput.ItemInput />\n </TagsInput.Item>\n ))}\n <TagsInput.Input placeholder={placeholder} />\n </chakra.div>\n {(statusIcon || (tagValues.length > 0 && !isDisabled && !isReadOnly)) && (\n <chakra.div css={styles.suffixBlock}>\n {statusIcon}\n {tagValues.length > 0 && !isDisabled && !isReadOnly && (\n <TagsInput.ClearTrigger css={styles.clearTrigger}>\n <IconCross size={size === 'lg' ? '24' : '16'} />\n </TagsInput.ClearTrigger>\n )}\n </chakra.div>\n )}\n </TagsInput.Control>\n <TagsInput.HiddenInput />\n </BitkitField>\n )}\n </TagsInput.Context>\n </TagsInput.Root>\n );\n});\n\nBitkitTagsInput.displayName = 'BitkitTagsInput';\nexport default BitkitTagsInput;\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,eAA6D,EAAE,iBAAiB,WAAW,KAAK,CAAC,CAAC,SAAS;;;;;;;AAQjH,IAAM,kBAAkB,YAAkD,OAAO,QAAQ;CACvF,MAAM,EACJ,aAAa,MACb,eAAe,OACf,cAGA,YAAY,UACZ,KACA,eACA,aACA,OAAO,MACP,OACA,UACA,OAGA,OACA,OACA,UACA,SACA,GAAG,eACD;CAIJ,MAAM,qBAAmE,YACvE,YAAY,OAAO,MAAM,WAAW,OAAO,KAAK;CAElD,MAAM,SAAS,cAAc,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;CAE3D,MAAM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BAAC,UAAU,OAAX,EAA8B,YAAc,CAAA,CAClC;SACV,cAAe,UAAU,SAAS,KAAK,CAAC,cAAc,CAAC,eACvD,qBAAC,OAAO,KAAR;KAAY,KAAK,OAAO;eAAxB,CACG,YACA,UAAU,SAAS,KAAK,CAAC,cAAc,CAAC,cACvC,oBAAC,UAAU,cAAX;MAAwB,KAAK,OAAO;gBAClC,oBAAC,WAAD,EAAW,MAAM,SAAS,OAAO,OAAO,KAAO,CAAA;KACzB,CAAA,CAEhB;MAEG,EAAA,CAAA;IACnB,oBAAC,UAAU,aAAX,CAAwB,CAAA;GACb;KAEE,CAAA;CACL,CAAA;AAEpB,CAAC;AAED,gBAAgB,cAAc"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit-v2",
3
3
  "private": false,
4
- "version": "0.3.308",
4
+ "version": "0.3.310",
5
5
  "description": "Bitrise Design System Components built with Chakra UI V3",
6
6
  "keywords": [
7
7
  "react",