@box/blueprint-web 17.12.1 → 17.12.3

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.
@@ -51,6 +51,7 @@ const ComboboxGroupSelect = /*#__PURE__*/forwardRef((props, forwardedRef) => {
51
51
  disabled: isDisabled,
52
52
  error: null,
53
53
  id: selectId,
54
+ label: "",
54
55
  onBlur: handleBlur,
55
56
  onFocus: handleFocus
56
57
  });
@@ -7,10 +7,9 @@ export interface ComboboxGroupProps {
7
7
  label: string;
8
8
  hideLabel?: boolean;
9
9
  }
10
- export interface ComboboxGroupSelectProps extends Omit<SelectProps, 'disabled'> {
10
+ export interface ComboboxGroupSelectProps extends Omit<SelectProps, 'disabled' | 'label' | 'labelInfoText' | 'labelInfoBadgeAriaLabel'> {
11
11
  disabled?: never;
12
12
  error?: boolean;
13
- label: never;
14
13
  position?: 'leading' | 'trailing';
15
14
  }
16
15
  export interface ComboboxGroupComboboxProps<Multiple extends boolean = true, FreeInput extends boolean = true, T extends OptionValue = OptionValue> extends Omit<ComboboxBaseProps<Multiple, FreeInput, T>, 'defaultValue' | 'value' | 'onValueChange'> {
@@ -12,6 +12,7 @@ import { useBlueprintConfiguration } from '../blueprint-configuration-context/us
12
12
  import { InlineError } from '../primitives/inline-error/inline-error.js';
13
13
  import { Text } from '../text/text.js';
14
14
  import { useLabelable } from '../util-components/labelable/useLabelable.js';
15
+ import { TextWithInfoBadge } from '../util-components/text-with-info-badge/text-with-info-badge.js';
15
16
  import { composeEventHandlers } from '../utils/composeEventHandlers.js';
16
17
  import { useControllableState } from '../utils/useControllableState.js';
17
18
  import { useUniqueId } from '../utils/useUniqueId.js';
@@ -26,6 +27,8 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
26
27
  className,
27
28
  error,
28
29
  hideLabel,
30
+ labelInfoBadgeAriaLabel,
31
+ labelInfoText,
29
32
  label,
30
33
  placeholder,
31
34
  placeholderLeftElement,
@@ -97,6 +100,7 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
97
100
  onValueChange,
98
101
  onOpenChange: handleOpenChange
99
102
  };
103
+ const shouldShowInfoBadge = !hideLabel && !!label && labelInfoText && labelInfoBadgeAriaLabel;
100
104
  const Label = useLabelable(label, selectId, required);
101
105
  const inlineErrorId = useUniqueId('inline-error-');
102
106
  const ariaDescribedBy = clsx(triggerProps['aria-describedby'], {
@@ -124,7 +128,14 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
124
128
  }, className),
125
129
  "data-bp-animated": isAnimationEnabled ? 'true' : 'false',
126
130
  "data-modern": 'true' ,
127
- children: [jsx(Label, {
131
+ children: [shouldShowInfoBadge ? jsx(TextWithInfoBadge, {
132
+ infoBadgeAriaLabel: labelInfoBadgeAriaLabel,
133
+ infoText: labelInfoText,
134
+ children: jsx(Label, {
135
+ className: styles.label,
136
+ hideLabel: hideLabel
137
+ })
138
+ }) : jsx(Label, {
128
139
  className: styles.label,
129
140
  hideLabel: hideLabel
130
141
  }), jsx(SelectProvider, {
@@ -1,7 +1,16 @@
1
1
  import { type SelectItemProps as RadixItemProps, type SelectContentProps as RadixSelectContentProps, type SelectProps as RadixSelectProps, type SelectTriggerProps as RadixSelectTriggerProps } from '@radix-ui/react-select';
2
2
  import { type ReactElement } from 'react';
3
+ import { type RequireAllOrNone } from 'type-fest';
3
4
  import { type Modify } from '../types/modify';
4
5
  import { type Labelable } from '../util-components/labelable/types';
6
+ import { type StyledText } from '../utils/commonTypes';
7
+ /** Label-info tooltip props. Using these requires a TooltipProvider around this Select (or, ideally, around the app). */
8
+ export interface LabelInfo {
9
+ /** Additional text to aid in use. It will appear inside info icon tooltip in the label. */
10
+ labelInfoText?: StyledText;
11
+ /** aria-label for the label badge button. */
12
+ labelInfoBadgeAriaLabel?: string;
13
+ }
5
14
  export interface ExtraProps extends Labelable {
6
15
  /**
7
16
  * The placeholder value displayed within the select trigger button when no values has been selected yet.
@@ -99,7 +108,7 @@ type SelectState = {
99
108
  readonly: true;
100
109
  subText?: string;
101
110
  };
102
- export type SelectProps = Modify<RadixSelectTriggerProps, ExtraProps & SelectState>;
111
+ export type SelectProps = Modify<RadixSelectTriggerProps, ExtraProps & SelectState & RequireAllOrNone<LabelInfo, keyof LabelInfo>>;
103
112
  export interface SelectContentProps extends React.ComponentPropsWithRef<'div'> {
104
113
  /**
105
114
  * Pass the select options and separators using `<Select.Option />` and `<Select.Separator />`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "17.12.1",
3
+ "version": "17.12.3",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@ariakit/react": "0.4.21",
57
57
  "@ariakit/react-core": "0.4.21",
58
- "@box/blueprint-web-assets": "^5.10.14",
58
+ "@box/blueprint-web-assets": "^5.10.16",
59
59
  "@internationalized/date": "^3.12.0",
60
60
  "@radix-ui/react-accordion": "1.1.2",
61
61
  "@radix-ui/react-checkbox": "1.0.4",
@@ -86,7 +86,7 @@
86
86
  "devDependencies": {
87
87
  "@box/box-test-client": "^3.2.7",
88
88
  "@box/playwright-utils": "^2.8.5",
89
- "@box/storybook-utils": "^1.2.58",
89
+ "@box/storybook-utils": "^1.2.60",
90
90
  "@figma/code-connect": "1.4.4",
91
91
  "@playwright/test": "1.46.1",
92
92
  "@types/js-yaml": "^4.0.9",