@atlaskit/flag 14.4.1

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +1244 -0
  2. package/LICENSE +13 -0
  3. package/README.md +13 -0
  4. package/__perf__/autodismiss.tsx +18 -0
  5. package/__perf__/default.tsx +18 -0
  6. package/__perf__/withFlagGroup.tsx +20 -0
  7. package/auto-dismiss-flag/package.json +7 -0
  8. package/constants/package.json +7 -0
  9. package/dist/cjs/auto-dismiss-flag.js +89 -0
  10. package/dist/cjs/constants.js +8 -0
  11. package/dist/cjs/expander.js +41 -0
  12. package/dist/cjs/flag-actions.js +64 -0
  13. package/dist/cjs/flag-group.js +107 -0
  14. package/dist/cjs/flag-provider.js +119 -0
  15. package/dist/cjs/flag.js +219 -0
  16. package/dist/cjs/index.js +51 -0
  17. package/dist/cjs/theme.js +160 -0
  18. package/dist/cjs/types.js +10 -0
  19. package/dist/cjs/version.json +5 -0
  20. package/dist/es2019/auto-dismiss-flag.js +67 -0
  21. package/dist/es2019/constants.js +1 -0
  22. package/dist/es2019/expander.js +33 -0
  23. package/dist/es2019/flag-actions.js +73 -0
  24. package/dist/es2019/flag-group.js +130 -0
  25. package/dist/es2019/flag-provider.js +68 -0
  26. package/dist/es2019/flag.js +245 -0
  27. package/dist/es2019/index.js +4 -0
  28. package/dist/es2019/theme.js +119 -0
  29. package/dist/es2019/types.js +2 -0
  30. package/dist/es2019/version.json +5 -0
  31. package/dist/esm/auto-dismiss-flag.js +67 -0
  32. package/dist/esm/constants.js +1 -0
  33. package/dist/esm/expander.js +29 -0
  34. package/dist/esm/flag-actions.js +50 -0
  35. package/dist/esm/flag-group.js +85 -0
  36. package/dist/esm/flag-provider.js +92 -0
  37. package/dist/esm/flag.js +195 -0
  38. package/dist/esm/index.js +4 -0
  39. package/dist/esm/theme.js +129 -0
  40. package/dist/esm/types.js +2 -0
  41. package/dist/esm/version.json +5 -0
  42. package/dist/types/auto-dismiss-flag.d.ts +4 -0
  43. package/dist/types/constants.d.ts +2 -0
  44. package/dist/types/expander.d.ts +9 -0
  45. package/dist/types/flag-actions.d.ts +14 -0
  46. package/dist/types/flag-group.d.ts +27 -0
  47. package/dist/types/flag-provider.d.ts +26 -0
  48. package/dist/types/flag.d.ts +3 -0
  49. package/dist/types/index.d.ts +6 -0
  50. package/dist/types/theme.d.ts +9 -0
  51. package/dist/types/types.d.ts +79 -0
  52. package/expander/package.json +7 -0
  53. package/extract-react-types/show-flag-args.tsx +5 -0
  54. package/flag/package.json +7 -0
  55. package/flag-actions/package.json +7 -0
  56. package/flag-group/package.json +7 -0
  57. package/flag-provider/package.json +7 -0
  58. package/package.json +80 -0
  59. package/theme/package.json +7 -0
  60. package/types/package.json +7 -0
@@ -0,0 +1,9 @@
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 getFlagTextColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
6
+ export declare const flagShadowColor = "rgba(9, 30, 66, 0.25)";
7
+ export declare const getFlagFocusRingColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
8
+ export declare const getActionBackground: (appearance: AppearanceTypes, mode: ThemeModes) => string;
9
+ export declare const getActionColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
@@ -0,0 +1,79 @@
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 AppearanceTypes = 'error' | 'info' | 'normal' | 'success' | 'warning';
12
+ export declare type ActionsType = Array<ActionType>;
13
+ export declare const AppearanceArray: AppearanceTypes[];
14
+ declare type FlagPropsId = {
15
+ /** A unique identifier used for rendering and onDismissed callbacks. */
16
+ id: number | string;
17
+ };
18
+ declare type AutoDismissFlagPropsWithoutId = {
19
+ /** Array of clickable actions to be shown at the bottom of the flag. For flags where appearance
20
+ * is 'normal', actions will be shown as links. For all other appearance values, actions will
21
+ * shown as buttons.
22
+ * If href is passed the action will be shown as a link with the passed href prop.
23
+ */
24
+ actions?: ActionsType;
25
+ /** Makes the flag appearance bold. Setting this to anything other than 'normal' hides the
26
+ * dismiss button.
27
+ */
28
+ appearance?: AppearanceTypes;
29
+ /** The secondary content shown below the flag title */
30
+ description?: ReactNode;
31
+ /** The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
32
+ * Your icon will receive the appropriate default color, which you can override by wrapping the
33
+ * icon in a containing element with CSS `color` set to your preferred icon color.
34
+ */
35
+ icon: ReactNode;
36
+ /** The bold text shown at the top of the flag. */
37
+ title: ReactNode;
38
+ /** Handler which will be called when a Flag's dismiss button is clicked.
39
+ * Receives the id of the dismissed Flag as a parameter.
40
+ */
41
+ onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
42
+ /** A link component that is passed down to the `@atlaskit/button` used by actions,
43
+ to allow custom routers to be used. See the
44
+ [button with router](https://atlaskit.atlassian.com/packages/design-system/button/example/ButtonWithRouter)
45
+ example of what this component should look like. */
46
+ linkComponent?: ComponentType<CustomThemeButtonProps>;
47
+ /**
48
+ * A `testId` prop is provided for specified elements,
49
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
50
+ * serving as a hook for automated tests.
51
+
52
+ * Will set these elements when defined:
53
+
54
+ * - Flag root element - `{testId}`
55
+ * - Close button visible on default flags - `{testId}-dismiss`
56
+ * - Toggle button visible on bold flags - `{testId}-toggle`
57
+ * - Flag content which wraps the description and actions - `{testId}-expander`
58
+ * - Flag description - `{testId}-description`
59
+ * - Flag actions - `{testId}-actions`
60
+ */
61
+ testId?: string;
62
+ /** Additional information to be included in the `context` of analytics events that come from flag */
63
+ analyticsContext?: Record<string, any>;
64
+ };
65
+ export interface AutoDismissFlagProps extends AutoDismissFlagPropsWithoutId, FlagPropsId {
66
+ }
67
+ export interface FlagPropsWithoutId extends AutoDismissFlagPropsWithoutId, WithAnalyticsEventsProps {
68
+ /** Standard onBlur event, applied to Flag by AutoDismissFlag */
69
+ onBlur?: (e: React.FocusEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
70
+ /** Standard onFocus event, applied to Flag by AutoDismissFlag */
71
+ onFocus?: (e: React.FocusEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
72
+ /** Standard onMouseOut event, applied to Flag by AutoDismissFlag */
73
+ onMouseOut?: MouseEventHandler;
74
+ /** Standard onMouseOver event, applied to Flag by AutoDismissFlag */
75
+ onMouseOver?: MouseEventHandler;
76
+ }
77
+ export interface FlagProps extends FlagPropsWithoutId, FlagPropsId {
78
+ }
79
+ export {};
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/expander",
3
+ "main": "../dist/cjs/expander.js",
4
+ "module": "../dist/esm/expander.js",
5
+ "module:es2019": "../dist/es2019/expander.js",
6
+ "types": "../dist/types/expander.d.ts"
7
+ }
@@ -0,0 +1,5 @@
1
+ import { CreateFlagArgs } from '../src';
2
+
3
+ export default function ShowFlagArgs(props: CreateFlagArgs) {
4
+ return null;
5
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/flag",
3
+ "main": "../dist/cjs/flag.js",
4
+ "module": "../dist/esm/flag.js",
5
+ "module:es2019": "../dist/es2019/flag.js",
6
+ "types": "../dist/types/flag.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/flag-actions",
3
+ "main": "../dist/cjs/flag-actions.js",
4
+ "module": "../dist/esm/flag-actions.js",
5
+ "module:es2019": "../dist/es2019/flag-actions.js",
6
+ "types": "../dist/types/flag-actions.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/flag-group",
3
+ "main": "../dist/cjs/flag-group.js",
4
+ "module": "../dist/esm/flag-group.js",
5
+ "module:es2019": "../dist/es2019/flag-group.js",
6
+ "types": "../dist/types/flag-group.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/flag-provider",
3
+ "main": "../dist/cjs/flag-provider.js",
4
+ "module": "../dist/esm/flag-provider.js",
5
+ "module:es2019": "../dist/es2019/flag-provider.js",
6
+ "types": "../dist/types/flag-provider.d.ts"
7
+ }
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@atlaskit/flag",
3
+ "version": "14.4.1",
4
+ "description": "A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/"
7
+ },
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
9
+ "author": "Atlassian Pty Ltd",
10
+ "license": "Apache-2.0",
11
+ "main": "dist/cjs/index.js",
12
+ "module": "dist/esm/index.js",
13
+ "module:es2019": "dist/es2019/index.js",
14
+ "types": "dist/types/index.d.ts",
15
+ "sideEffects": false,
16
+ "atlaskit:src": "src/index.ts",
17
+ "atlassian": {
18
+ "team": "Design System Team",
19
+ "deprecatedAutoEntryPoints": true,
20
+ "inPublicMirror": true,
21
+ "releaseModel": "scheduled",
22
+ "website": {
23
+ "name": "Flag"
24
+ }
25
+ },
26
+ "dependencies": {
27
+ "@atlaskit/analytics-next": "^8.0.0",
28
+ "@atlaskit/button": "^16.0.0",
29
+ "@atlaskit/icon": "^21.9.0",
30
+ "@atlaskit/motion": "^1.0.0",
31
+ "@atlaskit/portal": "^4.0.0",
32
+ "@atlaskit/theme": "^12.0.0",
33
+ "@babel/runtime": "^7.0.0",
34
+ "@emotion/core": "^10.0.9"
35
+ },
36
+ "peerDependencies": {
37
+ "react": "^16.8.0"
38
+ },
39
+ "devDependencies": {
40
+ "@atlaskit/build-utils": "*",
41
+ "@atlaskit/docs": "*",
42
+ "@atlaskit/field-radio-group": "^8.0.0",
43
+ "@atlaskit/radio": "^5.2.0",
44
+ "@atlaskit/section-message": "^6.0.0",
45
+ "@atlaskit/spinner": "^15.0.0",
46
+ "@atlaskit/ssr": "*",
47
+ "@atlaskit/theme": "^12.0.0",
48
+ "@atlaskit/visual-regression": "*",
49
+ "@atlaskit/webdriver-runner": "*",
50
+ "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
51
+ "@testing-library/react": "^8.0.1",
52
+ "jest-emotion": "^10.0.32",
53
+ "react-dom": "^16.8.0",
54
+ "storybook-addon-performance": "^0.16.0",
55
+ "typescript": "3.9.6"
56
+ },
57
+ "keywords": [
58
+ "atlaskit",
59
+ "react",
60
+ "ui"
61
+ ],
62
+ "techstack": {
63
+ "@repo/internal": {
64
+ "ui-components": [
65
+ "lite-mode"
66
+ ],
67
+ "analytics": [
68
+ "analytics-next"
69
+ ],
70
+ "theming": [
71
+ "new-theming-api"
72
+ ],
73
+ "deprecation": [
74
+ "no-deprecated-imports"
75
+ ]
76
+ }
77
+ },
78
+ "homepage": "https://atlassian.design/components/flag/",
79
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
80
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/theme",
3
+ "main": "../dist/cjs/theme.js",
4
+ "module": "../dist/esm/theme.js",
5
+ "module:es2019": "../dist/es2019/theme.js",
6
+ "types": "../dist/types/theme.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/flag/types",
3
+ "main": "../dist/cjs/types.js",
4
+ "module": "../dist/esm/types.js",
5
+ "module:es2019": "../dist/es2019/types.js",
6
+ "types": "../dist/types/types.d.ts"
7
+ }