@allxsmith/bestax-bulma 5.8.2 → 5.8.4
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.
- package/dist/index.cjs.js +83 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +83 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/types/form/Autocomplete.d.ts +9 -1
- package/dist/types/form/Checkboxes.d.ts +6 -0
- package/dist/types/form/Radios.d.ts +6 -0
- package/dist/types/form/Rate.d.ts +6 -0
- package/dist/types/form/Taginput.d.ts +9 -1
- package/dist/types/form/useAutoLabelId.d.ts +22 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5841,6 +5841,45 @@ const Field = withSubComponents(FieldComponent, {
|
|
|
5841
5841
|
Control,
|
|
5842
5842
|
}, 'Field');
|
|
5843
5843
|
|
|
5844
|
+
/**
|
|
5845
|
+
* Associates the convenience `label` prop with its control (#368): generates
|
|
5846
|
+
* an id for the control and returns labelProps carrying a matching `htmlFor`.
|
|
5847
|
+
* A user-supplied `id` is used as the target instead of the generated one, and
|
|
5848
|
+
* an explicit `labelProps.htmlFor` disables generation entirely — the user has
|
|
5849
|
+
* taken over the association. Internal; not part of the public API.
|
|
5850
|
+
*/
|
|
5851
|
+
function useAutoLabelId({ label, id, labelProps, rendersLabel, }) {
|
|
5852
|
+
// Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.
|
|
5853
|
+
const generatedId = React.useId();
|
|
5854
|
+
// Truthiness mirrors Field's own `if (label)` render gate.
|
|
5855
|
+
const active = !!label && rendersLabel;
|
|
5856
|
+
const controlId = id ?? (active && !labelProps?.htmlFor ? generatedId : undefined);
|
|
5857
|
+
const fieldLabelProps = active
|
|
5858
|
+
? { htmlFor: controlId, ...labelProps }
|
|
5859
|
+
: labelProps;
|
|
5860
|
+
return { controlId, fieldLabelProps };
|
|
5861
|
+
}
|
|
5862
|
+
/**
|
|
5863
|
+
* Group-input counterpart of {@link useAutoLabelId} (#494): a group of
|
|
5864
|
+
* controls cannot take a single `htmlFor`, so instead the rendered `<label>`
|
|
5865
|
+
* gets a generated id and the group container points at it with
|
|
5866
|
+
* `aria-labelledby`. A user-supplied `labelProps.id` is used as the target
|
|
5867
|
+
* instead of generating one. Any caller `htmlFor` is stripped — a group label
|
|
5868
|
+
* names the group, never a single control — so the merged labelProps always
|
|
5869
|
+
* carry an explicit `htmlFor: undefined`.
|
|
5870
|
+
* Internal; not part of the public API.
|
|
5871
|
+
*/
|
|
5872
|
+
function useAutoLabelledBy({ label, labelProps, rendersLabel, }) {
|
|
5873
|
+
// Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.
|
|
5874
|
+
const generatedId = React.useId();
|
|
5875
|
+
const active = !!label && rendersLabel;
|
|
5876
|
+
const labelId = labelProps?.id ?? (active ? generatedId : undefined);
|
|
5877
|
+
const fieldLabelProps = active
|
|
5878
|
+
? { ...labelProps, id: labelId, htmlFor: undefined }
|
|
5879
|
+
: labelProps;
|
|
5880
|
+
return { ariaLabelledBy: active ? labelId : undefined, fieldLabelProps };
|
|
5881
|
+
}
|
|
5882
|
+
|
|
5844
5883
|
/**
|
|
5845
5884
|
* The `Checkboxes` component wraps multiple `Checkbox` components in a Bulma-styled group.
|
|
5846
5885
|
*
|
|
@@ -5869,6 +5908,11 @@ const Field = withSubComponents(FieldComponent, {
|
|
|
5869
5908
|
const CheckboxesComponent = ({ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, name, value, defaultValue, onChange, children, className, ...props }) => {
|
|
5870
5909
|
const insideField = useInsideField();
|
|
5871
5910
|
const insideControl = useInsideControl();
|
|
5911
|
+
const { ariaLabelledBy, fieldLabelProps } = useAutoLabelledBy({
|
|
5912
|
+
label,
|
|
5913
|
+
labelProps,
|
|
5914
|
+
rendersLabel: !insideField,
|
|
5915
|
+
});
|
|
5872
5916
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
5873
5917
|
...props,
|
|
5874
5918
|
});
|
|
@@ -5891,37 +5935,18 @@ const CheckboxesComponent = ({ label, labelSize, labelProps, horizontal, message
|
|
|
5891
5935
|
name,
|
|
5892
5936
|
...(groupActive ? { value: currentValue, onChange: handleChange } : {}),
|
|
5893
5937
|
}), [name, groupActive, currentValue, handleChange]);
|
|
5894
|
-
const checkboxesElement = (jsxRuntime.jsx("div", { className: wrapperClass, ...rest, children: jsxRuntime.jsx(CheckboxesProvider, { value: ctx, children: children }) }));
|
|
5938
|
+
const checkboxesElement = (jsxRuntime.jsx("div", { className: wrapperClass, role: "group", "aria-labelledby": ariaLabelledBy, ...rest, children: jsxRuntime.jsx(CheckboxesProvider, { value: ctx, children: children }) }));
|
|
5895
5939
|
let content = checkboxesElement;
|
|
5896
5940
|
if (!insideControl) {
|
|
5897
5941
|
content = jsxRuntime.jsx(Control, { children: content });
|
|
5898
5942
|
}
|
|
5899
5943
|
if (!insideField) {
|
|
5900
|
-
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps:
|
|
5944
|
+
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [content, messageEl] }));
|
|
5901
5945
|
}
|
|
5902
5946
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [content, messageEl] }));
|
|
5903
5947
|
};
|
|
5904
5948
|
const Checkboxes = withSubComponents(CheckboxesComponent, { Checkbox }, 'Checkboxes');
|
|
5905
5949
|
|
|
5906
|
-
/**
|
|
5907
|
-
* Associates the convenience `label` prop with its control (#368): generates
|
|
5908
|
-
* an id for the control and returns labelProps carrying a matching `htmlFor`.
|
|
5909
|
-
* A user-supplied `id` is used as the target instead of the generated one, and
|
|
5910
|
-
* an explicit `labelProps.htmlFor` disables generation entirely — the user has
|
|
5911
|
-
* taken over the association. Internal; not part of the public API.
|
|
5912
|
-
*/
|
|
5913
|
-
function useAutoLabelId({ label, id, labelProps, rendersLabel, }) {
|
|
5914
|
-
// Called unconditionally per the rules of hooks; SSR-safe on React 18 and 19.
|
|
5915
|
-
const generatedId = React.useId();
|
|
5916
|
-
// Truthiness mirrors Field's own `if (label)` render gate.
|
|
5917
|
-
const active = !!label && rendersLabel;
|
|
5918
|
-
const controlId = id ?? (active && !labelProps?.htmlFor ? generatedId : undefined);
|
|
5919
|
-
const fieldLabelProps = active
|
|
5920
|
-
? { htmlFor: controlId, ...labelProps }
|
|
5921
|
-
: labelProps;
|
|
5922
|
-
return { controlId, fieldLabelProps };
|
|
5923
|
-
}
|
|
5924
|
-
|
|
5925
5950
|
/**
|
|
5926
5951
|
* The `File` component provides a Bulma-styled file input, supporting color, size, boxed/fullwidth/align styles, icons, "has name", and filename display.
|
|
5927
5952
|
*
|
|
@@ -6077,6 +6102,11 @@ Radio.displayName = 'Radio';
|
|
|
6077
6102
|
const RadiosComponent = ({ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, name, value, defaultValue, onChange, children, className, ...props }) => {
|
|
6078
6103
|
const insideField = useInsideField();
|
|
6079
6104
|
const insideControl = useInsideControl();
|
|
6105
|
+
const { ariaLabelledBy, fieldLabelProps } = useAutoLabelledBy({
|
|
6106
|
+
label,
|
|
6107
|
+
labelProps,
|
|
6108
|
+
rendersLabel: !insideField,
|
|
6109
|
+
});
|
|
6080
6110
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
6081
6111
|
...props,
|
|
6082
6112
|
});
|
|
@@ -6102,13 +6132,13 @@ const RadiosComponent = ({ label, labelSize, labelProps, horizontal, message, me
|
|
|
6102
6132
|
name,
|
|
6103
6133
|
...(groupActive ? { value: currentValue, onChange: handleChange } : {}),
|
|
6104
6134
|
}), [name, groupActive, currentValue, handleChange]);
|
|
6105
|
-
const radiosElement = (jsxRuntime.jsx("div", { className: wrapperClass, ...rest, children: jsxRuntime.jsx(RadiosProvider, { value: ctx, children: children }) }));
|
|
6135
|
+
const radiosElement = (jsxRuntime.jsx("div", { className: wrapperClass, role: "radiogroup", "aria-labelledby": ariaLabelledBy, ...rest, children: jsxRuntime.jsx(RadiosProvider, { value: ctx, children: children }) }));
|
|
6106
6136
|
let content = radiosElement;
|
|
6107
6137
|
if (!insideControl) {
|
|
6108
6138
|
content = jsxRuntime.jsx(Control, { children: content });
|
|
6109
6139
|
}
|
|
6110
6140
|
if (!insideField) {
|
|
6111
|
-
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps:
|
|
6141
|
+
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [content, messageEl] }));
|
|
6112
6142
|
}
|
|
6113
6143
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [content, messageEl] }));
|
|
6114
6144
|
};
|
|
@@ -6837,6 +6867,11 @@ function getFillPercent(iconIndex, value) {
|
|
|
6837
6867
|
const Rate = React.forwardRef(({ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, value: controlledValue, defaultValue = 0, max = 5, size, disabled = false, showScore = false, showText = false, texts, onChange, customIcon, spaced = false, rtl = false, iconName, iconLibrary: iconLibraryProp, iconVariant, iconFeatures, color, precision = 1, customText, name, form, className, ...props }, ref) => {
|
|
6838
6868
|
const insideField = useInsideField();
|
|
6839
6869
|
const insideControl = useInsideControl();
|
|
6870
|
+
const { ariaLabelledBy, fieldLabelProps } = useAutoLabelledBy({
|
|
6871
|
+
label,
|
|
6872
|
+
labelProps,
|
|
6873
|
+
rendersLabel: !insideField,
|
|
6874
|
+
});
|
|
6840
6875
|
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
6841
6876
|
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
6842
6877
|
const [hoverValue, setHoverValue] = React.useState(null);
|
|
@@ -7033,13 +7068,13 @@ const Rate = React.forwardRef(({ label, labelSize, labelProps, horizontal, messa
|
|
|
7033
7068
|
const rateScoreClass = usePrefixedClassNames('rate-score');
|
|
7034
7069
|
const rateTextClass = usePrefixedClassNames('rate-text');
|
|
7035
7070
|
const rateCustomTextClass = usePrefixedClassNames('rate-custom-text');
|
|
7036
|
-
const rateElement = (jsxRuntime.jsxs("div", { ref: ref, className: combinedClasses, role: "radiogroup", "aria-label":
|
|
7071
|
+
const rateElement = (jsxRuntime.jsxs("div", { ref: ref, className: combinedClasses, role: "radiogroup", "aria-label": ariaLabelledBy ? undefined : 'Rating', "aria-labelledby": ariaLabelledBy, "aria-valuenow": currentValue, "aria-valuemin": 0, "aria-valuemax": max, "aria-valuetext": ariaValueText, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, ...rest, children: [jsxRuntime.jsx("div", { className: rateItemsClass, children: renderIcons() }), showScore && (jsxRuntime.jsx("span", { className: rateScoreClass, children: getScoreDisplay() })), text && jsxRuntime.jsx("span", { className: rateTextClass, children: text }), customText && (jsxRuntime.jsx("span", { className: rateCustomTextClass, children: customText })), name && (jsxRuntime.jsx("input", { type: "hidden", name: name, value: currentValue, form: form }))] }));
|
|
7037
7072
|
let content = rateElement;
|
|
7038
7073
|
if (!insideControl) {
|
|
7039
7074
|
content = jsxRuntime.jsx(Control, { children: content });
|
|
7040
7075
|
}
|
|
7041
7076
|
if (!insideField) {
|
|
7042
|
-
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps:
|
|
7077
|
+
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [content, messageEl] }));
|
|
7043
7078
|
}
|
|
7044
7079
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [content, messageEl] }));
|
|
7045
7080
|
});
|
|
@@ -7069,10 +7104,16 @@ Rate.displayName = 'Rate';
|
|
|
7069
7104
|
* onSelect={(item) => console.log(item)}
|
|
7070
7105
|
* />
|
|
7071
7106
|
*/
|
|
7072
|
-
const Autocomplete = React.forwardRef(({ data = [], value: controlledValue, placeholder, field = 'label', clearable = false, openOnFocus = false, keepFirst = false, keepOpen = false, selectOnClickOutside = false, maxHeight = 200, loading = false, disabled = false, checkInfiniteScroll = false, infiniteScrollDistance = 50, color, size, onInput, onSelect, onActiveChange, onInfiniteScroll, itemTemplate, header, footer, empty, name, form, required,
|
|
7107
|
+
const Autocomplete = React.forwardRef(({ data = [], value: controlledValue, placeholder, field = 'label', clearable = false, openOnFocus = false, keepFirst = false, keepOpen = false, selectOnClickOutside = false, maxHeight = 200, loading = false, disabled = false, checkInfiniteScroll = false, infiniteScrollDistance = 50, color, size, onInput, onSelect, onActiveChange, onInfiniteScroll, itemTemplate, header, footer, empty, name, form, required, id,
|
|
7073
7108
|
// Field props
|
|
7074
7109
|
label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, className, ...props }, ref) => {
|
|
7075
7110
|
const insideField = useInsideField();
|
|
7111
|
+
const { controlId, fieldLabelProps } = useAutoLabelId({
|
|
7112
|
+
label,
|
|
7113
|
+
id,
|
|
7114
|
+
labelProps,
|
|
7115
|
+
rendersLabel: !insideField,
|
|
7116
|
+
});
|
|
7076
7117
|
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
7077
7118
|
const { classPrefix } = useConfig();
|
|
7078
7119
|
const containerRef = React.useRef(null);
|
|
@@ -7268,7 +7309,7 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
|
|
|
7268
7309
|
[`is-${messageColor}`]: !!messageColor,
|
|
7269
7310
|
});
|
|
7270
7311
|
const messageEl = message ? jsxRuntime.jsx("p", { className: helpClass, children: message }) : null;
|
|
7271
|
-
const autocompleteElement = (jsxRuntime.jsxs("div", { ref: containerRef, className: combinedClasses, ...rest, children: [jsxRuntime.jsxs("div", { className: controlClasses, children: [jsxRuntime.jsx("input", { ref: combinedRef, type: "text", className: inputClasses, value: inputValue, placeholder: placeholder, disabled: disabled, name: name, form: form, required: required, onChange: handleInputChange, onFocus: handleFocus, onKeyDown: handleKeyDown, role: "combobox", "aria-expanded": isActive, "aria-haspopup": "listbox", "aria-autocomplete": "list", autoComplete: "off" }), clearable && inputValue && !disabled && (jsxRuntime.jsx("span", { className: iconRightClickableClass, onClick: handleClear, role: "button", "aria-label": "Clear", children: jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "16", height: "16", children: [jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) })), loading && (jsxRuntime.jsx("span", { className: iconRightClass, children: jsxRuntime.jsx("span", { className: loaderClass }) }))] }), isActive && (filteredData.length > 0 || empty) && (jsxRuntime.jsx("div", { className: dropdownMenuClasses, children: jsxRuntime.jsxs("div", { ref: dropdownRef, className: dropdownContentClass, style: { maxHeight: `${maxHeight}px`, overflowY: 'auto' }, role: "listbox", onScroll: handleDropdownScroll, children: [header && jsxRuntime.jsx("div", { className: dropdownHeaderClass, children: header }), filteredData.length > 0 ? (filteredData.map((item, index) => {
|
|
7312
|
+
const autocompleteElement = (jsxRuntime.jsxs("div", { ref: containerRef, className: combinedClasses, ...rest, children: [jsxRuntime.jsxs("div", { className: controlClasses, children: [jsxRuntime.jsx("input", { ref: combinedRef, type: "text", className: inputClasses, id: controlId, value: inputValue, placeholder: placeholder, disabled: disabled, name: name, form: form, required: required, onChange: handleInputChange, onFocus: handleFocus, onKeyDown: handleKeyDown, role: "combobox", "aria-expanded": isActive, "aria-haspopup": "listbox", "aria-autocomplete": "list", autoComplete: "off" }), clearable && inputValue && !disabled && (jsxRuntime.jsx("span", { className: iconRightClickableClass, onClick: handleClear, role: "button", "aria-label": "Clear", children: jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "16", height: "16", children: [jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) })), loading && (jsxRuntime.jsx("span", { className: iconRightClass, children: jsxRuntime.jsx("span", { className: loaderClass }) }))] }), isActive && (filteredData.length > 0 || empty) && (jsxRuntime.jsx("div", { className: dropdownMenuClasses, children: jsxRuntime.jsxs("div", { ref: dropdownRef, className: dropdownContentClass, style: { maxHeight: `${maxHeight}px`, overflowY: 'auto' }, role: "listbox", onScroll: handleDropdownScroll, children: [header && jsxRuntime.jsx("div", { className: dropdownHeaderClass, children: header }), filteredData.length > 0 ? (filteredData.map((item, index) => {
|
|
7272
7313
|
const isDisabled = typeof item !== 'string' && item.disabled;
|
|
7273
7314
|
const isHighlighted = index === highlightedIndex;
|
|
7274
7315
|
const itemClasses = prefixedClassNames(classPrefix, 'dropdown-item', {
|
|
@@ -7280,7 +7321,7 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
|
|
|
7280
7321
|
: getDisplayValue(item) }, index));
|
|
7281
7322
|
})) : (jsxRuntime.jsx("div", { className: emptyItemClasses, children: empty })), footer && jsxRuntime.jsx("div", { className: dropdownFooterClass, children: footer })] }) }))] }));
|
|
7282
7323
|
if (!insideField) {
|
|
7283
|
-
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps:
|
|
7324
|
+
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [autocompleteElement, messageEl] }));
|
|
7284
7325
|
}
|
|
7285
7326
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [autocompleteElement, messageEl] }));
|
|
7286
7327
|
});
|
|
@@ -7311,7 +7352,7 @@ Autocomplete.displayName = 'Autocomplete';
|
|
|
7311
7352
|
*/
|
|
7312
7353
|
const Taginput = React.forwardRef(({
|
|
7313
7354
|
// Field props
|
|
7314
|
-
label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, value: controlledValue, defaultValue = [], data = [], placeholder, field = 'label', allowNew = true, allowDuplicates = false, openOnFocus = false, removeOnKeys = true, confirmKeys = ['Enter', ','], closable = true, attached = false, maxTags, maxlength, disabled = false, readonly = false, rounded = false, ellipsis = false, hasCounter = true, onPasteSeparators = [','], beforeAdding, createTag, keepFirst = false, keepOpen = true, loading = false, ariaCloseLabel, icon, iconLibrary: iconLibraryProp, iconVariant, iconFeatures, color, tagColor, size, onChange, onAdd, onRemove, onTyping, tagTemplate, name, form, className, ...props }, ref) => {
|
|
7355
|
+
label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, value: controlledValue, defaultValue = [], data = [], placeholder, field = 'label', allowNew = true, allowDuplicates = false, openOnFocus = false, removeOnKeys = true, confirmKeys = ['Enter', ','], closable = true, attached = false, maxTags, maxlength, disabled = false, readonly = false, rounded = false, ellipsis = false, hasCounter = true, onPasteSeparators = [','], beforeAdding, createTag, keepFirst = false, keepOpen = true, loading = false, ariaCloseLabel, icon, iconLibrary: iconLibraryProp, iconVariant, iconFeatures, color, tagColor, size, onChange, onAdd, onRemove, onTyping, tagTemplate, name, form, id, className, ...props }, ref) => {
|
|
7315
7356
|
const insideField = useInsideField();
|
|
7316
7357
|
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
7317
7358
|
const { classPrefix } = useConfig();
|
|
@@ -7327,6 +7368,15 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
|
|
|
7327
7368
|
const [highlightedIndex, setHighlightedIndex] = React.useState(-1);
|
|
7328
7369
|
// Use controlled or internal tags
|
|
7329
7370
|
const tags = controlledValue !== undefined ? controlledValue : internalTags;
|
|
7371
|
+
const isMaxReached = maxTags !== undefined && tags.length >= maxTags;
|
|
7372
|
+
// At the tag limit the text input is not rendered, so there is nothing to
|
|
7373
|
+
// wire the label to.
|
|
7374
|
+
const { controlId, fieldLabelProps } = useAutoLabelId({
|
|
7375
|
+
label,
|
|
7376
|
+
id,
|
|
7377
|
+
labelProps,
|
|
7378
|
+
rendersLabel: !insideField && !isMaxReached,
|
|
7379
|
+
});
|
|
7330
7380
|
// Get display value from tag
|
|
7331
7381
|
const getDisplayValue = (tag) => {
|
|
7332
7382
|
if (typeof tag === 'string')
|
|
@@ -7569,7 +7619,6 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
|
|
|
7569
7619
|
[`is-${size}`]: !!size,
|
|
7570
7620
|
});
|
|
7571
7621
|
const combinedClasses = classNames(taginputClasses, bulmaHelperClasses, className);
|
|
7572
|
-
const isMaxReached = maxTags !== undefined && tags.length >= maxTags;
|
|
7573
7622
|
// Counter text
|
|
7574
7623
|
const showCounter = hasCounter && (maxTags !== undefined || maxlength !== undefined);
|
|
7575
7624
|
const counterText = maxTags !== undefined
|
|
@@ -7593,12 +7642,14 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
|
|
|
7593
7642
|
e.stopPropagation();
|
|
7594
7643
|
removeTag(index);
|
|
7595
7644
|
}, "aria-label": ariaCloseLabel || `Remove ${displayVal}` }))] }, index));
|
|
7596
|
-
}), !isMaxReached && (jsxRuntime.jsx("input", { ref: combinedRef, type: "text", className: inputClasses, value: inputValue, placeholder: tags.length === 0 ? placeholder : undefined, disabled: disabled, readOnly: readonly, maxLength: maxlength, onChange: handleInputChange, onFocus: handleFocus, onKeyDown: handleKeyDown, onPaste: handlePaste, "aria-label":
|
|
7645
|
+
}), !isMaxReached && (jsxRuntime.jsx("input", { ref: combinedRef, type: "text", className: inputClasses, id: controlId, value: inputValue, placeholder: tags.length === 0 ? placeholder : undefined, disabled: disabled, readOnly: readonly, maxLength: maxlength, onChange: handleInputChange, onFocus: handleFocus, onKeyDown: handleKeyDown, onPaste: handlePaste, "aria-label": controlId && fieldLabelProps?.htmlFor === controlId
|
|
7646
|
+
? undefined
|
|
7647
|
+
: 'Add tag' }))] }), loading && (jsxRuntime.jsx("span", { className: iconRightClass, children: jsxRuntime.jsx("span", { className: loaderClass }) }))] }), isActive && filteredData.length > 0 && (jsxRuntime.jsx("div", { className: dropdownMenuClasses, children: jsxRuntime.jsx("div", { ref: dropdownRef, className: dropdownContentClasses, role: "listbox", children: filteredData.map((item, index) => (jsxRuntime.jsx("a", { className: pcn('dropdown-item', {
|
|
7597
7648
|
'is-active': index === highlightedIndex,
|
|
7598
7649
|
}), onClick: () => addTag(item), onMouseEnter: () => setHighlightedIndex(index), role: "option", "aria-selected": index === highlightedIndex, children: item }, index))) }) })), showCounter && jsxRuntime.jsx("small", { className: counterClasses, children: counterText }), name &&
|
|
7599
7650
|
tags.map((tag, i) => (jsxRuntime.jsx("input", { type: "hidden", name: name, value: getDisplayValue(tag), form: form }, `tag-input-${i}`)))] }));
|
|
7600
7651
|
if (!insideField) {
|
|
7601
|
-
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps:
|
|
7652
|
+
return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [taginputElement, messageEl] }));
|
|
7602
7653
|
}
|
|
7603
7654
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [taginputElement, messageEl] }));
|
|
7604
7655
|
});
|