@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
@@ -9,81 +9,101 @@ import pressablePrimaryDont from './images/pressable-01b-dont.png';
9
9
 
10
10
  ## Usage
11
11
 
12
- Pressable is a button with consistent focus styles and analytics built in. Pressable works with design tokens to make it easy to compose Atlassian-styled clickable elements that aren't possible using existing [buttons](/components/button/examples), [menus](/components/menu/examples), or other existing design system components.
12
+ Use pressable to make custom-styled buttons and other pressable elements. Pressable works similarly
13
+ to an HTML `<button>`, but with Atlassian focus styles, analytics events, and styling APIs built in.
14
+
15
+ For example, you could use pressable to make a colored square button that opens a color picker, or a
16
+ basic card that shows more details when selected.
13
17
 
14
18
  ![Pressable anatomy](./images/pressable-anatomy.png)
15
19
 
16
- 1. **Pressable area:** For accessibility this should be a minimum of 24 by 24 pixels, unless exempt from [Target Size (Minimum) (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html).
20
+ 1. **Pressable area:** For accessibility this should be a minimum of 24 by 24 pixels, unless exempt
21
+ from
22
+ [Target Size (Minimum) (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html).
17
23
  2. **Focus ring**: This is included in pressable and appears on keyboard focus.
18
- 3. **Accessible label:** Pressable should always include a clear label for accessibility. Use this to communicate the action that occurs when the button is pressed.
24
+ 3. **Accessible label:** Pressable should always include a clear label for accessibility. Use this
25
+ to communicate the action that occurs when the button is pressed.
26
+
27
+ ### Use existing buttons and other components whenever possible
19
28
 
20
- ### Use pressable when there aren't existing components that work for your experience
29
+ Only use pressable when existing components such as [buttons](/components/button/examples) or
30
+ [menus](/components/menu/examples) can't be customized to fit your case.
21
31
 
22
- Only use pressable when existing components such as [the button component](/components/button/examples), menus, or other existing design system components can't be customized to fit your case. Using existing components with safe customizations will prevent inconsistency as Atlassian UI evolves.
32
+ Using [existing components](/components) with safe customizations is usually faster and keeps
33
+ Atlassian UI more visually consistent as things change.
23
34
 
24
35
  <DoDont
25
- type="do"
26
- image={{
27
- url: pressablePrimaryDo,
28
- alt: "A set of custom buttons built with pressable that aren't possible using existing design system components",
29
- }}
36
+ type="do"
37
+ image={{
38
+ url: pressablePrimaryDo,
39
+ alt: 'A set of custom buttons built with pressable that are not possible using existing design system components',
40
+ }}
30
41
  >
31
- Use pressable to create buttons when there isn't an existing design system
32
- component to achieve your use case.
42
+ Use pressable to create buttons when there isn't an existing design system component to achieve
43
+ your use case.
33
44
  </DoDont>
34
45
 
35
46
  <DoDont
36
- type="dont"
37
- image={{
38
- url: pressablePrimaryDont,
39
- alt: 'A custom button build with Pressable that looks similar to Button, an existing design system component',
40
- }}
47
+ type="dont"
48
+ image={{
49
+ url: pressablePrimaryDont,
50
+ alt: 'A custom button build with Pressable that looks similar to Button, an existing design system component',
51
+ }}
41
52
  >
42
- Don't use pressable in place of an element that already has a design system
43
- representation, such as{' '}
44
- <a href="/components/button/examples">the button component</a>. This can cause
45
- visual and behavioral inconsistencies in Atlassian products.
53
+ Don't use pressable to redesign elements that already exists in the Atlassian design system, such
54
+ as <a href="/components/button/examples">buttons</a>. This can cause visual and behavioral
55
+ inconsistency in products.
46
56
  </DoDont>
47
57
 
48
58
  ## Accessibility
49
59
 
50
60
  ### Use clear labels for assistive technology
51
61
 
52
- Pressable should always announce what action will happen once pressed.
62
+ Pressable elements should always announce what action will happen once pressed, especially for
63
+ elements with no visible label, such as icon buttons.
53
64
 
54
65
  ![Pressable labels](./images/pressable-labels.png)
55
66
 
56
- #### When no visible label is present
67
+ Use [the visually hidden component](/components/visually-hidden/examples) to provide an accessible
68
+ label. This will render hidden text inside the button, which is preferable over the `aria-label`
69
+ attribute because not all screen readers translate this between languages.
57
70
 
58
- - Ensure an accessible label is still available by using [the visually hidden component](/components/visually-hidden/examples) which will render hidden text inside the button. This is preferable over the `aria-label` attribute because not all screen readers translate this between languages.
59
- - Use [a tooltip](/components/tooltip/examples) to provide sighted users with the same information.
71
+ Also consider [a tooltip](/components/tooltip/examples) to provide sighted users with the same
72
+ information.
60
73
 
61
74
  ### Focus ring behavior
62
75
 
63
- Pressable creates buttons that are available in focus order, and provides a visual ring to clarify what is in focus. Adding additional focus styles is unnecessary.
76
+ Pressable buttons are available in focus order, and include a visual ring to clarify what is in
77
+ focus by default. Adding additional focus styles is unnecessary.
64
78
 
65
79
  ### Avoid disabling buttons
66
80
 
67
- Disabled buttons can cause accessibility problems. Avoid disabling buttons and [follow our disabled and tooltip button guidance](/components/button/usage#avoid-disabling-buttons).
81
+ Disabled buttons can cause accessibility problems. Avoid disabling buttons and
82
+ [follow our disabled button and tooltip guidance](/components/button/usage#avoid-disabling-buttons).
68
83
 
69
84
  ## Best practices
70
85
 
71
86
  ### Make it clear what can be pressed
72
87
 
73
- Custom buttons should be obviously interactable. Make sure they are clearly identifiable through styles, surrounding context, labels, or other cues.
88
+ Custom buttons should look interactive. Make sure clickable elements are clearly identifiable
89
+ through styles, surrounding context, labels, and other cues.
74
90
 
75
- ### Don't use pressable for navigation
91
+ ### Use pressable for on-page actions, not navigation
76
92
 
77
- Pressable is meant for on-page actions such as opening modals, or submitting forms. If you're making something that navigates to a new page, use a component that renders a semantically correct HTML `<a>` element such as:
93
+ Pressable is meant for on-page actions such as opening modals or submitting forms. If you're making
94
+ something that navigates to a new page, use a component that renders a semantically correct HTML
95
+ `<a>` element such as:
78
96
 
79
97
  - The [link](/components/primitives/link/examples) component (coming soon) for standard text links.
80
- - The [anchor](/components/primitives/anchor/examples) primitive (coming soon) to create custom links.
98
+ - The [anchor](/components/primitives/anchor/examples) primitive (coming soon) to create custom
99
+ links.
81
100
 
82
101
  ## Content guidelines
83
102
 
84
103
  ### Use sentence case capitalization
85
104
 
86
- Use sentence case capitalization, only capitalizing the first letter of the label and any proper nouns. Other forms of capitalization should be only applied through styling with `text-transform`.
105
+ Use sentence case capitalization, only capitalizing the first letter of the label and any proper
106
+ nouns. Other forms of capitalization should be only applied through styling with `text-transform`.
87
107
 
88
108
  ### Make it clear what pressing the button does
89
109
 
@@ -93,10 +113,13 @@ For example, _Change issue color to yellow_ instead of _yellow_.
93
113
 
94
114
  ### Follow other label and UI content guidance
95
115
 
96
- Follow label and content guidelines for [buttons](/components/button/usage#content-guidelines). Review our [general UI text guidance](/foundations/accessibility/#meaningful-text) for specific question.
116
+ Follow label and content guidelines for [buttons](/components/button/usage#content-guidelines).
117
+ Review the [general UI text guidance](/foundations/accessibility/#meaningful-text) for specific
118
+ questions.
97
119
 
98
120
  ## Related
99
121
 
100
- - [Counterpart anchor primitive for links](/components/primitives/button/usage)
101
- - Prefer to use existing components such as [buttons](/components/button/examples) or [menus](/components/menu/examples) for most actions in Atlassian products
102
- - Pressable is built on the same API as [box](/components/primitives/box/usage)
122
+ - Use existing components such as [buttons](/components/button/examples) or
123
+ [menus](/components/menu/examples) for most actions in Atlassian products.
124
+ - Use the [anchor primitive for custom links](/components/primitives/button/usage).
125
+ - Pressable is built on the same API as [box](/components/primitives/box/usage).
@@ -7,9 +7,9 @@ order: 2
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 ShowProps from '!!extract-react-types-loader!../../../extract-react-types/show-props';
@@ -10,27 +10,23 @@ import ShowHideExample from '../../../examples/constellation/responsive/show-hid
10
10
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
11
11
 
12
12
  <CodeDocsHeader
13
- name="@atlaskit/primitives"
14
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
15
- directoryName="primitives"
13
+ name="@atlaskit/primitives"
14
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
15
+ directoryName="primitives"
16
16
  />
17
17
 
18
18
  ### Show
19
19
 
20
- Using `Show` allows you to show the children using CSS `display: …` when the viewport size is above a specified breakpoint. By default, unless the breakpoint is met, contents are hidden.
20
+ Using `Show` allows you to show the children using CSS `display: …` when the viewport size is above
21
+ a specified breakpoint. By default, unless the breakpoint is met, contents are hidden.
21
22
 
22
- Children that are not shown are still rendered into the DOM, so there so there is typically little performance savings — primarily that they are not painted.
23
+ Children that are not shown are still rendered into the DOM, so there so there is typically little
24
+ performance savings — primarily that they are not painted.
23
25
 
24
- <Example
25
- Component={ShowExample}
26
- packageName="@atlaskit/primitives/responsive"
27
- />
26
+ <Example Component={ShowExample} packageName="@atlaskit/primitives/responsive" />
28
27
 
29
28
  ### Mixing Show and Hide
30
29
 
31
30
  Prefer using consistent `above` or `below` for readability and consistency.
32
31
 
33
- <Example
34
- Component={ShowHideExample}
35
- packageName="@atlaskit/primitives/responsive"
36
- />
32
+ <Example Component={ShowHideExample} packageName="@atlaskit/primitives/responsive" />
@@ -7,9 +7,9 @@ order: 2
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 HideProps from '!!extract-react-types-loader!../../../extract-react-types/hide-props';
@@ -10,27 +10,23 @@ import ShowHideExample from '../../../examples/constellation/responsive/show-hid
10
10
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
11
11
 
12
12
  <CodeDocsHeader
13
- name="@atlaskit/primitives"
14
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
15
- directoryName="primitives"
13
+ name="@atlaskit/primitives"
14
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
15
+ directoryName="primitives"
16
16
  />
17
17
 
18
18
  ### Hide
19
19
 
20
- Using Hide allows you to Hide the children using CSS `display: none` when the viewport size is above a specified breakpoint. By default, unless the breakpoint is met, contents are hidden.
20
+ Using Hide allows you to Hide the children using CSS `display: none` when the viewport size is above
21
+ a specified breakpoint. By default, unless the breakpoint is met, contents are hidden.
21
22
 
22
- Children that are hidden are still rendered into the DOM, so there so there is typically little performance savings — primarily that they are not painted.
23
+ Children that are hidden are still rendered into the DOM, so there so there is typically little
24
+ performance savings — primarily that they are not painted.
23
25
 
24
- <Example
25
- Component={HideExample}
26
- packageName="@atlaskit/primitives/responsive"
27
- />
26
+ <Example Component={HideExample} packageName="@atlaskit/primitives/responsive" />
28
27
 
29
28
  ### Mixing Show and Hide
30
29
 
31
30
  Prefer using consistent `above` or `below` for readability and consistency.
32
31
 
33
- <Example
34
- Component={ShowHideExample}
35
- packageName="@atlaskit/primitives/responsive"
36
- />
32
+ <Example Component={ShowHideExample} packageName="@atlaskit/primitives/responsive" />
@@ -9,9 +9,9 @@ import { MediaQueriesTable } from '@af/design-system-docs-ui';
9
9
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
10
10
 
11
11
  <CodeDocsHeader
12
- name="@atlaskit/primitives"
13
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
14
- directoryName="primitives"
12
+ name="@atlaskit/primitives"
13
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
14
+ directoryName="primitives"
15
15
  />
16
16
 
17
17
  ### Media Queries
@@ -13,23 +13,22 @@ import ShowHideExample from '../../examples/constellation/responsive/show-hide';
13
13
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
14
14
 
15
15
  <CodeDocsHeader
16
- name="@atlaskit/primitives"
17
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
18
- directoryName="primitives"
16
+ name="@atlaskit/primitives"
17
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
18
+ directoryName="primitives"
19
19
  />
20
20
 
21
21
  ## Responsive `css` or `xcss`
22
22
 
23
- Utilize our media queries exposed in `css`, `styled`, or `xcss` as computed keys to build responsive UIs. Learn more about these media query exports in [usage](/components/primitives/responsive/usage).
23
+ Utilize our media queries exposed in `css`, `styled`, or `xcss` as computed keys to build responsive
24
+ UIs. Learn more about these media query exports in [usage](/components/primitives/responsive/usage).
24
25
 
25
26
  ### Using with `xcss`
26
27
 
27
- Please use `xcss` whenever possible to ensure consistency and safety with style overrides. Read more at [xcss](/components/primitives/xcss)
28
+ Please use `xcss` whenever possible to ensure consistency and safety with style overrides. Read more
29
+ at [xcss](/components/primitives/xcss)
28
30
 
29
- <Example
30
- Component={XCSSExample}
31
- packageName="@atlaskit/primitives/responsive"
32
- />
31
+ <Example Component={XCSSExample} packageName="@atlaskit/primitives/responsive" />
33
32
 
34
33
  ### Using with `css`
35
34
 
@@ -37,7 +36,8 @@ Please use `xcss` whenever possible to ensure consistency and safety with style
37
36
 
38
37
  ## Responsive primitives
39
38
 
40
- Consider these shortcuts to writing your own custom media queries. Composing with our primitives will be far quicker and consistent to implement, but may result in excess DOM nodes.
39
+ Consider these shortcuts to writing your own custom media queries. Composing with our primitives
40
+ will be far quicker and consistent to implement, but may result in excess DOM nodes.
41
41
 
42
42
  - [Show](/components/primitives/responsive/show)
43
43
  - [Hide](/components/primitives/responsive/hide)
@@ -6,26 +6,32 @@ order: 2
6
6
 
7
7
  ## Media query helpers
8
8
 
9
- The media query helper object `media.above[breakpoint]` maps to our [breakpoints](/components/primitives/responsive/breakpoints/examples) as a media query for use in CSS-in-JS. `media.above[breakpoint]` targets all viewports **above** (larger than) the min-width of a given breakpoint
9
+ The media query helper object `media.above[breakpoint]` maps to our
10
+ [breakpoints](/components/primitives/responsive/breakpoints/examples) as a media query for use in
11
+ CSS-in-JS. `media.above[breakpoint]` targets all viewports **above** (larger than) the min-width of
12
+ a given breakpoint
10
13
 
11
- These responsive helpers are designed be used in conjunction with [xcss](/components/primitives/xcss). It is recommended that both are used when available as this uses our media queries to allow for safe, responsive styling.
14
+ These responsive helpers are designed be used in conjunction with
15
+ [xcss](/components/primitives/xcss). It is recommended that both are used when available as this
16
+ uses our media queries to allow for safe, responsive styling.
12
17
 
13
18
  ### Basic example
14
19
 
15
- Compose your default styles alongside media overrides in [xcss](/components/primitives/xcss) or `css`.
20
+ Compose your default styles alongside media overrides in [xcss](/components/primitives/xcss) or
21
+ `css`.
16
22
 
17
23
  #### xcss
18
24
 
19
25
  ```tsx
20
26
  const customStyles = xcss({
21
- display: 'none', // hide by default
22
- padding: 'space.100',
23
- [media.above.md]: { display: 'revert' }, // show above md
24
- [media.above.lg]: { padding: 'space.150' }, // increase padding above md
27
+ display: 'none', // hide by default
28
+ padding: 'space.100',
29
+ [media.above.md]: { display: 'revert' }, // show above md
30
+ [media.above.lg]: { padding: 'space.150' }, // increase padding above md
25
31
  });
26
32
 
27
33
  export const Component = ({ children }: { children: ReactNode }) => (
28
- <Box xcss={customStyles}>{children}</Box>
34
+ <Box xcss={customStyles}>{children}</Box>
29
35
  );
30
36
  ```
31
37
 
@@ -33,15 +39,17 @@ export const Component = ({ children }: { children: ReactNode }) => (
33
39
 
34
40
  ```tsx
35
41
  const customStyles = css({
36
- marginBlock: token('space.0'),
37
- [media.above.xs]: { marginBlock: token('space.025') },
38
- [media.above.sm]: { marginBlock: token('space.050') },
39
- [media.above.md]: { marginBlock: token('space.075') },
40
- [media.above.lg]: { marginBlock: token('space.100') },
41
- [media.above.xl]: { marginBlock: token('space.150') },
42
+ marginBlock: token('space.0'),
43
+ [media.above.xs]: { marginBlock: token('space.025') },
44
+ [media.above.sm]: { marginBlock: token('space.050') },
45
+ [media.above.md]: { marginBlock: token('space.075') },
46
+ [media.above.lg]: { marginBlock: token('space.100') },
47
+ [media.above.xl]: { marginBlock: token('space.150') },
42
48
  });
43
49
  ```
44
50
 
45
51
  ### Using media.above
46
52
 
47
- It is important to note that the `media.above.xxs` will **always** match, it is explicitly `'@media all'`. This is only included for easy programmatic usage, but it has a negative performance impact.
53
+ It is important to note that the `media.above.xxs` will **always** match, it is explicitly
54
+ `'@media all'`. This is only included for easy programmatic usage, but it has a negative performance
55
+ impact.
@@ -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
@@ -16,16 +16,17 @@ import StackAs from '../../examples/constellation/stack/as';
16
16
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
17
17
 
18
18
  <CodeDocsHeader
19
- name="@atlaskit/primitives"
20
- repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
21
- directoryName="primitives"
19
+ name="@atlaskit/primitives"
20
+ repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
21
+ directoryName="primitives"
22
22
  />
23
23
 
24
24
  ## Basic
25
25
 
26
26
  Use a stack component to efficiently lay-out a group of elements vertically.
27
27
 
28
- Use the given props to configure display behavior using designs tokens, as shown in the more complex examples below.
28
+ Use the given props to configure display behavior using designs tokens, as shown in the more complex
29
+ examples below.
29
30
 
30
31
  <Example Component={StackBasic} packageName="@atlaskit/primitives/stack" />
31
32
 
@@ -37,17 +38,25 @@ Control spacing between items with the `space` prop.
37
38
 
38
39
  ## Reverse content
39
40
 
40
- `flex-direction: `column-reverse` is a pattern that has [accessibility concerns](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns) so stack doesn't support it.
41
+ `flex-direction: `column-reverse` is a pattern that has
42
+ [accessibility concerns](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns)
43
+ so stack doesn't support it.
41
44
 
42
- If reversing content is required, we generally recommend to use JavaScript to reverse the JSX content thereby preserving the tabbing order.
45
+ If reversing content is required, we generally recommend to use JavaScript to reverse the JSX
46
+ content thereby preserving the tabbing order.
43
47
 
44
- In situations where tabbing order changes based on different breakpoints, then we have [show](/components/primitives/responsive/show/examples) and [hide](/components/primitives/responsive/hide/examples) components that enable switching between different orderings of content.
48
+ In situations where tabbing order changes based on different breakpoints, then we have
49
+ [show](/components/primitives/responsive/show/examples) and
50
+ [hide](/components/primitives/responsive/hide/examples) components that enable switching between
51
+ different orderings of content.
45
52
 
46
- For non-tabbable content that needs to be reversed, `flex-direction: column-reverse` is supported in XCSS. However, please be aware that we may lint against this in the future.
53
+ For non-tabbable content that needs to be reversed, `flex-direction: column-reverse` is supported in
54
+ XCSS. However, please be aware that we may lint against this in the future.
47
55
 
48
56
  ## Alignment
49
57
 
50
- Control the alignment of items using the `alignBlock` and `alignInline` props which control alignment in the vertical and horizontal axis respectively.
58
+ Control the alignment of items using the `alignBlock` and `alignInline` props which control
59
+ alignment in the vertical and horizontal axis respectively.
51
60
 
52
61
  ### Block alignment
53
62
 
@@ -55,20 +64,19 @@ Control the alignment of items using the `alignBlock` and `alignInline` props wh
55
64
 
56
65
  ### Inline alignment
57
66
 
58
- <Example
59
- Component={StackAlignInline}
60
- packageName="@atlaskit/primitives/stack"
61
- />
67
+ <Example Component={StackAlignInline} packageName="@atlaskit/primitives/stack" />
62
68
 
63
69
  ## Spread
64
70
 
65
- Use the `spread` prop to set elements to stay together, spaced at the given value (default behavior) or spread equally in the space available.
71
+ Use the `spread` prop to set elements to stay together, spaced at the given value (default behavior)
72
+ or spread equally in the space available.
66
73
 
67
74
  <Example Component={StackSpread} packageName="@atlaskit/primitives/stack" />
68
75
 
69
76
  ## Width control
70
77
 
71
- By default a `Stack` will have its width influenced by the context where it appears. To control the width use the `grow` prop with the values:
78
+ By default a `Stack` will have its width influenced by the context where it appears. To control the
79
+ width use the `grow` prop with the values:
72
80
 
73
81
  - `hug` (default) to use space only as required by its children, or
74
82
  - `fill` to take all space provided by the parent element.
@@ -83,9 +91,7 @@ It's possible to control the rendered HTML element with the `as` prop.
83
91
 
84
92
  ## Practical use case
85
93
 
86
- An example of how a stack component might be used in product, using Atlassian Design System components.
94
+ An example of how a stack component might be used in product, using Atlassian Design System
95
+ components.
87
96
 
88
- <Example
89
- Component={StackPracticalUseCase}
90
- packageName="@atlaskit/primitives/stack"
91
- />
97
+ <Example Component={StackPracticalUseCase} packageName="@atlaskit/primitives/stack" />
@@ -4,21 +4,29 @@ description: A stack manages the vertical layout of direct children using flexbo
4
4
  order: 2
5
5
  ---
6
6
 
7
- Use the stack component in conjunction with other layout components such as [box](/components/primitives/box/usage) and [inline](/components/primitives/inline/usage) to easily create customized layouts, with built-in guidance from the Atlassian Design System.
7
+ Use the stack component in conjunction with other layout components such as
8
+ [box](/components/primitives/box/usage) and [inline](/components/primitives/inline/usage) to easily
9
+ create customized layouts, with built-in guidance from the Atlassian Design System.
8
10
 
9
- A stack component aligns content vertically on a page or layout, acting as a container that decides the vertical layout of its children. Stack components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. Stack is purely for visual alignment, and should have no opinions about the functionality of its children.
11
+ A stack component aligns content vertically on a page or layout, acting as a container that decides
12
+ the vertical layout of its children. Stack components also decide the specifics of how the children
13
+ are displayed, for example, where they are aligned or how much space is between child elements.
14
+ Stack is purely for visual alignment, and should have no opinions about the functionality of its
15
+ children.
10
16
 
11
- In its simplest form, `Stack` works like a flexbox column, with built-in design token support and guidance.
17
+ In its simplest form, `Stack` works like a flexbox column, with built-in design token support and
18
+ guidance.
12
19
 
13
20
  ```jsx
14
21
  <Stack space="space.100" alignInline="center" alignBlock="start">
15
- ...
22
+ ...
16
23
  </Stack>
17
24
  ```
18
25
 
19
26
  ## Using stack
20
27
 
21
- A stack is primarily a container element controlling how content is displayed and aligned vertically. Use stack any time you wish to lay out elements or components vertically.
28
+ A stack is primarily a container element controlling how content is displayed and aligned
29
+ vertically. Use stack any time you wish to lay out elements or components vertically.
22
30
 
23
31
  These props customize the spacing and styling of any child elements:
24
32
 
@@ -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
@@ -15,34 +15,44 @@ import TextTruncation from '../../examples/constellation/text/text-truncation';
15
15
 
16
16
  ## Basic
17
17
 
18
- Use a Text component for main content. Text typically appears after headings or subheadings as detailed descriptions and messages, but also as standalone text in components.
18
+ Use a Text component for main content. Text typically appears after headings or subheadings as
19
+ detailed descriptions and messages, but also as standalone text in components.
19
20
 
20
21
  The `size` prop expresses the visual appearance of the text element:
21
- - `'large'` is for long-form content. Use this size for a comfortable reading experience such as in blogs.
22
- - `'medium'` is the default size in components or where space is limited, for detailed or descriptive content such as primary descriptions in flags.
23
- - `'small'` should be used sparingly and is for secondary level content such as fine print or semantic messaging.
22
+
23
+ - `'large'` is for long-form content. Use this size for a comfortable reading experience such as in
24
+ blogs.
25
+ - `'medium'` is the default size in components or where space is limited, for detailed or
26
+ descriptive content such as primary descriptions in flags.
27
+ - `'small'` should be used sparingly and is for secondary level content such as fine print or
28
+ semantic messaging.
24
29
 
25
30
  <Example Component={TextBasic} packageName="@atlaskit/primitives" />
26
31
 
27
32
  ## Color
28
33
 
29
- Text uses the `color.text` token which automatically switches colors to be legible across both light and dark modes.
34
+ Text uses the `color.text` token which automatically switches colors to be legible across both light
35
+ and dark modes.
30
36
 
31
- Text will automatically apply the correct inverse color token if placed within a [box component](/components/primitives/box) with a bold background color.
37
+ Text will automatically apply the correct inverse color token if placed within a
38
+ [box component](/components/primitives/box) with a bold background color.
32
39
 
33
40
  <Example Component={TextColorInverse} packageName="@atlaskit/primitives" />
34
41
 
35
- The `color` prop can be used with any text color token. If Text is nested inside another Text component, color will automatically inherit from its parent.
42
+ The `color` prop can be used with any text color token. If Text is nested inside another Text
43
+ component, color will automatically inherit from its parent.
36
44
 
37
45
  <Example Component={TextColorInherit} packageName="@atlaskit/primitives" />
38
46
 
39
47
  ## Font weight
40
48
 
41
- Font weight defaults to regular (400) and can be set using the `weight` prop.
42
- More information about the available weights can be found on the [typography foundations page](/foundations/typography-beta/#body-font-weight).
49
+ Font weight defaults to regular (400) and can be set using the `weight` prop. More information about
50
+ the available weights can be found on the
51
+ [typography foundations page](/foundations/typography-beta/#body-font-weight).
43
52
 
44
- Note: Text supports the semibold weight, however due to differences between font stacks across different operating systems, semibold text may render as bold.
45
- We recommend using regular, medium, and bold for the best results.
53
+ Note: Text supports the semibold weight, however due to differences between font stacks across
54
+ different operating systems, semibold text may render as bold. We recommend using regular, medium,
55
+ and bold for the best results.
46
56
 
47
57
  <Example Component={TextWeight} packageName="@atlaskit/primitives" />
48
58
 
@@ -54,15 +64,18 @@ Text can be aligned using the `align` prop.
54
64
 
55
65
  ## Rendered HTML element
56
66
 
57
- Text renders a HTML `<span>` element by default. Use the `as` prop to change the rendered HTML element.
67
+ Text renders a HTML `<span>` element by default. Use the `as` prop to change the rendered HTML
68
+ element.
58
69
 
59
70
  <Example Component={TextAsElement} packageName="@atlaskit/primitives" />
60
71
 
61
72
  ## Arrangement with other text styles
62
73
 
63
- Text does not apply any vertical margin or spacing. To control space between text and other content, use a [stack component](/components/primitives/stack).
74
+ Text does not apply any vertical margin or spacing. To control space between text and other content,
75
+ use a [stack component](/components/primitives/stack).
64
76
 
65
- The available values for paragraph spacing are outlined in the [Typography foundations](/foundations/typography-beta/#body) page.
77
+ The available values for paragraph spacing are outlined in the
78
+ [Typography foundations](/foundations/typography-beta/#body) page.
66
79
 
67
80
  <Example Component={TextSpacing} packageName="@atlaskit/primitives" />
68
81
 
@@ -70,6 +83,7 @@ The available values for paragraph spacing are outlined in the [Typography found
70
83
 
71
84
  Truncation in product experiences [should be avoided](/content/language-and-grammar/#truncation).
72
85
 
73
- However if truncation cannot be avoided, for example when displaying user-generated content, use the `maxLines` prop to indicate how text should be truncated.
86
+ However if truncation cannot be avoided, for example when displaying user-generated content, use the
87
+ `maxLines` prop to indicate how text should be truncated.
74
88
 
75
89
  <Example Component={TextTruncation} packageName="@atlaskit/primitives" />