@box/blueprint-web 17.9.1 → 17.11.0

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.
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Calendar, XMark } from '@box/blueprint-web-assets/icons/Fill';
3
- import { Size4, Gray65 } from '@box/blueprint-web-assets/tokens/tokens';
2
+ import '@box/blueprint-web-assets/icons/Fill';
3
+ import { Calendar, XMark } from '@box/blueprint-web-assets/icons/Medium';
4
+ import { bpSize040, bpGray65 } from '@box/blueprint-web-assets/tokens/tokens';
4
5
  import * as RadixPopover from '@radix-ui/react-popover';
5
6
  import clsx from 'clsx';
6
7
  import { forwardRef, useState, useEffect, useRef, useCallback } from 'react';
@@ -17,11 +18,11 @@ import { useControllableState } from '../utils/useControllableState.js';
17
18
  import { useUniqueId } from '../utils/useUniqueId.js';
18
19
  import styles from './date-picker.module.js';
19
20
 
20
- const XMarkIcon = label => () => jsx(XMark, {
21
+ const XMarkIconModern = label => () => jsx(XMark, {
21
22
  "aria-label": label,
22
- color: Gray65,
23
- height: Size4,
24
- width: Size4
23
+ color: bpGray65,
24
+ height: bpSize040,
25
+ width: bpSize040
25
26
  });
26
27
  const handleSubmitKeyPress = (key, callback) => {
27
28
  const submitKeys = [' ', 'Enter'];
@@ -191,7 +192,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
191
192
  "aria-label": clearDatePickerAriaLabel,
192
193
  className: clsx(styles.button, styles.clear),
193
194
  disabled: isDisabled,
194
- icon: XMarkIcon(clearDatePickerAriaLabel),
195
+ icon: XMarkIconModern(clearDatePickerAriaLabel) ,
195
196
  onClick: onClearInputButtonClicked,
196
197
  onKeyDownCapture: onClearButtonKeypress,
197
198
  size: "x-small"
@@ -204,10 +205,10 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
204
205
  onPress: onPressCalendar,
205
206
  children: jsx(Calendar, {
206
207
  "aria-label": openCalendarDropdownAriaLabel,
207
- color: Gray65,
208
- height: Size4,
209
- width: Size4
210
- })
208
+ color: bpGray65,
209
+ height: bpSize040,
210
+ width: bpSize040
211
+ })
211
212
  })]
212
213
  })
213
214
  }), jsx(RadixPopover.Portal, {
@@ -1,6 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
2
3
  import { forwardRef } from 'react';
3
4
  import { BaseGridList } from '../util-components/base-grid-list-item/base-grid-list.js';
5
+ import styles from '../util-components/base-grid-list-item/base-grid-list-item.module.js';
4
6
 
5
7
  /**
6
8
  * GridListV2 is a modernized grid list component for displaying items in a grid layout.
@@ -8,11 +10,14 @@ import { BaseGridList } from '../util-components/base-grid-list-item/base-grid-l
8
10
  const GridListV2Root = /*#__PURE__*/forwardRef(function GridListV2(props, forwardedRef) {
9
11
  const {
10
12
  children,
13
+ className,
14
+ hasBorder,
11
15
  ...rest
12
16
  } = props;
13
17
  return jsx(BaseGridList, {
14
18
  ...rest,
15
19
  ref: forwardedRef,
20
+ className: clsx(hasBorder && styles.gridListV2XSmallBordered, className),
16
21
  layoutStyle: "grid-v2",
17
22
  children: children
18
23
  });
@@ -1,5 +1,5 @@
1
1
  import { type RequireAllOrNone } from 'type-fest';
2
- import { type BaseGridListActionIconButtonProps, type BaseGridListActionsProps, type BaseGridListDescriptionProps, type BaseGridListHeaderProps, type BaseGridListItemProps, type BaseGridListProps, type BaseGridListSubtitleProps, type BaseGridListThumbnailProps } from '../util-components/base-grid-list-item';
2
+ import { type BaseGridListActionIconButtonProps, type BaseGridListActionsProps, type BaseGridListDescriptionProps, type BaseGridListHeaderProps, type BaseGridListItemProps, type BaseGridListProps, type BaseGridListSubtitleProps, type BaseGridListThumbnailProps, type GridV2Variant } from '../util-components/base-grid-list-item';
3
3
  export type { GridV2Variant } from '../util-components/base-grid-list-item';
4
4
  export type GridListV2HeaderProps = BaseGridListHeaderProps;
5
5
  export type GridListV2ThumbnailProps = BaseGridListThumbnailProps;
@@ -7,5 +7,18 @@ export type GridListV2SubtitleProps = BaseGridListSubtitleProps;
7
7
  export type GridListV2DescriptionProps = BaseGridListDescriptionProps;
8
8
  export type GridListV2ActionsProps = BaseGridListActionsProps;
9
9
  export type GridListV2ActionIconButtonProps = BaseGridListActionIconButtonProps;
10
- export type GridListV2Props = Omit<BaseGridListProps, 'layoutStyle'>;
10
+ type GridListV2CommonProps = Omit<BaseGridListProps, 'layoutStyle' | 'variant' | 'hasBorder'>;
11
+ /**
12
+ * `hasBorder` is only available on the `x-small` variant. Passing it with any other
13
+ * variant (including the default) is a type error. A dynamically-typed `GridV2Variant`
14
+ * without `hasBorder` is always accepted. Boolean variables are supported:
15
+ * `hasBorder={someBoolean}` type-checks when `variant="x-small"`.
16
+ */
17
+ export type GridListV2Props = (GridListV2CommonProps & {
18
+ variant: 'x-small';
19
+ hasBorder?: boolean;
20
+ }) | (GridListV2CommonProps & {
21
+ variant?: GridV2Variant;
22
+ hasBorder?: never;
23
+ });
11
24
  export type GridListV2ItemProps = RequireAllOrNone<BaseGridListItemProps, 'pinned' | 'pinAriaLabel'>;