@carbon-labs/react-ui-shell 0.80.0 → 0.82.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.
@@ -9,7 +9,7 @@ import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useRef, useState, useContext } from 'react';
12
- import { Popover, ToggletipContent, ToggletipActions, IconButton } from '@carbon/react';
12
+ import { Popover, IconButton, ToggletipContent, ToggletipActions } from '@carbon/react';
13
13
  import { Escape } from '../internal/keyboard/keys.js';
14
14
  import { match } from '../internal/keyboard/match.js';
15
15
  import { useWindowEvent } from '../internal/useEvent.js';
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React, { type ElementType, type Ref } from 'react';
8
+ import { type ElementType, type WeakValidationMap, type Ref } from 'react';
9
9
  import { type PolymorphicProps } from '../types/common';
10
10
  type LinkBaseProps<E extends ElementType> = {
11
11
  /**
@@ -21,9 +21,9 @@ export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps
21
21
  * in their own components to support use-cases like `react-router` or
22
22
  * `@reach/router`
23
23
  */
24
- declare const Link: (<E extends React.ElementType = "a">(props: LinkProps<E>) => JSX.Element) & {
25
- displayName?: string | undefined;
26
- propTypes?: React.WeakValidationMap<LinkProps<any>> | undefined;
24
+ declare const Link: (<E extends ElementType = "a">(props: LinkProps<E>) => JSX.Element) & {
25
+ displayName?: string;
26
+ propTypes?: WeakValidationMap<LinkProps<any>>;
27
27
  };
28
28
  declare const LinkPropTypes: {
29
29
  /**
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { ChevronRight, ChevronDown, ArrowLeft } from '@carbon/icons-react';
8
+ import { ArrowLeft, ChevronRight, ChevronDown } from '@carbon/icons-react';
9
9
  import { SideNavIcon, Layer, Button } from '@carbon/react';
10
10
  import { breakpoints } from '../node_modules/@carbon/layout/es/index.js';
11
11
  import cx from 'classnames';
@@ -27,5 +27,5 @@ export type GlobalEventCallback<E extends keyof GlobalEventHandlersEventMap> = (
27
27
  /**
28
28
  * <T>
29
29
  */
30
- export type MutableRefObject<T> = import('react').MutableRefObject<T>;
30
+ export type MutableRefObject<T> = import("react").MutableRefObject<T>;
31
31
  export type WindowEventCallback<E extends keyof WindowEventMap> = (event: WindowEventMap[E]) => void;
@@ -4,7 +4,7 @@
4
4
  * @param {string} [prefix] the optional prefix id
5
5
  * @returns {string}
6
6
  */
7
- export function useCompatibleId(prefix?: string | undefined): string;
7
+ export function useCompatibleId(prefix?: string): string;
8
8
  /**
9
9
  * Generate a unique id if a given `id` is not provided
10
10
  * This is an internal utility, not intended for public usage.
@@ -18,4 +18,4 @@ export function useFallbackId(id: string | undefined): string;
18
18
  * @param {string} [prefix] the optional prefix id
19
19
  * @returns {string}
20
20
  */
21
- export function useId(prefix?: string | undefined): string;
21
+ export function useId(prefix?: string): string;
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React__default, { useState, useEffect, useLayoutEffect } from 'react';
8
+ import React__default, { useState, useLayoutEffect, useEffect } from 'react';
9
9
  import setupGetInstanceId from './setupGetInstanceId.js';
10
10
  import { useIdPrefix } from './useIdPrefix.js';
11
11
  import { canUseDOM } from './environment.js';
@@ -21,7 +21,7 @@ const componentName = 'TooltipTrigger';
21
21
  * This is an tooltip trigger as Carbon Tooltip requires an active element to work but provides
22
22
  * no blanked button.
23
23
  */
24
- let TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
24
+ const TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
25
25
  let {
26
26
  children,
27
27
  className,
@@ -40,7 +40,6 @@ let TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
40
40
  });
41
41
 
42
42
  // Return a placeholder if not released and not enabled by feature flag.
43
- TooltipTrigger = pkg.checkComponentEnabled(TooltipTrigger, componentName);
44
43
 
45
44
  // The display name of the component, used by React. Note that displayName
46
45
  // is used in preference to relying on function.name.
@@ -13,7 +13,6 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
13
  import { pkg } from '../../settings.js';
14
14
  import { usePrefix, Tooltip } from '@carbon/react';
15
15
  import { User } from '@carbon/react/icons';
16
- import '../../global/js/utils/props-helper.js';
17
16
  import { TooltipTrigger } from '../TooltipTrigger/TooltipTrigger.js';
18
17
 
19
18
  // Carbon and package components we use.
@@ -29,7 +28,7 @@ const componentName = 'UserAvatar';
29
28
  * TODO: A description of the component.
30
29
  */
31
30
 
32
- let UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
31
+ const UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
33
32
  const {
34
33
  backgroundColor = 'order-1-cyan',
35
34
  className,
@@ -107,7 +106,6 @@ let UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
107
106
  });
108
107
 
109
108
  // Return a placeholder if not released and not enabled by feature flag
110
- UserAvatar = pkg.checkComponentEnabled(UserAvatar, componentName);
111
109
 
112
110
  // The display name of the component, used by React. Note that displayName
113
111
  // is used in preference to relying on function.name.
@@ -135,12 +133,7 @@ UserAvatar.propTypes = {
135
133
  * When passing the image prop use the imageDescription prop to describe the image for screen reader.
136
134
  */
137
135
  /**@ts-ignore */
138
- imageDescription: PropTypes.string.isRequired.if(_ref => {
139
- let {
140
- image
141
- } = _ref;
142
- return !!image;
143
- }),
136
+ imageDescription: PropTypes.string,
144
137
  /**
145
138
  * When passing the name prop, either send the initials to be used or the user's full name. The first two capital letters of the user's name will be used as the name.
146
139
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { devtoolsAttribute, getDevtoolsId } from '../package-settings.js';
8
+ import { getDevtoolsId, devtoolsAttribute } from '../package-settings.js';
9
9
 
10
10
  function getDevtoolsProps(componentName) {
11
11
  return {
@@ -29,30 +29,10 @@ function rem(px) {
29
29
  // Initial map of our breakpoints and their values
30
30
  var breakpoints = {
31
31
  sm: {
32
- width: rem(320),
33
- columns: 4,
34
- margin: '0'
35
- },
32
+ width: rem(320)},
36
33
  md: {
37
- width: rem(672),
38
- columns: 8,
39
- margin: rem(16)
40
- },
34
+ width: rem(672)},
41
35
  lg: {
42
- width: rem(1056),
43
- columns: 16,
44
- margin: rem(16)
45
- },
46
- xlg: {
47
- width: rem(1312),
48
- columns: 16,
49
- margin: rem(16)
50
- },
51
- max: {
52
- width: rem(1584),
53
- columns: 16,
54
- margin: rem(24)
55
- }
56
- };
36
+ width: rem(1056)}};
57
37
 
58
38
  export { baseFontSize, breakpoints, rem };
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React, { type ElementType, type Ref } from 'react';
8
+ import { type ElementType, type WeakValidationMap, type Ref } from 'react';
9
9
  import { type PolymorphicProps } from '../types/common';
10
10
  type LinkBaseProps<E extends ElementType> = {
11
11
  /**
@@ -21,9 +21,9 @@ export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps
21
21
  * in their own components to support use-cases like `react-router` or
22
22
  * `@reach/router`
23
23
  */
24
- declare const Link: (<E extends React.ElementType = "a">(props: LinkProps<E>) => JSX.Element) & {
25
- displayName?: string | undefined;
26
- propTypes?: React.WeakValidationMap<LinkProps<any>> | undefined;
24
+ declare const Link: (<E extends ElementType = "a">(props: LinkProps<E>) => JSX.Element) & {
25
+ displayName?: string;
26
+ propTypes?: WeakValidationMap<LinkProps<any>>;
27
27
  };
28
28
  declare const LinkPropTypes: {
29
29
  /**
@@ -27,5 +27,5 @@ export type GlobalEventCallback<E extends keyof GlobalEventHandlersEventMap> = (
27
27
  /**
28
28
  * <T>
29
29
  */
30
- export type MutableRefObject<T> = import('react').MutableRefObject<T>;
30
+ export type MutableRefObject<T> = import("react").MutableRefObject<T>;
31
31
  export type WindowEventCallback<E extends keyof WindowEventMap> = (event: WindowEventMap[E]) => void;
@@ -4,7 +4,7 @@
4
4
  * @param {string} [prefix] the optional prefix id
5
5
  * @returns {string}
6
6
  */
7
- export function useCompatibleId(prefix?: string | undefined): string;
7
+ export function useCompatibleId(prefix?: string): string;
8
8
  /**
9
9
  * Generate a unique id if a given `id` is not provided
10
10
  * This is an internal utility, not intended for public usage.
@@ -18,4 +18,4 @@ export function useFallbackId(id: string | undefined): string;
18
18
  * @param {string} [prefix] the optional prefix id
19
19
  * @returns {string}
20
20
  */
21
- export function useId(prefix?: string | undefined): string;
21
+ export function useId(prefix?: string): string;
@@ -23,7 +23,7 @@ const componentName = 'TooltipTrigger';
23
23
  * This is an tooltip trigger as Carbon Tooltip requires an active element to work but provides
24
24
  * no blanked button.
25
25
  */
26
- exports.TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
26
+ const TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
27
27
  let {
28
28
  children,
29
29
  className,
@@ -42,16 +42,15 @@ exports.TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
42
42
  });
43
43
 
44
44
  // Return a placeholder if not released and not enabled by feature flag.
45
- exports.TooltipTrigger = settings.pkg.checkComponentEnabled(exports.TooltipTrigger, componentName);
46
45
 
47
46
  // The display name of the component, used by React. Note that displayName
48
47
  // is used in preference to relying on function.name.
49
- exports.TooltipTrigger.displayName = componentName;
48
+ TooltipTrigger.displayName = componentName;
50
49
 
51
50
  // The types and DocGen commentary for the component props,
52
51
  // in alphabetical order (for consistency).
53
52
  // See https://www.npmjs.com/package/prop-types#usage.
54
- exports.TooltipTrigger.propTypes = {
53
+ TooltipTrigger.propTypes = {
55
54
  /**
56
55
  * Child content of tooltip trigger
57
56
  */
@@ -61,3 +60,5 @@ exports.TooltipTrigger.propTypes = {
61
60
  */
62
61
  className: index.default.string
63
62
  };
63
+
64
+ exports.TooltipTrigger = TooltipTrigger;
@@ -15,7 +15,6 @@ var devtools = require('../../global/js/utils/devtools.js');
15
15
  var settings = require('../../settings.js');
16
16
  var react = require('@carbon/react');
17
17
  var icons = require('@carbon/react/icons');
18
- require('../../global/js/utils/props-helper.js');
19
18
  var TooltipTrigger = require('../TooltipTrigger/TooltipTrigger.js');
20
19
 
21
20
  // Carbon and package components we use.
@@ -31,7 +30,7 @@ const componentName = 'UserAvatar';
31
30
  * TODO: A description of the component.
32
31
  */
33
32
 
34
- exports.UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
33
+ const UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
35
34
  const {
36
35
  backgroundColor = 'order-1-cyan',
37
36
  className,
@@ -109,16 +108,15 @@ exports.UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
109
108
  });
110
109
 
111
110
  // Return a placeholder if not released and not enabled by feature flag
112
- exports.UserAvatar = settings.pkg.checkComponentEnabled(exports.UserAvatar, componentName);
113
111
 
114
112
  // The display name of the component, used by React. Note that displayName
115
113
  // is used in preference to relying on function.name.
116
- exports.UserAvatar.displayName = componentName;
114
+ UserAvatar.displayName = componentName;
117
115
 
118
116
  // The types and DocGen commentary for the component props,
119
117
  // in alphabetical order (for consistency).
120
118
  // See https://www.npmjs.com/package/prop-types#usage.
121
- exports.UserAvatar.propTypes = {
119
+ UserAvatar.propTypes = {
122
120
  /**
123
121
  * Provide the background color need to be set for UserAvatar. Background color will be set based on lighter or darker theme.
124
122
  * For example: if you select order-5-purple, it will take $purple-60 for lighter theme and $purple-50 for darker theme.
@@ -137,12 +135,7 @@ exports.UserAvatar.propTypes = {
137
135
  * When passing the image prop use the imageDescription prop to describe the image for screen reader.
138
136
  */
139
137
  /**@ts-ignore */
140
- imageDescription: index.default.string.isRequired.if(_ref => {
141
- let {
142
- image
143
- } = _ref;
144
- return !!image;
145
- }),
138
+ imageDescription: index.default.string,
146
139
  /**
147
140
  * When passing the name prop, either send the initials to be used or the user's full name. The first two capital letters of the user's name will be used as the name.
148
141
  */
@@ -166,3 +159,5 @@ exports.UserAvatar.propTypes = {
166
159
  tooltipText: index.default.string
167
160
  /* TODO: add types and DocGen for all props. */
168
161
  };
162
+
163
+ exports.UserAvatar = UserAvatar;
@@ -31,31 +31,11 @@ function rem(px) {
31
31
  // Initial map of our breakpoints and their values
32
32
  var breakpoints = {
33
33
  sm: {
34
- width: rem(320),
35
- columns: 4,
36
- margin: '0'
37
- },
34
+ width: rem(320)},
38
35
  md: {
39
- width: rem(672),
40
- columns: 8,
41
- margin: rem(16)
42
- },
36
+ width: rem(672)},
43
37
  lg: {
44
- width: rem(1056),
45
- columns: 16,
46
- margin: rem(16)
47
- },
48
- xlg: {
49
- width: rem(1312),
50
- columns: 16,
51
- margin: rem(16)
52
- },
53
- max: {
54
- width: rem(1584),
55
- columns: 16,
56
- margin: rem(24)
57
- }
58
- };
38
+ width: rem(1056)}};
59
39
 
60
40
  exports.baseFontSize = baseFontSize;
61
41
  exports.breakpoints = breakpoints;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-ui-shell",
3
- "version": "0.80.0",
3
+ "version": "0.82.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@carbon-labs/utilities": "canary",
40
- "@carbon/ibm-products": "^2.72.1"
40
+ "@carbon/ibm-products": "^2.76.0"
41
41
  },
42
42
  "dependencies": {
43
43
  "@ibm/telemetry-js": "^1.10.2"
44
44
  },
45
- "gitHead": "b40ae3cdabef52e30ed4e74819325ca5c0e36877"
45
+ "gitHead": "5520cf06630215524af572ddea13596eaf8a0811"
46
46
  }
@@ -10,6 +10,7 @@
10
10
  @use '@carbon/styles/scss/motion' as *;
11
11
  @use '@carbon/react/scss/utilities/convert' as convert;
12
12
  @use '@carbon/styles/scss/utilities/custom-property' as custom-property;
13
+ @use '@carbon/styles/scss/breakpoint' as *;
13
14
 
14
15
  $prefix: 'cds' !default;
15
16
 
@@ -79,3 +80,14 @@ $prefix: 'cds' !default;
79
80
  ):hover {
80
81
  color: $text-primary;
81
82
  }
83
+
84
+ //----------------------------------------------------------------------------
85
+ // Search expanded inside Header
86
+ //----------------------------------------------------------------------------
87
+ @include breakpoint-down(lg) {
88
+ .#{$prefix}--header .#{$prefix}--search--expanded {
89
+ position: absolute;
90
+ z-index: 1;
91
+ inset-inline-start: 0;
92
+ }
93
+ }
@@ -1,46 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import 'react';
9
- import PropTypes from '../../../_virtual/index.js';
10
- import pconsole from './pconsole.js';
11
-
12
- /**
13
- * A prop-types validation function that takes a type checkers and a condition
14
- * function and invokes either the type checker or the isRequired variant of
15
- * the type checker according to whether the condition function returns false
16
- * or true when called with the full set of props. This can be useful to make
17
- * a prop conditionally required. The function also has a decorate function
18
- * which can be used to add isRequiredIf to any existing type which already has
19
- * an isRequired variant, and this is automatically applied to the simple type
20
- * checkers in PropTypes when this props-helper module is imported. The second
21
- * example produces better results with DocGen and Storybook.
22
- *
23
- * Examples:
24
- *
25
- * MyComponent1.propTypes = {
26
- * showFoo: PropTypes.bool,
27
- * fooLabel: isRequiredIf(PropTypes.string, ({ showFoo }) => showFoo),
28
- * }
29
- *
30
- * MyComponent2.propTypes = {
31
- * showBar: PropTypes.bool,
32
- * barLabel: PropTypes.string.isRequired.if(({ showBar }) => showBar),
33
- * }
34
- *
35
- */
36
- const isRequiredIf = (checker, conditionFn) => (props, propName, componentName, location, propFullName, secret) => (conditionFn(props) ? checker.isRequired : checker)(props, propName, componentName, location, propFullName, secret);
37
- isRequiredIf.decorate = checker => {
38
- checker.isRequired.if = pconsole.isProduction ? pconsole.noop : isRequiredIf.bind(null, checker);
39
- };
40
- for (const checker in PropTypes) {
41
- if (PropTypes[checker].isRequired) {
42
- isRequiredIf.decorate(PropTypes[checker]);
43
- }
44
- }
45
-
46
- export { isRequiredIf };
@@ -1,48 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2024
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- 'use strict';
9
-
10
- require('react');
11
- var index = require('../../../_virtual/index.js');
12
- var pconsole = require('./pconsole.js');
13
-
14
- /**
15
- * A prop-types validation function that takes a type checkers and a condition
16
- * function and invokes either the type checker or the isRequired variant of
17
- * the type checker according to whether the condition function returns false
18
- * or true when called with the full set of props. This can be useful to make
19
- * a prop conditionally required. The function also has a decorate function
20
- * which can be used to add isRequiredIf to any existing type which already has
21
- * an isRequired variant, and this is automatically applied to the simple type
22
- * checkers in PropTypes when this props-helper module is imported. The second
23
- * example produces better results with DocGen and Storybook.
24
- *
25
- * Examples:
26
- *
27
- * MyComponent1.propTypes = {
28
- * showFoo: PropTypes.bool,
29
- * fooLabel: isRequiredIf(PropTypes.string, ({ showFoo }) => showFoo),
30
- * }
31
- *
32
- * MyComponent2.propTypes = {
33
- * showBar: PropTypes.bool,
34
- * barLabel: PropTypes.string.isRequired.if(({ showBar }) => showBar),
35
- * }
36
- *
37
- */
38
- const isRequiredIf = (checker, conditionFn) => (props, propName, componentName, location, propFullName, secret) => (conditionFn(props) ? checker.isRequired : checker)(props, propName, componentName, location, propFullName, secret);
39
- isRequiredIf.decorate = checker => {
40
- checker.isRequired.if = pconsole.default.isProduction ? pconsole.default.noop : isRequiredIf.bind(null, checker);
41
- };
42
- for (const checker in index.default) {
43
- if (index.default[checker].isRequired) {
44
- isRequiredIf.decorate(index.default[checker]);
45
- }
46
- }
47
-
48
- exports.isRequiredIf = isRequiredIf;