@hyphen/hyphen-components 7.7.0 → 7.8.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.
- package/dist/css/fonts.css +3 -3
- package/dist/css/index.css +108 -108
- package/dist/css/reset.css +3 -3
- package/dist/css/utilities.css +7 -7
- package/dist/css/variables.css +60 -62
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +44 -2
- package/package.json +21 -36
- package/src/components/FormControl/FormControl.stories.tsx +92 -0
- package/src/components/Heading/Heading.tsx +2 -2
- package/src/components/HelpText/HelpText.stories.tsx +45 -0
- package/src/components/InputValidationMessage/InputValidationMessage.stories.tsx +50 -0
- package/src/components/Sidebar/Sidebar.mdx +208 -0
- package/src/components/Sidebar/Sidebar.stories.tsx +13 -0
- package/src/components/Sidebar/Sidebar.tsx +42 -0
- package/src/docs/Brands.mdx +14 -12
- package/src/docs/DesignTokens.mdx +1 -1
- package/src/docs/intro.mdx +1 -1
|
@@ -243,9 +243,26 @@ function useSidebar(sideOverride?: SidebarSide) {
|
|
|
243
243
|
const SidebarProvider = forwardRef<
|
|
244
244
|
HTMLDivElement,
|
|
245
245
|
React.ComponentProps<'div'> & {
|
|
246
|
+
/**
|
|
247
|
+
* Initial open state for uncontrolled usage. Pass a boolean for both
|
|
248
|
+
* sides, or `{ left, right }` to set each side independently.
|
|
249
|
+
*/
|
|
246
250
|
defaultOpen?: SidebarOpenValue;
|
|
251
|
+
/**
|
|
252
|
+
* Controlled open state. Pass a boolean for both sides, or
|
|
253
|
+
* `{ left, right }` to control each side independently.
|
|
254
|
+
*/
|
|
247
255
|
open?: SidebarOpenValue;
|
|
256
|
+
/**
|
|
257
|
+
* localStorage key(s) the open state is written to when a sidebar is
|
|
258
|
+
* toggled. A string applies to the left sidebar, with `_right` appended
|
|
259
|
+
* for the right sidebar; pass `{ left, right }` to set each explicitly.
|
|
260
|
+
*/
|
|
248
261
|
storageKey?: SidebarStorageKey;
|
|
262
|
+
/**
|
|
263
|
+
* Called when a sidebar is toggled, with the new open state and which
|
|
264
|
+
* side was toggled.
|
|
265
|
+
*/
|
|
249
266
|
onOpenChange?: (open: boolean, side?: SidebarSide) => void;
|
|
250
267
|
}
|
|
251
268
|
>(
|
|
@@ -368,7 +385,15 @@ SidebarProvider.displayName = 'SidebarProvider';
|
|
|
368
385
|
const Sidebar = React.forwardRef<
|
|
369
386
|
HTMLDivElement,
|
|
370
387
|
React.ComponentProps<'div'> & {
|
|
388
|
+
/**
|
|
389
|
+
* Which edge of the viewport the sidebar is attached to.
|
|
390
|
+
*/
|
|
371
391
|
side?: 'left' | 'right';
|
|
392
|
+
/**
|
|
393
|
+
* Collapse behavior when the sidebar is toggled closed: slide fully out
|
|
394
|
+
* of view (`offcanvas`), collapse to a narrow icon strip (`icon`), or
|
|
395
|
+
* stay at full width (`none`).
|
|
396
|
+
*/
|
|
372
397
|
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
373
398
|
}
|
|
374
399
|
>(
|
|
@@ -498,7 +523,14 @@ Sidebar.displayName = 'Sidebar';
|
|
|
498
523
|
const SidebarTrigger = React.forwardRef<
|
|
499
524
|
React.ElementRef<typeof Button>,
|
|
500
525
|
React.ComponentProps<typeof Button> & {
|
|
526
|
+
/**
|
|
527
|
+
* Which sidebar to toggle. Defaults to the side of the containing
|
|
528
|
+
* Sidebar, or `left` outside of one.
|
|
529
|
+
*/
|
|
501
530
|
side?: SidebarSide;
|
|
531
|
+
/**
|
|
532
|
+
* Icon shown on the trigger button.
|
|
533
|
+
*/
|
|
502
534
|
iconName?: IconName;
|
|
503
535
|
}
|
|
504
536
|
>(({ className, onClick, side, iconName = 'dock-left', ...props }, ref) => {
|
|
@@ -642,8 +674,18 @@ SidebarMenuItem.displayName = 'SidebarMenuItem';
|
|
|
642
674
|
const SidebarMenuButton = React.forwardRef<
|
|
643
675
|
HTMLButtonElement,
|
|
644
676
|
React.ComponentProps<'button'> & {
|
|
677
|
+
/**
|
|
678
|
+
* Render the child element (e.g. a router link) instead of a `button`.
|
|
679
|
+
*/
|
|
645
680
|
asChild?: boolean;
|
|
681
|
+
/**
|
|
682
|
+
* Marks the item as the current page.
|
|
683
|
+
*/
|
|
646
684
|
isActive?: boolean;
|
|
685
|
+
/**
|
|
686
|
+
* Tooltip shown when the sidebar is collapsed to icons (desktop only).
|
|
687
|
+
* Pass a string, or TooltipContent props for full control.
|
|
688
|
+
*/
|
|
647
689
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
648
690
|
}
|
|
649
691
|
>(
|
package/src/docs/Brands.mdx
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
import logos from '@hyphen/hyphen-design-tokens/build/assets/images/react';
|
|
4
|
+
|
|
5
|
+
export const HyphenLogoHorizontalRgbPositive = logos['hyphen-logo-horizontal-rgb-positive'];
|
|
6
|
+
export const HyphenLogoHorizontalRgbNegative = logos['hyphen-logo-horizontal-rgb-negative'];
|
|
7
|
+
export const HyphenLogoHorizontalBlack = logos['hyphen-logo-horizontal-black'];
|
|
8
|
+
export const HyphenLogoHorizontalWhite = logos['hyphen-logo-horizontal-white'];
|
|
9
|
+
export const EnvLogoRgbPositive = logos['env-logo-rgb-positive'];
|
|
10
|
+
export const EnvLogoRgbNegative = logos['env-logo-rgb-negative'];
|
|
11
|
+
export const LinkLogoRgbPositive = logos['link-logo-rgb-positive'];
|
|
12
|
+
export const LinkLogoRgbNegative = logos['link-logo-rgb-negative'];
|
|
13
|
+
export const ToggleLogoHorizontalRgbPositive = logos['toggle-logo-horizontal-rgb-positive'];
|
|
14
|
+
export const ToggleLogoHorizontalRgbNegative = logos['toggle-logo-horizontal-rgb-negative'];
|
|
15
|
+
export const DeployLogoHorizontalPositive = logos['deploy-logo-horizontal-positive'];
|
|
16
|
+
export const DeployLogoHorizontalNegative = logos['deploy-logo-horizontal-negative'];
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
import { Box } from '../components/Box/Box';
|
|
@@ -13,7 +13,7 @@ We use [Style Dictionary](https://amzn.github.io/style-dictionary/) to generate
|
|
|
13
13
|
|
|
14
14
|
## Source on Github
|
|
15
15
|
|
|
16
|
-
[Hyphen Design Tokens](https://github.com/
|
|
16
|
+
[Hyphen Design Tokens](https://github.com/Hyphen/hyphen-components/tree/main/packages/design-tokens) are available as an [npm package](https://www.npmjs.com/package/@hyphen/hyphen-design-tokens) so that you can create a Hyphen unified product experience for your platform of choice.
|
|
17
17
|
|
|
18
18
|
## Border Radius
|
|
19
19
|
|
package/src/docs/intro.mdx
CHANGED
|
@@ -7,6 +7,6 @@ import { Meta } from '@storybook/addon-docs/blocks';
|
|
|
7
7
|
Welcome to the Hyphen Design System, whose purpose is to help us deliver high quality Hyphen branded applications, faster and better. It consists of the following:
|
|
8
8
|
|
|
9
9
|
- [Hyphen Components](https://github.com/hyphen/hyphen-components) - an open source, react-based, component library for Hyphen applications and websites.
|
|
10
|
-
- [Hyphen Design Tokens](https://github.com/
|
|
10
|
+
- [Hyphen Design Tokens](https://github.com/Hyphen/hyphen-components/tree/main/packages/design-tokens) - A central location to store shared attributes of the Hyphen Design System. These include things like color, fonts, spacing, and more.
|
|
11
11
|
|
|
12
12
|
❤️ The Hyphen Team
|