@atlaskit/flag 15.2.1 → 15.2.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 +6 -0
- package/dist/cjs/auto-dismiss-flag.js +1 -1
- package/dist/cjs/flag.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/auto-dismiss-flag.js +1 -1
- package/dist/es2019/flag.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/auto-dismiss-flag.js +1 -1
- package/dist/esm/flag.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.5/auto-dismiss-flag.d.ts +13 -0
- package/dist/types-ts4.5/constants.d.ts +6 -0
- package/dist/types-ts4.5/flag-actions.d.ts +12 -0
- package/dist/types-ts4.5/flag-group.d.ts +45 -0
- package/dist/types-ts4.5/flag-provider.d.ts +33 -0
- package/dist/types-ts4.5/flag.d.ts +15 -0
- package/dist/types-ts4.5/index.d.ts +6 -0
- package/dist/types-ts4.5/internal/dismiss-button.d.ts +12 -0
- package/dist/types-ts4.5/internal/expander.d.ts +8 -0
- package/dist/types-ts4.5/internal/index.d.ts +2 -0
- package/dist/types-ts4.5/theme.d.ts +24 -0
- package/dist/types-ts4.5/types.d.ts +101 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,7 +15,7 @@ var _flagGroup = require("./flag-group");
|
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
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; }
|
|
17
17
|
var packageName = "@atlaskit/flag";
|
|
18
|
-
var packageVersion = "15.2.
|
|
18
|
+
var packageVersion = "15.2.2";
|
|
19
19
|
var AUTO_DISMISS_SECONDS = 8;
|
|
20
20
|
|
|
21
21
|
/**
|
package/dist/cjs/flag.js
CHANGED
|
@@ -26,7 +26,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
26
26
|
var analyticsAttributes = {
|
|
27
27
|
componentName: 'flag',
|
|
28
28
|
packageName: "@atlaskit/flag",
|
|
29
|
-
packageVersion: "15.2.
|
|
29
|
+
packageVersion: "15.2.2"
|
|
30
30
|
};
|
|
31
31
|
var transitionStyles = (0, _react2.css)({
|
|
32
32
|
flexGrow: 1,
|
package/dist/cjs/version.json
CHANGED
|
@@ -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 = "15.2.
|
|
8
|
+
const packageVersion = "15.2.2";
|
|
9
9
|
export const AUTO_DISMISS_SECONDS = 8;
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/es2019/flag.js
CHANGED
package/dist/es2019/version.json
CHANGED
|
@@ -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 = "15.2.
|
|
8
|
+
var packageVersion = "15.2.2";
|
|
9
9
|
export var AUTO_DISMISS_SECONDS = 8;
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/esm/flag.js
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -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,6 @@
|
|
|
1
|
+
import { AppearanceTypes } from './types';
|
|
2
|
+
export declare const DEFAULT_APPEARANCE: AppearanceTypes;
|
|
3
|
+
export declare const VAR_COLOR = "--color";
|
|
4
|
+
export declare const VAR_BG_COLOR = "--bg-color";
|
|
5
|
+
export declare const VAR_BG_COLOR_HOVER = "--bg-color-hover";
|
|
6
|
+
export declare const VAR_BG_COLOR_ACTIVE = "--bg-color-active";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { ComponentType, FC } from 'react';
|
|
3
|
+
import type { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
4
|
+
import type { ActionsType, AppearanceTypes } from './types';
|
|
5
|
+
type FlagActionsProps = {
|
|
6
|
+
appearance: AppearanceTypes;
|
|
7
|
+
actions: ActionsType;
|
|
8
|
+
linkComponent?: ComponentType<CustomThemeButtonProps>;
|
|
9
|
+
testId?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const FlagActions: FC<FlagActionsProps>;
|
|
12
|
+
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
|
+
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
|
+
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
|
+
type FlagId = string | number;
|
|
4
|
+
export 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 type FlagArgs = Combine<CreateFlagArgs, {
|
|
18
|
+
id: FlagId;
|
|
19
|
+
}>;
|
|
20
|
+
export type DismissFn = () => void;
|
|
21
|
+
export 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,15 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import type { FlagProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* __Flag__
|
|
6
|
+
*
|
|
7
|
+
* A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
|
|
8
|
+
* often displayed using a flag group.
|
|
9
|
+
*
|
|
10
|
+
* - [Examples](https://atlassian.design/components/flag/examples)
|
|
11
|
+
* - [Code](https://atlassian.design/components/flag/code)
|
|
12
|
+
* - [Usage](https://atlassian.design/components/flag/usage)
|
|
13
|
+
*/
|
|
14
|
+
declare const Flag: FC<FlagProps>;
|
|
15
|
+
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,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,24 @@
|
|
|
1
|
+
import { UNSAFE_BoxProps as BoxProps, UNSAFE_TextProps as TextProps } from '@atlaskit/ds-explorations';
|
|
2
|
+
import { AppearanceTypes } from './types';
|
|
3
|
+
export declare const flagBackgroundColor: Record<AppearanceTypes, BoxProps['backgroundColor']>;
|
|
4
|
+
export declare const flagIconColor: Record<AppearanceTypes, string>;
|
|
5
|
+
export declare const flagTextColor: Record<AppearanceTypes, TextProps['color']>;
|
|
6
|
+
export declare const flagTextColorToken: {
|
|
7
|
+
error: "var(--ds-text-inverse)";
|
|
8
|
+
info: "var(--ds-text-inverse)";
|
|
9
|
+
normal: "var(--ds-text-subtle)";
|
|
10
|
+
success: "var(--ds-text-inverse)";
|
|
11
|
+
warning: "var(--ds-text-warning-inverse)";
|
|
12
|
+
};
|
|
13
|
+
type ActionBackgroundColor = Record<Exclude<AppearanceTypes, 'normal'>, {
|
|
14
|
+
default: 'var(--ds-background-inverse-subtle)';
|
|
15
|
+
active: 'var(--ds-background-inverse-subtle-pressed)';
|
|
16
|
+
pressed: 'var(--ds-background-inverse-subtle-hovered)';
|
|
17
|
+
}> & Record<Extract<AppearanceTypes, 'normal'>, {
|
|
18
|
+
default: 'none';
|
|
19
|
+
active: 'none';
|
|
20
|
+
pressed: 'none';
|
|
21
|
+
}>;
|
|
22
|
+
export declare const actionBackgroundColor: ActionBackgroundColor;
|
|
23
|
+
export declare const actionTextColor: Record<AppearanceTypes, string>;
|
|
24
|
+
export {};
|
|
@@ -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 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 type ActionsType = Array<ActionType>;
|
|
12
|
+
export type AppearanceTypes = 'error' | 'info' | 'success' | 'warning' | 'normal';
|
|
13
|
+
export declare const AppearanceArray: AppearanceTypes[];
|
|
14
|
+
type FlagPropsId = {
|
|
15
|
+
/**
|
|
16
|
+
* A unique identifier used for rendering and onDismissed callbacks.
|
|
17
|
+
*/
|
|
18
|
+
id: number | string;
|
|
19
|
+
};
|
|
20
|
+
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/flag",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.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/"
|