├── .all-contributorsrc
├── .browserslistrc
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── npm-publish.yml
│ └── storybook-deploy.yml
├── .gitignore
├── .npmrc
├── .storybook
├── main.ts
├── preview.ts
└── styles.css
├── .stylelintrc
├── .vscode
└── settings.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── components
├── Accessibility
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── Accessibility.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── Accordion
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── Accordion.stories.tsx
│ │ ├── Accordion.test.tsx
│ │ ├── __snapshots__
│ │ │ └── Accordion.test.tsx.snap
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── BundleSize
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── BundleSize.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── DesignSpec
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── DesignSpec.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── Guideline
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── Guideline.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── IntendedUsage
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── IntendedUsage.module.css
│ │ ├── IntendedUsage.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── RelatedComponents
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── RelatedComponents.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── ResponsiveStory
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── ResponsiveStory.module.css
│ │ ├── ResponsiveStory.stories.tsx
│ │ ├── devices.min.css
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── Row
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── Row.module.css
│ │ ├── Row.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── Shield
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── Shield.module.css
│ │ ├── Shield.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── ShieldRow
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── ShieldRow.module.css
│ │ ├── ShieldRow.stories.tsx
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── Tabs
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ │ ├── Tabs.module.css
│ │ ├── Tabs.stories.tsx
│ │ ├── Tabs.test.tsx
│ │ ├── __snapshots__
│ │ │ └── Tabs.test.tsx.snap
│ │ ├── index.tsx
│ │ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
└── Version
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ ├── Version.stories.mdx
│ ├── Version.stories.tsx
│ └── index.tsx
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ ├── vite-env.d.ts
│ └── vite.config.ts
├── eslint.config.js
├── example
├── Example.mdx
├── Example.stories.tsx
├── package.json
└── yarn.lock
├── jest.config.js
├── lerna.json
├── media
└── logo-mark.svg
├── package.json
├── packages
└── doc-blocks
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── jest.config.js
│ ├── package.json
│ ├── src
│ ├── index.tsx
│ └── vite-env.d.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── renovate.json
├── tsconfig.build.json
├── tsconfig.json
├── vite.config.ts
└── yarn.lock
/.all-contributorsrc:
--------------------------------------------------------------------------------
1 | {
2 | "projectName": "doc-blocks",
3 | "projectOwner": "intuit",
4 | "repoType": "github",
5 | "repoHost": "https://github.com",
6 | "files": [
7 | "README.md"
8 | ],
9 | "imageSize": 100,
10 | "commit": true,
11 | "commitConvention": "none",
12 | "contributors": [
13 | {
14 | "login": "hipstersmoothie",
15 | "name": "Andrew Lisowski",
16 | "avatar_url": "https://avatars3.githubusercontent.com/u/1192452?v=4",
17 | "profile": "http://hipstersmoothie.com/",
18 | "contributions": [
19 | "code",
20 | "doc",
21 | "example",
22 | "infra"
23 | ]
24 | },
25 | {
26 | "login": "kharrop",
27 | "name": "Kelly Harrop",
28 | "avatar_url": "https://avatars0.githubusercontent.com/u/24794756?v=4",
29 | "profile": "https://github.com/kharrop",
30 | "contributions": [
31 | "doc",
32 | "code"
33 | ]
34 | },
35 | {
36 | "login": "kendallgassner",
37 | "name": "Kendall Gassner",
38 | "avatar_url": "https://avatars.githubusercontent.com/u/15275462?v=4",
39 | "profile": "https://github.com/kendallgassner",
40 | "contributions": [
41 | "code"
42 | ]
43 | },
44 | {
45 | "login": "fattslug",
46 | "name": "Sean Powell",
47 | "avatar_url": "https://avatars.githubusercontent.com/u/18297343?v=4",
48 | "profile": "https://github.com/fattslug",
49 | "contributions": [
50 | "doc",
51 | "example",
52 | "test",
53 | "code",
54 | "infra"
55 | ]
56 | },
57 | {
58 | "login": "NoWorries",
59 | "name": "Josh Harwood",
60 | "avatar_url": "https://avatars.githubusercontent.com/u/803064?v=4",
61 | "profile": "https://github.com/NoWorries",
62 | "contributions": [
63 | "code"
64 | ]
65 | }
66 | ],
67 | "contributorsPerLine": 7
68 | }
69 |
--------------------------------------------------------------------------------
/.browserslistrc:
--------------------------------------------------------------------------------
1 | ie >= 10
2 | Edge >= 12
3 | Firefox >= 11
4 | Chrome >= 4
5 | Opera >= 30
6 | Safari >= 5
7 | iOS >= 5
8 | Android >= 4.0
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ""
5 | labels: bug
6 | assignees: ""
7 | ---
8 |
9 | **Describe the bug**
10 |
11 |
12 |
13 | **To Reproduce**
14 |
15 |
16 |
17 |
18 |
19 | **Expected behavior**
20 |
21 |
22 |
23 | **Screenshots**
24 |
25 |
26 |
27 | **Environment information:**
28 |
29 |
30 |
31 | ```txt
32 |
33 | ```
34 |
35 | **Additional context**
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ""
5 | labels: enhancement
6 | assignees: ""
7 | ---
8 |
9 | **Is your feature request related to a problem? Please describe.**
10 |
11 |
12 |
13 | **Describe the solution you'd like**
14 |
15 |
16 |
17 | **Describe alternatives you've considered**
18 |
19 |
20 |
21 | **Additional context**
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # What Changed
2 |
3 | ## Why
4 |
5 | Todo:
6 |
7 | - [ ] Add tests
8 | - [ ] Add docs
9 |
10 | ## Change Type
11 |
12 | Indicate the type of change your pull request is:
13 |
14 | - [ ] `documentation`
15 | - [ ] `patch`
16 | - [ ] `minor`
17 | - [ ] `major`
18 |
--------------------------------------------------------------------------------
/.github/workflows/npm-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3 |
4 | name: Node.js Package
5 |
6 | on:
7 | pull_request:
8 | types: [opened, synchronize, reopened]
9 | release:
10 | types: [created]
11 | push:
12 | branches:
13 | - "master"
14 |
15 | jobs:
16 | build-publish:
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: actions/checkout@v4
20 | - uses: actions/setup-node@v4
21 | with:
22 | node-version: 22
23 | cache: "yarn"
24 | - name: Install dependencies
25 | run: yarn install
26 | - name: Test
27 | run: yarn test
28 | - name: Build
29 | run: yarn build
30 | - name: Prepare repository
31 | run: git fetch --unshallow --tags
32 | - name: Release
33 | env:
34 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36 | GH_TOKEN: ${{ secrets.GH_TOKEN }}
37 | PR: ${{ steps.PR.outputs.number }}
38 | run: yarn release
39 |
--------------------------------------------------------------------------------
/.github/workflows/storybook-deploy.yml:
--------------------------------------------------------------------------------
1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3 |
4 | name: Storybook Deployment
5 |
6 | on:
7 | push:
8 | branches:
9 | - "master"
10 |
11 | permissions:
12 | contents: read
13 | pages: write
14 | id-token: write
15 |
16 | jobs:
17 | storybook-publish:
18 | environment:
19 | name: github-pages
20 | url: ${{ steps.build-publish.outputs.page_url }}
21 | runs-on: ubuntu-latest
22 | steps:
23 | - uses: actions/checkout@v4
24 | with:
25 | fetch-depth: 0
26 | - uses: actions/setup-node@v4
27 | with:
28 | node-version: 22
29 | cache: "yarn"
30 | - name: Install
31 | run: yarn install
32 | - name: Build
33 | run: yarn build
34 | - name: Deploy Storybook
35 | uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3
36 | with:
37 | path: storybook-static
38 | install_command: yarn install
39 | build_command: yarn build:storybook
40 | checkout: false
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.swp
3 | .idea
4 | node_modules
5 | report
6 | dist/
7 | commonjs/
8 | module/
9 | target/
10 | npm-debug.log
11 | npm-shrinkwrap.json
12 | *.iml
13 | jsconfig.json
14 | .vscode/*
15 | !.vscode/settings.json
16 | _node
17 | .nyc_output
18 | yarn-error.log
19 | package-lock.json
20 | lerna-debug.log
21 | coverage/
22 | junit.xml
23 | out/
24 | bundle-master
25 | bundle-pr
26 | diff.html
27 | roleFile
28 | core.*
29 | .env
30 | .eslintcache
31 | tsconfig.tsbuildinfo
32 |
33 | *storybook.log
34 | storybook-static/
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | save-exact=true
2 | registry=https://registry.npmjs.com
--------------------------------------------------------------------------------
/.storybook/main.ts:
--------------------------------------------------------------------------------
1 | import type { StorybookConfig } from "@storybook/react-vite";
2 | import { join, dirname } from "path";
3 |
4 | /**
5 | * This function is used to resolve the absolute path of a package.
6 | * It is needed in projects that use Yarn PnP or are set up within a monorepo.
7 | */
8 | function getAbsolutePath(value: string): any {
9 | return dirname(require.resolve(join(value, "package.json")));
10 | }
11 | const config: StorybookConfig = {
12 | stories: ["../components/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
13 | core: {
14 | builder: "@storybook/builder-vite",
15 | },
16 | addons: [getAbsolutePath("@chromatic-com/storybook")],
17 | framework: {
18 | name: getAbsolutePath("@storybook/react-vite"),
19 | options: {},
20 | },
21 | };
22 | export default config;
23 |
--------------------------------------------------------------------------------
/.storybook/preview.ts:
--------------------------------------------------------------------------------
1 | import type { Preview } from "@storybook/react";
2 | import "./styles.css";
3 |
4 | const preview: Preview = {
5 | parameters: {
6 | controls: {
7 | matchers: {
8 | color: /(background|color)$/i,
9 | date: /Date$/i,
10 | },
11 | },
12 | },
13 | };
14 |
15 | export default preview;
16 |
--------------------------------------------------------------------------------
/.storybook/styles.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
3 | Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
4 | "Segoe UI Symbol";
5 | }
6 |
--------------------------------------------------------------------------------
/.stylelintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["@design-systems/stylelint-config"]
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "workbench.colorCustomizations": {
3 | "activityBar.activeBackground": "#a979f2",
4 | "activityBar.activeBorder": "#f7c7a8",
5 | "activityBar.background": "#a979f2",
6 | "activityBar.foreground": "#15202b",
7 | "activityBar.inactiveForeground": "#15202b99",
8 | "activityBarBadge.background": "#f7c7a8",
9 | "activityBarBadge.foreground": "#15202b",
10 | "statusBar.background": "#8b4aee",
11 | "statusBar.foreground": "#e7e7e7",
12 | "statusBarItem.hoverBackground": "#a979f2",
13 | "titleBar.activeBackground": "#8b4aee",
14 | "titleBar.activeForeground": "#e7e7e7",
15 | "titleBar.inactiveBackground": "#8b4aee99",
16 | "titleBar.inactiveForeground": "#e7e7e799",
17 | "editorGroup.border": "#a979f2",
18 | "panel.border": "#a979f2",
19 | "sash.hoverBorder": "#a979f2",
20 | "sideBar.border": "#a979f2",
21 | "statusBarItem.remoteBackground": "#8b4aee",
22 | "statusBarItem.remoteForeground": "#e7e7e7"
23 | },
24 | "peacock.color": "#8b4aee"
25 | }
26 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.0.0 (Wed Jul 02 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - `@doc-blocks/accordion`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/tabs`, `@doc-blocks/all`
6 | - feat: bump to storybook 9 [#36](https://github.com/intuit/doc-blocks/pull/36) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
7 |
8 | #### Authors: 2
9 |
10 | - Sean Powell ([@fattslug](https://github.com/fattslug))
11 | - spowell9 (sean_powell@intuit.com)
12 |
13 | ---
14 |
15 | # v1.0.0 (Thu May 01 2025)
16 |
17 | #### 💥 Breaking Change
18 |
19 | - `@doc-blocks/accessibility`, `@doc-blocks/accordion`, `@doc-blocks/bundle-size`, `@doc-blocks/design-spec`, `@doc-blocks/guideline`, `@doc-blocks/intended-usage`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/row`, `@doc-blocks/shield`, `@doc-blocks/shield-row`, `@doc-blocks/tabs`, `@doc-blocks/version`, `@doc-blocks/doc-blocks`
20 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
21 |
22 | #### 🐛 Bug Fix
23 |
24 | - fix: publish on master push [#35](https://github.com/intuit/doc-blocks/pull/35) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
25 |
26 | #### Authors: 2
27 |
28 | - Sean Powell ([@fattslug](https://github.com/fattslug))
29 | - spowell9 (sean_powell@intuit.com)
30 |
31 | ---
32 |
33 | # v0.8.15 (Mon Jul 25 2022)
34 |
35 | #### 🐛 Bug Fix
36 |
37 | - `@doc-blocks/tabs`
38 | - add missing peer deps [#26](https://github.com/intuit/doc-blocks/pull/26) ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 |
40 | #### Authors: 1
41 |
42 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
43 |
44 | ---
45 |
46 | # v0.8.14 (Mon Jul 25 2022)
47 |
48 | #### 🐛 Bug Fix
49 |
50 | - `@doc-blocks/accordion`, `@doc-blocks/guideline`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`
51 | - add missing peer deps [#25](https://github.com/intuit/doc-blocks/pull/25) ([@hipstersmoothie](https://github.com/hipstersmoothie))
52 |
53 | #### Authors: 1
54 |
55 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
56 |
57 | ---
58 |
59 | # v0.8.13 (Tue Mar 08 2022)
60 |
61 | #### 🐛 Bug Fix
62 |
63 | - `@doc-blocks/guideline`
64 | - Update index.tsx [#24](https://github.com/intuit/doc-blocks/pull/24) ([@NoWorries](https://github.com/NoWorries))
65 |
66 | #### Authors: 1
67 |
68 | - Josh Harwood ([@NoWorries](https://github.com/NoWorries))
69 |
70 | ---
71 |
72 | # v0.8.12 (Mon Nov 15 2021)
73 |
74 | #### 🐛 Bug Fix
75 |
76 | - `@doc-blocks/accordion`
77 | - Adding styled-components dependency to Accordion [#22](https://github.com/intuit/doc-blocks/pull/22) (sean_powell@intuit.com)
78 |
79 | #### Authors: 1
80 |
81 | - Sean Powell ([@fattslug](https://github.com/fattslug))
82 |
83 | ---
84 |
85 | # v0.8.11 (Thu Oct 21 2021)
86 |
87 | #### 🐛 Bug Fix
88 |
89 | - `@doc-blocks/accordion`
90 | - Removing width and horizontal padding from accordion panel [#21](https://github.com/intuit/doc-blocks/pull/21) ([@kharrop](https://github.com/kharrop))
91 |
92 | #### Authors: 1
93 |
94 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
95 |
96 | ---
97 |
98 | # v0.8.10 (Thu Oct 21 2021)
99 |
100 | #### 🐛 Bug Fix
101 |
102 | - `@doc-blocks/accordion`
103 | - Adding className support for accordion [#19](https://github.com/intuit/doc-blocks/pull/19) ([@kharrop](https://github.com/kharrop))
104 |
105 | #### Authors: 1
106 |
107 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
108 |
109 | ---
110 |
111 | # v0.8.9 (Mon Oct 18 2021)
112 |
113 | #### 🐛 Bug Fix
114 |
115 | - `@doc-blocks/accordion`, `@doc-blocks/tabs`
116 | - Adding option for external tab state [#18](https://github.com/intuit/doc-blocks/pull/18) (sean_powell@intuit.com)
117 |
118 | #### Authors: 1
119 |
120 | - Sean Powell ([@fattslug](https://github.com/fattslug))
121 |
122 | ---
123 |
124 | # v0.8.8 (Thu Oct 14 2021)
125 |
126 | #### 🐛 Bug Fix
127 |
128 | - `@doc-blocks/accordion`, `@doc-blocks/tabs`
129 | - Updating Tabs & Accordion exports [#17](https://github.com/intuit/doc-blocks/pull/17) (sean_powell@intuit.com)
130 |
131 | #### Authors: 1
132 |
133 | - Sean Powell ([@fattslug](https://github.com/fattslug))
134 |
135 | ---
136 |
137 | # v0.8.7 (Tue Oct 05 2021)
138 |
139 | #### 🐛 Bug Fix
140 |
141 | - `@doc-blocks/accordion`, `doc-blocks`
142 | - Updating exports to include tabs and accordion [#16](https://github.com/intuit/doc-blocks/pull/16) (sean_powell@intuit.com)
143 |
144 | #### Authors: 1
145 |
146 | - Sean Powell ([@fattslug](https://github.com/fattslug))
147 |
148 | ---
149 |
150 | # v0.8.6 (Mon Oct 04 2021)
151 |
152 | #### 🐛 Bug Fix
153 |
154 | - `@doc-blocks/accordion`
155 | - Creating Accordion component [#14](https://github.com/intuit/doc-blocks/pull/14) (sean_powell@intuit.com)
156 | - `@doc-blocks/tabs`
157 | - Adding Tabs onChange handler [#15](https://github.com/intuit/doc-blocks/pull/15) (sean_powell@intuit.com)
158 |
159 | #### Authors: 1
160 |
161 | - Sean Powell ([@fattslug](https://github.com/fattslug))
162 |
163 | ---
164 |
165 | # v0.8.5 (Fri Aug 13 2021)
166 |
167 | #### 🐛 Bug Fix
168 |
169 | - `@doc-blocks/row`
170 | - Adding `align` prop [#12](https://github.com/intuit/doc-blocks/pull/12) ([@kharrop](https://github.com/kharrop))
171 |
172 | #### Authors: 1
173 |
174 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
175 |
176 | ---
177 |
178 | # v0.8.4 (Fri Aug 13 2021)
179 |
180 | #### 🐛 Bug Fix
181 |
182 | - `@doc-blocks/tabs`
183 | - Adding tabs component [#13](https://github.com/intuit/doc-blocks/pull/13) (sean_powell@intuit.com)
184 |
185 | #### 📝 Documentation
186 |
187 | - New logo mark [#11](https://github.com/intuit/doc-blocks/pull/11) ([@kharrop](https://github.com/kharrop))
188 |
189 | #### Authors: 2
190 |
191 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
192 | - Sean Powell ([@fattslug](https://github.com/fattslug))
193 |
194 | ---
195 |
196 | # v0.8.3 (Mon May 24 2021)
197 |
198 | #### 🐛 Bug Fix
199 |
200 | - `@doc-blocks/gallery`, `@doc-blocks/guideline`, `@doc-blocks/intended-usage`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/row`, `@doc-blocks/shield-row`
201 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
202 |
203 | #### Authors: 1
204 |
205 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
206 |
207 | ---
208 |
209 | # v0.8.2 (Thu Nov 05 2020)
210 |
211 | #### 🐛 Bug Fix
212 |
213 | - `@doc-blocks/gallery`
214 | - Fix for wider characters in alphabet nav [#7](https://github.com/intuit/doc-blocks/pull/7) ([@kharrop](https://github.com/kharrop))
215 |
216 | #### Authors: 1
217 |
218 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
219 |
220 | ---
221 |
222 | # v0.8.1 (Mon Nov 02 2020)
223 |
224 | #### 🐛 Bug Fix
225 |
226 | - `@doc-blocks/gallery`
227 | - Gallery updates [#6](https://github.com/intuit/doc-blocks/pull/6) ([@kharrop](https://github.com/kharrop))
228 |
229 | #### Authors: 1
230 |
231 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
232 |
233 | ---
234 |
235 | # v0.8.0 (Wed Oct 28 2020)
236 |
237 | #### 🚀 Enhancement
238 |
239 | - `@doc-blocks/gallery`
240 | - allow for regex in match path [#5](https://github.com/intuit/doc-blocks/pull/5) ([@hipstersmoothie](https://github.com/hipstersmoothie))
241 |
242 | #### 📝 Documentation
243 |
244 | - `@doc-blocks/gallery`
245 | - more docs for gallery props [#4](https://github.com/intuit/doc-blocks/pull/4) ([@hipstersmoothie](https://github.com/hipstersmoothie))
246 | - add gallery prop docs [#3](https://github.com/intuit/doc-blocks/pull/3) ([@hipstersmoothie](https://github.com/hipstersmoothie))
247 |
248 | #### Authors: 1
249 |
250 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
251 |
252 | ---
253 |
254 | # v0.7.0 (Mon Oct 19 2020)
255 |
256 | #### 🚀 Enhancement
257 |
258 | - `@doc-blocks/accessibility`, `@doc-blocks/bundle-size`, `@doc-blocks/design-spec`, `@doc-blocks/gallery`, `@doc-blocks/guideline`, `@doc-blocks/intended-usage`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/row`, `@doc-blocks/shield`, `@doc-blocks/shield-row`, `@doc-blocks/version`, `doc-blocks`
259 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
260 |
261 | #### 🐛 Bug Fix
262 |
263 | - `@doc-blocks/accessibility`, `@doc-blocks/bundle-size`, `@doc-blocks/design-spec`, `@doc-blocks/intended-usage`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/row`, `@doc-blocks/shield`, `@doc-blocks/shield-row`, `@doc-blocks/version`, `doc-blocks`
264 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
265 |
266 | #### Authors: 1
267 |
268 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
269 |
270 | ---
271 |
272 | # v0.6.5 (Wed Oct 14 2020)
273 |
274 | #### ⚠️ Pushed to `master`
275 |
276 | - add more auto plugins ([@hipstersmoothie](https://github.com/hipstersmoothie))
277 | - `@doc-blocks/accessibility`, `@doc-blocks/bundle-size`, `@doc-blocks/design-spec`, `@doc-blocks/guideline`, `@doc-blocks/header-link`, `@doc-blocks/intended-usage`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/row`, `@doc-blocks/shield`, `@doc-blocks/shield-row`, `@doc-blocks/version`, `doc-blocks`
278 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
279 | - `@doc-blocks/accessibility`, `@doc-blocks/bundle-size`, `@doc-blocks/design-spec`, `@doc-blocks/guideline`, `@doc-blocks/header-link`, `@doc-blocks/intended-usage`, `@doc-blocks/related-components`, `@doc-blocks/responsive-story`, `@doc-blocks/row`, `@doc-blocks/shield`, `@doc-blocks/shield-row`, `@doc-blocks/version`, `doc-blocks`
280 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
281 |
282 | #### Authors: 1
283 |
284 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
285 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018 Intuit
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19 | OR OTHER DEALINGS IN THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
doc-blocks
4 |
5 |
6 | > A design system for doc-blocks UI components, built on [@design-systems/cli](https://github.com/intuit/design-systems-cli).
7 |
8 | ## 👍 Philosophy
9 |
10 | This repo contains a collection of components that make writing rich component documentation with `@storybook/addon-docs` a breeze!
11 |
12 | ## 🚀 Usage
13 |
14 | To use a component from this repo you will first need to install the component into your project.
15 |
16 | For an example we will try to use the `@doc-blocks/row` component.
17 |
18 | ```sh
19 | npm i @doc-blocks/row
20 | # or with yarn
21 | yarn add @doc-blocks/row
22 | ```
23 |
24 | Then to use the component in your code just import it!
25 |
26 | ```js
27 | import { Row } from "@doc-blocks/row";
28 | ```
29 |
30 | If you don't want to install all of the different components you can install [`doc-blocks`](./packages/doc-blocks/README.md).
31 |
32 | ## 🤝 Contributing
33 |
34 | To create a new component:
35 |
36 | ```sh
37 | yarn run create
38 | ```
39 |
40 | Follow the prompts and you will have a new sub-package for your component!
41 |
42 | ```sh
43 | # First link the package
44 | yarn
45 | # Then start developing
46 | cd components/
47 | yarn run dev
48 | ```
49 |
50 | Before submitting a pull request ensure that all of the following work:
51 |
52 | 1. `yarn build`
53 | 2. `yarn lint`
54 | 3. `yarn test`
55 |
56 | ### How to use the `scripts`
57 |
58 | Inside the package.json there are a bunch of scripts that this repo uses to run the project in development and to build the project.
59 |
60 | Below you can read a description of scripts you should use while developing in this project.
61 |
62 | - `yarn dev`: Builds everything and starts a storybook with all components
63 | - `yarn test`: Run `jest` over the test files
64 | - `yarn lint`: Lint all files using `eslint`
65 | - `yarn clean`: Remove all dependencies, build files, and generated files from the project
66 | - `yarn create`: Create a new components withing the repo
67 | - `yarn create:package`: Create a new package withing the repo
68 | - `yarn size`: Determine how your changes effect the size of all sub-packages
69 |
70 | #### Package Level `scripts`
71 |
72 | Every command works at both the monorepo and package level. The means you can run some script from just the package/component for a faster development experience.
73 |
74 | - `yarn dev`: Build any dependency in the monorepo the component depends on, and start a storybook with just the component
75 | - `yarn test`: Test just the component
76 | - `yarn lint`: Lint just the component
77 | - `yarn clean`: Clean the generated files for just the component
78 | - `yarn size`: Determine how your changes effect the size of the component
79 |
80 | ## Contributors ✨
81 |
82 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
83 |
84 |
85 |
86 |
87 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
103 |
--------------------------------------------------------------------------------
/components/Accessibility/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.7.0 (Mon Oct 19 2020)
15 |
16 | #### 🚀 Enhancement
17 |
18 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
19 |
20 | #### 🐛 Bug Fix
21 |
22 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
23 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
24 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
25 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
26 |
27 | #### Authors: 1
28 |
29 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
30 |
31 | ---
32 |
33 | # v0.6.5 (Wed Oct 14 2020)
34 |
35 | #### ⚠️ Pushed to `master`
36 |
37 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 |
40 | #### Authors: 1
41 |
42 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
43 |
--------------------------------------------------------------------------------
/components/Accessibility/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/accessibility
2 |
3 | Welcome to my `Accessibility` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/accessibility
9 | # or with yarn
10 | yarn add @doc-blocks/accessibility
11 | ```
12 |
13 | ## Usage
14 |
15 | **Example:**
16 |
17 | ```jsx
18 | import { Accessibility } from "@doc-blocks/accessibility";
19 |
20 | ;
21 | ```
22 |
--------------------------------------------------------------------------------
/components/Accessibility/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/Accessibility/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/accessibility",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "exports": {
8 | ".": {
9 | "import": "./dist/esm/index.js",
10 | "require": "./dist/cjs/index.js"
11 | }
12 | },
13 | "types": "./dist",
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Kendall Gassner kendall.gassner@yahoo.com",
16 | "contributors": [
17 | "Kendall Gassner kendall.gassner@yahoo.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2",
35 | "@doc-blocks/shield": "link:../Shield"
36 | },
37 | "peerDependencies": {
38 | "react": ">= 18.2.0"
39 | },
40 | "files": [
41 | "dist",
42 | "src",
43 | "!*.snippet.*",
44 | "!*theme.*",
45 | "!*.test.*",
46 | "!__snapshots__",
47 | "!__tests__"
48 | ],
49 | "devDependencies": {
50 | "@eslint/js": "9.25.1",
51 | "@types/node": "22.15.3",
52 | "@types/react": "19.1.2",
53 | "@types/react-dom": "19.1.3",
54 | "@vitejs/plugin-react": "4.4.1",
55 | "eslint": "9.25.1",
56 | "eslint-plugin-react-hooks": "5.2.0",
57 | "eslint-plugin-react-refresh": "0.4.20",
58 | "global": "4.4.0",
59 | "typescript": "5.8.3",
60 | "typescript-eslint": "8.31.1",
61 | "vite": "6.3.4"
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/components/Accessibility/src/Accessibility.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react";
2 |
3 | import { Accessibility } from ".";
4 |
5 | const meta: Meta = {
6 | title: "Shields/Accessibility",
7 | component: Accessibility,
8 | parameters: {
9 | layout: "centered",
10 | },
11 | tags: ["autodocs"],
12 | };
13 |
14 | export default meta;
15 | type Story = StoryObj;
16 |
17 | export const BasicUsage: Story = {
18 | args: {
19 | tag: "a11y",
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/components/Accessibility/src/index.tsx:
--------------------------------------------------------------------------------
1 | import { Shield } from "@doc-blocks/shield";
2 |
3 | export interface AccessibilityProps {
4 | /** The current accessibility tag */
5 | tag?: string;
6 | }
7 |
8 | /** A simple component. */
9 | export const Accessibility = ({ tag }: AccessibilityProps) => (
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/components/Accessibility/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Accessibility/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Accessibility/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Accessibility/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/Accordion/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.0.0 (Wed Jul 02 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: bump to storybook 9 [#36](https://github.com/intuit/doc-blocks/pull/36) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v1.0.0 (Thu May 01 2025)
15 |
16 | #### 💥 Breaking Change
17 |
18 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
19 |
20 | #### Authors: 2
21 |
22 | - Sean Powell ([@fattslug](https://github.com/fattslug))
23 | - spowell9 (sean_powell@intuit.com)
24 |
25 | ---
26 |
27 | # v0.8.14 (Mon Jul 25 2022)
28 |
29 | #### 🐛 Bug Fix
30 |
31 | - add missing peer deps [#25](https://github.com/intuit/doc-blocks/pull/25) ([@hipstersmoothie](https://github.com/hipstersmoothie))
32 | - add missing peer deps ([@hipstersmoothie](https://github.com/hipstersmoothie))
33 |
34 | #### Authors: 1
35 |
36 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
37 |
38 | ---
39 |
40 | # v0.8.12 (Mon Nov 15 2021)
41 |
42 | #### 🐛 Bug Fix
43 |
44 | - Adding styled-components dependency to Accordion [#22](https://github.com/intuit/doc-blocks/pull/22) (sean_powell@intuit.com)
45 |
46 | #### Authors: 1
47 |
48 | - Sean Powell ([@fattslug](https://github.com/fattslug))
49 |
50 | ---
51 |
52 | # v0.8.11 (Thu Oct 21 2021)
53 |
54 | #### 🐛 Bug Fix
55 |
56 | - Removing width and horizontal padding from accordion panel [#21](https://github.com/intuit/doc-blocks/pull/21) ([@kharrop](https://github.com/kharrop))
57 |
58 | #### Authors: 1
59 |
60 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
61 |
62 | ---
63 |
64 | # v0.8.10 (Thu Oct 21 2021)
65 |
66 | #### 🐛 Bug Fix
67 |
68 | - Adding className support for accordion [#19](https://github.com/intuit/doc-blocks/pull/19) ([@kharrop](https://github.com/kharrop))
69 |
70 | #### Authors: 1
71 |
72 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
73 |
74 | ---
75 |
76 | # v0.8.9 (Mon Oct 18 2021)
77 |
78 | #### 🐛 Bug Fix
79 |
80 | - Adding option for external tab state [#18](https://github.com/intuit/doc-blocks/pull/18) (sean_powell@intuit.com)
81 |
82 | #### Authors: 1
83 |
84 | - Sean Powell ([@fattslug](https://github.com/fattslug))
85 |
86 | ---
87 |
88 | # v0.8.8 (Thu Oct 14 2021)
89 |
90 | #### 🐛 Bug Fix
91 |
92 | - Updating Tabs & Accordion exports [#17](https://github.com/intuit/doc-blocks/pull/17) (sean_powell@intuit.com)
93 |
94 | #### Authors: 1
95 |
96 | - Sean Powell ([@fattslug](https://github.com/fattslug))
97 |
98 | ---
99 |
100 | # v0.8.7 (Tue Oct 05 2021)
101 |
102 | #### 🐛 Bug Fix
103 |
104 | - Updating exports to include tabs and accordion [#16](https://github.com/intuit/doc-blocks/pull/16) (sean_powell@intuit.com)
105 |
106 | #### Authors: 1
107 |
108 | - Sean Powell ([@fattslug](https://github.com/fattslug))
109 |
110 | ---
111 |
112 | # v0.8.4 (Mon Oct 04 2021)
113 |
114 | #### 🐛 Bug Fix
115 |
116 | - Creating Accordion component [#14](https://github.com/intuit/doc-blocks/pull/14) (sean_powell@intuit.com)
117 |
118 | #### Authors: 1
119 |
120 | - Sean Powell ([@fattslug](https://github.com/fattslug))
121 |
--------------------------------------------------------------------------------
/components/Accordion/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/accordion
2 |
3 | Welcome to my `Accordion` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/accordion
9 | # or with yarn
10 | yarn add @doc-blocks/accordion
11 | ```
12 |
13 | Then to use the component in your code just import it!
14 |
15 | ```js
16 | import { Accordion } from "@doc-blocks/accordion";
17 | // and with css-modules
18 | import "@doc-blocks/accordion/dist/main.css";
19 | ```
20 |
21 | ## Usage
22 |
23 | The Accordion component handles all click events internally so all you have to worry about is the content you want to display.
24 | Remember to provide an `id` prop to tie the accordion title to its panel!
25 | Feel free to add whatever classes or styles you want to either `Accordion.Title` or `Accordion.Panel` - they will be applied to the respective DOM elements.
26 | To use the `Accordion`, just do this:
27 |
28 | ```js
29 | const AccordionInterface = () => (
30 |
31 | Colors that make me happy
32 |
33 | Black, Burgundy, Maroon, Mahogany
34 |
35 | Colors that make me angry
36 | Pink, Green, White, Orange
37 |
38 | );
39 | ```
40 |
41 | Or with an `Array.map()`:
42 |
43 | ```js
44 | const AccordionInterface = () => (
45 |
46 | {accordionItems.map((accordion) => (
47 |
48 | {accordion.title}
49 | {accordion.content}
50 |
51 | ))}
52 |
53 | );
54 | ```
55 |
56 | ### onChange Handler
57 |
58 | When a user clicks on an Accordion title, the `onChange` handler is called. You can make use of this functionality by adding an `onChange` prop to the `` wrapper like so:
59 |
60 | ```jsx
61 | const TabbedInterface = () => (
62 | console.log(selectedId)}>...
63 | );
64 | ```
65 |
66 | ### Active Class
67 |
68 | You can apply an `activeClassName` to each `Accordion.Title` and `Accordion.Panel` component. When that accordion item is selected, the specified classes will be applied.
69 |
70 | ```jsx
71 | const AccordionInterface = () => (
72 |
73 |
74 | Colors that make me happy
75 |
76 |
77 | Black, Burgundy, Maroon, Mahogany
78 |
79 |
80 | Colors that make me angry
81 |
82 |
83 | Pink, Green, White, Orange
84 |
85 |
86 | );
87 | ```
88 |
--------------------------------------------------------------------------------
/components/Accordion/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | setupFiles: [],
9 | setupFilesAfterEnv: [require.resolve("@testing-library/jest-dom")],
10 | };
11 |
--------------------------------------------------------------------------------
/components/Accordion/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/accordion",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Sean Powell sean_powell@intuit.com",
16 | "contributors": [
17 | "Sean Powell sean_powell@intuit.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "7.11.2"
35 | },
36 | "peerDependencies": {
37 | "react": ">= 18.2.0"
38 | },
39 | "files": [
40 | "dist",
41 | "src",
42 | "!*.snippet.*",
43 | "!*theme.*",
44 | "!*.test.*",
45 | "!__snapshots__",
46 | "!__tests__"
47 | ]
48 | }
49 |
--------------------------------------------------------------------------------
/components/Accordion/src/Accordion.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { Meta, StoryObj } from "@storybook/react";
3 | import { fn } from "storybook/test";
4 |
5 | import { Accordion } from ".";
6 |
7 | const meta: Meta = {
8 | title: "Components/Accordion",
9 | component: Accordion,
10 | parameters: {
11 | layout: "centered",
12 | },
13 | tags: ["autodocs"],
14 | args: {
15 | onChange: fn(),
16 | },
17 | };
18 |
19 | export default meta;
20 | type Story = StoryObj;
21 |
22 | export const BasicUsage: Story = {
23 | render: ({ onChange }) => (
24 | onChange?.(selectedId)}>
25 |
26 | Title 1
27 |
28 | Panel 1
29 |
30 | Title 2
31 |
32 | Panel 2
33 |
34 | ),
35 | };
36 |
37 | const Chevron = ({ style }: { style: React.CSSProperties }) => (
38 |
46 |
47 |
48 | );
49 |
50 | export const WithIndicators = ({
51 | onChange,
52 | }: {
53 | onChange: (selectedId: string | null) => void;
54 | }) => {
55 | const [selectedId, setSelectedId] = React.useState(null);
56 |
57 | return (
58 | {
60 | onChange(selected);
61 | setSelectedId(selected);
62 | }}
63 | >
64 |
65 |
71 |
78 |
79 | Title 1
80 |
81 | Panel 1
82 |
83 |
89 |
96 |
97 | Title 2
98 |
99 | Panel 2
100 |
101 | );
102 | };
103 |
--------------------------------------------------------------------------------
/components/Accordion/src/Accordion.test.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { screen, render, cleanup } from "@testing-library/react";
3 | import userEvent from "@testing-library/user-event";
4 |
5 | import { Accordion } from ".";
6 |
7 | const AccordionStub = ({ spy }: { spy?: jest.Mock }) => (
8 | spy?.(selectedId)}>
9 |
14 | Title 1
15 |
16 |
21 | Panel 1
22 |
23 |
28 | Title 2
29 |
30 |
35 | Panel 2
36 |
37 |
38 | );
39 |
40 | afterEach(cleanup);
41 |
42 | describe("Accordion", () => {
43 | test("It matches the snapshot", () => {
44 | const { container } = render( );
45 | expect(container).toMatchSnapshot();
46 | });
47 |
48 | test("It renders all accordions", () => {
49 | const { queryByText } = render( );
50 | expect(queryByText("Title 1")).toBeInTheDocument();
51 | expect(queryByText("Title 2")).toBeInTheDocument();
52 | });
53 |
54 | test("It renders with all accordions collapsed", () => {
55 | const { queryByText } = render( );
56 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
57 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
58 | expect(queryByText("Panel 2")).toHaveClass("collapsed");
59 | expect(queryByText("Panel 2")).not.toHaveClass("expanded");
60 | });
61 |
62 | test("It applies the provided className to the accordion title & panel", () => {
63 | const { queryByText } = render( );
64 | expect(queryByText("Title 1")).toHaveClass("title-1-default");
65 | expect(queryByText("Panel 1")).toHaveClass("panel-1-default");
66 | });
67 |
68 | test("It expands and collapses the accordion panel when selected", async () => {
69 | const user = userEvent.setup();
70 | const { queryByText, getByText } = render( );
71 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
72 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
73 |
74 | await user.click(getByText("Title 1"));
75 |
76 | expect(queryByText("Panel 1")).toHaveClass("expanded");
77 | expect(queryByText("Panel 1")).not.toHaveClass("collapsed");
78 |
79 | await user.click(getByText("Title 1"));
80 |
81 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
82 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
83 | });
84 |
85 | test("It expands and collapses the accordion panel with keyboard events", async () => {
86 | const user = userEvent.setup();
87 | const { queryByText } = render( );
88 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
89 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
90 |
91 | await user.type(screen.getByText("Title 1"), "{space}");
92 |
93 | expect(queryByText("Panel 1")).toHaveClass("expanded");
94 | expect(queryByText("Panel 1")).not.toHaveClass("collapsed");
95 |
96 | await user.type(screen.getByText("Title 1"), "{space}");
97 |
98 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
99 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
100 | });
101 |
102 | test("It collapses all other panels when another title is selected", async () => {
103 | const user = userEvent.setup();
104 | const { queryByText } = render( );
105 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
106 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
107 |
108 | await user.click(screen.getByText("Title 1"));
109 |
110 | expect(queryByText("Panel 1")).toHaveClass("expanded");
111 | expect(queryByText("Panel 1")).not.toHaveClass("collapsed");
112 |
113 | await user.click(screen.getByText("Title 2"));
114 |
115 | expect(queryByText("Panel 1")).not.toHaveClass("expanded");
116 | expect(queryByText("Panel 1")).toHaveClass("collapsed");
117 | expect(queryByText("Panel 2")).not.toHaveClass("collapsed");
118 | expect(queryByText("Panel 2")).toHaveClass("expanded");
119 | });
120 |
121 | test("It toggles the activeClassName to the selected accordion title & panel", async () => {
122 | const user = userEvent.setup();
123 | const { queryByText } = render( );
124 | expect(queryByText("Title 1")).not.toHaveClass("title-1-selected");
125 | expect(queryByText("Panel 1")).not.toHaveClass("panel-1-selected");
126 |
127 | await user.click(screen.getByText("Title 1"));
128 |
129 | expect(queryByText("Title 1")).toHaveClass("title-1-selected");
130 | expect(queryByText("Panel 1")).toHaveClass("panel-1-selected");
131 |
132 | await user.click(screen.getByText("Title 1"));
133 |
134 | expect(queryByText("Title 1")).not.toHaveClass("title-1-selected");
135 | expect(queryByText("Panel 1")).not.toHaveClass("panel-1-selected");
136 | });
137 |
138 | test("It calls onChange when a tab is clicked", async () => {
139 | const user = userEvent.setup();
140 | const spy = jest.fn();
141 | const { queryByText } = render( );
142 | expect(queryByText("Title 1")).toBeInTheDocument();
143 | expect(queryByText("Title 2")).toBeInTheDocument();
144 |
145 | await user.click(screen.getByText("Title 2"));
146 |
147 | expect(spy).toHaveBeenCalledTimes(1);
148 | expect(spy).toHaveBeenCalledWith("two");
149 | });
150 | });
151 |
--------------------------------------------------------------------------------
/components/Accordion/src/__snapshots__/Accordion.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Accordion It matches the snapshot 1`] = `
4 |
5 |
6 |
13 | Title 1
14 |
15 |
21 | Panel 1
22 |
23 |
30 | Title 2
31 |
32 |
38 | Panel 2
39 |
40 |
41 |
42 | `;
43 |
--------------------------------------------------------------------------------
/components/Accordion/src/index.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/ban-ts-comment */
2 | import React from "react";
3 |
4 | export interface AccordionCompositionProps
5 | extends React.DetailedHTMLProps<
6 | React.HTMLAttributes,
7 | HTMLDivElement
8 | > {
9 | /** Class to apply when selected */
10 | activeClassName?: string;
11 | /** ID to assign to accordion item */
12 | id: string;
13 | }
14 |
15 | export interface AccordionProps {
16 | /** Children of accordion wrapper */
17 | children?: React.ReactNode[];
18 | /** Classes to apply to accordion wrapper **/
19 | className?: string;
20 | /** Callback after an accordion panel is expanded */
21 | onChange?: (selectedId: string | null) => void;
22 | }
23 |
24 | interface AccordionContextProps {
25 | /** ID of currently selected panel */
26 | selectedId: string | null;
27 | /** Setter method for setting selected panel */
28 | setSelectedId: React.Dispatch>;
29 | /** Callback after an accordion panel is expanded (derived from AccordionProps) */
30 | onChange?: (selectedId: string | null) => void;
31 | }
32 |
33 | // Setting up context with dummy values to satisfy typechecking
34 | const AccordionContext = React.createContext({
35 | selectedId: null,
36 | setSelectedId: () => null,
37 | onChange: () => null,
38 | });
39 |
40 | /** Accordion component */
41 | export const Accordion = ({
42 | className: accordionWrapperClassName,
43 | children,
44 | onChange,
45 | ...rest
46 | }: AccordionProps) => {
47 | const [selectedId, setSelectedId] = React.useState(null);
48 |
49 | return (
50 | /* @ts-ignore */
51 |
52 |
53 | {children}
54 |
55 |
56 | );
57 | };
58 |
59 | /** Renders the accordion title */
60 | const Title = ({
61 | id,
62 | children,
63 | className,
64 | activeClassName,
65 | }: AccordionCompositionProps) => {
66 | const { selectedId, setSelectedId, onChange } = React.useContext(
67 | AccordionContext
68 | );
69 |
70 | return (
71 | {
85 | setSelectedId((prev) => {
86 | const selected = prev === id ? null : id;
87 | onChange?.(selected);
88 | return selected;
89 | });
90 | }}
91 | onKeyDown={(e) => {
92 | if (e.key === "Enter" || e.key === " " || e.key === "Space") {
93 | e.preventDefault();
94 | setSelectedId((prev) => {
95 | const selected = prev === id ? null : id;
96 | onChange?.(selected);
97 | return selected;
98 | });
99 | }
100 | }}
101 | >
102 | {children}
103 |
104 | );
105 | };
106 |
107 | /** Renders the accordion content panel */
108 | const Panel = ({
109 | id,
110 | children,
111 | className,
112 | activeClassName,
113 | }: AccordionCompositionProps) => {
114 | const { selectedId } = React.useContext(AccordionContext);
115 | const panelRef = React.useRef(null);
116 | const isSelected = selectedId === id;
117 |
118 | return (
119 |
133 | {children}
134 |
135 | );
136 | };
137 |
138 | Accordion.Title = Title;
139 | Accordion.Panel = Panel;
140 |
--------------------------------------------------------------------------------
/components/Accordion/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Accordion/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Accordion/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Accordion/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/BundleSize/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.7.0 (Mon Oct 19 2020)
15 |
16 | #### 🚀 Enhancement
17 |
18 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
19 |
20 | #### 🐛 Bug Fix
21 |
22 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
23 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
24 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
25 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
26 |
27 | #### Authors: 1
28 |
29 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
30 |
31 | ---
32 |
33 | # v0.6.5 (Wed Oct 14 2020)
34 |
35 | #### ⚠️ Pushed to `master`
36 |
37 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 |
40 | #### Authors: 1
41 |
42 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
43 |
--------------------------------------------------------------------------------
/components/BundleSize/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/bundle-size
2 |
3 | Welcome to my `BundleSize` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/bundle-size
9 | # or with yarn
10 | yarn add @doc-blocks/bundle-size
11 | ```
12 |
13 | Then to use the component in your code just import it!
14 |
15 | ```js
16 | import { BundleSize } from "@doc-blocks/bundle-size";
17 |
18 | ;
19 | ```
20 |
--------------------------------------------------------------------------------
/components/BundleSize/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/BundleSize/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/bundle-size",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2",
35 | "@doc-blocks/shield": "link:../Shield"
36 | },
37 | "peerDependencies": {
38 | "react": ">= 18.2.0"
39 | },
40 | "files": [
41 | "dist",
42 | "src",
43 | "!*.snippet.*",
44 | "!*theme.*",
45 | "!*.test.*",
46 | "!__snapshots__",
47 | "!__tests__"
48 | ]
49 | }
50 |
--------------------------------------------------------------------------------
/components/BundleSize/src/BundleSize.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react";
2 |
3 | import { BundleSize } from "./index";
4 |
5 | const meta: Meta = {
6 | title: "Shields/Bundle Size",
7 | component: BundleSize,
8 | parameters: {
9 | layout: "centered",
10 | },
11 | tags: ["autodocs"],
12 | };
13 |
14 | export default meta;
15 | type Story = StoryObj;
16 |
17 | export const BasicUsage: Story = {
18 | args: {
19 | size: "1.2 kB",
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/components/BundleSize/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Shield } from "@doc-blocks/shield";
3 |
4 | export interface BundleSizeProps {
5 | /** The current BundleSize */
6 | size: string;
7 | }
8 |
9 | /** A simple component. */
10 | export const BundleSize = ({ size }: BundleSizeProps) => (
11 |
12 | );
13 |
--------------------------------------------------------------------------------
/components/BundleSize/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/BundleSize/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/BundleSize/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/BundleSize/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/DesignSpec/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.7.0 (Mon Oct 19 2020)
15 |
16 | #### 🚀 Enhancement
17 |
18 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
19 |
20 | #### 🐛 Bug Fix
21 |
22 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
23 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
24 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
25 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
26 |
27 | #### Authors: 1
28 |
29 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
30 |
31 | ---
32 |
33 | # v0.6.5 (Wed Oct 14 2020)
34 |
35 | #### ⚠️ Pushed to `master`
36 |
37 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 |
40 | #### Authors: 1
41 |
42 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
43 |
--------------------------------------------------------------------------------
/components/DesignSpec/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/design-spec
2 |
3 | A component to display a `DesignSpec` shield.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/design-spec
9 | # or with yarn
10 | yarn add @doc-blocks/design-spec
11 | ```
12 |
13 | Then to use the component in your code just import it!
14 |
15 | ```js
16 | import { DesignSpec } from "@doc-blocks/design-spec";
17 |
18 | ;
19 | ```
20 |
--------------------------------------------------------------------------------
/components/DesignSpec/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/DesignSpec/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/design-spec",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2",
35 | "@doc-blocks/shield": "link:../Shield"
36 | },
37 | "peerDependencies": {
38 | "react": ">= 18.2.0"
39 | },
40 | "files": [
41 | "dist",
42 | "src",
43 | "!*.snippet.*",
44 | "!*theme.*",
45 | "!*.test.*",
46 | "!__snapshots__",
47 | "!__tests__"
48 | ]
49 | }
50 |
--------------------------------------------------------------------------------
/components/DesignSpec/src/DesignSpec.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react";
2 |
3 | import { DesignSpec } from ".";
4 |
5 | const meta: Meta = {
6 | title: "Shields/Design Spec",
7 | component: DesignSpec,
8 | parameters: {
9 | layout: "centered",
10 | },
11 | tags: ["autodocs"],
12 | };
13 |
14 | export default meta;
15 | type Story = StoryObj;
16 |
17 | export const BasicUsage: Story = {
18 | args: {
19 | type: "figma",
20 | url: "http://figma.com/",
21 | },
22 | };
23 |
--------------------------------------------------------------------------------
/components/DesignSpec/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Shield } from "@doc-blocks/shield";
3 |
4 | const typeMap: Record = {
5 | figma: "#a259ff",
6 | zeplin: "#f69833",
7 | abstract: "#191a1b",
8 | };
9 |
10 | interface DesignSpecProps {
11 | /** Where the spec came from */
12 | type: string;
13 | /** Link to a spec */
14 | url: string;
15 | }
16 |
17 | /** A simple component. */
18 | export const DesignSpec = ({ type, url }: DesignSpecProps) => (
19 |
26 | );
27 |
--------------------------------------------------------------------------------
/components/DesignSpec/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/DesignSpec/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/DesignSpec/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/DesignSpec/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/Guideline/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.8.14 (Mon Jul 25 2022)
15 |
16 | #### 🐛 Bug Fix
17 |
18 | - add missing peer deps [#25](https://github.com/intuit/doc-blocks/pull/25) ([@hipstersmoothie](https://github.com/hipstersmoothie))
19 | - add missing peer deps ([@hipstersmoothie](https://github.com/hipstersmoothie))
20 |
21 | #### Authors: 1
22 |
23 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
24 |
25 | ---
26 |
27 | # v0.8.13 (Tue Mar 08 2022)
28 |
29 | #### 🐛 Bug Fix
30 |
31 | - Update index.tsx [#24](https://github.com/intuit/doc-blocks/pull/24) ([@NoWorries](https://github.com/NoWorries))
32 | - Update index.tsx ([@NoWorries](https://github.com/NoWorries))
33 |
34 | #### Authors: 1
35 |
36 | - Josh Harwood ([@NoWorries](https://github.com/NoWorries))
37 |
38 | ---
39 |
40 | # v0.8.3 (Mon May 24 2021)
41 |
42 | #### 🐛 Bug Fix
43 |
44 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
45 | - document ([@kendallgassner](https://github.com/kendallgassner))
46 | - lint ([@kendallgassner](https://github.com/kendallgassner))
47 |
48 | #### Authors: 1
49 |
50 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
51 |
52 | ---
53 |
54 | # v0.7.0 (Mon Oct 19 2020)
55 |
56 | #### 🚀 Enhancement
57 |
58 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
59 |
60 | #### 🐛 Bug Fix
61 |
62 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
63 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
64 |
65 | #### Authors: 1
66 |
67 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
68 |
69 | ---
70 |
71 | # v0.6.5 (Wed Oct 14 2020)
72 |
73 | #### ⚠️ Pushed to `master`
74 |
75 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
76 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
77 |
78 | #### Authors: 1
79 |
80 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
81 |
--------------------------------------------------------------------------------
/components/Guideline/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/guideline
2 |
3 | Welcome to my `Guideline` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/guideline
9 | # or with yarn
10 | yarn add @doc-blocks/guideline
11 | ```
12 |
13 | ## Usage
14 |
15 | To use this component simply provide a label and some jsx to render.
16 |
17 | **Example:**
18 |
19 | ```jsx
20 | import { Do, Dont } from '@doc-blocks/guideline';
21 |
22 |
23 |
24 | Click me
25 |
26 |
27 |
28 | Click me to do the thing that is a
29 |
30 | ```
31 |
--------------------------------------------------------------------------------
/components/Guideline/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/Guideline/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/guideline",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2"
35 | },
36 | "peerDependencies": {
37 | "react": ">= 18.2.0"
38 | },
39 | "devDependencies": {
40 | "@doc-blocks/row": "link:../Row"
41 | },
42 | "files": [
43 | "dist",
44 | "src",
45 | "!*.snippet.*",
46 | "!*theme.*",
47 | "!*.test.*",
48 | "!__snapshots__",
49 | "!__tests__"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/components/Guideline/src/Guideline.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { Meta, StoryObj } from "@storybook/react";
3 | import { Row } from "@doc-blocks/row";
4 |
5 | import { Do, Dont } from ".";
6 |
7 | const meta: Meta = {
8 | title: "Components/Guideline",
9 | parameters: {
10 | layout: "centered",
11 | },
12 | tags: ["autodocs"],
13 | };
14 |
15 | export default meta;
16 | type Story = StoryObj;
17 |
18 | /**
19 | * The `Do` guideline should show the right way to use the component.
20 | */
21 | export const DoExample: Story = {
22 | name: "Do",
23 | render: () => (
24 |
25 | Click me
26 |
27 | ),
28 | };
29 |
30 | /**
31 | * The `Don't` guideline should show the wrong way to use the component.
32 | */
33 | export const DontExample: Story = {
34 | name: "Dont",
35 | render: () => (
36 |
37 | Click me to do the thing that is a
38 |
39 | ),
40 | };
41 |
42 | /**
43 | * Used with `@doc-blocks/row` you can display a pair of `Do/Don't` on one line.
44 | */
45 | export const DoAndDontRow: Story = {
46 | name: "A Row of Do/Dont",
47 | render: () => (
48 |
49 |
50 | Click me
51 |
52 |
53 | Click me to do the thing that is a
54 |
55 |
56 | ),
57 | };
58 |
--------------------------------------------------------------------------------
/components/Guideline/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | interface LineProps {
4 | /** The color of the line */
5 | color: string;
6 | }
7 |
8 | /** A line */
9 | const Line = ({ color }: LineProps) => (
10 |
18 | );
19 |
20 | export interface CreateGuidelineProps {
21 | /** The label for the guideline */
22 | guidelineLabel: React.ReactNode;
23 | /** The color of the line */
24 | color: string;
25 | }
26 |
27 | export interface GuidelineProps
28 | extends React.DetailedHTMLProps<
29 | React.HTMLAttributes,
30 | HTMLDivElement
31 | > {
32 | /** The label for the guideline */
33 | label: React.ReactNode;
34 | }
35 |
36 | /** A good thing to do with the component. */
37 | const Guideline = ({
38 | color,
39 | guidelineLabel,
40 | label,
41 | children,
42 | ...html
43 | }: GuidelineProps & CreateGuidelineProps) => (
44 |
45 |
51 | {children}
52 |
53 |
54 |
55 |
56 |
57 | {guidelineLabel}:
58 | {label}
59 |
60 |
61 | );
62 |
63 | /** A good thing to do with the component. */
64 | export const Do = (props: GuidelineProps) => (
65 |
66 | );
67 |
68 | /** A bad thing to do with the component. */
69 | export const Dont = (props: GuidelineProps) => (
70 |
71 | );
72 |
--------------------------------------------------------------------------------
/components/Guideline/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Guideline/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Guideline/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Guideline/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/IntendedUsage/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.8.3 (Mon May 24 2021)
15 |
16 | #### 🐛 Bug Fix
17 |
18 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
19 | - document ([@kendallgassner](https://github.com/kendallgassner))
20 | - lint ([@kendallgassner](https://github.com/kendallgassner))
21 |
22 | #### Authors: 1
23 |
24 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
25 |
26 | ---
27 |
28 | # v0.7.0 (Mon Oct 19 2020)
29 |
30 | #### 🚀 Enhancement
31 |
32 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
33 |
34 | #### 🐛 Bug Fix
35 |
36 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
37 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
40 |
41 | #### Authors: 1
42 |
43 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
44 |
45 | ---
46 |
47 | # v0.6.5 (Wed Oct 14 2020)
48 |
49 | #### ⚠️ Pushed to `master`
50 |
51 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
52 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
53 |
54 | #### Authors: 1
55 |
56 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
57 |
--------------------------------------------------------------------------------
/components/IntendedUsage/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/intended-usage
2 |
3 | Welcome to my `IntendedUsage` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/intended-usage
9 | # or with yarn
10 | yarn add @doc-blocks/intended-usage
11 | ```
12 |
13 | ## Usage
14 |
15 | **Example:**
16 |
17 | ```jsx
18 | import { BestFor, NotFor } from '@doc-blocks/intended-usage';
19 |
20 |
21 |
22 | one
23 | two
24 | three
25 |
26 |
27 |
28 |
29 |
30 | four
31 | five
32 | six
33 |
34 |
35 | ```
36 |
--------------------------------------------------------------------------------
/components/IntendedUsage/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/IntendedUsage/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/intended-usage",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2",
35 | "@design-systems/utils": "4.15.4",
36 | "emotion": "^10.0.27"
37 | },
38 | "peerDependencies": {
39 | "react": ">= 18.2.0"
40 | },
41 | "files": [
42 | "dist",
43 | "src",
44 | "!*.snippet.*",
45 | "!*theme.*",
46 | "!*.test.*",
47 | "!__snapshots__",
48 | "!__tests__"
49 | ]
50 | }
51 |
--------------------------------------------------------------------------------
/components/IntendedUsage/src/IntendedUsage.module.css:
--------------------------------------------------------------------------------
1 | .intended-usage {
2 | margin: 40px 0;
3 | }
4 |
5 | .intended-usage ul {
6 | list-style: none;
7 | padding-left: 0;
8 | margin: 0;
9 | }
10 |
11 | .intended-usage li {
12 | padding: 5px 0 5px 30px;
13 | position: relative;
14 | line-height: 24px;
15 | }
16 |
17 | .intended-usage li:before {
18 | position: absolute;
19 | left: 0;
20 | top: 6px;
21 | }
22 |
23 | .intended-usage-title {
24 | font-weight: 500;
25 | margin-bottom: 10px;
26 | font-size: 24px;
27 | }
28 |
--------------------------------------------------------------------------------
/components/IntendedUsage/src/IntendedUsage.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Meta, StoryObj } from "@storybook/react";
3 | import { BestFor, NotFor } from ".";
4 |
5 | const meta: Meta = {
6 | title: "Components/Intended Usage",
7 | component: BestFor,
8 | parameters: {
9 | layout: "centered",
10 | },
11 | tags: ["autodocs"],
12 | };
13 |
14 | export default meta;
15 |
16 | type Story = StoryObj;
17 |
18 | export const BestForStory: Story = {
19 | name: "Best For",
20 | render: () => (
21 |
22 |
23 | one
24 | two
25 | three
26 |
27 |
28 | ),
29 | };
30 |
31 | export const NotForStory: Story = {
32 | name: "Not For",
33 | render: () => (
34 |
35 |
36 | one
37 | two
38 |
39 | With a really really really really really really really really really
40 | really really really really really really really really really really
41 | really really really really really long line
42 |
43 |
44 |
45 | ),
46 | };
47 |
48 | export const Together: Story = {
49 | name: "Together",
50 | render: () => (
51 | <>
52 |
53 |
54 | one
55 | two
56 | three
57 |
58 |
59 |
60 |
61 | four
62 | five
63 | six
64 |
65 |
66 | >
67 | ),
68 | };
69 |
--------------------------------------------------------------------------------
/components/IntendedUsage/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | import styles from "./IntendedUsage.module.css";
4 |
5 | export interface IntendedUsageProps
6 | extends React.DetailedHTMLProps<
7 | React.HTMLAttributes,
8 | HTMLDivElement
9 | > {
10 | /** The title of the section */
11 | sectionTitle: string;
12 | /** The icon for the list */
13 | icon: string;
14 | }
15 |
16 | /** A fancy list */
17 | export const IntendedUsage = ({
18 | children,
19 | sectionTitle,
20 | icon,
21 | ...props
22 | }: IntendedUsageProps) => {
23 | const uid = Math.random().toString(36).substring(2, 15);
24 |
25 | // Add the icon dynamically with a style element
26 | const iconStyle = `
27 | .${styles["intended-usage"]}#${uid} li:before {
28 | content: "${icon}";
29 | }
30 | `;
31 |
32 | return (
33 |
34 |
35 |
{sectionTitle}
36 | {children}
37 |
38 | );
39 | };
40 |
41 | /** A component that lists what the component being documented is intended to be used like. */
42 | export const BestFor = (
43 | props: React.DetailedHTMLProps<
44 | React.HTMLAttributes,
45 | HTMLDivElement
46 | >
47 | ) => ;
48 |
49 | /** A component that lists what the component being documented is not intended to be used like. */
50 | export const NotFor = (
51 | props: React.DetailedHTMLProps<
52 | React.HTMLAttributes,
53 | HTMLDivElement
54 | >
55 | ) => ;
56 |
--------------------------------------------------------------------------------
/components/IntendedUsage/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/IntendedUsage/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/IntendedUsage/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/IntendedUsage/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/RelatedComponents/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.0.0 (Wed Jul 02 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: bump to storybook 9 [#36](https://github.com/intuit/doc-blocks/pull/36) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v1.0.0 (Thu May 01 2025)
15 |
16 | #### 💥 Breaking Change
17 |
18 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
19 |
20 | #### Authors: 2
21 |
22 | - Sean Powell ([@fattslug](https://github.com/fattslug))
23 | - spowell9 (sean_powell@intuit.com)
24 |
25 | ---
26 |
27 | # v0.8.14 (Mon Jul 25 2022)
28 |
29 | #### 🐛 Bug Fix
30 |
31 | - add missing peer deps [#25](https://github.com/intuit/doc-blocks/pull/25) ([@hipstersmoothie](https://github.com/hipstersmoothie))
32 | - add missing peer deps ([@hipstersmoothie](https://github.com/hipstersmoothie))
33 |
34 | #### Authors: 1
35 |
36 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
37 |
38 | ---
39 |
40 | # v0.8.3 (Mon May 24 2021)
41 |
42 | #### 🐛 Bug Fix
43 |
44 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
45 | - lint ([@kendallgassner](https://github.com/kendallgassner))
46 |
47 | #### Authors: 1
48 |
49 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
50 |
51 | ---
52 |
53 | # v0.7.0 (Mon Oct 19 2020)
54 |
55 | #### 🚀 Enhancement
56 |
57 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
58 |
59 | #### 🐛 Bug Fix
60 |
61 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
62 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
63 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
64 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
65 |
66 | #### Authors: 1
67 |
68 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
69 |
70 | ---
71 |
72 | # v0.6.5 (Wed Oct 14 2020)
73 |
74 | #### ⚠️ Pushed to `master`
75 |
76 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
77 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
78 |
79 | #### Authors: 1
80 |
81 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
82 |
--------------------------------------------------------------------------------
/components/RelatedComponents/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/related-components
2 |
3 | Welcome to my `RelatedComponents` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/related-components
9 | # or with yarn
10 | yarn add @doc-blocks/related-components
11 | ```
12 |
13 | ## Usage
14 |
15 | **Example:**
16 |
17 | ```jsx
18 | import { RelatedComponents } from "@doc-blocks/related-components";
19 |
20 | ;
23 | ```
24 |
--------------------------------------------------------------------------------
/components/RelatedComponents/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/RelatedComponents/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/related-components",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2"
35 | },
36 | "peerDependencies": {
37 | "@storybook/addon-links": "^9.0.0",
38 | "react": ">= 18.2.0"
39 | },
40 | "devDependencies": {
41 | "@storybook/addon-links": "^9.0.0"
42 | },
43 | "files": [
44 | "dist",
45 | "src",
46 | "!*.snippet.*",
47 | "!*theme.*",
48 | "!*.test.*",
49 | "!__snapshots__",
50 | "!__tests__"
51 | ]
52 | }
53 |
--------------------------------------------------------------------------------
/components/RelatedComponents/src/RelatedComponents.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { Meta, StoryObj } from "@storybook/react";
3 |
4 | import { RelatedComponents } from ".";
5 |
6 | const meta: Meta = {
7 | title: "Components/Related Components",
8 | component: RelatedComponents,
9 | parameters: {
10 | layout: "centered",
11 | },
12 | tags: ["autodocs"],
13 | };
14 |
15 | export default meta;
16 | type Story = StoryObj;
17 |
18 | export const BasicUsage: Story = {
19 | render: (args) => (
20 |
21 | ),
22 | args: {
23 | components: ["Components/Responsive Story", "Components/Row"],
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/components/RelatedComponents/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import LinkTo from "@storybook/addon-links/react";
3 |
4 | interface KindLinkProps {
5 | /** Text of the link */
6 | children: string;
7 | /** The kind to link to */
8 | kind: string;
9 | }
10 |
11 | /** A link to a story kind */
12 | const KindLink = ({ kind, children }: KindLinkProps) => (
13 | {children}
14 | );
15 |
16 | export interface RelatedComponentsProps {
17 | /** Stories that are related to this one */
18 | components: string[];
19 | }
20 |
21 | /** A component to list related components */
22 | export const RelatedComponents = (props: RelatedComponentsProps) => (
23 |
31 |
37 | Related Components:
38 |
39 |
40 | {props.components.map((component, i) => (
41 |
42 | {component.split("/")[1]}
43 | {i !== props.components.length - 1 && ", "}
44 |
45 | ))}
46 |
47 |
48 | );
49 |
--------------------------------------------------------------------------------
/components/RelatedComponents/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/RelatedComponents/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/RelatedComponents/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/RelatedComponents/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.0.0 (Wed Jul 02 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: bump to storybook 9 [#36](https://github.com/intuit/doc-blocks/pull/36) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v1.0.0 (Thu May 01 2025)
15 |
16 | #### 💥 Breaking Change
17 |
18 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
19 |
20 | #### Authors: 2
21 |
22 | - Sean Powell ([@fattslug](https://github.com/fattslug))
23 | - spowell9 (sean_powell@intuit.com)
24 |
25 | ---
26 |
27 | # v0.8.14 (Mon Jul 25 2022)
28 |
29 | #### 🐛 Bug Fix
30 |
31 | - add missing peer deps [#25](https://github.com/intuit/doc-blocks/pull/25) ([@hipstersmoothie](https://github.com/hipstersmoothie))
32 | - add missing peer deps ([@hipstersmoothie](https://github.com/hipstersmoothie))
33 |
34 | #### Authors: 1
35 |
36 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
37 |
38 | ---
39 |
40 | # v0.8.3 (Mon May 24 2021)
41 |
42 | #### 🐛 Bug Fix
43 |
44 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
45 | - document ([@kendallgassner](https://github.com/kendallgassner))
46 | - lint ([@kendallgassner](https://github.com/kendallgassner))
47 |
48 | #### Authors: 1
49 |
50 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
51 |
52 | ---
53 |
54 | # v0.7.0 (Mon Oct 19 2020)
55 |
56 | #### 🚀 Enhancement
57 |
58 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
59 |
60 | #### 🐛 Bug Fix
61 |
62 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
63 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
64 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
65 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
66 |
67 | #### Authors: 1
68 |
69 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
70 |
71 | ---
72 |
73 | # v0.6.5 (Wed Oct 14 2020)
74 |
75 | #### ⚠️ Pushed to `master`
76 |
77 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
78 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
79 |
80 | #### Authors: 1
81 |
82 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
83 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/responsive-story
2 |
3 | Welcome to my `ResponsiveStory` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/responsive-story
9 | # or with yarn
10 | yarn add @doc-blocks/responsive-story
11 | ```
12 |
13 | Add the following to your `preview-head.html`.
14 |
15 | ```html
16 |
20 | ```
21 |
22 | ## Usage
23 |
24 | Provide the ID of a story to render in a iframe + mock device.
25 |
26 | **Example:**
27 |
28 | ```jsx
29 | import { ResponsiveStory } from "@doc-blocks/responsive-story";
30 |
31 | ;
32 | ```
33 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/responsive-story",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2",
35 | "@storybook/addon-docs": "^9.0.0",
36 | "clsx": "^1.1.1"
37 | },
38 | "peerDependencies": {
39 | "@storybook/addon-docs": "^9.0.0",
40 | "react": ">= 18.2.0"
41 | },
42 | "files": [
43 | "dist",
44 | "src",
45 | "!*.snippet.*",
46 | "!*theme.*",
47 | "!*.test.*",
48 | "!__snapshots__",
49 | "!__tests__"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/src/ResponsiveStory.module.css:
--------------------------------------------------------------------------------
1 | .deviceSelect {
2 | cursor: pointer;
3 | color: rgb(51, 51, 51);
4 | text-align: center;
5 | appearance: none;
6 | font-size: 12px;
7 | line-height: 16px;
8 | font-family: "Nunito Sans", -apple-system, ".SFNSText-Regular",
9 | "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica,
10 | Arial, sans-serif;
11 | font-weight: 700;
12 | padding: 4px 10px;
13 | background: rgb(255, 255, 255);
14 | border: 1px solid rgba(0, 0, 0, 0.1);
15 | border-radius: 4px;
16 | margin: 20px 0;
17 | text-align-last: center;
18 | }
19 |
20 | .infoBar {
21 | height: 30px;
22 | display: flex;
23 | justify-content: space-between;
24 | align-items: flex-end;
25 | padding: 0 25px 0 34px;
26 | font-size: 14px;
27 | }
28 |
29 | .iframeLabel {
30 | width: 100%;
31 | align-items: center;
32 | justify-content: center;
33 | display: flex;
34 | margin-top: 14px;
35 | }
36 |
37 | .iframeLabel > *:not(:last-child) {
38 | margin-right: 10px;
39 | }
40 |
41 | .showCodeButton {
42 | cursor: pointer;
43 | display: flex;
44 | align-items: center;
45 | color: rgb(51, 51, 51);
46 | font-size: 12px;
47 | line-height: 16px;
48 | font-family: "Nunito Sans", -apple-system, ".SFNSText-Regular",
49 | "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica,
50 | Arial, sans-serif;
51 | font-weight: 700;
52 | margin-left: -1px;
53 | padding: 4px 10px;
54 | background: rgb(255, 255, 255);
55 | border: 1px solid rgba(0, 0, 0, 0.1);
56 | border-radius: 4px;
57 | }
58 |
59 | .responsiveStoryWrapper {
60 | margin: 30px auto;
61 | display: flex;
62 | flex-direction: column;
63 | }
64 |
65 | .iframe {
66 | border: none;
67 | width: 100%;
68 | height: 100%;
69 | margin: auto;
70 | display: block;
71 | }
72 |
73 | .iframeIphoneLandscape {
74 | padding-left: 30px;
75 | box-sizing: border-box;
76 | }
77 |
78 | .iframeMac {
79 | width: 1200px;
80 | height: 750px;
81 | transform: scale(0.8);
82 | transform-origin: 0 0;
83 | }
84 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/src/ResponsiveStory.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react";
2 | import React from "react";
3 | import { ResponsiveStory } from ".";
4 |
5 | const meta: Meta = {
6 | title: "Components/Responsive Story",
7 | component: ResponsiveStory,
8 | parameters: {
9 | layout: "centered",
10 | docs: {
11 | description: {
12 | component: `The \`ResponsiveStory\` lets you render any story in an \`iframe\` with a fancy device wrapper.
13 | Since it is in an \`iframe\` all of the media queries work and your component will actually render at that screen size.
14 | It will also display the source for the story you are documenting.`,
15 | },
16 | },
17 | },
18 | };
19 |
20 | export default meta;
21 | type Story = StoryObj;
22 |
23 | /**
24 | * Basic example of the ResponsiveStory component.
25 | */
26 | export const BasicUsage: Story = {
27 | args: {
28 | id: "components-row--basic-usage",
29 | },
30 | };
31 |
32 | /**
33 | * Example with a label for additional context.
34 | */
35 | export const WithLabel: Story = {
36 | args: {
37 | id: "components-row--basic-usage",
38 | label: "A label for the story",
39 | },
40 | };
41 |
42 | /**
43 | * Examples showing different device options.
44 | */
45 | export const Devices: Story = {
46 | render: () => (
47 |
48 |
49 |
50 |
51 |
52 | ),
53 | };
54 |
55 | /**
56 | * Let the user choose which device to render on.
57 | */
58 | export const ChooseDevice: Story = {
59 | args: {
60 | id: "components-row--basic-usage",
61 | device: "choose",
62 | },
63 | };
64 |
65 | /**
66 | * Different alignment options for the device.
67 | */
68 | export const Align: Story = {
69 | render: () => (
70 |
71 |
72 |
73 |
74 |
75 | ),
76 | };
77 |
78 | /**
79 | * Examples showing only portions of the device.
80 | */
81 | export const TopOrBottom: Story = {
82 | render: () => (
83 |
84 |
85 |
86 |
87 | ),
88 | };
89 |
90 | /**
91 | * Examples showing devices in landscape mode.
92 | */
93 | export const RotateMobile: Story = {
94 | render: () => (
95 |
96 |
97 |
102 |
103 | ),
104 | };
105 |
106 | /**
107 | * Example showing customized header colors.
108 | */
109 | export const MobileHeader: Story = {
110 | args: {
111 | id: "components-row--basic-usage",
112 | headerColor: "black",
113 | headerText: "white",
114 | },
115 | };
116 |
117 | /**
118 | * Example showing device with custom screen styles.
119 | */
120 | export const DeviceStyles: Story = {
121 | args: {
122 | id: "components-row--basic-usage",
123 | headerColor: "black",
124 | headerText: "white",
125 | screenStyles: { paddingTop: 20 },
126 | },
127 | };
128 |
129 | /**
130 | * Inline example story for demonstrating a simple button.
131 | */
132 | export const Test: Story = {
133 | render: () => foo ,
134 | };
135 |
136 | /**
137 | * Example showing how to reference an inline story.
138 | */
139 | export const InlineReference: Story = {
140 | render: () => (
141 |
146 | ),
147 | };
148 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/src/index.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/no-unused-prop-types */
2 |
3 | import React from "react";
4 | import makeClass from "clsx";
5 | import { Source } from "@storybook/addon-docs";
6 |
7 | import styles from "./ResponsiveStory.module.css";
8 | import "./devices.min.css";
9 |
10 | const devices = ["iPad", "iPhone", "mac"] as const;
11 | type Device = typeof devices[number];
12 |
13 | interface DeviceProp {
14 | /** The device to render the story in */
15 | device?: "iPad" | "iPhone" | "mac" | "choose";
16 | }
17 |
18 | interface IsLandscape {
19 | /** Display the device in landscape mode */
20 | isLandscape?: boolean;
21 | }
22 |
23 | export type DeviceProps = IsLandscape & {
24 | /** The content to display in the device screen */
25 | children: React.ReactNode;
26 | /** Color to make iOS header */
27 | headerColor?: string;
28 | /** Color to make iOS header text */
29 | headerText?: string;
30 | };
31 |
32 | /** A mock iPhone */
33 | const IPhone = ({
34 | children,
35 | isLandscape,
36 | headerColor,
37 | headerText,
38 | }: DeviceProps) => {
39 | const time = new Date(Date.now());
40 |
41 | return (
42 |
48 |
52 |
53 |
54 |
55 |
56 |
62 |
63 |
64 | {!isLandscape && (
65 |
69 | {`${time.getHours() % 12}:${time.getMinutes()}`}
70 |
71 | )}
72 | {children}
73 |
74 |
75 | );
76 | };
77 |
78 | /** A mock iPad */
79 | const IPad = ({ children, isLandscape }: DeviceProps) => (
80 |
86 |
87 |
{children}
88 |
89 |
90 | );
91 |
92 | /** A mock mac */
93 | const Mac = ({ children }: DeviceProps) => (
94 |
95 |
96 |
97 |
{children}
98 |
99 |
100 | );
101 |
102 | /** Show only a portion of the device */
103 | function useTopOrBottom(top: number | undefined, bottom: number | undefined) {
104 | if (top) {
105 | return { height: top, overflowY: "hidden" } as const;
106 | }
107 |
108 | if (bottom) {
109 | return {
110 | height: bottom,
111 | display: "flex",
112 | alignItems: "flex-end",
113 | overflowY: "hidden",
114 | } as const;
115 | }
116 |
117 | return {};
118 | }
119 |
120 | const deviceMap: Record JSX.Element> = {
121 | iPhone: IPhone,
122 | iPad: IPad,
123 | mac: Mac,
124 | };
125 |
126 | type ResponsiveStoryBaseProps = IsLandscape &
127 | DeviceProp & {
128 | /** The id of the story to render */
129 | id: string;
130 | /** An optional label to put below the story */
131 | label?: string;
132 | /** Display the device in landscape mode */
133 | isLandscape?: boolean;
134 | /** How to align the story */
135 | align?: "start" | "center" | "end";
136 | /** Color to make iOS header */
137 | headerColor?: string;
138 | /** Color to make iOS header text */
139 | headerText?: string;
140 | /** Styles to add to the device wrapper. */
141 | screenStyles?: React.CSSProperties;
142 | };
143 |
144 | interface TopProps extends ResponsiveStoryBaseProps {
145 | /** A number x between 1-100 to show only the top x% of the device */
146 | top: number;
147 | }
148 |
149 | interface BottomProps extends ResponsiveStoryBaseProps {
150 | /** A number x between 1-100 to show only the top x% of the device */
151 | bottom: number;
152 | }
153 |
154 | export type ResponsiveStoryProps =
155 | | ResponsiveStoryBaseProps
156 | | TopProps
157 | | BottomProps;
158 |
159 | /** Render a story in an iframe so it's responsive */
160 | export const ResponsiveStory = ({
161 | id,
162 | label,
163 | device = "iPhone",
164 | isLandscape,
165 | align = "start",
166 | headerColor,
167 | headerText,
168 | screenStyles = {},
169 | ...rest
170 | }: ResponsiveStoryProps) => {
171 | const [open, setOpen] = React.useState(false);
172 | const [currentDevice, setCurrentDevice] = React.useState(
173 | device === "choose" ? "mac" : device
174 | );
175 |
176 | const DeviceComponent = deviceMap[currentDevice];
177 | const top = "top" in rest ? rest.top : undefined;
178 | const bottom = "bottom" in rest ? rest.bottom : undefined;
179 |
180 | const iframeClasses = makeClass(
181 | styles.iframe,
182 | currentDevice === "iPhone" && isLandscape && styles.iframeIphoneLandscape,
183 | currentDevice === "mac" && styles.iframeMac
184 | );
185 |
186 | return (
187 |
193 |
194 |
203 |
208 |
217 |
218 |
219 |
220 |
221 | {label && {label} }
222 | {device === "choose" && (
223 | {
227 | setCurrentDevice(e.target.value as Device);
228 | }}
229 | >
230 | {devices.map((d) => (
231 |
232 | {d}
233 |
234 | ))}
235 |
236 | )}
237 | setOpen(!open)}
241 | >
242 | {open ? "Hide" : "Show"} Code
243 |
244 |
245 |
246 | {open &&
}
247 |
248 | );
249 | };
250 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/ResponsiveStory/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/Row/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.8.5 (Fri Aug 13 2021)
15 |
16 | #### 🐛 Bug Fix
17 |
18 | - Adding `align` prop [#12](https://github.com/intuit/doc-blocks/pull/12) ([@kharrop](https://github.com/kharrop))
19 |
20 | #### Authors: 1
21 |
22 | - Kelly Harrop ([@kharrop](https://github.com/kharrop))
23 |
24 | ---
25 |
26 | # v0.8.3 (Mon May 24 2021)
27 |
28 | #### 🐛 Bug Fix
29 |
30 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
31 | - document ([@kendallgassner](https://github.com/kendallgassner))
32 | - lint ([@kendallgassner](https://github.com/kendallgassner))
33 |
34 | #### Authors: 1
35 |
36 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
37 |
38 | ---
39 |
40 | # v0.7.0 (Mon Oct 19 2020)
41 |
42 | #### 🚀 Enhancement
43 |
44 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
45 |
46 | #### 🐛 Bug Fix
47 |
48 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
49 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
50 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
51 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
52 |
53 | #### Authors: 1
54 |
55 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
56 |
57 | ---
58 |
59 | # v0.6.5 (Wed Oct 14 2020)
60 |
61 | #### ⚠️ Pushed to `master`
62 |
63 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
64 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
65 |
66 | #### Authors: 1
67 |
68 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
69 |
--------------------------------------------------------------------------------
/components/Row/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/row
2 |
3 | Welcome to my `Row` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/row
9 | # or with yarn
10 | yarn add @doc-blocks/row
11 | ```
12 |
13 | ## Usage
14 |
15 | **Example:**
16 |
17 | ```jsx
18 | import { Row } from "@doc-blocks/row";
19 |
20 |
21 |
22 |
23 |
24 |
;
25 | ```
26 |
--------------------------------------------------------------------------------
/components/Row/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/Row/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/row",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2"
35 | },
36 | "peerDependencies": {
37 | "react": ">= 18.2.0"
38 | },
39 | "files": [
40 | "dist",
41 | "src",
42 | "!*.snippet.*",
43 | "!*theme.*",
44 | "!*.test.*",
45 | "!__snapshots__",
46 | "!__tests__"
47 | ]
48 | }
49 |
--------------------------------------------------------------------------------
/components/Row/src/Row.module.css:
--------------------------------------------------------------------------------
1 | .row {
2 | align-items: var(--align);
3 | display: grid;
4 | grid-auto-flow: row;
5 | grid-gap: var(--gap);
6 | margin: 45px 0;
7 | }
8 |
9 | .row > * {
10 | margin: 0 !important;
11 | }
12 |
13 | @media (min-width: 992px) {
14 | .row {
15 | grid-auto-flow: column;
16 | grid-template-columns: var(--grid-template);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/components/Row/src/Row.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { Meta, StoryObj } from "@storybook/react";
3 | import { Row } from ".";
4 |
5 | const meta: Meta = {
6 | title: "Components/Row",
7 | component: Row,
8 | parameters: {
9 | docs: {
10 | description: {
11 | component:
12 | "The `Row` component makes it simple to lay out any piece of content next to each other.",
13 | },
14 | },
15 | },
16 | tags: ["autodocs"],
17 | };
18 |
19 | export default meta;
20 |
21 | type Story = StoryObj;
22 |
23 | export const BasicUsage: Story = {
24 | render: () => (
25 |
26 |
27 |
28 |
29 |
30 | ),
31 | };
32 |
33 | export const LargeText: Story = {
34 | render: () => (
35 |
36 |
37 |
38 |
39 | ),
40 | parameters: {
41 | docs: {
42 | description: {
43 | story:
44 | 'If you have a story you want to add a bit of context to, you can use the `type="large-text"` prop to add a large text area.',
45 | },
46 | },
47 | },
48 | };
49 |
50 | export const WithContent: Story = {
51 | render: () => (
52 |
53 |
54 |
Title
55 |
56 | Sed mollis elit dictum ligula suscipit, ac luctus quam mattis. Aliquam
57 | lectus quam, fringilla vel molestie vitae, iaculis suscipit dolor.
58 | Nulla tristique egestas tortor, eget sollicitudin arcu convallis et.
59 | Duis placerat nibh justo, nec accumsan metus sollicitudin bibendum.
60 | Integer gravida elementum dui, at facilisis libero gravida a. Ut
61 | lobortis justo et quam lobortis tristique. Pellentesque arcu mauris,
62 | efficitur tempus lorem vitae, condimentum gravida sapien. Pellentesque
63 | sed accumsan felis, non mollis metus. Mauris sollicitudin facilisis
64 | gravida. Nulla varius, lacus quis ornare malesuada, dolor magna semper
65 | turpis, ut placerat mi enim vel leo.
66 |
67 |
68 |
78 | Content Preview
79 |
80 |
81 | ),
82 | parameters: {
83 | docs: {
84 | description: {
85 | story: "Here is what it looks like with some mock content.",
86 | },
87 | },
88 | },
89 | };
90 |
--------------------------------------------------------------------------------
/components/Row/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | import styles from "./Row.module.css";
4 |
5 | export interface RowProps
6 | extends React.DetailedHTMLProps<
7 | React.HTMLAttributes,
8 | HTMLDivElement
9 | > {
10 | /** The space between items in the row */
11 | gap?: number;
12 | /** A specific type of row */
13 | type?: "large-text";
14 | /** Vertical alignment */
15 | align?: string;
16 | }
17 |
18 | /** Render a story in an iframe so it"s responsive */
19 | export const Row = ({
20 | gap = 40,
21 | align = "self-start",
22 | type,
23 | className,
24 | style,
25 | ...props
26 | }: RowProps) => {
27 | // Define CSS variables
28 | const cssVars = {
29 | "--gap": `${gap}px`,
30 | "--align": align,
31 | "--grid-template":
32 | type === "large-text"
33 | ? "2fr 1fr"
34 | : "repeat(auto-fit, minmax(200px, 1fr))",
35 | } as React.CSSProperties;
36 |
37 | return (
38 |
43 | );
44 | };
45 |
--------------------------------------------------------------------------------
/components/Row/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Row/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Row/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Row/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/Shield/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.7.0 (Mon Oct 19 2020)
15 |
16 | #### 🚀 Enhancement
17 |
18 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
19 |
20 | #### 🐛 Bug Fix
21 |
22 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
23 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
24 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
25 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
26 |
27 | #### Authors: 1
28 |
29 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
30 |
31 | ---
32 |
33 | # v0.6.5 (Wed Oct 14 2020)
34 |
35 | #### ⚠️ Pushed to `master`
36 |
37 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 |
40 | #### Authors: 1
41 |
42 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
43 |
--------------------------------------------------------------------------------
/components/Shield/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/shield
2 |
3 | Welcome to my `Shield` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/shield
9 | # or with yarn
10 | yarn add @doc-blocks/shield
11 | ```
12 |
13 | ## Usage
14 |
15 | **Example:**
16 |
17 | ```jsx
18 | import { Shield } from "@doc-blocks/shield";
19 |
20 | ;
21 | ```
22 |
--------------------------------------------------------------------------------
/components/Shield/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/Shield/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/shield",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "exports": {
8 | ".": {
9 | "import": "./dist/esm/index.js",
10 | "require": "./dist/cjs/index.js"
11 | }
12 | },
13 | "types": "./dist/index.d.ts",
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Kendall Gassner kendall.gassner@yahoo.com",
16 | "contributors": [
17 | "Kendall Gassner kendall.gassner@yahoo.com",
18 | "Andrew Lisowski lisowski54@gmail.com"
19 | ],
20 | "license": "MIT",
21 | "sideEffects": [
22 | "*.css"
23 | ],
24 | "publishConfig": {
25 | "registry": "https://registry.npmjs.org/",
26 | "access": "public"
27 | },
28 | "scripts": {
29 | "dev": "vite",
30 | "build": "vite build",
31 | "lint": "eslint .",
32 | "preview": "vite preview"
33 | },
34 | "dependencies": {
35 | "@babel/runtime": "^7.11.2"
36 | },
37 | "peerDependencies": {
38 | "react": ">= 18.2.0"
39 | },
40 | "files": [
41 | "dist",
42 | "src",
43 | "!*.snippet.*",
44 | "!*theme.*",
45 | "!*.test.*",
46 | "!__snapshots__",
47 | "!__tests__"
48 | ]
49 | }
50 |
--------------------------------------------------------------------------------
/components/Shield/src/Shield.module.css:
--------------------------------------------------------------------------------
1 | .wrapper {
2 | border-radius: 4px;
3 | overflow: hidden;
4 | display: flex;
5 | width: fit-content;
6 | font-size: 12px;
7 | text-decoration: none;
8 | }
9 |
10 | .label {
11 | background: gray;
12 | color: white;
13 | padding: 4px 6px 4px 8px;
14 | }
15 |
16 | .message {
17 | color: white;
18 | padding: 4px 8px 4px 6px;
19 | }
20 |
--------------------------------------------------------------------------------
/components/Shield/src/Shield.stories.tsx:
--------------------------------------------------------------------------------
1 | // components/Shield/src/shield.stories.tsx
2 | import type { Meta, StoryObj } from "@storybook/react";
3 |
4 | import { Shield } from ".";
5 |
6 | const meta: Meta = {
7 | title: "Shields/Shield",
8 | component: Shield,
9 | parameters: {
10 | layout: "centered",
11 | },
12 | tags: ["autodocs"],
13 | };
14 |
15 | export default meta;
16 | type Story = StoryObj;
17 |
18 | /**
19 | * A shield displaying a version number
20 | */
21 | export const Version: Story = {
22 | args: {
23 | label: "version",
24 | message: "1.0.0",
25 | },
26 | };
27 |
28 | /**
29 | * A shield with a custom color
30 | */
31 | export const Accessibility: Story = {
32 | args: {
33 | label: "a11y",
34 | message: "reduced-motion",
35 | color: "#c9007a",
36 | },
37 | };
38 |
39 | /**
40 | * A shield with a link
41 | */
42 | export const Url: Story = {
43 | args: {
44 | label: "search",
45 | message: "google",
46 | url: "https://google.com",
47 | },
48 | };
49 |
--------------------------------------------------------------------------------
/components/Shield/src/index.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable jsx-a11y/anchor-has-content */
2 | import React, { JSX } from "react";
3 |
4 | import styles from "./Shield.module.css";
5 |
6 | export interface ShieldProps {
7 | /** The current label */
8 | label?: string;
9 | /** The current message */
10 | message?: string;
11 | /** The color behind the message */
12 | color?: string;
13 | /** A link to open when the shield is clicked */
14 | url?: string;
15 | /** A title for the link */
16 | title?: string;
17 | }
18 |
19 | type AnchorProps = JSX.LibraryManagedAttributes<
20 | "a",
21 | React.ComponentPropsWithoutRef<"a">
22 | >;
23 |
24 | /** A simple component. */
25 | export const Shield = ({
26 | label,
27 | message,
28 | color = "orange",
29 | title,
30 | url,
31 | }: ShieldProps) => {
32 | const Wrapper = url
33 | ? (p: AnchorProps) => (
34 |
41 | )
42 | : "span";
43 |
44 | return (
45 |
46 | {label}
47 |
48 | {message}
49 |
50 |
51 | );
52 | };
53 |
--------------------------------------------------------------------------------
/components/Shield/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Shield/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Shield/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Shield/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/ShieldRow/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.8.3 (Mon May 24 2021)
15 |
16 | #### 🐛 Bug Fix
17 |
18 | - Bump Storybook to 6.2.9 [#9](https://github.com/intuit/doc-blocks/pull/9) ([@kendallgassner](https://github.com/kendallgassner))
19 | - document ([@kendallgassner](https://github.com/kendallgassner))
20 | - lint ([@kendallgassner](https://github.com/kendallgassner))
21 |
22 | #### Authors: 1
23 |
24 | - Kendall Gassner ([@kendallgassner](https://github.com/kendallgassner))
25 |
26 | ---
27 |
28 | # v0.7.0 (Mon Oct 19 2020)
29 |
30 | #### 🚀 Enhancement
31 |
32 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
33 |
34 | #### 🐛 Bug Fix
35 |
36 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
37 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
40 |
41 | #### Authors: 1
42 |
43 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
44 |
45 | ---
46 |
47 | # v0.6.5 (Wed Oct 14 2020)
48 |
49 | #### ⚠️ Pushed to `master`
50 |
51 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
52 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
53 |
54 | #### Authors: 1
55 |
56 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
57 |
--------------------------------------------------------------------------------
/components/ShieldRow/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/shield-row
2 |
3 | Use to display a row of `Shield`s.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/shield-row
9 | # or with yarn
10 | yarn add @doc-blocks/shield-row
11 | ```
12 |
13 | Then to use the component in your code just import it!
14 |
15 | ```js
16 | import ShieldRow from "@doc-blocks/shield-row";
17 | // and with css-modules
18 | import "@doc-blocks/shield-row/dist/main.css";
19 | ```
20 |
--------------------------------------------------------------------------------
/components/ShieldRow/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/ShieldRow/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/shield-row",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2"
35 | },
36 | "devDependencies": {
37 | "@doc-blocks/accessibility": "link:../Accessibility",
38 | "@doc-blocks/design-spec": "link:../DesignSpec",
39 | "@doc-blocks/version": "link:../Version"
40 | },
41 | "peerDependencies": {
42 | "react": ">= 18.2.0"
43 | },
44 | "files": [
45 | "dist",
46 | "src",
47 | "!*.snippet.*",
48 | "!*theme.*",
49 | "!*.test.*",
50 | "!__snapshots__",
51 | "!__tests__"
52 | ]
53 | }
54 |
--------------------------------------------------------------------------------
/components/ShieldRow/src/ShieldRow.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | display: flex;
3 | }
4 |
5 | .container > *:not(:last-child) {
6 | margin-right: 12px;
7 | }
8 |
--------------------------------------------------------------------------------
/components/ShieldRow/src/ShieldRow.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { Meta, StoryObj } from "@storybook/react";
3 |
4 | import { Accessibility } from "@doc-blocks/accessibility";
5 | import { DesignSpec } from "@doc-blocks/design-spec";
6 | import { Version } from "@doc-blocks/version";
7 |
8 | import { ShieldRow } from ".";
9 |
10 | const meta: Meta = {
11 | title: "Shields/ShieldRow",
12 | component: ShieldRow,
13 | parameters: {
14 | // You can keep notes as part of the docs description or in parameters
15 | docs: {
16 | description: {
17 | component: "Use to display a row of shields.",
18 | },
19 | },
20 | },
21 | tags: ["autodocs"],
22 | };
23 |
24 | export default meta;
25 | type Story = StoryObj;
26 |
27 | /**
28 | * Basic usage example of the ShieldRow component
29 | */
30 | export const BasicUsage: Story = {
31 | render: () => (
32 |
33 |
34 |
35 |
36 |
37 | ),
38 | };
39 |
--------------------------------------------------------------------------------
/components/ShieldRow/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | import styles from "./ShieldRow.module.css";
4 |
5 | /** Render a story in an iframe so it's responsive */
6 | export const ShieldRow = (
7 | props: React.DetailedHTMLProps<
8 | React.HTMLAttributes,
9 | HTMLDivElement
10 | >
11 | ) =>
;
12 |
--------------------------------------------------------------------------------
/components/ShieldRow/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/ShieldRow/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/ShieldRow/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/ShieldRow/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/Tabs/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.0.0 (Wed Jul 02 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: bump to storybook 9 [#36](https://github.com/intuit/doc-blocks/pull/36) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v1.0.0 (Thu May 01 2025)
15 |
16 | #### 💥 Breaking Change
17 |
18 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
19 |
20 | #### Authors: 2
21 |
22 | - Sean Powell ([@fattslug](https://github.com/fattslug))
23 | - spowell9 (sean_powell@intuit.com)
24 |
25 | ---
26 |
27 | # v0.8.15 (Mon Jul 25 2022)
28 |
29 | #### 🐛 Bug Fix
30 |
31 | - add missing peer deps [#26](https://github.com/intuit/doc-blocks/pull/26) ([@hipstersmoothie](https://github.com/hipstersmoothie))
32 | - add missing peer deps ([@hipstersmoothie](https://github.com/hipstersmoothie))
33 |
34 | #### Authors: 1
35 |
36 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
37 |
38 | ---
39 |
40 | # v0.8.9 (Mon Oct 18 2021)
41 |
42 | #### 🐛 Bug Fix
43 |
44 | - Adding option for external tab state [#18](https://github.com/intuit/doc-blocks/pull/18) (sean_powell@intuit.com)
45 |
46 | #### Authors: 1
47 |
48 | - Sean Powell ([@fattslug](https://github.com/fattslug))
49 |
50 | ---
51 |
52 | # v0.8.8 (Thu Oct 14 2021)
53 |
54 | #### 🐛 Bug Fix
55 |
56 | - Updating Tabs & Accordion exports [#17](https://github.com/intuit/doc-blocks/pull/17) (sean_powell@intuit.com)
57 |
58 | #### Authors: 1
59 |
60 | - Sean Powell ([@fattslug](https://github.com/fattslug))
61 |
62 | ---
63 |
64 | # v0.8.6 (Mon Oct 04 2021)
65 |
66 | #### 🐛 Bug Fix
67 |
68 | - Adding Tabs onChange handler [#15](https://github.com/intuit/doc-blocks/pull/15) (sean_powell@intuit.com)
69 |
70 | #### Authors: 1
71 |
72 | - Sean Powell ([@fattslug](https://github.com/fattslug))
73 |
74 | ---
75 |
76 | # v0.8.4 (Fri Aug 13 2021)
77 |
78 | #### 🐛 Bug Fix
79 |
80 | - Adding tabs component [#13](https://github.com/intuit/doc-blocks/pull/13) (sean_powell@intuit.com)
81 |
82 | #### Authors: 1
83 |
84 | - Sean Powell ([@fattslug](https://github.com/fattslug))
85 |
--------------------------------------------------------------------------------
/components/Tabs/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/tabs
2 |
3 | Use to display a set of tabs for your docs.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/tabs
9 | # or with yarn
10 | yarn add @doc-blocks/tabs
11 | ```
12 |
13 | Then to use the component in your code just import it!
14 |
15 | ```js
16 | import { Tabs } from "@doc-blocks/tabs";
17 | // and with css-modules
18 | import "@doc-blocks/tabs/dist/main.css";
19 | ```
20 |
21 | ## Usage
22 |
23 | The `Tabs` component handles all state-related logic internally by default, meaning you get all basic tabs functionality out of the box. Remember to provide an `id` prop to tie the tab title to its content!
24 | Feel free to add whatever classes or styles you want to any of the `Tabs.x` components - they'll be passed down to the div element.
25 | Just do this:
26 |
27 | ```js
28 | const TabbedInterface = () => (
29 |
30 | Title 1
31 | Content for tab 1
32 | Title 2
33 | Content for tab 2
34 |
35 | );
36 | ```
37 |
38 | Or with an `Array.map()`:
39 |
40 | ```jsx
41 | const TabbedInterface = () => (
42 |
43 | {tabs.map((tab) => (
44 |
45 | {tab.title}
46 | {tab.content}
47 |
48 | ))}
49 |
50 | );
51 | ```
52 |
53 | ### State Handling
54 |
55 | By default, all state is handled internally by the `Tabs` component.
56 | If you'd like to further customize this behavior (e.g. change the default active tab), you can provide an `active` prop to the `Tabs` component. You will then have to manage the state outside of the tabs component using the `onChange` event. Like so:
57 |
58 | ```jsx
59 | const ExampleDocs = () => {
60 | const queryParams = new URLSearchParams(window.location.search);
61 | const [activeId, setActiveId] = React.useState(queryParams.get("default"));
62 |
63 | return (
64 |
65 | Title 1
66 | Content for tab 1
67 | Title 2
68 | Content for tab 2
69 |
70 | );
71 | };
72 | ```
73 |
74 | ### onChange Handler
75 |
76 | When a user clicks on a Tab, the `onChange` handler is called. You can make use of this functionality by adding an `onChange` prop to the `` wrapper like so:
77 |
78 | ```jsx
79 | const TabbedInterface = () => (
80 | console.log(selectedId)}>...
81 | );
82 | ```
83 |
84 | ### Active Class
85 |
86 | You can apply an `activeClassName` to each `Tabs.Title` component. When that title is selected, the specified className will be applied.
87 |
88 | ```jsx
89 | const TabbedInterface = () => (
90 |
91 |
92 | Title 1
93 |
94 | Content for tab 1
95 |
96 | Title 2
97 |
98 | Content for tab 2
99 |
100 | );
101 | ```
102 |
103 | ### Class Names
104 |
105 | `className` props provided to any `Tab` component will be passed down to the render element.
106 |
107 | A `className` provided to the `Tabs` component will be added to the `div` element which wraps the tab title group.
108 | A `className` provided to the `Tabs.Title` component will be added to the `div` element which wraps an individual tab title.
109 | A `className` provided to the `Tabs.Content` component will be added to the `div` element which wraps the tab content.
110 |
--------------------------------------------------------------------------------
/components/Tabs/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/Tabs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/tabs",
3 | "version": "2.0.0",
4 | "main": "./dist/cjs/index.js",
5 | "module": "./dist/esm/index.js",
6 | "types": "./dist",
7 | "exports": {
8 | ".": {
9 | "import": "./dist/esm/index.js",
10 | "require": "./dist/cjs/index.js"
11 | }
12 | },
13 | "repository": "https://github.com/intuit/doc-blocks",
14 | "author": "Sean Powell sean_powell@intuit.com",
15 | "contributors": [
16 | "Sean Powell sean_powell@intuit.com"
17 | ],
18 | "license": "MIT",
19 | "sideEffects": [
20 | "*.css"
21 | ],
22 | "publishConfig": {
23 | "registry": "https://registry.npmjs.org/",
24 | "access": "public"
25 | },
26 | "scripts": {
27 | "dev": "vite",
28 | "build": "vite build",
29 | "lint": "eslint .",
30 | "preview": "vite preview"
31 | },
32 | "dependencies": {
33 | "@babel/runtime": "7.11.2"
34 | },
35 | "peerDependencies": {
36 | "react": ">= 18.2.0"
37 | },
38 | "files": [
39 | "dist",
40 | "src",
41 | "!*.snippet.*",
42 | "!*theme.*",
43 | "!*.test.*",
44 | "!__snapshots__",
45 | "!__tests__"
46 | ]
47 | }
48 |
--------------------------------------------------------------------------------
/components/Tabs/src/Tabs.module.css:
--------------------------------------------------------------------------------
1 | .container {
2 | width: 100%;
3 | }
4 |
5 | .tabsRow {
6 | display: flex;
7 | flex-direction: row;
8 | }
9 |
10 | .tabTitle {
11 | padding: 8px 16px;
12 | cursor: pointer;
13 | }
14 |
15 | .activeTab {
16 | border-bottom: 1px solid #000000;
17 | }
18 |
19 | .tabTitle:not(.activeTab):hover {
20 | border-bottom: 1px solid rgba(0, 0, 0, 0.2);
21 | }
22 |
23 | .tabContent {
24 | padding: 16px 32px;
25 | }
26 |
--------------------------------------------------------------------------------
/components/Tabs/src/Tabs.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { Meta, StoryObj } from "@storybook/react";
3 | import { fn } from "storybook/test";
4 |
5 | import { Tabs, TabsProps } from ".";
6 |
7 | const meta: Meta = {
8 | title: "Components/Tabs",
9 | component: Tabs,
10 | args: { onChange: fn() },
11 | tags: ["autodocs"],
12 | };
13 |
14 | export default meta;
15 | type Story = StoryObj;
16 |
17 | const TabsDemo = (args: TabsProps) => {
18 | const [activeTab, setActiveTab] = React.useState();
19 |
20 | return (
21 | {
24 | setActiveTab(selectedId);
25 | args.onChange?.(selectedId);
26 | }}
27 | >
28 |
29 | Title 1
30 |
31 | Content 1
32 |
33 | Title 2
34 |
35 | Content 2
36 |
37 | );
38 | };
39 |
40 | export const BasicUsage: Story = {
41 | render: (args) => ,
42 | };
43 |
--------------------------------------------------------------------------------
/components/Tabs/src/Tabs.test.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { cleanup, render, screen } from "@testing-library/react";
3 | import userEvent from "@testing-library/user-event";
4 |
5 | import { Tabs } from ".";
6 |
7 | const TabStub = ({
8 | spy,
9 | active,
10 | }: {
11 | spy?: jest.Mock;
12 | active?: string;
13 | }) => (
14 | spy && spy(selectedId)}
17 | >
18 |
23 | Title 1
24 |
25 | Content 1
26 |
31 | Title 2
32 |
33 | Content 2
34 |
35 | );
36 |
37 | afterEach(cleanup);
38 |
39 | describe("Tabs", () => {
40 | test("It matches the snapshot", () => {
41 | const { container } = render( );
42 | expect(container).toMatchSnapshot();
43 | });
44 |
45 | test("It renders both tabs", () => {
46 | const { queryByText } = render( );
47 | expect(queryByText("Title 1")).toBeInTheDocument();
48 | expect(queryByText("Title 2")).toBeInTheDocument();
49 | });
50 |
51 | test("It renders first tab content by default", () => {
52 | const { queryByText } = render( );
53 | expect(queryByText("Content 1")).toBeInTheDocument();
54 | expect(queryByText("Content 2")).not.toBeInTheDocument();
55 | });
56 |
57 | test("It changes tab content when unselected title is clicked", async () => {
58 | const user = userEvent.setup();
59 | const { queryByText } = render( );
60 | expect(queryByText("Content 2")).not.toBeInTheDocument();
61 |
62 | await user.click(screen.getByText("Title 2"));
63 |
64 | expect(queryByText("Content 2")).toBeInTheDocument();
65 | });
66 |
67 | test("It changes tab content when unselected title is key pressed", async () => {
68 | const user = userEvent.setup();
69 | const { queryByText } = render( );
70 | expect(queryByText("Content 2")).not.toBeInTheDocument();
71 |
72 | await user.type(screen.getByText("Title 2"), "{space}");
73 |
74 | expect(queryByText("Content 2")).toBeInTheDocument();
75 | });
76 |
77 | test("It applies the activeClassName to the currently selected title", async () => {
78 | const user = userEvent.setup();
79 | const { queryByText } = render( );
80 | expect(queryByText("Title 2")).toHaveClass("title-2-default");
81 | expect(queryByText("Title 2")).not.toHaveClass("title-2-selected");
82 | expect(queryByText("Title 1")).toHaveClass("title-1-selected");
83 | expect(queryByText("Title 1")).toHaveClass("title-1-default");
84 |
85 | await user.click(screen.getByText("Title 2"));
86 |
87 | expect(queryByText("Title 2")).toHaveClass("title-2-selected");
88 | expect(queryByText("Title 2")).toHaveClass("title-2-default");
89 | expect(queryByText("Title 1")).toHaveClass("title-1-default");
90 | expect(queryByText("Title 1")).not.toHaveClass("title-1-selected");
91 | });
92 |
93 | test("It calls onChange when a tab is clicked", async () => {
94 | const user = userEvent.setup();
95 | const spy = jest.fn();
96 | const { queryByText } = render( );
97 | expect(queryByText("Title 1")).toBeInTheDocument();
98 | expect(queryByText("Title 2")).toBeInTheDocument();
99 |
100 | await user.click(screen.getByText("Title 2"));
101 |
102 | expect(spy).toHaveBeenCalledTimes(1);
103 | expect(spy).toHaveBeenCalledWith("two");
104 | });
105 |
106 | test("It sets initial tab state based on active prop", () => {
107 | const { queryByText } = render( );
108 | expect(queryByText("Content 2")).toBeInTheDocument();
109 | expect(queryByText("Content 1")).not.toBeInTheDocument();
110 | });
111 | });
112 |
--------------------------------------------------------------------------------
/components/Tabs/src/__snapshots__/Tabs.test.tsx.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Tabs It matches the snapshot 1`] = `
4 |
5 |
8 |
11 |
17 | Title 1
18 |
19 |
25 | Title 2
26 |
27 |
28 |
31 | Content 1
32 |
33 |
34 |
35 | `;
36 |
--------------------------------------------------------------------------------
/components/Tabs/src/index.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/ban-ts-comment */
2 | import React, { useEffect } from "react";
3 |
4 | import styles from "./Tabs.module.css";
5 |
6 | export interface TabsProps {
7 | /** Default active tab */
8 | active?: string;
9 | /** Children of tabs wrapper */
10 | children?: React.ReactNode[];
11 | /** Classes to apply to tab title wrapper **/
12 | className?: string;
13 | /** Callback after a tab is selected */
14 | onChange?: (selectedId: string) => void;
15 | }
16 |
17 | export interface TabProps
18 | extends React.DetailedHTMLProps<
19 | React.HTMLAttributes,
20 | HTMLDivElement
21 | > {
22 | /** ID of tab (ties tab content to tab title) */
23 | id: string;
24 | /** Class to apply to selected tab title */
25 | activeClassName?: string;
26 | }
27 |
28 | interface TabsContextProps {
29 | /** Array of tabs to render */
30 | tabs?: Record;
31 | /** Setter method for tabs */
32 | setTabs: React.Dispatch>>;
33 | }
34 |
35 | interface Tab {
36 | /** Title to render in tab */
37 | title?: React.ReactNode;
38 | /** Props to spread to tab title element */
39 | titleProps?: React.HTMLAttributes &
40 | React.AriaAttributes &
41 | TabProps;
42 | /** Content to render in tab panel */
43 | content?: React.ReactNode;
44 | /** Props to spread to tab content element */
45 | contentProps?: React.DOMAttributes & React.AriaAttributes;
46 | }
47 |
48 | // Setting up context with dummy values to satisfy typechecking
49 | const TabsContext = React.createContext({
50 | tabs: {},
51 | setTabs: () => null,
52 | });
53 |
54 | /** Tabbed interface to show consumer and contributor docs */
55 | export const Tabs = ({
56 | active,
57 | children,
58 | className: tabsWrapperClassName,
59 | onChange,
60 | }: TabsProps) => {
61 | const [tabs, setTabs] = React.useState>({});
62 | const [selectedId, setSelectedId] = React.useState();
63 | const providerState = React.useMemo(() => ({ tabs, setTabs }), [tabs]);
64 |
65 | useEffect(() => {
66 | const tabKeys = Object.keys(tabs);
67 | if (tabKeys.length > 1) {
68 | const tabIndex = active ? tabKeys.indexOf(active) : 0;
69 | setSelectedId(tabKeys[tabIndex]);
70 | }
71 | }, [tabs, active]);
72 |
73 | return (
74 | <>
75 | {/* @ts-ignore */}
76 |
77 | {children}
78 |
79 |
80 |
81 | {Object.entries(tabs).map(([id, tab]) => {
82 | if (tab.titleProps) {
83 | const {
84 | className,
85 | activeClassName,
86 | ...titleProps
87 | } = tab.titleProps;
88 |
89 | return (
90 |
{
100 | onChange?.(id);
101 | setSelectedId(id);
102 | }}
103 | onKeyDown={(e) => e.key !== "Tab" && setSelectedId(id)}
104 | {...titleProps}
105 | >
106 | {tab.title}
107 |
108 | );
109 | }
110 |
111 | return "No Title";
112 | })}
113 |
114 | {Object.entries(tabs)
115 | .filter(([id]) => id === selectedId)
116 | .map(([id, tab]) => (
117 |
122 | {tab.content}
123 |
124 | ))}
125 |
126 | >
127 | );
128 | };
129 |
130 | /** Add a title to a tab */
131 | const Title = ({ id, children, activeClassName, ...rest }: TabProps) => {
132 | const { setTabs } = React.useContext(TabsContext);
133 | const { current: otherProps } = React.useRef(rest);
134 |
135 | React.useEffect(() => {
136 | if (id) {
137 | setTabs((prev: Record) => {
138 | // If this tab already exists, append to the existing object
139 | if (prev[id]) {
140 | return {
141 | ...prev,
142 | [id]: {
143 | ...prev[id],
144 | title: children,
145 | titleProps: { ...otherProps, id, activeClassName },
146 | },
147 | };
148 | }
149 |
150 | // Otherwise, create a new object with this ID
151 | return {
152 | ...prev,
153 | [id]: {
154 | title: children,
155 | titleProps: { ...otherProps, id, activeClassName },
156 | },
157 | };
158 | });
159 | }
160 | }, [id, children, setTabs, otherProps, activeClassName]);
161 |
162 | return null;
163 | };
164 |
165 | /** Add some content to a tab */
166 | const Content = ({ id, children, ...rest }: TabProps) => {
167 | const { setTabs } = React.useContext(TabsContext);
168 | const { current: otherProps } = React.useRef(rest);
169 |
170 | React.useEffect(() => {
171 | if (id) {
172 | setTabs((prev: Record) => {
173 | // If this tab already exists, append to the existing object
174 | if (prev[id]) {
175 | return {
176 | ...prev,
177 | [id]: { ...prev[id], content: children, contentProps: otherProps },
178 | };
179 | }
180 |
181 | // Otherwise, create a new object with this ID
182 | return {
183 | ...prev,
184 | [id]: { content: children, contentProps: otherProps },
185 | };
186 | });
187 | }
188 | }, [id, children, setTabs, otherProps]);
189 |
190 | return null;
191 | };
192 |
193 | Tabs.Title = Title;
194 | Tabs.Content = Content;
195 |
--------------------------------------------------------------------------------
/components/Tabs/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Tabs/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Tabs/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Tabs/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/components/Version/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v1.0.0 (Thu May 01 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v0.7.0 (Mon Oct 19 2020)
15 |
16 | #### 🚀 Enhancement
17 |
18 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
19 |
20 | #### 🐛 Bug Fix
21 |
22 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
23 | - Add Gallery component ([@hipstersmoothie](https://github.com/hipstersmoothie))
24 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
25 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
26 |
27 | #### Authors: 1
28 |
29 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
30 |
31 | ---
32 |
33 | # v0.6.5 (Wed Oct 14 2020)
34 |
35 | #### ⚠️ Pushed to `master`
36 |
37 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
38 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
39 |
40 | #### Authors: 1
41 |
42 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
43 |
--------------------------------------------------------------------------------
/components/Version/README.md:
--------------------------------------------------------------------------------
1 | # @doc-blocks/version
2 |
3 | Welcome to my `Version` component.
4 |
5 | ## Installation
6 |
7 | ```sh
8 | npm i @doc-blocks/version
9 | # or with yarn
10 | yarn add @doc-blocks/version
11 | ```
12 |
13 | ## Usage
14 |
15 | **Example:**
16 |
17 | ```jsx
18 | import { Version } from "@doc-blocks/version";
19 | import { version } from "../package.json";
20 |
21 | ;
22 | ```
23 |
--------------------------------------------------------------------------------
/components/Version/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/components/Version/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/version",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "license": "MIT",
20 | "sideEffects": [
21 | "*.css"
22 | ],
23 | "publishConfig": {
24 | "registry": "https://registry.npmjs.org/",
25 | "access": "public"
26 | },
27 | "scripts": {
28 | "dev": "vite",
29 | "build": "vite build",
30 | "lint": "eslint .",
31 | "preview": "vite preview"
32 | },
33 | "dependencies": {
34 | "@babel/runtime": "^7.11.2",
35 | "@doc-blocks/shield": "link:../Shield"
36 | },
37 | "peerDependencies": {
38 | "react": ">= 18.2.0"
39 | },
40 | "files": [
41 | "dist",
42 | "src",
43 | "!*.snippet.*",
44 | "!*theme.*",
45 | "!*.test.*",
46 | "!__snapshots__",
47 | "!__tests__"
48 | ]
49 | }
50 |
--------------------------------------------------------------------------------
/components/Version/src/Version.stories.mdx:
--------------------------------------------------------------------------------
1 | import { Story, Meta, Canvas } from "@storybook/addon-docs";
2 |
3 | import { Version } from ".";
4 | import { version } from "../package.json";
5 | import notes from "../README.md";
6 |
7 |
8 |
9 | # @doc-blocks/version
10 |
11 | A component that makes displays the current version of the component.
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/components/Version/src/Version.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react";
2 |
3 | import { Version } from ".";
4 | import { version } from "../package.json";
5 |
6 | const meta: Meta = {
7 | title: "Shields/Version",
8 | component: Version,
9 | parameters: {
10 | layout: "centered",
11 | docs: {
12 | description: {
13 | component:
14 | "A component that displays the current version of the component.",
15 | },
16 | },
17 | },
18 | tags: ["autodocs"],
19 | };
20 |
21 | export default meta;
22 | type Story = StoryObj;
23 |
24 | export const BasicUsage: Story = {
25 | args: {
26 | current: version,
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/components/Version/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Shield } from "@doc-blocks/shield";
3 |
4 | export interface VersionProps {
5 | /** The current version */
6 | current?: string;
7 | /** Url to the component's changelog */
8 | url?: string;
9 | }
10 |
11 | /** A simple component. */
12 | export const Version = ({ current, url }: VersionProps) => (
13 |
20 | );
21 |
--------------------------------------------------------------------------------
/components/Version/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/components/Version/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/components/Version/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/components/Version/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from "@eslint/js";
2 | import globals from "globals";
3 | import reactHooks from "eslint-plugin-react-hooks";
4 | import reactRefresh from "eslint-plugin-react-refresh";
5 | import tseslint from "typescript-eslint";
6 |
7 | export default tseslint.config(
8 | { ignores: ["dist"] },
9 | {
10 | extends: [js.configs.recommended, ...tseslint.configs.recommended],
11 | files: ["**/*.{ts,tsx}"],
12 | languageOptions: {
13 | ecmaVersion: 2020,
14 | globals: globals.browser,
15 | },
16 | plugins: {
17 | "react-hooks": reactHooks,
18 | "react-refresh": reactRefresh,
19 | },
20 | rules: {
21 | ...reactHooks.configs.recommended.rules,
22 | "react-refresh/only-export-components": [
23 | "warn",
24 | { allowConstantExport: true },
25 | ],
26 | },
27 | }
28 | );
29 |
--------------------------------------------------------------------------------
/example/Example.mdx:
--------------------------------------------------------------------------------
1 | import { Story, Meta, Canvas } from "@storybook/addon-docs";
2 | import { Button } from "@storybook/react/demo";
3 |
4 | import { Accessibility } from "@doc-blocks/accessibility";
5 | import { BundleSize } from "@doc-blocks/bundle-size";
6 | import { DesignSpec } from "@doc-blocks/design-spec";
7 | import { Do, Dont } from "@doc-blocks/guideline";
8 | import { BestFor, NotFor } from "@doc-blocks/intended-usage";
9 | import { RelatedComponents } from "@doc-blocks/related-components";
10 | import { ResponsiveStory } from "@doc-blocks/responsive-story";
11 | import { Row } from "@doc-blocks/row";
12 | import { ShieldRow } from "@doc-blocks/shield-row";
13 | import { Version } from "@doc-blocks/version";
14 |
15 | import { version } from "./package.json";
16 |
17 | # Button
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Buttons allow users to take actions, and make choices, with a single tap.
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | - Taking action within a page
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | - Navigation between pages
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | ## Types
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | ### Side by side (column size flexible)
61 |
62 | Description of type and breakdown of usage.
63 |
64 | - one
65 | - two
66 | - three
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | ### Usage Guidelines
79 |
80 | Description of variants and breakdown of usage. This text block expands to the full width of the page.
81 |
82 |
83 |
84 | Click me
85 |
86 |
87 | Click me to do the thing that is a
88 |
89 |
90 |
91 | ## Scenarios
92 |
93 |
94 |
95 |
96 |
97 | ### Scenario 1 (example with a mobile shell)
98 |
99 | Typical application of one of the component variants
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/example/Example.stories.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Button } from "@storybook/react/demo";
3 |
4 | import mdx from "./Example.mdx";
5 |
6 | export default {
7 | title: "Examples/Button",
8 | component: Button,
9 | parameters: {
10 | docs: {
11 | page: mdx,
12 | },
13 | },
14 | };
15 |
16 | export const Basic = () => Hello Button ;
17 |
18 | export const WithEmoji = () => (
19 |
20 |
21 | 😀 😎 👍 💯
22 |
23 |
24 | );
25 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.3"
3 | }
4 |
--------------------------------------------------------------------------------
/example/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 |
3 | module.exports = {
4 | ...base,
5 | roots: ["/components/", "/packages/"],
6 | coverageDirectory: "/coverage/",
7 | setupFiles: [],
8 | setupFilesAfterEnv: [require.resolve("@testing-library/jest-dom")],
9 | };
10 |
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "npmClient": "yarn",
4 | "packages": ["components/*", "packages/*"]
5 | }
6 |
--------------------------------------------------------------------------------
/media/logo-mark.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/monorepo",
3 | "private": true,
4 | "repository": "https://github.com/intuit/doc-blocks",
5 | "author": "Andrew Lisowski lisowski54@gmail.com",
6 | "contributors": [
7 | "Andrew Lisowski lisowski54@gmail.com"
8 | ],
9 | "license": "MIT",
10 | "scripts": {
11 | "create": "ds create component",
12 | "create:package": "ds create package",
13 | "clean": "ds clean",
14 | "dev": "ds dev",
15 | "start": "lerna run start --parallel",
16 | "storybook": "storybook dev -p 6006",
17 | "lint": "ds lint",
18 | "test": "ds test",
19 | "build": "lerna run build --stream",
20 | "build:storybook": "storybook build",
21 | "size": "ds size",
22 | "release": "npx auto shipit -vv"
23 | },
24 | "workspaces": [
25 | "components/*",
26 | "packages/*"
27 | ],
28 | "resolutions": {
29 | "typescript": "5.8.2",
30 | "react": "18.2.0",
31 | "@types/react": "18.3.20",
32 | "@types/react-dom": "18.2.0",
33 | "unified": "11.0.5",
34 | "@types/scheduler": "< 0.23.0",
35 | "@testing-library/jest-dom": "6.6.3",
36 | "@testing-library/dom": "^10.0.0"
37 | },
38 | "devDependencies": {
39 | "@auto-it/all-contributors": "10.46.0",
40 | "@auto-it/gh-pages": "10.46.0",
41 | "@auto-it/released": "10.46.0",
42 | "@chromatic-com/storybook": "^4",
43 | "@design-systems/cli": "4.15.4",
44 | "@eslint/js": "9.25.1",
45 | "@storybook/addon-docs": "^9.0.0",
46 | "@storybook/builder-vite": "9.0.0",
47 | "@storybook/react": "^9.0.0",
48 | "@storybook/react-vite": "9.0.0",
49 | "@testing-library/dom": "^10.0.0",
50 | "@testing-library/jest-dom": "6.6.3",
51 | "@testing-library/react": "16.3.0",
52 | "@testing-library/user-event": "14.6.1",
53 | "@types/node": "22.15.3",
54 | "@types/react": "19.1.2",
55 | "@types/react-dom": "19.1.3",
56 | "@vitejs/plugin-react": "4.4.1",
57 | "auto": "11.3.0",
58 | "eslint": "9.25.1",
59 | "eslint-plugin-react-hooks": "5.2.0",
60 | "eslint-plugin-react-refresh": "0.4.20",
61 | "global": "4.4.0",
62 | "husky": "2.7.0",
63 | "lerna": "7.4.2",
64 | "lint-staged": "^9.0.0",
65 | "prettier": "2.1.2",
66 | "react": "18.2.0",
67 | "react-dom": "18.2.0",
68 | "storybook": "^9.0.0",
69 | "typescript": "5.8.3",
70 | "typescript-eslint": "8.31.1",
71 | "vite": "6.3.4",
72 | "vite-plugin-css-injected-by-js": "3.5.2",
73 | "vite-plugin-dts": "4.5.3"
74 | },
75 | "lint-staged": {
76 | "*.{js,json,css,md,ts,tsx,jsx}": [
77 | "prettier --write",
78 | "git add"
79 | ]
80 | },
81 | "jest-junit": {
82 | "outputDirectory": "./coverage/target/surefire-reports"
83 | },
84 | "husky": {
85 | "hooks": {
86 | "pre-commit": "lint-staged"
87 | }
88 | },
89 | "publishConfig": {
90 | "registry": "https://registry.npmjs.org/",
91 | "access": "public"
92 | },
93 | "auto": {
94 | "plugins": [
95 | "npm",
96 | "released",
97 | "all-contributors",
98 | [
99 | "gh-pages",
100 | {
101 | "dir": "./out"
102 | }
103 | ]
104 | ]
105 | },
106 | "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
107 | }
108 |
--------------------------------------------------------------------------------
/packages/doc-blocks/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # v2.0.0 (Wed Jul 02 2025)
2 |
3 | #### 💥 Breaking Change
4 |
5 | - feat: bump to storybook 9 [#36](https://github.com/intuit/doc-blocks/pull/36) (sean_powell@intuit.com [@fattslug](https://github.com/fattslug))
6 |
7 | #### Authors: 2
8 |
9 | - Sean Powell ([@fattslug](https://github.com/fattslug))
10 | - spowell9 (sean_powell@intuit.com)
11 |
12 | ---
13 |
14 | # v1.0.0 (Thu May 01 2025)
15 |
16 | #### 💥 Breaking Change
17 |
18 | - feat: add github actions pipeline, bump to react v18 + storybook v8 + lerna v7 + auto v11 + vite [#34](https://github.com/intuit/doc-blocks/pull/34) ([@fattslug](https://github.com/fattslug) sean_powell@intuit.com)
19 |
20 | #### Authors: 2
21 |
22 | - Sean Powell ([@fattslug](https://github.com/fattslug))
23 | - spowell9 (sean_powell@intuit.com)
24 |
25 | ---
26 |
27 | # v0.8.7 (Tue Oct 05 2021)
28 |
29 | #### 🐛 Bug Fix
30 |
31 | - Updating exports to include tabs and accordion [#16](https://github.com/intuit/doc-blocks/pull/16) (sean_powell@intuit.com)
32 |
33 | #### Authors: 1
34 |
35 | - Sean Powell ([@fattslug](https://github.com/fattslug))
36 |
37 | ---
38 |
39 | # v0.7.0 (Mon Oct 19 2020)
40 |
41 | #### 🚀 Enhancement
42 |
43 | - Add Gallery component [#2](https://github.com/intuit/doc-blocks/pull/2) ([@hipstersmoothie](https://github.com/hipstersmoothie))
44 |
45 | #### 🐛 Bug Fix
46 |
47 | - upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
48 | - add gallery to doc-blocks package ([@hipstersmoothie](https://github.com/hipstersmoothie))
49 | - remove default exports and update example [#1](https://github.com/intuit/doc-blocks/pull/1) ([@hipstersmoothie](https://github.com/hipstersmoothie))
50 | - remove default exports and update example ([@hipstersmoothie](https://github.com/hipstersmoothie))
51 |
52 | #### Authors: 1
53 |
54 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
55 |
56 | ---
57 |
58 | # v0.6.5 (Wed Oct 14 2020)
59 |
60 | #### ⚠️ Pushed to `master`
61 |
62 | - add publishConfig ([@hipstersmoothie](https://github.com/hipstersmoothie))
63 | - init ([@hipstersmoothie](https://github.com/hipstersmoothie))
64 |
65 | #### Authors: 1
66 |
67 | - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
68 |
--------------------------------------------------------------------------------
/packages/doc-blocks/README.md:
--------------------------------------------------------------------------------
1 | # doc-blocks
2 |
3 | All of the storybook @doc-blocks in 1 package.
4 |
5 | This package contains all of the following:
6 |
7 | - [`@doc-blocks/accessibility`](../../components/Accessibility/README.md)
8 | - [`@doc-blocks/bundle-size`](../../components/BundleSize/README.md)
9 | - [`@doc-blocks/design-spec`](../../components/DesignSpec/README.md)
10 | - [`@doc-blocks/guideline`](../../components/Guideline/README.md)
11 | - [`@doc-blocks/intended-usage`](../../components/IntendedUsage/README.md)
12 | - [`@doc-blocks/related-components`](../../components/RelatedComponents/README.md)
13 | - [`@doc-blocks/responsive-story`](../../components/ResponsiveStory/README.md)
14 | - [`@doc-blocks/row`](../../components/Row/README.md)
15 | - [`@doc-blocks/shield`](../../components/Shield/README.md)
16 | - [`@doc-blocks/shield-row`](../../components/ShieldRow/README.md)
17 | - [`@doc-blocks/version`](../../components/Version/README.md)
18 |
19 | ## Installation
20 |
21 | ```sh
22 | npm i doc-blocks
23 | # or with yarn
24 | yarn add doc-blocks
25 | ```
26 |
27 | Then import the component you want to use
28 |
29 | ```js
30 | import { Row } from "doc-blocks";
31 | ```
32 |
--------------------------------------------------------------------------------
/packages/doc-blocks/jest.config.js:
--------------------------------------------------------------------------------
1 | const base = require("@design-systems/test/jest.config.base");
2 | const { name } = require("./package.json");
3 |
4 | module.exports = {
5 | ...base,
6 | name,
7 | displayName: name,
8 | };
9 |
--------------------------------------------------------------------------------
/packages/doc-blocks/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@doc-blocks/all",
3 | "version": "2.0.0",
4 | "type": "module",
5 | "main": "./dist/cjs/index.js",
6 | "module": "./dist/esm/index.js",
7 | "types": "./dist",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/esm/index.js",
11 | "require": "./dist/cjs/index.js"
12 | }
13 | },
14 | "repository": "https://github.com/intuit/doc-blocks",
15 | "author": "Andrew Lisowski lisowski54@gmail.com",
16 | "contributors": [
17 | "Andrew Lisowski lisowski54@gmail.com"
18 | ],
19 | "publishConfig": {
20 | "registry": "https://registry.npmjs.org/",
21 | "access": "public"
22 | },
23 | "description": "All of the storybook doc blocks in 1 package",
24 | "license": "MIT",
25 | "scripts": {
26 | "dev": "vite",
27 | "build": "vite build",
28 | "lint": "eslint .",
29 | "preview": "vite preview"
30 | },
31 | "files": [
32 | "dist",
33 | "src",
34 | "!*.test.*",
35 | "!__snapshots__",
36 | "!__tests__"
37 | ],
38 | "dependencies": {
39 | "@babel/runtime": "^7.11.2",
40 | "@doc-blocks/accessibility": "link:../../components/Accessibility",
41 | "@doc-blocks/accordion": "link:../../components/Accordion",
42 | "@doc-blocks/bundle-size": "link:../../components/BundleSize",
43 | "@doc-blocks/design-spec": "link:../../components/DesignSpec",
44 | "@doc-blocks/gallery": "link:../../components/Gallery",
45 | "@doc-blocks/guideline": "link:../../components/Guideline",
46 | "@doc-blocks/intended-usage": "link:../../components/IntendedUsage",
47 | "@doc-blocks/related-components": "link:../../components/RelatedComponents",
48 | "@doc-blocks/responsive-story": "link:../../components/ResponsiveStory",
49 | "@doc-blocks/row": "link:../../components/Row",
50 | "@doc-blocks/shield": "link:../../components/Shield",
51 | "@doc-blocks/shield-row": "link:../../components/ShieldRow",
52 | "@doc-blocks/tabs": "link:../../components/Tabs",
53 | "@doc-blocks/version": "link:../../components/Version"
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/packages/doc-blocks/src/index.tsx:
--------------------------------------------------------------------------------
1 | export * from "@doc-blocks/accessibility";
2 | export * from "@doc-blocks/accordion";
3 | export * from "@doc-blocks/bundle-size";
4 | export * from "@doc-blocks/design-spec";
5 | export * from "@doc-blocks/guideline";
6 | export * from "@doc-blocks/intended-usage";
7 | export * from "@doc-blocks/related-components";
8 | export * from "@doc-blocks/responsive-story";
9 | export * from "@doc-blocks/row";
10 | export * from "@doc-blocks/shield";
11 | export * from "@doc-blocks/shield-row";
12 | export * from "@doc-blocks/tabs";
13 | export * from "@doc-blocks/version";
14 |
--------------------------------------------------------------------------------
/packages/doc-blocks/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/packages/doc-blocks/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["src/**/*.test.+(ts|tsx)", "src/**/*.stories.+(ts|tsx)"],
4 | "types": ["vite/client"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/doc-blocks/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.build.json",
3 | "exclude": ["node_modules", "dist", "coverage", "src/**/*.test.+(ts|tsx)"],
4 | "compilerOptions": {
5 | "outDir": "./dist",
6 | "rootDir": "./src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/packages/doc-blocks/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { resolve } from "path";
3 | import react from "@vitejs/plugin-react";
4 | import dts from "vite-plugin-dts";
5 | import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6 |
7 | // https://vite.dev/config/
8 | export default defineConfig({
9 | plugins: [
10 | react(),
11 | dts({
12 | tsconfigPath: "tsconfig.build.json",
13 | }),
14 | cssInjectedByJsPlugin(),
15 | ],
16 | build: {
17 | lib: {
18 | entry: resolve(__dirname, `src/index.tsx`),
19 | formats: ["es", "cjs"],
20 | fileName(format) {
21 | if (format === "es") {
22 | return "esm/[name].js";
23 | }
24 |
25 | return "cjs/[name].js";
26 | },
27 | },
28 | rollupOptions: {
29 | external: ["react", "react-dom"],
30 | output: {
31 | globals: {
32 | react: "React",
33 | "react-dom": "React-dom",
34 | },
35 | },
36 | },
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["@appfabric"],
3 | "automerge": false,
4 | "patch": {
5 | "labels": ["dependency-update"]
6 | },
7 | "minor": {
8 | "labels": ["dependency-update"]
9 | },
10 | "major": {
11 | "labels": ["dependency-update"]
12 | },
13 | "digest": {
14 | "labels": ["dependency-update"]
15 | },
16 | "packageRules": [
17 | {
18 | "automerge": false,
19 | "depTypeList": ["devDependencies"],
20 | "labels": ["dev-dependency", "dependency-update"]
21 | },
22 | {
23 | "packagePatterns": ["auto", "@auto-it"],
24 | "groupName": "auto"
25 | },
26 | {
27 | "packagePatterns": ["@ids", "@ids-open", "@ids-beta"],
28 | "groupName": "ids"
29 | },
30 | {
31 | "packagePatterns": ["@fuego"],
32 | "groupName": "fuego"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "types": ["vite/client"],
4 | "composite": true,
5 | "target": "es5",
6 | "module": "commonjs",
7 | "strict": true,
8 | "jsx": "preserve",
9 | "esModuleInterop": true,
10 | "sourceMap": true,
11 | "declaration": true,
12 | "lib": ["esnext", "dom"],
13 | "experimentalDecorators": true,
14 | "resolveJsonModule": true,
15 | "downlevelIteration": true
16 | },
17 | "exclude": ["node_modules"]
18 | }
19 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.build.json",
3 | "compilerOptions": {
4 | // Monorepo support
5 | "baseUrl": ".",
6 | "paths": {
7 | "@doc-blocks/*": ["components/*/src"]
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | });
8 |
--------------------------------------------------------------------------------