@atlaskit/flag 14.7.0 → 14.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/flag
2
2
 
3
+ ## 14.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9de88fa1e1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9de88fa1e1e) - Internal changes to include spacing tokens in component implementations.
8
+
9
+ ## 14.7.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
14
+
3
15
  ## 14.7.0
4
16
 
5
17
  ### Minor Changes
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/auto-dismiss-flag.js",
5
5
  "module:es2019": "../dist/es2019/auto-dismiss-flag.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/auto-dismiss-flag.d.ts"
7
+ "types": "../dist/types/auto-dismiss-flag.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/auto-dismiss-flag.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/constants.js",
5
5
  "module:es2019": "../dist/es2019/constants.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/constants.d.ts"
7
+ "types": "../dist/types/constants.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/constants.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -26,7 +26,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
26
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
27
 
28
28
  var packageName = "@atlaskit/flag";
29
- var packageVersion = "14.7.0";
29
+ var packageVersion = "14.7.2";
30
30
  var AUTO_DISMISS_SECONDS = 8;
31
31
  /**
32
32
  * __Auto dismiss flag__
package/dist/cjs/flag.js CHANGED
@@ -44,7 +44,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
44
44
  var analyticsAttributes = {
45
45
  componentName: 'flag',
46
46
  packageName: "@atlaskit/flag",
47
- packageVersion: "14.7.0"
47
+ packageVersion: "14.7.2"
48
48
  };
49
49
  var gridSize = (0, _constants.gridSize)();
50
50
  var doubleGridSize = gridSize * 2;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.7.0",
3
+ "version": "14.7.2",
4
4
  "sideEffects": false
5
5
  }
@@ -5,7 +5,7 @@ import noop from '@atlaskit/ds-lib/noop';
5
5
  import Flag from './flag';
6
6
  import { useFlagGroup } from './flag-group';
7
7
  const packageName = "@atlaskit/flag";
8
- const packageVersion = "14.7.0";
8
+ const packageVersion = "14.7.2";
9
9
  export const AUTO_DISMISS_SECONDS = 8;
10
10
  /**
11
11
  * __Auto dismiss flag__
@@ -16,7 +16,7 @@ import { Title, Description, Expander, DismissButton } from './internal';
16
16
  const analyticsAttributes = {
17
17
  componentName: 'flag',
18
18
  packageName: "@atlaskit/flag",
19
- packageVersion: "14.7.0"
19
+ packageVersion: "14.7.2"
20
20
  };
21
21
  const gridSize = getGridSize();
22
22
  const doubleGridSize = gridSize * 2;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.7.0",
3
+ "version": "14.7.2",
4
4
  "sideEffects": false
5
5
  }
@@ -5,7 +5,7 @@ import noop from '@atlaskit/ds-lib/noop';
5
5
  import Flag from './flag';
6
6
  import { useFlagGroup } from './flag-group';
7
7
  var packageName = "@atlaskit/flag";
8
- var packageVersion = "14.7.0";
8
+ var packageVersion = "14.7.2";
9
9
  export var AUTO_DISMISS_SECONDS = 8;
10
10
  /**
11
11
  * __Auto dismiss flag__
package/dist/esm/flag.js CHANGED
@@ -22,7 +22,7 @@ import { Title, Description, Expander, DismissButton } from './internal';
22
22
  var analyticsAttributes = {
23
23
  componentName: 'flag',
24
24
  packageName: "@atlaskit/flag",
25
- packageVersion: "14.7.0"
25
+ packageVersion: "14.7.2"
26
26
  };
27
27
  var gridSize = getGridSize();
28
28
  var doubleGridSize = gridSize * 2;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.7.0",
3
+ "version": "14.7.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { AutoDismissFlagProps } from './types';
3
+ export declare const AUTO_DISMISS_SECONDS = 8;
4
+ /**
5
+ * __Auto dismiss flag__
6
+ *
7
+ * An auto dismiss flag is dismissed automatically after eight seconds.
8
+ *
9
+ * - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
10
+ * - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
11
+ */
12
+ declare const AutoDismissFlag: (props: AutoDismissFlagProps) => JSX.Element;
13
+ export default AutoDismissFlag;
@@ -0,0 +1,2 @@
1
+ import { AppearanceTypes } from './types';
2
+ export declare const DEFAULT_APPEARANCE: AppearanceTypes;
@@ -0,0 +1,15 @@
1
+ /** @jsx jsx */
2
+ import type { ComponentType } from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import type { CustomThemeButtonProps } from '@atlaskit/button/types';
5
+ import type { ThemeModes } from '@atlaskit/theme/types';
6
+ import type { ActionsType, AppearanceTypes } from './types';
7
+ declare type FlagActionsProps = {
8
+ appearance: AppearanceTypes;
9
+ actions: ActionsType;
10
+ linkComponent?: ComponentType<CustomThemeButtonProps>;
11
+ mode: ThemeModes;
12
+ testId?: string;
13
+ };
14
+ declare const FlagActions: (props: FlagActionsProps) => jsx.JSX.Element | null;
15
+ export default FlagActions;
@@ -0,0 +1,45 @@
1
+ /** @jsx jsx */
2
+ import { ReactElement } from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
5
+ declare type FlagGroupProps = {
6
+ /**
7
+ * ID attribute used for DOM selection.
8
+ */
9
+ id?: string;
10
+ /**
11
+ * Describes the specific role of this FlagGroup for users viewing the page with a screen reader (defaults to `Flag notifications`).
12
+ */
13
+ label?: string;
14
+ /**
15
+ * Describes the specific tag on which the screen reader text will be rendered (defaults to `h2`).
16
+ */
17
+ labelTag?: React.ElementType;
18
+ /**
19
+ * Flag elements to be displayed.
20
+ */
21
+ children?: Array<ReactElement> | ReactElement | null | boolean;
22
+ /**
23
+ * Handler which will be called when a Flag's dismiss button is clicked.
24
+ * Receives the id of the dismissed Flag as a parameter.
25
+ */
26
+ onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
27
+ };
28
+ export declare const flagWidth: number;
29
+ export declare const flagAnimationTime = 400;
30
+ declare type FlagGroupAPI = {
31
+ onDismissed: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
32
+ isDismissAllowed: boolean;
33
+ };
34
+ export declare const FlagGroupContext: import("react").Context<FlagGroupAPI>;
35
+ export declare function useFlagGroup(): FlagGroupAPI;
36
+ /**
37
+ * __Flag group__
38
+ *
39
+ * A flag group is used to group a set of related flags, with entry and exit animations.
40
+ *
41
+ * - [Examples](https://atlassian.design/components/flag/flag-group/examples)
42
+ * - [Code](https://atlassian.design/components/flag/flag-group/code)
43
+ */
44
+ declare const FlagGroup: (props: FlagGroupProps) => jsx.JSX.Element;
45
+ export default FlagGroup;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { FlagPropsWithoutId } from './types';
3
+ declare type FlagId = string | number;
4
+ export declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
5
+ export interface CreateFlagArgs extends FlagPropsWithoutId {
6
+ /**
7
+ * A unique identifier used for rendering and onDismissed callbacks.
8
+ * This will be autogenerated if you don’t supply one.
9
+ * If you don’t want the same flag showing multiple times, provide a unique id.
10
+ */
11
+ id?: FlagId;
12
+ /**
13
+ * Marks whether the flag should render as an AutoDismissFlag
14
+ */
15
+ isAutoDismiss?: boolean;
16
+ }
17
+ export declare type FlagArgs = Combine<CreateFlagArgs, {
18
+ id: FlagId;
19
+ }>;
20
+ export declare type DismissFn = () => void;
21
+ export declare type FlagAPI = {
22
+ showFlag: (args: CreateFlagArgs) => DismissFn;
23
+ };
24
+ /**
25
+ * useFlags is used to access the `showFlags` function which can be used to programatically display flags.
26
+ * - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
27
+ */
28
+ export declare function useFlags(): FlagAPI;
29
+ export declare function FlagsProvider({ children }: {
30
+ children: React.ReactNode;
31
+ }): JSX.Element;
32
+ export declare const withFlagsProvider: (fn: () => React.ReactNode) => React.ReactNode;
33
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx } from '@emotion/react';
2
+ import type { FlagProps } from './types';
3
+ /**
4
+ * __Flag__
5
+ *
6
+ * A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
7
+ * often displayed using a flag group.
8
+ *
9
+ * - [Examples](https://atlassian.design/components/flag/examples)
10
+ * - [Code](https://atlassian.design/components/flag/code)
11
+ * - [Usage](https://atlassian.design/components/flag/usage)
12
+ */
13
+ declare const Flag: (props: FlagProps) => jsx.JSX.Element;
14
+ export default Flag;
@@ -0,0 +1,6 @@
1
+ export { default } from './flag';
2
+ export { default as AutoDismissFlag } from './auto-dismiss-flag';
3
+ export { default as FlagGroup } from './flag-group';
4
+ export { useFlags, withFlagsProvider, FlagsProvider } from './flag-provider';
5
+ export type { CreateFlagArgs, DismissFn, FlagAPI, FlagArgs, } from './flag-provider';
6
+ export type { FlagProps, ActionsType, AppearanceTypes } from './types';
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ interface DescriptionProps {
3
+ testId?: string;
4
+ color: string;
5
+ isBold: boolean;
6
+ }
7
+ declare const Description: FC<DescriptionProps>;
8
+ export default Description;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { jsx } from '@emotion/react';
3
+ import { AppearanceTypes } from '../types';
4
+ interface DismissButtonProps {
5
+ appearance: AppearanceTypes;
6
+ onClick: (...args: any) => void;
7
+ isExpanded: boolean;
8
+ isBold: boolean;
9
+ testId?: string;
10
+ }
11
+ declare const _default: import("react").MemoExoticComponent<({ appearance, onClick, isBold, isExpanded, testId, }: DismissButtonProps) => jsx.JSX.Element>;
12
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ declare type ExpanderProps = {
4
+ isExpanded: boolean;
5
+ testId?: string;
6
+ };
7
+ declare const Expander: FC<ExpanderProps>;
8
+ export default Expander;
@@ -0,0 +1,4 @@
1
+ export { default as Title } from './title';
2
+ export { default as Description } from './description';
3
+ export { default as Expander } from './expander';
4
+ export { default as DismissButton } from './dismiss-button';
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface TitleProps {
3
+ color: string;
4
+ }
5
+ declare const Title: FC<TitleProps>;
6
+ export default Title;
@@ -0,0 +1,10 @@
1
+ import { ThemeModes } from '@atlaskit/theme/types';
2
+ import { AppearanceTypes } from './types';
3
+ export declare const getFlagBackgroundColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
4
+ export declare const flagBorderColor = "rgba(9, 30, 66, 0.31)";
5
+ export declare const flagShadowColor = "rgba(9, 30, 66, 0.25)";
6
+ export declare const getFlagTextColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
7
+ export declare const getFlagIconColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
8
+ export declare const getFlagFocusRingColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
9
+ export declare const getActionBackground: (appearance: AppearanceTypes, mode: ThemeModes) => string;
10
+ export declare const getActionColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
@@ -0,0 +1,101 @@
1
+ import { ComponentType, MouseEventHandler, ReactNode } from 'react';
2
+ import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { CustomThemeButtonProps } from '@atlaskit/button/types';
4
+ export declare type ActionType = {
5
+ content: ReactNode;
6
+ onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
7
+ href?: string;
8
+ target?: string;
9
+ testId?: string;
10
+ };
11
+ export declare type ActionsType = Array<ActionType>;
12
+ export declare type AppearanceTypes = 'error' | 'info' | 'normal' | 'success' | 'warning';
13
+ export declare const AppearanceArray: AppearanceTypes[];
14
+ declare type FlagPropsId = {
15
+ /**
16
+ * A unique identifier used for rendering and onDismissed callbacks.
17
+ */
18
+ id: number | string;
19
+ };
20
+ declare type AutoDismissFlagPropsWithoutId = {
21
+ /**
22
+ * Array of clickable actions to be shown at the bottom of the flag. For flags where appearance
23
+ * is 'normal', actions will be shown as links. For all other appearance values, actions will
24
+ * shown as buttons.
25
+ * If href is passed the action will be shown as a link with the passed href prop.
26
+ */
27
+ actions?: ActionsType;
28
+ /**
29
+ * Makes the flag appearance bold. Setting this to anything other than 'normal' hides the
30
+ * dismiss button.
31
+ */
32
+ appearance?: AppearanceTypes;
33
+ /**
34
+ * The secondary content shown below the flag title
35
+ */
36
+ description?: ReactNode;
37
+ /**
38
+ * The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
39
+ * Your icon will receive the appropriate default color, which you can override by wrapping the
40
+ * icon in a containing element with CSS `color` set to your preferred icon color.
41
+ */
42
+ icon: ReactNode;
43
+ /**
44
+ * The bold text shown at the top of the flag.
45
+ */
46
+ title: ReactNode;
47
+ /**
48
+ * Handler which will be called when a Flag's dismiss button is clicked.
49
+ * Receives the id of the dismissed Flag as a parameter.
50
+ */
51
+ onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
52
+ /**
53
+ * A link component that is passed down to the `@atlaskit/button` used by actions,
54
+ * to allow custom routers to be used. See the
55
+ * [button with router](https://atlaskit.atlassian.com/packages/design-system/button/example/ButtonWithRouter)
56
+ * example of what this component should look like.
57
+ */
58
+ linkComponent?: ComponentType<CustomThemeButtonProps>;
59
+ /**
60
+ * A `testId` prop is provided for specified elements,
61
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
62
+ * serving as a hook for automated tests.
63
+ *
64
+ * Will set these elements when defined:
65
+ *
66
+ * - Flag root element - `{testId}`
67
+ * - Close button visible on default flags - `{testId}-dismiss`
68
+ * - Toggle button visible on bold flags - `{testId}-toggle`
69
+ * - Flag content which wraps the description and actions - `{testId}-expander`
70
+ * - Flag description - `{testId}-description`
71
+ * - Flag actions - `{testId}-actions`
72
+ */
73
+ testId?: string;
74
+ /**
75
+ * Additional information to be included in the `context` of analytics events that come from flag
76
+ */
77
+ analyticsContext?: Record<string, any>;
78
+ };
79
+ export interface AutoDismissFlagProps extends AutoDismissFlagPropsWithoutId, FlagPropsId {
80
+ }
81
+ export interface FlagPropsWithoutId extends AutoDismissFlagPropsWithoutId, WithAnalyticsEventsProps {
82
+ /**
83
+ * Standard onBlur event, applied to Flag by AutoDismissFlag
84
+ */
85
+ onBlur?: (e: React.FocusEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
86
+ /**
87
+ * Standard onFocus event, applied to Flag by AutoDismissFlag
88
+ */
89
+ onFocus?: (e: React.FocusEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
90
+ /**
91
+ * Standard onMouseOut event, applied to Flag by AutoDismissFlag
92
+ */
93
+ onMouseOut?: MouseEventHandler;
94
+ /**
95
+ * Standard onMouseOver event, applied to Flag by AutoDismissFlag
96
+ */
97
+ onMouseOver?: MouseEventHandler;
98
+ }
99
+ export interface FlagProps extends FlagPropsWithoutId, FlagPropsId {
100
+ }
101
+ export {};
package/flag/package.json CHANGED
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/flag.js",
5
5
  "module:es2019": "../dist/es2019/flag.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/flag.d.ts"
7
+ "types": "../dist/types/flag.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/flag.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/flag-actions.js",
5
5
  "module:es2019": "../dist/es2019/flag-actions.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/flag-actions.d.ts"
7
+ "types": "../dist/types/flag-actions.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/flag-actions.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/flag-group.js",
5
5
  "module:es2019": "../dist/es2019/flag-group.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/flag-group.d.ts"
7
+ "types": "../dist/types/flag-group.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/flag-group.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/flag-provider.js",
5
5
  "module:es2019": "../dist/es2019/flag-provider.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/flag-provider.d.ts"
7
+ "types": "../dist/types/flag-provider.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/flag-provider.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.7.0",
3
+ "version": "14.7.2",
4
4
  "description": "A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,9 +12,18 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*",
19
+ "dist/types-ts4.0/index.d.ts"
20
+ ]
21
+ }
22
+ },
15
23
  "sideEffects": false,
16
24
  "atlaskit:src": "src/index.tsx",
17
25
  "atlassian": {
26
+ "disableProductCI": true,
18
27
  "team": "Design System Team",
19
28
  "releaseModel": "scheduled",
20
29
  "website": {
@@ -37,8 +46,8 @@
37
46
  "@atlaskit/analytics-next": "^8.0.0",
38
47
  "@atlaskit/button": "^16.3.0",
39
48
  "@atlaskit/ds-lib": "^2.1.0",
40
- "@atlaskit/focus-ring": "^1.0.0",
41
- "@atlaskit/icon": "^21.10.0",
49
+ "@atlaskit/focus-ring": "^1.1.0",
50
+ "@atlaskit/icon": "^21.11.0",
42
51
  "@atlaskit/motion": "^1.2.0",
43
52
  "@atlaskit/portal": "^4.0.0",
44
53
  "@atlaskit/theme": "^12.2.0",
@@ -53,7 +62,7 @@
53
62
  "devDependencies": {
54
63
  "@atlaskit/docs": "*",
55
64
  "@atlaskit/radio": "^5.4.0",
56
- "@atlaskit/section-message": "^6.2.0",
65
+ "@atlaskit/section-message": "^6.3.0",
57
66
  "@atlaskit/spinner": "^15.0.0",
58
67
  "@atlaskit/ssr": "*",
59
68
  "@atlaskit/theme": "^12.2.0",
@@ -61,10 +70,11 @@
61
70
  "@atlaskit/webdriver-runner": "*",
62
71
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
63
72
  "@emotion/jest": "^11.8.0",
64
- "@testing-library/react": "^8.0.1",
73
+ "@testing-library/react": "^12.1.5",
74
+ "jest-emotion": "^10.0.32",
65
75
  "react-dom": "^16.8.0",
66
76
  "storybook-addon-performance": "^0.16.0",
67
- "typescript": "4.3.5"
77
+ "typescript": "4.5.5"
68
78
  },
69
79
  "keywords": [
70
80
  "atlaskit",
@@ -75,6 +85,7 @@
75
85
  "@repo/internal": {
76
86
  "dom-events": "use-bind-event-listener",
77
87
  "design-system": "v1",
88
+ "design-tokens": "spacing",
78
89
  "ui-components": [
79
90
  "lite-mode"
80
91
  ],
package/report.api.md CHANGED
@@ -1,12 +1,15 @@
1
- ## API Report File for "@atlaskit/flag"
1
+ ## API Report File for "@atlaskit/flag".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
4
6
 
5
7
  ```ts
6
8
  /// <reference types="react" />
7
9
 
8
10
  import { ComponentType } from 'react';
9
11
  import { CustomThemeButtonProps } from '@atlaskit/button/types';
12
+ import { jsx } from '@emotion/react';
10
13
  import { MouseEventHandler } from 'react';
11
14
  import { default as React_2 } from 'react';
12
15
  import { ReactElement } from 'react';
@@ -34,6 +37,14 @@ export declare type AppearanceTypes =
34
37
  | 'success'
35
38
  | 'warning';
36
39
 
40
+ /**
41
+ * __Auto dismiss flag__
42
+ *
43
+ * An auto dismiss flag is dismissed automatically after eight seconds.
44
+ *
45
+ * - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
46
+ * - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
47
+ */
37
48
  export declare const AutoDismissFlag: (
38
49
  props: AutoDismissFlagProps,
39
50
  ) => JSX.Element;
@@ -43,68 +54,93 @@ declare interface AutoDismissFlagProps
43
54
  FlagPropsId {}
44
55
 
45
56
  declare type AutoDismissFlagPropsWithoutId = {
46
- /** Array of clickable actions to be shown at the bottom of the flag. For flags where appearance
57
+ /**
58
+ * Array of clickable actions to be shown at the bottom of the flag. For flags where appearance
47
59
  * is 'normal', actions will be shown as links. For all other appearance values, actions will
48
60
  * shown as buttons.
49
61
  * If href is passed the action will be shown as a link with the passed href prop.
50
62
  */
51
63
  actions?: ActionsType;
52
- /** Makes the flag appearance bold. Setting this to anything other than 'normal' hides the
64
+ /**
65
+ * Makes the flag appearance bold. Setting this to anything other than 'normal' hides the
53
66
  * dismiss button.
54
67
  */
55
68
  appearance?: AppearanceTypes;
56
- /** The secondary content shown below the flag title */
69
+ /**
70
+ * The secondary content shown below the flag title
71
+ */
57
72
  description?: ReactNode;
58
- /** The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
73
+ /**
74
+ * The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
59
75
  * Your icon will receive the appropriate default color, which you can override by wrapping the
60
76
  * icon in a containing element with CSS `color` set to your preferred icon color.
61
77
  */
62
78
  icon: ReactNode;
63
- /** The bold text shown at the top of the flag. */
79
+ /**
80
+ * The bold text shown at the top of the flag.
81
+ */
64
82
  title: ReactNode;
65
- /** Handler which will be called when a Flag's dismiss button is clicked.
83
+ /**
84
+ * Handler which will be called when a Flag's dismiss button is clicked.
66
85
  * Receives the id of the dismissed Flag as a parameter.
67
86
  */
68
87
  onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
69
- /** A link component that is passed down to the `@atlaskit/button` used by actions,
70
- to allow custom routers to be used. See the
71
- [button with router](https://atlaskit.atlassian.com/packages/design-system/button/example/ButtonWithRouter)
72
- example of what this component should look like. */
88
+ /**
89
+ * A link component that is passed down to the `@atlaskit/button` used by actions,
90
+ * to allow custom routers to be used. See the
91
+ * [button with router](https://atlaskit.atlassian.com/packages/design-system/button/example/ButtonWithRouter)
92
+ * example of what this component should look like.
93
+ */
73
94
  linkComponent?: ComponentType<CustomThemeButtonProps>;
74
95
  /**
75
- * A `testId` prop is provided for specified elements,
76
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
77
- * serving as a hook for automated tests.
78
-
79
- * Will set these elements when defined:
80
-
81
- * - Flag root element - `{testId}`
82
- * - Close button visible on default flags - `{testId}-dismiss`
83
- * - Toggle button visible on bold flags - `{testId}-toggle`
84
- * - Flag content which wraps the description and actions - `{testId}-expander`
85
- * - Flag description - `{testId}-description`
86
- * - Flag actions - `{testId}-actions`
87
- */
96
+ * A `testId` prop is provided for specified elements,
97
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
98
+ * serving as a hook for automated tests.
99
+ *
100
+ * Will set these elements when defined:
101
+ *
102
+ * - Flag root element - `{testId}`
103
+ * - Close button visible on default flags - `{testId}-dismiss`
104
+ * - Toggle button visible on bold flags - `{testId}-toggle`
105
+ * - Flag content which wraps the description and actions - `{testId}-expander`
106
+ * - Flag description - `{testId}-description`
107
+ * - Flag actions - `{testId}-actions`
108
+ */
88
109
  testId?: string;
89
- /** Additional information to be included in the `context` of analytics events that come from flag */
110
+ /**
111
+ * Additional information to be included in the `context` of analytics events that come from flag
112
+ */
90
113
  analyticsContext?: Record<string, any>;
91
114
  };
92
115
 
93
116
  declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
94
117
 
95
118
  export declare interface CreateFlagArgs extends FlagPropsWithoutId {
96
- /** A unique identifier used for rendering and onDismissed callbacks.
119
+ /**
120
+ * A unique identifier used for rendering and onDismissed callbacks.
97
121
  * This will be autogenerated if you don’t supply one.
98
122
  * If you don’t want the same flag showing multiple times, provide a unique id.
99
123
  */
100
124
  id?: FlagId;
101
- /** Marks whether the flag should render as an AutoDismissFlag */
125
+ /**
126
+ * Marks whether the flag should render as an AutoDismissFlag
127
+ */
102
128
  isAutoDismiss?: boolean;
103
129
  }
104
130
 
105
131
  export declare type DismissFn = () => void;
106
132
 
107
- declare const Flag: (props: FlagProps) => JSX.Element;
133
+ /**
134
+ * __Flag__
135
+ *
136
+ * A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
137
+ * often displayed using a flag group.
138
+ *
139
+ * - [Examples](https://atlassian.design/components/flag/examples)
140
+ * - [Code](https://atlassian.design/components/flag/code)
141
+ * - [Usage](https://atlassian.design/components/flag/usage)
142
+ */
143
+ declare const Flag: (props: FlagProps) => jsx.JSX.Element;
108
144
  export default Flag;
109
145
 
110
146
  export declare type FlagAPI = {
@@ -118,18 +154,35 @@ export declare type FlagArgs = Combine<
118
154
  }
119
155
  >;
120
156
 
121
- export declare const FlagGroup: (props: FlagGroupProps) => JSX.Element;
157
+ /**
158
+ * __Flag group__
159
+ *
160
+ * A flag group is used to group a set of related flags, with entry and exit animations.
161
+ *
162
+ * - [Examples](https://atlassian.design/components/flag/flag-group/examples)
163
+ * - [Code](https://atlassian.design/components/flag/flag-group/code)
164
+ */
165
+ export declare const FlagGroup: (props: FlagGroupProps) => jsx.JSX.Element;
122
166
 
123
167
  declare type FlagGroupProps = {
124
- /** ID attribute used for DOM selection. */
168
+ /**
169
+ * ID attribute used for DOM selection.
170
+ */
125
171
  id?: string;
126
- /** Describes the specific role of this FlagGroup for users viewing the page with a screen reader (defaults to `Flag notifications`). */
172
+ /**
173
+ * Describes the specific role of this FlagGroup for users viewing the page with a screen reader (defaults to `Flag notifications`).
174
+ */
127
175
  label?: string;
128
- /** Describes the specific tag on which the screen reader text will be rendered (defaults to `h2`). */
176
+ /**
177
+ * Describes the specific tag on which the screen reader text will be rendered (defaults to `h2`).
178
+ */
129
179
  labelTag?: React.ElementType;
130
- /** Flag elements to be displayed. */
180
+ /**
181
+ * Flag elements to be displayed.
182
+ */
131
183
  children?: Array<ReactElement> | ReactElement | null | boolean;
132
- /** Handler which will be called when a Flag's dismiss button is clicked.
184
+ /**
185
+ * Handler which will be called when a Flag's dismiss button is clicked.
133
186
  * Receives the id of the dismissed Flag as a parameter.
134
187
  */
135
188
  onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
@@ -140,26 +193,36 @@ declare type FlagId = string | number;
140
193
  export declare interface FlagProps extends FlagPropsWithoutId, FlagPropsId {}
141
194
 
142
195
  declare type FlagPropsId = {
143
- /** A unique identifier used for rendering and onDismissed callbacks. */
196
+ /**
197
+ * A unique identifier used for rendering and onDismissed callbacks.
198
+ */
144
199
  id: number | string;
145
200
  };
146
201
 
147
202
  declare interface FlagPropsWithoutId
148
203
  extends AutoDismissFlagPropsWithoutId,
149
204
  WithAnalyticsEventsProps {
150
- /** Standard onBlur event, applied to Flag by AutoDismissFlag */
205
+ /**
206
+ * Standard onBlur event, applied to Flag by AutoDismissFlag
207
+ */
151
208
  onBlur?: (
152
209
  e: React.FocusEvent<HTMLElement>,
153
210
  analyticsEvent: UIAnalyticsEvent,
154
211
  ) => void;
155
- /** Standard onFocus event, applied to Flag by AutoDismissFlag */
212
+ /**
213
+ * Standard onFocus event, applied to Flag by AutoDismissFlag
214
+ */
156
215
  onFocus?: (
157
216
  e: React.FocusEvent<HTMLElement>,
158
217
  analyticsEvent: UIAnalyticsEvent,
159
218
  ) => void;
160
- /** Standard onMouseOut event, applied to Flag by AutoDismissFlag */
219
+ /**
220
+ * Standard onMouseOut event, applied to Flag by AutoDismissFlag
221
+ */
161
222
  onMouseOut?: MouseEventHandler;
162
- /** Standard onMouseOver event, applied to Flag by AutoDismissFlag */
223
+ /**
224
+ * Standard onMouseOver event, applied to Flag by AutoDismissFlag
225
+ */
163
226
  onMouseOver?: MouseEventHandler;
164
227
  }
165
228
 
@@ -169,6 +232,10 @@ export declare function FlagsProvider({
169
232
  children: React_2.ReactNode;
170
233
  }): JSX.Element;
171
234
 
235
+ /**
236
+ * useFlags is used to access the `showFlags` function which can be used to programatically display flags.
237
+ * - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
238
+ */
172
239
  export declare function useFlags(): FlagAPI;
173
240
 
174
241
  export declare const withFlagsProvider: (
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/theme.js",
5
5
  "module:es2019": "../dist/es2019/theme.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/theme.d.ts"
7
+ "types": "../dist/types/theme.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/theme.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts"
7
+ "types": "../dist/types/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }