Skip to content

Commit

Permalink
Merge branch 'master' into docs-icon-keyword-search
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltaranto authored Oct 28, 2024
2 parents 07e06eb + 1422b36 commit 68ab071
Show file tree
Hide file tree
Showing 20 changed files with 426 additions and 40 deletions.
12 changes: 12 additions & 0 deletions .changeset/loud-wasps-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'braid-design-system': patch
---

---
updated:
- useToast
---

**useToast**: Ensure content is left aligned

Applies left alignment to `Toast` content to ensure intended alignment, regardless of other styles applied.
12 changes: 12 additions & 0 deletions .changeset/polite-donkeys-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'braid-design-system': patch
---

---
updated:
- IconRocket
---

**IconRocket:** Update design

Update the design asset for `IconRocket`
17 changes: 17 additions & 0 deletions .changeset/soft-bees-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'braid-design-system': minor
---

---
new:
- IconAttachment
---

**IconAttachment:** Add component

Add `IconAttachment` to icon suite

**EXAMPLE USAGE:**
```jsx
<IconAttachment />
```
21 changes: 21 additions & 0 deletions .changeset/wet-bananas-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'braid-design-system': minor
---

---
updated:
- Disclosure
---

**Disclosure:** Add `size` support

Introduce the `size` prop to the `Disclosure` component, providing the same options as the `Text` component.

**EXAMPLE USAGE:**
```jsx
<Disclosure
size="small"
>
...
</Disclosure>
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"volta": {
"node": "20.18.0"
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].2",
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
Expand Down
3 changes: 3 additions & 0 deletions packages/braid-design-system/icons/attachment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion packages/braid-design-system/icons/rocket.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type { ComponentDocs } from 'site/types';
import { Disclosure, Text, TextLink, Strong } from '..';
import { Disclosure, Text, TextLink, Strong, Stack, Notice } from '..';
import source from '@braid-design-system/source.macro';

const docs: ComponentDocs = {
Expand Down Expand Up @@ -43,53 +43,123 @@ const docs: ComponentDocs = {
],
additional: [
{
label: 'Custom space',
label: 'Visual weight',
description: (
<Text>
The space between the disclosure label and content can be customised
via the <Strong>space</Strong> prop.
By default, the call to action will have the same affordance as{' '}
<TextLink href="/components/TextLinkButton">TextLinkButton</TextLink>.
Optionally, the visual weight can be decreased by setting{' '}
<Strong>weight</Strong> to <Strong>weak</Strong>.
</Text>
),
Example: ({ id, setDefaultState, getState, setState }) =>
source(
<>
{setDefaultState('expanded', true)}
{setDefaultState('expanded', false)}

<Disclosure
id={id}
weight="weak"
expandLabel="Show content"
collapseLabel="Hide content"
expanded={getState('expanded')}
onToggle={setState('expanded')}
space="small"
>
<Text>Content</Text>
</Disclosure>
</>,
),
},
{
label: 'Visual weight',
label: 'Sizing',
description: (
<>
<Text>
The size can be customised via the <Strong>size</Strong> prop, which
accepts the same sizes as the{' '}
<TextLink href="/components/Text">Text</TextLink> component.
</Text>
<Notice>
<Text>
The provided <Strong>size</Strong> will also be used as the
default size for <TextLink href="/components/Text">Text</TextLink>{' '}
components within the content of the disclosure.
</Text>
</Notice>
</>
),
Example: ({ id, handler }) =>
source(
<Stack space="large">
<Disclosure
id={`${id}_1`}
expandLabel="Large size"
size="large"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>large</Strong> text size
</Text>
</Disclosure>
<Disclosure
id={`${id}_2`}
expandLabel="Standard size"
size="standard"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>standard</Strong> text size
</Text>
</Disclosure>
<Disclosure
id={`${id}_3`}
expandLabel="Small size"
size="small"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>small</Strong> text size
</Text>
</Disclosure>
<Disclosure
id={`${id}_4`}
expandLabel="Xsmall size"
size="xsmall"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>xsmall</Strong> text size
</Text>
</Disclosure>
</Stack>,
),
},
{
label: 'Custom space',
description: (
<Text>
By default, the call to action will have the same affordance as{' '}
<TextLink href="/components/TextLinkButton">TextLinkButton</TextLink>.
Optionally, the visual weight can be decreased by setting{' '}
<Strong>weight</Strong> to <Strong>weak</Strong>.
The default space between the disclosure label and content will be
determined by the <TextLink href="#sizing">size</TextLink>.
Alternatively, this can be customised via the <Strong>space</Strong>{' '}
prop.
</Text>
),
Example: ({ id, setDefaultState, getState, setState }) =>
source(
<>
{setDefaultState('expanded', false)}
{setDefaultState('expanded', true)}

<Disclosure
id={id}
weight="weak"
expandLabel="Show content"
collapseLabel="Hide content"
expanded={getState('expanded')}
onToggle={setState('expanded')}
space="large"
>
<Text>Content</Text>
</Disclosure>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import type { GalleryComponent } from 'site/types';
import { Disclosure } from '..';
import { Disclosure, Stack, Strong, Text } from '..';
import source from '@braid-design-system/source.macro';
import { Placeholder } from '../../playroom/components';

export const galleryItems: GalleryComponent = {
examples: [
{
label: 'Standard',
Example: ({ id }) =>
source(
<Disclosure
Expand All @@ -18,5 +19,80 @@ export const galleryItems: GalleryComponent = {
</Disclosure>,
),
},
{
label: 'Visual weight',
Example: ({ id }) =>
source(
<Stack space="large">
<Disclosure
id={`${id}_1`}
expandLabel="Regular weight"
weight="regular"
>
<Placeholder height={100} />
</Disclosure>
<Disclosure
id={`${id}_2`}
expandLabel="Weak weight"
size="standard"
weight="weak"
>
<Placeholder height={100} />
</Disclosure>
</Stack>,
),
},
{
label: 'Sizing',
Example: ({ id, handler }) =>
source(
<Stack space="large">
<Disclosure
id={`${id}_1`}
expandLabel="Large size"
size="large"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>large</Strong> text size
</Text>
</Disclosure>
<Disclosure
id={`${id}_2`}
expandLabel="Standard size"
size="standard"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>standard</Strong> text size
</Text>
</Disclosure>
<Disclosure
id={`${id}_3`}
expandLabel="Small size"
size="small"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>small</Strong> text size
</Text>
</Disclosure>
<Disclosure
id={`${id}_4`}
expandLabel="Xsmall size"
size="xsmall"
expanded={true}
onToggle={handler}
>
<Text>
Defaults to <Strong>xsmall</Strong> text size
</Text>
</Disclosure>
</Stack>,
),
},
],
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import React, { type ReactNode } from 'react';
import type { ComponentScreenshot } from 'site/types';
import { Disclosure, Text } from '../';
import { Disclosure, Stack, Text } from '../';
import { Box } from '../Box/Box';
import { textSizeUntrimmed } from '../../css/typography.css';

const Container = ({ children }: { children: ReactNode }) => (
<Box style={{ maxWidth: 250 }}>{children}</Box>
);

const textSizes = Object.keys(textSizeUntrimmed) as Array<
keyof typeof textSizeUntrimmed
>;

export const screenshots: ComponentScreenshot = {
screenshotWidths: [320],
examples: [
Expand Down Expand Up @@ -182,5 +187,46 @@ export const screenshots: ComponentScreenshot = {
</Text>
),
},
{
label: 'Sizes and default spacing',
Example: ({ id, handler }) => (
<Stack space="large">
{textSizes.map((size) => (
<Disclosure
key={size}
id={`${id}_${size}`}
expandLabel={`${size.charAt(0).toUpperCase()}${size.slice(
1,
)} size`}
size={size}
expanded={true}
onToggle={handler}
>
<Text>Defaults to {size} text size</Text>
</Disclosure>
))}
</Stack>
),
},
{
label: 'Inline: Sizes and default spacing',
Example: ({ id, handler }) => (
<Stack space="large">
{textSizes.map((size) => (
<Text size={size} key={size}>
Inline disclosure in{' '}
<Disclosure
id={`${id}_${size}`}
expandLabel={`${size} size`}
expanded={true}
onToggle={handler}
>
Defaults to {size} text size
</Disclosure>
</Text>
))}
</Stack>
),
},
],
};
Loading

0 comments on commit 68ab071

Please sign in to comment.