@allxsmith/bestax-bulma 5.27.4 → 5.27.6

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 CHANGED
@@ -9068,9 +9068,10 @@ const FieldLabelIdContext = React.createContext(undefined);
9068
9068
  * The id a labeled Field wants its single composed control to adopt (#495).
9069
9069
  * `undefined` outside a Field, in unlabeled/grouped/addons Fields, or when the
9070
9070
  * user took over the association with an explicit `labelProps.htmlFor`.
9071
- * Consumed by the single-control bases (InputBase, SelectBase, TextAreaBase)
9072
- * and, through `useAutoLabelId`, by the convenience inputs that render an
9073
- * input of their own (#939). Internal; not part of the public API.
9071
+ * Consumed by the single-control bases (InputBase, SelectBase, TextAreaBase,
9072
+ * and the date and time picker bases unless inline, #968) and, through
9073
+ * `useAutoLabelId`, by the convenience inputs that render an input of their
9074
+ * own (#939). Internal; not part of the public API.
9074
9075
  */
9075
9076
  const useFieldLabelId = () => React.useContext(FieldLabelIdContext);
9076
9077
  /** Provider for the Field label-target id — used internally by Field. */
@@ -9079,26 +9080,30 @@ const FieldLabelElementIdContext = React.createContext(undefined);
9079
9080
  /**
9080
9081
  * The id of a labeled Field's own `<label>`, for a group control (Radios,
9081
9082
  * Checkboxes, Rate, DateRangeInput) to point `aria-labelledby` at, since a group cannot take
9082
- * the label's `htmlFor` (#939), and for a range Slider's thumbs, which each
9083
- * need the label in a name of their own (#981). Set under the same conditions
9084
- * as {@link useFieldLabelId}. Consumed through `useAutoLabelledBy` and
9085
- * `useAutoLabelId`.
9083
+ * the label's `htmlFor` (#939). Set under the same conditions as
9084
+ * {@link useFieldLabelId}. Consumed through `useAutoLabelledBy`.
9086
9085
  * Internal; not part of the public API.
9087
9086
  */
9088
9087
  const useFieldLabelElementId = () => React.useContext(FieldLabelElementIdContext);
9089
9088
  /** Provider for the Field label's own id, used internally by Field. */
9090
9089
  const FieldLabelElementIdProvider = FieldLabelElementIdContext.Provider;
9091
- const FieldLabelForContext = React.createContext(undefined);
9092
- /**
9093
- * What the nearest labeled Field's `<label>` points `htmlFor` at: the id it
9094
- * generated, or the caller's own `labelProps.htmlFor`. An unlabeled Field
9095
- * passes it through, so a control in the inner Field of a horizontal layout
9096
- * can tell the outer label names it. Only ever compared with a control's own
9097
- * id, never adopted, so it hands out no id. Internal; not part of the public
9098
- * API.
9090
+ const FieldLabelForContext = React.createContext({});
9091
+ /**
9092
+ * The nearest labeled Field's `<label>`: what it points `htmlFor` at, the id
9093
+ * it generated or the caller's own `labelProps.htmlFor`, and the id the label
9094
+ * renders with, if it has one. An unlabeled Field passes both through
9095
+ * together, so a control in the inner Field of a horizontal layout can tell
9096
+ * the outer label names it, and point at that label by its id, as a range
9097
+ * Slider's thumbs (#981) and Autocomplete's suggestion list (#998) do. The
9098
+ * `htmlFor` is only ever compared with a control's own id, never adopted, so
9099
+ * it hands out no id for a control. The `id` is set only while that label
9100
+ * renders with it. Unlike {@link useFieldLabelId}, it is set in a `grouped`
9101
+ * or `hasAddons` Field too, so a label wired by hand names the control its
9102
+ * `for` picks in those rows as well. Consumed through `useAutoLabelId`.
9103
+ * Internal; not part of the public API.
9099
9104
  */
9100
9105
  const useFieldLabelFor = () => React.useContext(FieldLabelForContext);
9101
- /** Provider for the Field label's `htmlFor` target, used internally by Field. */
9106
+ /** Provider for the Field label's `htmlFor` target and id, used internally by Field. */
9102
9107
  const FieldLabelForProvider = FieldLabelForContext.Provider;
9103
9108
  const RadiosContext = React.createContext(undefined);
9104
9109
  const CheckboxesContext = React.createContext(undefined);
@@ -9298,14 +9303,26 @@ const Control = React.forwardRef(({ as = 'div', hasIconsLeft, hasIconsRight, isL
9298
9303
  Control.displayName = 'Control';
9299
9304
 
9300
9305
  /**
9301
- * FieldLabel component for rendering a Bulma field label.
9306
+ * FieldLabel component for rendering a Bulma field label. It renders the
9307
+ * label column of a horizontal `Field` (a `div` with the `field-label` class),
9308
+ * not a `<label>`, so text placed straight in it names nothing. Put a `<label>`
9309
+ * with the `label` class inside it and point its `htmlFor` at the control's
9310
+ * `id`, or give the horizontal `Field` a `label` prop, which renders this
9311
+ * column and its `<label>` for you. A `<label>` you put here names the
9312
+ * control through its `htmlFor` alone: a range `Slider`'s thumbs and an
9313
+ * `Autocomplete`'s suggestion list point `aria-labelledby` at a `Field`'s
9314
+ * label only when its `label` prop renders it and it names the control.
9315
+ * Where it would not name the control on its own, as in an inner `Field`,
9316
+ * pass `labelProps={{ htmlFor, id }}` with a matching `id` on the control.
9302
9317
  *
9303
9318
  * @function
9304
9319
  * @param {FieldLabelProps} props - Props for the FieldLabel component.
9305
9320
  * @returns {JSX.Element} The rendered field label.
9306
9321
  *
9307
9322
  * @example
9308
- * <FieldLabel size="normal">Name</FieldLabel>
9323
+ * <FieldLabel size="normal">
9324
+ * <label className="label" htmlFor="name">Name</label>
9325
+ * </FieldLabel>
9309
9326
  */
9310
9327
  const FieldLabel = ({ size, textColor, bgColor, className, children, ...props }) => {
9311
9328
  const { bulmaHelperClasses, rest } = useBulmaClasses({
@@ -9390,8 +9407,8 @@ const FieldComponent = ({ horizontal, grouped, hasAddons, narrow, label, labelSi
9390
9407
  const effectiveLabelSize = labelSize ?? (horizontal ? 'normal' : undefined);
9391
9408
  const labelClass = usePrefixedClassNames('label');
9392
9409
  // Auto-associate the label with a single composed base control (#495): the
9393
- // label points at a generated id shared via context, which InputBase/
9394
- // SelectBase/TextAreaBase adopt when the user supplied no id of their own.
9410
+ // label points at a generated id shared via context, which a composed base
9411
+ // adopts when the user supplied no id of their own.
9395
9412
  // Presence semantics on htmlFor — even an explicit `htmlFor: undefined`
9396
9413
  // means the caller owns the association. Grouped/addons fields hold several
9397
9414
  // controls, so no single association is generated for them.
@@ -9405,15 +9422,19 @@ const FieldComponent = ({ horizontal, grouped, hasAddons, narrow, label, labelSi
9405
9422
  // The label gets an id whenever the association is on, unless the caller
9406
9423
  // gave it one.
9407
9424
  const labelId = labelProps?.id ?? (targetId ? `${targetId}-label` : undefined);
9408
- // What the rendered label's `for` points at, generated or the caller's, so
9409
- // a control can tell when a label wired by hand names it. An unlabeled
9410
- // Field passes on its parent's.
9425
+ // What the rendered label's `for` points at, generated or the caller's, and
9426
+ // the id it renders with, so a control can tell when a label wired by hand
9427
+ // names it and point at that label. An unlabeled Field passes on its
9428
+ // parent's. Unlike `targetId`, a label wired by hand passes on its own in
9429
+ // `grouped`/`hasAddons` Fields too, on purpose: those only stop the Field
9430
+ // picking one control out of several, and the caller's `for` has picked
9431
+ // one, so a range Slider or Autocomplete it names points at that label in
9432
+ // a row as well. A group reads the label element id below instead, which
9433
+ // stays off for a label wired by hand, since no group takes its `for`.
9411
9434
  const inheritedLabelFor = useFieldLabelFor();
9412
- const labelFor = label
9413
- ? userWiredLabel
9414
- ? labelProps.htmlFor
9415
- : targetId
9416
- : inheritedLabelFor;
9435
+ const labelForTarget = userWiredLabel ? labelProps.htmlFor : targetId;
9436
+ const ownLabelFor = React.useMemo(() => ({ htmlFor: labelForTarget, id: labelId }), [labelForTarget, labelId]);
9437
+ const labelFor = label ? ownLabelFor : inheritedLabelFor;
9417
9438
  let renderedLabel = null;
9418
9439
  if (label) {
9419
9440
  if (horizontal) {
@@ -9471,10 +9492,11 @@ function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput = true,
9471
9492
  // Read outside the control's own Field, so it is set only when an outer
9472
9493
  // Field holds the control, which then renders no label of its own.
9473
9494
  const fieldLabelId = useFieldLabelId();
9474
- // What an outer Field's label points at, even when wired by hand.
9495
+ // What an outer Field's label points at, even when wired by hand, and the
9496
+ // id that label renders with, read together so the id is that label's.
9497
+ // Set in `grouped`/`hasAddons` Fields too when the label is wired by hand,
9498
+ // since its `for` names this one control whatever the layout (see Field).
9475
9499
  const fieldLabelFor = useFieldLabelFor();
9476
- // That Field's label element, set under the same conditions.
9477
- const fieldLabelElementId = useFieldLabelElementId();
9478
9500
  // Truthiness mirrors Field's own `if (label)` render gate.
9479
9501
  const active = !!label && rendersLabel;
9480
9502
  // Presence, not truthiness: `htmlFor: undefined` is an explicit opt-out and
@@ -9483,7 +9505,7 @@ function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput = true,
9483
9505
  const adopted = !active && hasInput ? fieldLabelId : undefined;
9484
9506
  const controlId = id ?? (active && !userWired ? generatedId : adopted);
9485
9507
  const ownLabelProps = { htmlFor: controlId, ...labelProps };
9486
- const labelTarget = active ? ownLabelProps.htmlFor : fieldLabelFor;
9508
+ const labelTarget = active ? ownLabelProps.htmlFor : fieldLabelFor.htmlFor;
9487
9509
  const labelled = !!controlId && labelTarget === controlId;
9488
9510
  // Only a label that names the control gets an id to point at, with the
9489
9511
  // suffix Field gives its own, from an id that is already unique.
@@ -9504,7 +9526,7 @@ function useAutoLabelId({ label, id, labelProps, rendersLabel, hasInput = true,
9504
9526
  const labelId = needsLabelId && labelled
9505
9527
  ? active
9506
9528
  ? ownLabelId
9507
- : fieldLabelElementId
9529
+ : fieldLabelFor.id
9508
9530
  : undefined;
9509
9531
  return { controlId, fieldLabelProps, labelled, labelId };
9510
9532
  }
@@ -10956,11 +10978,14 @@ const Autocomplete = React.forwardRef(({ data = [], value: controlledValue, plac
10956
10978
  // Field props
10957
10979
  label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName, className, ...props }, ref) => {
10958
10980
  const insideField = useInsideField();
10959
- const { controlId, fieldLabelProps } = useAutoLabelId({
10981
+ // The suggestion list points `aria-labelledby` at the label that names
10982
+ // the input, so it needs that label's id.
10983
+ const { controlId, fieldLabelProps, labelId: listLabelId, } = useAutoLabelId({
10960
10984
  label,
10961
10985
  id,
10962
10986
  labelProps,
10963
10987
  rendersLabel: !insideField,
10988
+ needsLabelId: true,
10964
10989
  });
10965
10990
  const { bulmaHelperClasses, rest } = useBulmaClasses(props);
10966
10991
  const { classPrefix } = useConfig();
@@ -11163,12 +11188,11 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
11163
11188
  const controlLoading = useControlLoading();
11164
11189
  const showClear = clearable && !!inputValue && !disabled && !loading && !controlLoading;
11165
11190
  // The combobox controls its listbox and points at the highlighted option.
11166
- // The listbox takes its name from the label this renders, or a fallback
11167
- // when it renders none.
11191
+ // The listbox takes its name from the label that names the combobox, the
11192
+ // one this renders or a surrounding Field's, so the two say the same
11193
+ // thing. When no label names the combobox, or the one that does has no
11194
+ // id to point at, the list keeps a fallback name.
11168
11195
  const listOpen = isActive && (filteredData.length > 0 || !!empty);
11169
- const listLabelId = !insideField && label
11170
- ? (fieldLabelProps?.id ?? `${listboxId}-label`)
11171
- : undefined;
11172
11196
  const activeOptionId = listOpen &&
11173
11197
  highlightedIndex >= 0 &&
11174
11198
  highlightedIndex < filteredData.length
@@ -11186,9 +11210,7 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
11186
11210
  : getDisplayValue(item) }, index));
11187
11211
  })) : (jsxRuntime.jsx("div", { className: emptyItemClasses, children: empty })), footer && jsxRuntime.jsx("div", { className: dropdownFooterClass, children: footer })] }) }))] }));
11188
11212
  if (!insideField) {
11189
- return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: listLabelId
11190
- ? { ...fieldLabelProps, id: listLabelId }
11191
- : fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [autocompleteElement, messageEl] }));
11213
+ return (jsxRuntime.jsxs(Field, { label: label, labelSize: labelSize, labelProps: fieldLabelProps, horizontal: horizontal, className: fieldClassName, children: [autocompleteElement, messageEl] }));
11192
11214
  }
11193
11215
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [autocompleteElement, messageEl] }));
11194
11216
  });
@@ -14129,7 +14151,13 @@ const SKIPPED_SEGMENTS = {
14129
14151
  * @returns {JSX.Element}
14130
14152
  */
14131
14153
  const DateInputBase = React.forwardRef((props, ref) => {
14132
- const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled, readOnly, placeholder, granularity = 'day', format, parse, locale, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = true, position = 'bottom-left', appendToBody = false, color, size, isRounded, shouldDisableDate, unselectableDates, firstDayOfWeek = 0, dayNames, monthNames, nearbyMonthDays = true, className, name, form, required, id, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', labels, ...rest } = props;
14154
+ const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled, readOnly, placeholder, granularity = 'day', format, parse, locale, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = true, position = 'bottom-left', appendToBody = false, color, size, isRounded, shouldDisableDate, unselectableDates, firstDayOfWeek = 0, dayNames, monthNames, nearbyMonthDays = true, className, name, form, required, id: idProp, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', labels, ...rest } = props;
14155
+ // Inside a labeled Field the input takes the id the label points at
14156
+ // when the caller set none, as InputBase does, and the popover's ids
14157
+ // follow it. Inline there is no input to name, so nothing takes the
14158
+ // Field's id or builds on it.
14159
+ const fieldLabelId = useFieldLabelId();
14160
+ const id = idProp ?? (inline ? undefined : fieldLabelId);
14133
14161
  // The launcher gives way to the loading spinner of a Control this sits in.
14134
14162
  const controlLoading = useControlLoading();
14135
14163
  const triggerIcon = triggerIconProp ?? !controlLoading;
@@ -15305,7 +15333,13 @@ const fromIsoTime = (s) => {
15305
15333
  * @returns {JSX.Element}
15306
15334
  */
15307
15335
  const TimeInputBase = React.forwardRef((props, ref) => {
15308
- const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled, readOnly, placeholder, format, parse, locale, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = false, position = 'bottom-left', appendToBody = false, color, size, isRounded, hourFormat = '24', enableSeconds = false, incrementHours = 1, incrementMinutes = 1, incrementSeconds = 1, unselectableTimes, className, name, form, required, id, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', labels, audioTick = false, haptics = false, ...rest } = props;
15336
+ const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled, readOnly, placeholder, format, parse, locale, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = false, position = 'bottom-left', appendToBody = false, color, size, isRounded, hourFormat = '24', enableSeconds = false, incrementHours = 1, incrementMinutes = 1, incrementSeconds = 1, unselectableTimes, className, name, form, required, id: idProp, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', labels, audioTick = false, haptics = false, ...rest } = props;
15337
+ // Inside a labeled Field the input takes the id the label points at
15338
+ // when the caller set none, as InputBase does, and the popover's ids
15339
+ // follow it. Inline there is no input to name, so nothing takes the
15340
+ // Field's id or builds on it.
15341
+ const fieldLabelId = useFieldLabelId();
15342
+ const id = idProp ?? (inline ? undefined : fieldLabelId);
15309
15343
  // The launcher gives way to the loading spinner of a Control this sits in.
15310
15344
  const controlLoading = useControlLoading();
15311
15345
  const triggerIcon = triggerIconProp ?? !controlLoading;
@@ -15617,7 +15651,13 @@ const fromIsoDateTime = (s) => {
15617
15651
  const DateTimeInputBase = React.forwardRef((props, ref) => {
15618
15652
  const { value: controlledValue, defaultValue, onChange, onOpen, onClose, min, max, disabled, readOnly, placeholder, format, parse, locale, inline = false, mobileNative = 'auto', editable = true, popover = true, openOnFocus = true, closeOnSelect = false, position = 'bottom-left', appendToBody = false, color, size, isRounded, shouldDisableDate, unselectableDates, firstDayOfWeek = 0, dayNames, monthNames, nearbyMonthDays = true, hourFormat = '24', enableSeconds = false, incrementHours = 1,
15619
15653
  // Step between visible wheel values; 1 gives the iOS-style every-minute wheel.
15620
- incrementMinutes = 1, incrementSeconds = 1, unselectableTimes, className, name, form, required, id, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', audioTick = false, haptics = false, labels, ...rest } = props;
15654
+ incrementMinutes = 1, incrementSeconds = 1, unselectableTimes, className, name, form, required, id: idProp, onFocus, onClick, onKeyDown, onBlur, iconLeftName: _iconLeftName, triggerIcon: triggerIconProp, triggerIconName = 'chevron-down', audioTick = false, haptics = false, labels, ...rest } = props;
15655
+ // Inside a labeled Field the input takes the id the label points at
15656
+ // when the caller set none, as InputBase does, and the popover's ids
15657
+ // follow it. Inline there is no input to name, so nothing takes the
15658
+ // Field's id or builds on it.
15659
+ const fieldLabelId = useFieldLabelId();
15660
+ const id = idProp ?? (inline ? undefined : fieldLabelId);
15621
15661
  // The launcher gives way to the loading spinner of a Control this sits in.
15622
15662
  const controlLoading = useControlLoading();
15623
15663
  const triggerIcon = triggerIconProp ?? !controlLoading;