@atlaskit/primitives 7.0.0 → 7.0.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.
Files changed (76) hide show
  1. package/.eslintrc.js +1 -1
  2. package/CHANGELOG.md +19 -1
  3. package/LICENSE.md +6 -8
  4. package/constellation/anchor/code.mdx +3 -3
  5. package/constellation/anchor/examples.mdx +33 -39
  6. package/constellation/anchor/usage.mdx +60 -30
  7. package/constellation/bleed/code.mdx +3 -3
  8. package/constellation/bleed/examples.mdx +17 -13
  9. package/constellation/box/code.mdx +3 -3
  10. package/constellation/box/examples.mdx +25 -19
  11. package/constellation/box/usage.mdx +15 -5
  12. package/constellation/flex/code.mdx +3 -3
  13. package/constellation/flex/examples.mdx +12 -11
  14. package/constellation/grid/code.mdx +3 -3
  15. package/constellation/grid/examples.mdx +15 -10
  16. package/constellation/inline/code.mdx +3 -3
  17. package/constellation/inline/examples.mdx +32 -38
  18. package/constellation/inline/usage.mdx +15 -6
  19. package/constellation/overview/index.mdx +29 -27
  20. package/constellation/pressable/code.mdx +5 -4
  21. package/constellation/pressable/examples.mdx +41 -55
  22. package/constellation/pressable/usage.mdx +59 -36
  23. package/constellation/responsive/01-show/code.mdx +3 -3
  24. package/constellation/responsive/01-show/examples.mdx +9 -13
  25. package/constellation/responsive/02-hide/code.mdx +3 -3
  26. package/constellation/responsive/02-hide/examples.mdx +9 -13
  27. package/constellation/responsive/03-breakpoints/examples.mdx +3 -3
  28. package/constellation/responsive/examples.mdx +10 -10
  29. package/constellation/responsive/usage.mdx +23 -15
  30. package/constellation/stack/code.mdx +3 -3
  31. package/constellation/stack/examples.mdx +26 -20
  32. package/constellation/stack/usage.mdx +13 -5
  33. package/constellation/text/code.mdx +3 -3
  34. package/constellation/text/examples.mdx +29 -15
  35. package/constellation/text/usage.mdx +6 -3
  36. package/constellation/xcss/examples.mdx +7 -5
  37. package/constellation/xcss/migration.mdx +32 -25
  38. package/constellation/xcss/usage.mdx +72 -60
  39. package/dist/cjs/components/anchor.js +4 -4
  40. package/dist/cjs/components/pressable.js +1 -1
  41. package/dist/cjs/xcss/style-maps.partial.js +13 -13
  42. package/dist/es2019/components/anchor.js +4 -4
  43. package/dist/es2019/components/pressable.js +1 -1
  44. package/dist/es2019/xcss/style-maps.partial.js +13 -13
  45. package/dist/esm/components/anchor.js +4 -4
  46. package/dist/esm/components/pressable.js +1 -1
  47. package/dist/esm/xcss/style-maps.partial.js +13 -13
  48. package/dist/types/components/anchor.d.ts +4 -4
  49. package/dist/types/responsive/index.d.ts +2 -2
  50. package/dist/types/xcss/style-maps.partial.d.ts +13 -13
  51. package/dist/types-ts4.5/components/anchor.d.ts +4 -4
  52. package/dist/types-ts4.5/responsive/index.d.ts +2 -2
  53. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +13 -13
  54. package/extract-react-types/anchor-props.tsx +108 -116
  55. package/extract-react-types/bleed-props.tsx +17 -22
  56. package/extract-react-types/box-props.tsx +67 -70
  57. package/extract-react-types/flex-props.tsx +61 -61
  58. package/extract-react-types/grid-props.tsx +92 -92
  59. package/extract-react-types/hide-props.tsx +35 -35
  60. package/extract-react-types/inline-props.tsx +68 -68
  61. package/extract-react-types/pressable-props.tsx +101 -107
  62. package/extract-react-types/show-props.tsx +35 -35
  63. package/extract-react-types/stack-props.tsx +55 -55
  64. package/package.json +2 -2
  65. package/report.api.md +940 -965
  66. package/scripts/border-codegen-template.tsx +40 -47
  67. package/scripts/codegen-file-templates/dimensions.tsx +8 -8
  68. package/scripts/codegen-file-templates/layer.tsx +9 -9
  69. package/scripts/codegen-styles.tsx +97 -103
  70. package/scripts/color-codegen-template.tsx +61 -73
  71. package/scripts/elevation-codegen-template.tsx +50 -62
  72. package/scripts/inverse-color-map-template.tsx +26 -31
  73. package/scripts/misc-codegen-template.tsx +4 -9
  74. package/scripts/spacing-codegen-template.tsx +25 -31
  75. package/scripts/typography-codegen-template.tsx +59 -65
  76. package/scripts/utils.tsx +36 -43
@@ -15,28 +15,31 @@ import ResponsiveGrid from '../../examples/constellation/grid/responsive';
15
15
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
16
16
 
17
17
  <CodeDocsHeader
18
- name="@atlaskit/primitives"
19
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
20
- directoryName="primitives"
18
+ name="@atlaskit/primitives"
19
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
20
+ directoryName="primitives"
21
21
  />
22
22
 
23
23
  ## Basic
24
24
 
25
- The `Grid` component is designed as a very basic mapping to the CSS Grid API.
26
- It can be used as an alternative to [Flex](/components/primitives/flex), [Inline](/components/primitives/inline) or [Stack](/components/primitives/stack).
25
+ The `Grid` component is designed as a very basic mapping to the CSS Grid API. It can be used as an
26
+ alternative to [Flex](/components/primitives/flex), [Inline](/components/primitives/inline) or
27
+ [Stack](/components/primitives/stack).
27
28
 
28
29
  <Example Component={GridBasic} packageName="@atlaskit/primitives/grid" />
29
30
 
30
31
  ## Gap properties
31
32
 
32
- Gap properties `rowGap`, `columnGap` and `gap` only allow token-backed values. This is to aid ergonomics and keep the whitespace of the grid harmonious with the spacing system.
33
+ Gap properties `rowGap`, `columnGap` and `gap` only allow token-backed values. This is to aid
34
+ ergonomics and keep the whitespace of the grid harmonious with the spacing system.
33
35
 
34
36
  <Example Component={GridGap} packageName="@atlaskit/primitives/grid" />
35
37
 
36
38
  ## Template syntax
37
39
 
38
- Grid-prefixed template properties in CSS do not have this prefix in the component API.
39
- For example `grid-template-*` are instead applied as `templateColumns`, `templateRows` and `templateArea` properties.
40
+ Grid-prefixed template properties in CSS do not have this prefix in the component API. For example
41
+ `grid-template-*` are instead applied as `templateColumns`, `templateRows` and `templateArea`
42
+ properties.
40
43
 
41
44
  ### Template columns
42
45
 
@@ -58,13 +61,15 @@ Template areas enables grid to declare the grid areas are applied in the templat
58
61
 
59
62
  ## Autoflow syntax
60
63
 
61
- Grid-prefixed properties in CSS do not have this prefix in the component API. `grid-auto-flow` is instead applied via `autoFlow`.
64
+ Grid-prefixed properties in CSS do not have this prefix in the component API. `grid-auto-flow` is
65
+ instead applied via `autoFlow`.
62
66
 
63
67
  <Example Component={GridAutoFlow} packageName="@atlaskit/primitives/grid" />
64
68
 
65
69
  ## Responsive grid
66
70
 
67
- Here, we construct a grid layout that adapts from a single column to a four-column layout depending on the viewport size.
71
+ Here, we construct a grid layout that adapts from a single column to a four-column layout depending
72
+ on the viewport size.
68
73
 
69
74
  <Example Component={ResponsiveGrid} packageName="@atlaskit/primitives/grid" />
70
75
 
@@ -11,9 +11,9 @@ props:
11
11
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
12
12
 
13
13
  <CodeDocsHeader
14
- name="@atlaskit/primitives"
15
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
16
- directoryName="primitives"
14
+ name="@atlaskit/primitives"
15
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
16
+ directoryName="primitives"
17
17
  />
18
18
 
19
19
  ## Props
@@ -19,16 +19,17 @@ import InlinePracticalUseCase from '../../examples/constellation/inline/practica
19
19
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
20
20
 
21
21
  <CodeDocsHeader
22
- name="@atlaskit/primitives"
23
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
24
- directoryName="primitives"
22
+ name="@atlaskit/primitives"
23
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
24
+ directoryName="primitives"
25
25
  />
26
26
 
27
27
  ## Basic
28
28
 
29
29
  Use an inline component to configure the layout of a group of elements horizontally.
30
30
 
31
- Use the given props to configure display behavior using design tokens, as shown in the more complex examples below.
31
+ Use the given props to configure display behavior using design tokens, as shown in the more complex
32
+ examples below.
32
33
 
33
34
  <Example Component={InlineBasic} packageName="@atlaskit/primitives/inline" />
34
35
 
@@ -36,57 +37,55 @@ Use the given props to configure display behavior using design tokens, as shown
36
37
 
37
38
  Control the spacing between items with the `space` prop.
38
39
 
39
- <Example
40
- Component={InlineSpaceBasic}
41
- packageName="@atlaskit/primitives/inline"
42
- />
40
+ <Example Component={InlineSpaceBasic} packageName="@atlaskit/primitives/inline" />
43
41
 
44
42
  When content is set to wrap, the `space` prop applies equal spacing between rows.
45
43
 
46
44
  For a different space value between rows use the `rowSpace` prop.
47
45
 
48
- <Example
49
- Component={InlineSpaceWrap}
50
- packageName="@atlaskit/primitives/inline"
51
- />
46
+ <Example Component={InlineSpaceWrap} packageName="@atlaskit/primitives/inline" />
52
47
 
53
48
  ## Reverse content
54
49
 
55
- `flex-direction: `row-reverse` is a pattern that has [accessibility concerns](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns) so inline doesn't support it.
50
+ `flex-direction: `row-reverse` is a pattern that has
51
+ [accessibility concerns](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns)
52
+ so inline doesn't support it.
56
53
 
57
- If reversing content is required, we generally recommend to use JavaScript to reverse the JSX content thereby preserving the tabbing order.
54
+ If reversing content is required, we generally recommend to use JavaScript to reverse the JSX
55
+ content thereby preserving the tabbing order.
58
56
 
59
- In situations where tabbing order changes based on different breakpoints, then we have [show](/components/primitives/responsive/hide/examples) and [hide](/components/primitives/responsive/hide/examples) components that enable switching between different orderings of content.
57
+ In situations where tabbing order changes based on different breakpoints, then we have
58
+ [show](/components/primitives/responsive/hide/examples) and
59
+ [hide](/components/primitives/responsive/hide/examples) components that enable switching between
60
+ different orderings of content.
60
61
 
61
- For non-tabbable content that needs to be reversed, `flex-direction: row-reverse` is supported in XCSS. However, please be aware that we may lint against this in the future.
62
+ For non-tabbable content that needs to be reversed, `flex-direction: row-reverse` is supported in
63
+ XCSS. However, please be aware that we may lint against this in the future.
62
64
 
63
65
  ## Alignment
64
66
 
65
- To control the alignment of items you can use the `alignBlock` and `alignInline` props which control alignment in the vertical and horizontal axis respectively.
67
+ To control the alignment of items you can use the `alignBlock` and `alignInline` props which control
68
+ alignment in the vertical and horizontal axis respectively.
66
69
 
67
70
  ### Block alignment
68
71
 
69
- <Example
70
- Component={InlineAlignBlock}
71
- packageName="@atlaskit/primitives/inline"
72
- />
72
+ <Example Component={InlineAlignBlock} packageName="@atlaskit/primitives/inline" />
73
73
 
74
74
  ### Inline alignment
75
75
 
76
- <Example
77
- Component={InlineAlignInline}
78
- packageName="@atlaskit/primitives/inline"
79
- />
76
+ <Example Component={InlineAlignInline} packageName="@atlaskit/primitives/inline" />
80
77
 
81
78
  ## Spread
82
79
 
83
- Elements can be set to stay together, spaced at the given value (default behavior) or spread equally in the space available.
80
+ Elements can be set to stay together, spaced at the given value (default behavior) or spread equally
81
+ in the space available.
84
82
 
85
83
  <Example Component={InlineSpread} packageName="@atlaskit/primitives/inline" />
86
84
 
87
85
  ## Wrap
88
86
 
89
- When the number of items goes beyond the available space, use `shouldWrap` to create new rows of content.
87
+ When the number of items goes beyond the available space, use `shouldWrap` to create new rows of
88
+ content.
90
89
 
91
90
  <Example Component={InlineWrap} packageName="@atlaskit/primitives/inline" />
92
91
 
@@ -94,15 +93,12 @@ When the number of items goes beyond the available space, use `shouldWrap` to cr
94
93
 
95
94
  For logically related elements it's possible to specify a `separator` character value.
96
95
 
97
- <Example
98
- Component={InlineSeparator}
99
- packageName="@atlaskit/primitives/inline"
100
- />
96
+ <Example Component={InlineSeparator} packageName="@atlaskit/primitives/inline" />
101
97
 
102
98
  ## Width control
103
99
 
104
- By default an `Inline` will have its width influenced by the context where it appears.
105
- To control the width, use the `grow` prop with the values:
100
+ By default an `Inline` will have its width influenced by the context where it appears. To control
101
+ the width, use the `grow` prop with the values:
106
102
 
107
103
  - `hug` (default) to use space only as required by its children, or
108
104
  - `fill` to take all space provided by the parent element.
@@ -117,9 +113,7 @@ It's possible to control the rendered HTML element with the `as` prop.
117
113
 
118
114
  ## Practical use case
119
115
 
120
- An example of how an inline component might be used in product, using Atlassian Design System components.
116
+ An example of how an inline component might be used in product, using Atlassian Design System
117
+ components.
121
118
 
122
- <Example
123
- Component={InlinePracticalUseCase}
124
- packageName="@atlaskit/primitives/inline"
125
- />
119
+ <Example Component={InlinePracticalUseCase} packageName="@atlaskit/primitives/inline" />
@@ -4,23 +4,32 @@ description: An inline manages the horizontal layout of direct children using fl
4
4
  order: 2
5
5
  ---
6
6
 
7
- Use the inline component in conjunction with other layout components such as [box](/components/primitives/box/usage) and [stack](/components/primitives/stack/usage) to easily create customized layouts, with built-in guidance from the Atlassian Design System.
7
+ Use the inline component in conjunction with other layout components such as
8
+ [box](/components/primitives/box/usage) and [stack](/components/primitives/stack/usage) to easily
9
+ create customized layouts, with built-in guidance from the Atlassian Design System.
8
10
 
9
- Inline components act as container to decide the horizontal layout of its children. They decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. An inline component should be used purely for visual alignment, and should have no opinions about the functionality of its children.
11
+ Inline components act as container to decide the horizontal layout of its children. They decide the
12
+ specifics of how the children are displayed, for example, where they are aligned or how much space
13
+ is between child elements. An inline component should be used purely for visual alignment, and
14
+ should have no opinions about the functionality of its children.
10
15
 
11
- In its simplest form, an inline component operates like a flexbox row, however adds the built in design token support and guidance.
16
+ In its simplest form, an inline component operates like a flexbox row, however adds the built in
17
+ design token support and guidance.
12
18
 
13
19
  ```jsx
14
20
  <Inline space="space.100" alignInline="center" alignBlock="start">
15
- ...
21
+ ...
16
22
  </Inline>
17
23
  ```
18
24
 
19
- Inline also has a `flex-direction: row;`. This is the default for flexbox, so it is not explicitly applied.
25
+ Inline also has a `flex-direction: row;`. This is the default for flexbox, so it is not explicitly
26
+ applied.
20
27
 
21
28
  ## Using inline
22
29
 
23
- The purpose of an inline is primarily as a container element controlling how child components are displayed and positioned horizontally. An inline should be used any time you wish to layout elements or components horizontally.
30
+ The purpose of an inline is primarily as a container element controlling how child components are
31
+ displayed and positioned horizontally. An inline should be used any time you wish to layout elements
32
+ or components horizontally.
24
33
 
25
34
  Use the inline props to customize the spacing and styling on any child elements. These include:
26
35
 
@@ -14,21 +14,23 @@ import stackUsageExample from './images/stack-usage-example.png';
14
14
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
15
15
 
16
16
  <CodeDocsHeader
17
- name="@atlaskit/primitives"
18
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
19
- directoryName="primitives"
17
+ name="@atlaskit/primitives"
18
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
19
+ directoryName="primitives"
20
20
  />
21
21
 
22
- Primitives are a new type of component for layouts, styling, and the placement of elements.
23
- They act as building blocks to compose different parts of the user experience,
24
- from the smallest design decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a page is structured).
22
+ Primitives are a new type of component for layouts, styling, and the placement of elements. They act
23
+ as building blocks to compose different parts of the user experience, from the smallest design
24
+ decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a
25
+ page is structured).
25
26
 
26
- Primitives are powered by design tokens and make it easier to apply design decisions. This reduces cognitive overhead, improves productivity and prevents accidents or mistakes.
27
+ Primitives are powered by design tokens and make it easier to apply design decisions. This reduces
28
+ cognitive overhead, improves productivity and prevents accidents or mistakes.
27
29
 
28
30
  ## Available primitives
29
31
 
30
- Primitives are used together to compose complex designs not otherwise implemented directly in the Design System.
31
- Currently, three layout primitive components are available:
32
+ Primitives are used together to compose complex designs not otherwise implemented directly in the
33
+ Design System. Currently, three layout primitive components are available:
32
34
 
33
35
  - in a container (see [box](/components/primitives/box))
34
36
  - horizontally (see [inline](/components/primitives/inline))
@@ -50,36 +52,36 @@ $ yarn add @atlaskit/primitives
50
52
 
51
53
  ## Using primitives
52
54
 
53
- Use primitives for composing layouts.
54
- Primitives are not currently available in Figma, so the first step in implementing primitive components is identifying where they might fit in a given design.
55
- This involves breaking down a design into its core layout components to as granular level as is useful.
55
+ Use primitives for composing layouts. Primitives are not currently available in Figma, so the first
56
+ step in implementing primitive components is identifying where they might fit in a given design.
57
+ This involves breaking down a design into its core layout components to as granular level as is
58
+ useful.
56
59
 
57
- You might like to think first about breaking down a page into `Box` containers,
58
- identifying larger pieces of a design that function in a similar manner or fulfill a singular purpose
59
- in a layout and grouping them together under a `Box`.
60
+ You might like to think first about breaking down a page into `Box` containers, identifying larger
61
+ pieces of a design that function in a similar manner or fulfill a singular purpose in a layout and
62
+ grouping them together under a `Box`.
60
63
 
61
64
  <Image
62
- src={boxUsageExample}
63
- alt="Screenshot of a typical Jira board with swimlanes. Various areas are highlighted as examples of how Box containers are used for layout"
65
+ src={boxUsageExample}
66
+ alt="Screenshot of a typical Jira board with swimlanes. Various areas are highlighted as examples of how Box containers are used for layout"
64
67
  />
65
68
 
66
- The behavior within and around these boxes can then be broken down into their horizontal `Inline` and vertical `Stack` components.
69
+ The behavior within and around these boxes can then be broken down into their horizontal `Inline`
70
+ and vertical `Stack` components.
67
71
 
68
72
  <SectionMessage>
69
- The ESLint rule{' '}
70
- <a href="/components/eslint-plugin-design-system/use-primitives">
71
- use-primitives
72
- </a>{' '}
73
- offers suggestions for possible primitives to apply in a layout.
73
+ The ESLint rule{' '}
74
+ <a href="/components/eslint-plugin-design-system/use-primitives">use-primitives</a> offers
75
+ suggestions for possible primitives to apply in a layout.
74
76
  </SectionMessage>
75
77
 
76
78
  <Image
77
- src={inlineUsageExample}
78
- alt="Screenshot of a typical Jira board with swimlanes. Various areas are highlighted as examples of how Inline containers are used for layout"
79
+ src={inlineUsageExample}
80
+ alt="Screenshot of a typical Jira board with swimlanes. Various areas are highlighted as examples of how Inline containers are used for layout"
79
81
  />
80
82
  <Image
81
- src={stackUsageExample}
82
- alt="Screenshot of a typical Jira board with swimlanes. Various areas are highlighted as examples of how Stack containers are used for layout"
83
+ src={stackUsageExample}
84
+ alt="Screenshot of a typical Jira board with swimlanes. Various areas are highlighted as examples of how Stack containers are used for layout"
83
85
  />
84
86
 
85
87
  ## Related
@@ -7,15 +7,16 @@ order: 1
7
7
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
8
8
 
9
9
  <CodeDocsHeader
10
- name="@atlaskit/primitives"
11
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
12
- directoryName="primitives"
10
+ name="@atlaskit/primitives"
11
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
12
+ directoryName="primitives"
13
13
  />
14
14
 
15
15
  import ERTPressable from '!!extract-react-types-loader!../../extract-react-types/pressable-props';
16
16
 
17
17
  ## Props
18
18
 
19
- Pressable also supports all valid `HTMLButtonElement` props, except for `disabled` which is replaced by the `isDisabled` prop.
19
+ Pressable also supports all valid `HTMLButtonElement` props, except for `disabled` which is replaced
20
+ by the `isDisabled` prop.
20
21
 
21
22
  <PropsTable heading="" props={ERTPressable} />
@@ -18,98 +18,84 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
18
18
  import SectionMessage from '@atlaskit/section-message';
19
19
 
20
20
  <CodeDocsHeader
21
- name="@atlaskit/primitives"
22
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
23
- directoryName="primitives"
21
+ name="@atlaskit/primitives"
22
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
23
+ directoryName="primitives"
24
24
  />
25
25
 
26
- Pressable is a primitive used for building custom buttons with Atlassian Design System styling and built-in event tracking. It renders a `<button>` element.
27
-
28
- Only use Pressable when existing components such as [button](/components/button/examples) are unsuitable and unable to be customized to fit your needs.
26
+ Pressable is a primitive for building custom buttons with Atlassian Design System styling and
27
+ built-in event tracking. It renders a `<button>` element. Use pressable when existing
28
+ [buttons](/components/button/examples) can't be customized to fit your needs.
29
29
 
30
30
  ## Default
31
31
 
32
- Pressable is unstyled by default.
32
+ Pressable is unstyled by default, aside from basic focus styles.
33
33
 
34
- <Example
35
- Component={PressableDefault}
36
- packageName="@atlaskit/primitives/pressable"
37
- />
34
+ <Example Component={PressableDefault} packageName="@atlaskit/primitives/pressable" />
38
35
 
39
36
  ## Basic styling with XCSS
40
37
 
41
- Pressable can be styled using XCSS. Ensure styling indicates the interaction state using `:hover` and `:active` pseudo-classes. Pressable includes consistent Atlassian Design System `:focus` styles, so it's unnecessary to add your own.
38
+ Pressable can be styled further using the design system styling API,
39
+ [XCSS](/components/primitives/xcss).
42
40
 
43
- For more information on XCSS, see the [XCSS documentation](/components/primitives/xcss).
41
+ Make sure styling indicates the interaction state using `:hover` and `:active` pseudo-classes.
44
42
 
45
- <Example
46
- Component={PressableBasic}
47
- packageName="@atlaskit/primitives/pressable"
48
- />
43
+ <Example Component={PressableBasic} packageName="@atlaskit/primitives/pressable" />
49
44
 
50
45
  ## Advanced styling
51
46
 
52
47
  Use a combination of XCSS and other primitives for more complex designs.
53
48
 
54
49
  <Example
55
- Component={PressableStyled}
56
- packageName="@atlaskit/primitives/pressable"
57
- backgroundColor="white"
50
+ Component={PressableStyled}
51
+ packageName="@atlaskit/primitives/pressable"
52
+ backgroundColor="white"
58
53
  />
59
54
 
60
55
  ## Disabled
61
56
 
62
- Pressable can be disabled using the `isDisabled` prop. Disabled styles should be conditionally applied and defined using XCSS.
57
+ You can disable pressable buttons with the `isDisabled` prop. Disabled styles should be applied and
58
+ defined conditionally using XCSS.
63
59
 
64
- <Example
65
- Component={PressableDisabled}
66
- packageName="@atlaskit/primitives/pressable"
67
- />
60
+ Disabled buttons can cause accessibility issues (disabled elements are not in the tab order) so
61
+ wherever possible, avoid using `isDisabled`. Instead, use validation or other techniques to show
62
+ users how to proceed.
63
+
64
+ <!-- todo: snippet for disabled a11y warnings? -->
65
+
66
+ <Example Component={PressableDisabled} packageName="@atlaskit/primitives/pressable" />
68
67
 
69
68
  ## Buttons without visible labels
70
69
 
71
- For buttons without visible labels such as icon buttons, ensure an accessible label is still available by using [the visually hidden component](/components/visually-hidden/examples). This will render hidden text inside the button, which is preferable over the `aria-label` attribute because not all screen readers translate this between languages.
70
+ For buttons without visible labels such as icon buttons, make an accessible label available using
71
+ the [visually hidden component](/components/visually-hidden/examples). This renders hidden text
72
+ inside the button for assistive technologies, which is preferable to an `aria-label` attribute
73
+ because not all screen readers translate these between languages.
72
74
 
73
- Provide a tooltip to help sighted users understand the button's purpose rather than relying on iconography alone.
75
+ Also, consider providing a [tooltip](/components/tooltip) to help sighted users understand the
76
+ button's purpose.
74
77
 
75
78
  <Example
76
- Component={PressableWithoutVisibleLabels}
77
- packageName="@atlaskit/primitives/pressable"
78
- backgroundColor="white"
79
+ Component={PressableWithoutVisibleLabels}
80
+ packageName="@atlaskit/primitives/pressable"
81
+ backgroundColor="white"
79
82
  />
80
83
 
81
84
  ## HTML attributes
82
85
 
83
- Pressable passes through all valid HTML attributes to the underlying `<button>` element. It will default the `type` attribute to `button` to prevent buttons unintentionally submitting forms.
86
+ Pressable passes all valid HTML attributes to the underlying `<button>` element. The `type`
87
+ attribute defaults to `button` to prevent unintentionally submitting forms.
84
88
 
85
- <Example
86
- Component={PressableHtmlAttributes}
87
- packageName="@atlaskit/primitives/pressable"
88
- />
89
+ <Example Component={PressableHtmlAttributes} packageName="@atlaskit/primitives/pressable" />
89
90
 
90
- <Snippet
91
- name="primitives-event-tracking-header"
92
- variables={{ componentName: 'pressable' }}
93
- />
91
+ <Snippet name="primitives-event-tracking-header" variables={{ componentName: 'pressable' }} />
94
92
 
95
- <Example
96
- Component={PressableAnalytics}
97
- packageName="@atlaskit/primitives/pressable"
98
- />
93
+ <Example Component={PressableAnalytics} packageName="@atlaskit/primitives/pressable" />
99
94
 
100
95
  <Snippet name="primitives-event-tracking-gasv3" />
101
96
 
102
- <Example
103
- Component={PressableAnalyticsGASv3}
104
- packageName="@atlaskit/primitives/pressable"
105
- />
97
+ <Example Component={PressableAnalyticsGASv3} packageName="@atlaskit/primitives/pressable" />
106
98
 
107
- <Snippet
108
- name="primitives-event-tracking-ufo"
109
- variables={{ componentName: 'pressable' }}
110
- />
99
+ <Snippet name="primitives-event-tracking-ufo" variables={{ componentName: 'pressable' }} />
111
100
 
112
- <Example
113
- Component={PressablePressTracing}
114
- packageName="@atlaskit/primitives/pressable"
115
- />
101
+ <Example Component={PressablePressTracing} packageName="@atlaskit/primitives/pressable" />