├── .coveralls.yml
├── .eslintignore
├── .eslintrc
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── help.md
├── .gitignore
├── .npmignore
├── .nvmrc
├── .prettierrc
├── .storybook
├── common-props.js
├── main.js
├── manager.js
├── package.json
├── preview.js
├── rewrites.scss
└── theme.js
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── babel.config.cjs
├── index.esm.mjs
├── jest.config.js
├── package-lock.json
├── package.json
├── src
├── __test__
│ ├── __snapshots__
│ │ └── index.test.js.snap
│ ├── index.test.js
│ └── setup.js
├── changelog.story.mdx
├── components
│ ├── block
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── block.test.js.snap
│ │ │ └── block.test.js
│ │ ├── block.js
│ │ ├── block.story.js
│ │ ├── block.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── box
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── box.test.js.snap
│ │ │ └── box.test.js
│ │ ├── box.js
│ │ ├── box.story.js
│ │ ├── box.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── breadcrumb
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── breadcrumb.test.js.snap
│ │ │ └── breadcrumb.test.js
│ │ ├── breadcrumb.js
│ │ ├── breadcrumb.story.js
│ │ ├── breadcrumb.story.mdx
│ │ ├── components
│ │ │ └── item.js
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── button
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── button.test.js.snap
│ │ │ └── button.test.js
│ │ ├── button.js
│ │ ├── button.story.js
│ │ ├── button.story.mdx
│ │ ├── components
│ │ │ └── button-group.js
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── card
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── card.test.js.snap
│ │ │ └── card.test.js
│ │ ├── card.js
│ │ ├── card.story.js
│ │ ├── card.story.mdx
│ │ ├── components
│ │ │ ├── content.js
│ │ │ ├── footer
│ │ │ │ ├── components
│ │ │ │ │ └── footer-item.js
│ │ │ │ ├── footer.js
│ │ │ │ └── index.js
│ │ │ ├── header
│ │ │ │ ├── components
│ │ │ │ │ ├── header-icon.js
│ │ │ │ │ └── header-title.js
│ │ │ │ ├── header.js
│ │ │ │ └── index.js
│ │ │ └── image.js
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── columns
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── columns.test.js.snap
│ │ │ └── columns.test.js
│ │ ├── columns.js
│ │ ├── components
│ │ │ └── column.js
│ │ ├── constants.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ └── stories
│ │ │ ├── columns-1-basics.story.mdx
│ │ │ ├── columns-2-sizes.story.mdx
│ │ │ ├── columns-3-responsiveness.story.mdx
│ │ │ ├── columns-4-nesting.story.mdx
│ │ │ ├── columns-5-gap.story.mdx
│ │ │ ├── columns-6-Options.story.mdx
│ │ │ └── columns.story.js
│ ├── container
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── container.test.js.snap
│ │ │ └── container.test.js
│ │ ├── container.js
│ │ ├── container.story.js
│ │ ├── container.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── content
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── content.test.js.snap
│ │ │ └── content.test.js
│ │ ├── content.js
│ │ ├── content.story.js
│ │ ├── content.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── delete
│ │ └── delete.story.mdx
│ ├── dropdown
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── dropdown.test.js.snap
│ │ │ └── dropdown.test.js
│ │ ├── components
│ │ │ ├── divider.js
│ │ │ └── item.js
│ │ ├── dropdown.js
│ │ ├── dropdown.story.js
│ │ ├── dropdown.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── element
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── element.test.js.snap
│ │ │ └── element.test.js
│ │ ├── element.js
│ │ ├── element.story.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ └── stories
│ │ │ ├── element-1-basic.story.mdx
│ │ │ ├── element-2-proptypes.story.mdx
│ │ │ ├── element-3-responsive.story.mdx
│ │ │ ├── element-4-renderas.story.mdx
│ │ │ └── element-5-customization.story.mdx
│ ├── footer
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── footer.test.js.snap
│ │ │ └── footer.test.js
│ │ ├── footer.js
│ │ ├── footer.story.js
│ │ ├── footer.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── form
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── index.test.js.snap
│ │ │ └── index.test.js
│ │ ├── components
│ │ │ ├── __test__
│ │ │ │ ├── __snapshots__
│ │ │ │ │ ├── checkbox.test.js.snap
│ │ │ │ │ ├── control.test.js.snap
│ │ │ │ │ ├── field.test.js.snap
│ │ │ │ │ ├── help.test.js.snap
│ │ │ │ │ ├── input-file.test.js.snap
│ │ │ │ │ ├── input.test.js.snap
│ │ │ │ │ ├── label.test.js.snap
│ │ │ │ │ ├── radio.test.js.snap
│ │ │ │ │ ├── select.test.js.snap
│ │ │ │ │ └── textarea.test.js.snap
│ │ │ │ ├── checkbox.test.js
│ │ │ │ ├── control.test.js
│ │ │ │ ├── field.test.js
│ │ │ │ ├── help.test.js
│ │ │ │ ├── input-file.test.js
│ │ │ │ ├── input.test.js
│ │ │ │ ├── label.test.js
│ │ │ │ ├── radio.test.js
│ │ │ │ ├── select.test.js
│ │ │ │ └── textarea.test.js
│ │ │ ├── checkbox.js
│ │ │ ├── control.js
│ │ │ ├── field
│ │ │ │ ├── context.js
│ │ │ │ ├── field-body.js
│ │ │ │ ├── field-label.js
│ │ │ │ ├── field.js
│ │ │ │ └── index.js
│ │ │ ├── help.js
│ │ │ ├── input-file.js
│ │ │ ├── input.js
│ │ │ ├── label.js
│ │ │ ├── radio.js
│ │ │ ├── select.js
│ │ │ └── textarea.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ └── stories
│ │ │ ├── form-1-basics.story.mdx
│ │ │ ├── form-2-label.story.mdx
│ │ │ ├── form-3-field.story.mdx
│ │ │ ├── form-4-control.story.mdx
│ │ │ ├── form-5-input.story.mdx
│ │ │ ├── form-6-textarea.story.mdx
│ │ │ ├── form-7-select.story.mdx
│ │ │ ├── form-8-checkbox.story.mdx
│ │ │ ├── form-9-radio.story.mdx
│ │ │ ├── form-99-input-file.story.mdx
│ │ │ └── form.story.js
│ ├── heading
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── heading.test.js.snap
│ │ │ └── heading.test.js
│ │ ├── heading.js
│ │ ├── heading.story.js
│ │ ├── heading.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── hero
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── hero.test.js.snap
│ │ │ └── hero.test.js
│ │ ├── components
│ │ │ ├── hero-body.js
│ │ │ ├── hero-footer.js
│ │ │ └── hero-header.js
│ │ ├── hero.js
│ │ ├── hero.story.js
│ │ ├── hero.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── icon
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── icon.test.js.snap
│ │ │ └── icon.test.js
│ │ ├── components
│ │ │ └── text
│ │ │ │ ├── index.js
│ │ │ │ └── text.js
│ │ ├── icon.js
│ │ ├── icon.story.js
│ │ ├── icon.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── image
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── image.test.js.snap
│ │ │ └── image.test.js
│ │ ├── constants.js
│ │ ├── image.js
│ │ ├── image.story.js
│ │ ├── image.story.mdx
│ │ ├── index.d.ts
│ │ └── index.js
│ ├── index.d.ts
│ ├── level
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── level.test.js.snap
│ │ │ └── level.test.js
│ │ ├── components
│ │ │ ├── level-item.js
│ │ │ └── level-side.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── level.js
│ │ ├── level.story.js
│ │ └── level.story.mdx
│ ├── loader
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── loader.test.js.snap
│ │ │ └── loader.test.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── loader.js
│ │ └── loader.story.js
│ ├── media
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── media.test.js.snap
│ │ │ └── media.test.js
│ │ ├── components
│ │ │ └── media-item.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── media.js
│ │ ├── media.story.js
│ │ └── media.story.mdx
│ ├── menu
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── menu.test.js.snap
│ │ │ └── menu.test.js
│ │ ├── components
│ │ │ └── list
│ │ │ │ ├── components
│ │ │ │ └── item.js
│ │ │ │ ├── index.js
│ │ │ │ └── list.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── menu.js
│ │ ├── menu.story.js
│ │ └── menu.story.mdx
│ ├── message
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── message.test.js.snap
│ │ │ └── message.test.js
│ │ ├── components
│ │ │ ├── body.js
│ │ │ └── header.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── message.js
│ │ ├── message.story.js
│ │ └── message.story.mdx
│ ├── modal
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── modal.test.js.snap
│ │ │ └── modal.test.js
│ │ ├── components
│ │ │ ├── card
│ │ │ │ ├── body.js
│ │ │ │ ├── card.js
│ │ │ │ ├── footer.js
│ │ │ │ ├── header.js
│ │ │ │ ├── index.js
│ │ │ │ └── title.js
│ │ │ └── content.js
│ │ ├── context.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── modal.js
│ │ ├── modal.story.js
│ │ └── modal.story.mdx
│ ├── navbar
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── navbar.test.js.snap
│ │ │ └── navbar.test.js
│ │ ├── components
│ │ │ ├── brand.js
│ │ │ ├── burger.js
│ │ │ ├── container.js
│ │ │ ├── divider.js
│ │ │ ├── dropdown.js
│ │ │ ├── item.js
│ │ │ ├── link.js
│ │ │ └── menu.js
│ │ ├── context.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── navbar.js
│ │ ├── navbar.story.js
│ │ └── navbar.story.mdx
│ ├── notification
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── notification.test.js.snap
│ │ │ └── notification.test.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── notification.js
│ │ ├── notification.story.js
│ │ └── notification.story.mdx
│ ├── pagination
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── pagination.test.js.snap
│ │ │ └── pagination.test.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── pagination.js
│ │ ├── pagination.story.js
│ │ └── pagination.story.mdx
│ ├── panel
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── panel.test.js.snap
│ │ │ └── panel.test.js
│ │ ├── components
│ │ │ ├── block.js
│ │ │ ├── header.js
│ │ │ ├── icon.js
│ │ │ └── tabs
│ │ │ │ ├── components
│ │ │ │ └── tab.js
│ │ │ │ ├── index.js
│ │ │ │ └── tabs.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── panel.js
│ │ ├── panel.story.js
│ │ └── panel.story.mdx
│ ├── progress
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── progress.test.js.snap
│ │ │ └── progress.test.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── progress.js
│ │ ├── progress.story.js
│ │ └── progress.story.mdx
│ ├── section
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── section.test.js.snap
│ │ │ └── section.test.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── section.js
│ │ ├── section.story.js
│ │ └── section.story.mdx
│ ├── table
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── table.test.js.snap
│ │ │ └── table.test.js
│ │ ├── components
│ │ │ └── container.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── table.js
│ │ ├── table.story.js
│ │ └── table.story.mdx
│ ├── tabs
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── tabs.test.js.snap
│ │ │ └── tabs.test.js
│ │ ├── components
│ │ │ └── tab.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── tabs.js
│ │ ├── tabs.story.js
│ │ └── tabs.story.mdx
│ ├── tag
│ │ ├── __test__
│ │ │ ├── __snapshots__
│ │ │ │ └── tag.test.js.snap
│ │ │ └── tag.test.js
│ │ ├── components
│ │ │ └── tag-group.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── tag.js
│ │ ├── tag.story.js
│ │ └── tag.story.mdx
│ └── tile
│ │ ├── __test__
│ │ ├── __snapshots__
│ │ │ └── tile.test.js.snap
│ │ └── tile.test.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── tile.js
│ │ ├── tile.story.js
│ │ └── tile.story.mdx
├── constants.js
├── index.d.ts
├── index.js
├── introduction.story.mdx
└── services
│ └── normalizer.js
├── static
└── img.png
└── tsconfig.json
/.coveralls.yml:
--------------------------------------------------------------------------------
1 | repo_token: BGvoD4hDgcfFV9DFbGzmWO3915iTYOEik
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | dist/**
2 | **.min.js
3 | full/**
4 | lib/**
5 | node_modules
6 | reports
7 | *.test.js
8 | **/*.d.ts
9 | documentation/**
10 | .coverage
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "airbnb",
4 | "prettier"
5 | ],
6 | "parser": "babel-eslint",
7 | "parserOptions": {
8 | "ecmaFeatures": {
9 | "jsx": true
10 | }
11 | },
12 | "globals": {
13 | "document": true,
14 | "window": true
15 | },
16 | "env": {
17 | "jest": true
18 | },
19 | "plugins": [
20 | "jest",
21 | "prettier"
22 | ],
23 | "settings": {
24 | "react": {
25 | "pragma": "React",
26 | "version": "16.3"
27 | }
28 | },
29 | "rules": {
30 | "prettier/prettier": "error",
31 | "arrow-body-style": [2, "always"],
32 | "no-console": 0,
33 | "no-param-reassign": 0,
34 | "react/jsx-filename-extension": 0,
35 | "import/no-extraneous-dependencies": 0,
36 | "global-require": 0,
37 | "jsx-a11y/media-has-caption": 0,
38 | "import/prefer-default-export": 0,
39 | "react/forbid-prop-types": 0,
40 | "max-len": 0,
41 | "jsx-a11y/accessible-emoji": 0,
42 | "jsx-a11y/href-no-hash": 0,
43 | "jest/no-disabled-tests": "warn",
44 | "jest/no-focused-tests": "error",
45 | "jest/no-identical-title": "error",
46 | "jest/valid-expect": "error",
47 | "no-underscore-dangle": 0,
48 | "react/jsx-one-expression-per-line": 0,
49 | "jsx-a11y/click-events-have-key-events": 0,
50 | "react/jsx-props-no-spreading": 0,
51 | "react/forbid-foreign-prop-types": 0,
52 | "jsx-a11y/anchor-is-valid": 0,
53 | "react/destructuring-assignment": 0,
54 | "jsx-a11y/label-has-associated-control": 0,
55 | "react/require-default-props": 0,
56 | "react/default-props-match-prop-types": 0,
57 | "react/prop-types": 0
58 | }
59 | }
--------------------------------------------------------------------------------
/.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 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Versions**
27 | - `react-bulma-components:`:
28 | - `bulma`:
29 | - `react`:
30 | - Browser: (e.g. Firefox version 67)
31 |
32 | **Additional context**
33 | Add any other context about the problem here.
34 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/help.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Help
3 | about: If you need any help using this library, use this template.
4 | title: "[HELP]"
5 | labels: question
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .history
2 |
3 | # Logs
4 | logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 |
10 | # Runtime data
11 | pids
12 | *.pid
13 | *.seed
14 | *.pid.lock
15 |
16 | # Directory for instrumented libs generated by jscoverage/JSCover
17 | lib-cov
18 |
19 | # Coverage directory used by tools like istanbul
20 | coverage
21 |
22 | # nyc test coverage
23 | .nyc_output
24 |
25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26 | .grunt
27 |
28 | # Bower dependency directory (https://bower.io/)
29 | bower_components
30 |
31 | # node-waf configuration
32 | .lock-wscript
33 |
34 | # Compiled binary addons (http://nodejs.org/api/addons.html)
35 | build/Release
36 |
37 | # Dependency directories
38 | node_modules/
39 | jspm_packages/
40 |
41 | # JetBrains IDE config
42 | .idea/
43 |
44 | # Typescript v1 declaration files
45 | typings/
46 |
47 | # Optional npm cache directory
48 | .npm
49 |
50 | # Optional eslint cache
51 | .eslintcache
52 |
53 | # Optional REPL history
54 | .node_repl_history
55 |
56 | # Output of 'npm pack'
57 | *.tgz
58 |
59 | # Yarn Integrity file
60 | .yarn-integrity
61 |
62 | # dotenv environment variables file
63 | .env
64 |
65 | .DS_Store
66 |
67 | .out
68 | out*
69 |
70 | /reports
71 | /esm
72 | /cjs
73 | .coverage
74 | .vscode
75 | .cache
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .coverage
2 | .storybook
3 | docs
4 | node_modules
5 | .babelrc
6 | .eslint*
7 | .git*
8 | README.md
9 | webpack.config.js
10 | yarn*
11 | .npmignore
12 | reports
13 | **/__mocks__
14 | .coveralls.yml
15 | .travis.yml
16 | .yarnclean
17 | jest.json
18 | **/__test__
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | v12.22.1
2 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "all",
3 | "singleQuote": true
4 | }
--------------------------------------------------------------------------------
/.storybook/common-props.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { ArgsTable } from '@storybook/addon-docs/blocks';
3 | import { Block, Message, Button } from '../'
4 | import Element from '../src/components/element'
5 |
6 | const CommonProps = () => {
7 | const [show, setShow] = useState()
8 | return (
9 | <>
10 |
11 |
12 |
13 | This component also has all the shared props from the Element
component {' '}
14 | setShow(s => !s)}>{show ? 'Hide' : 'Show'} common props
15 |
16 |
17 | {
18 | show &&
19 | }
20 |
21 | >
22 | )
23 | };
24 |
25 | export default CommonProps
--------------------------------------------------------------------------------
/.storybook/main.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const { DefinePlugin } = require('webpack');
3 |
4 | module.exports = {
5 | stories: ['../src/**/*.story.mdx'],
6 | addons: [
7 | '@storybook/addon-essentials',
8 | {
9 | name: '@storybook/addon-storysource',
10 | options: {
11 | rule: {
12 | test: [/\.story\.js?$/],
13 | },
14 | },
15 | },
16 | '@storybook/addon-knobs',
17 | '@storybook/addon-links',
18 | '@storybook/addon-events',
19 | '@storybook/addon-viewport',
20 | '@storybook/addon-postcss',
21 | 'storybook-addon-react-docgen',
22 | '@storybook/preset-scss',
23 | ],
24 | webpackFinal: (config) => {
25 | config.resolve.modules.push('node_modules', 'src');
26 | config.resolve.alias['react-bulma-components'] = path.resolve(
27 | __dirname,
28 | '../src',
29 | );
30 | return config;
31 | },
32 | };
33 |
--------------------------------------------------------------------------------
/.storybook/manager.js:
--------------------------------------------------------------------------------
1 | import { addons } from '@storybook/addons';
2 | import theme from './theme';
3 |
4 | addons.setConfig({
5 | theme,
6 | });
7 |
--------------------------------------------------------------------------------
/.storybook/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
--------------------------------------------------------------------------------
/.storybook/preview.js:
--------------------------------------------------------------------------------
1 | import { addDecorator } from '@storybook/react';
2 | import { withPropsTable } from 'storybook-addon-react-docgen';
3 | import { MINIMAL_VIEWPORTS} from '@storybook/addon-viewport';
4 |
5 | import test from './rewrites.scss'
6 | import '@fortawesome/fontawesome-free/css/all.min.css';
7 |
8 | console.log(test);
9 |
10 | addDecorator(withPropsTable);
11 |
12 | export const parameters = {
13 | layout: 'padded',
14 | viewMode: 'docs',
15 | viewport: {
16 | viewports: {
17 | ...MINIMAL_VIEWPORTS,
18 | "tablet": {
19 | "name": "Tablet",
20 | "styles": {
21 | "width": "1023px",
22 | "height": "963px"
23 | },
24 | "type": "tablet"
25 | },
26 | "desktop": {
27 | "name": "Desktop",
28 | "styles": {
29 | "width": "1215px",
30 | "height": "100%"
31 | },
32 | "type": "desktop"
33 | },
34 | "widescreen": {
35 | "name": "Widescreen",
36 | "styles": {
37 | "width": "1407px",
38 | "height": "100%"
39 | },
40 | "type": "desktop"
41 | },
42 | "fullhd": {
43 | "name": "Fullhd",
44 | "styles": {
45 | "width": "1920px",
46 | "height": "100%"
47 | },
48 | "type": "desktop"
49 | },
50 | }
51 | },
52 | options: {
53 | storySort: {
54 | order: ['Welcome', 'Changelog', 'Core Component', 'Columns', 'Elements', 'Components', 'Form', 'Layout'],
55 | },
56 | },
57 | previewTabs: {
58 | 'storybook/docs/panel': { index: 0, default: true },
59 | }
60 | };
61 |
--------------------------------------------------------------------------------
/.storybook/rewrites.scss:
--------------------------------------------------------------------------------
1 |
2 | pre code {
3 | color: currentColor;
4 | }
5 |
6 | pre code .tag.token {
7 | background-color: unset;
8 | border-radius: unset;
9 | display: unset;
10 | font-size: 1em;
11 | height: unset;
12 | padding-left: unset;
13 | padding-right: unset;
14 | white-space: unset;
15 | }
16 | pre code .number.token {
17 | margin-right: unset;
18 | }
19 |
20 | pre code .plain-text {
21 | color: #da1039;
22 | }
23 |
24 | pre code .number{
25 | padding: unset;
26 | min-width: unset;
27 | font-size: unset;
28 | height: unset;
29 | }
30 |
31 | $custom-colors: ("brand": (#8A4D76, #FFF), "custom": (#f88fa1,#000));
32 |
33 | @import "~bulma/bulma.sass";
--------------------------------------------------------------------------------
/.storybook/theme.js:
--------------------------------------------------------------------------------
1 | import { create } from '@storybook/theming/create';
2 |
3 | export default create({
4 | base: 'light',
5 | brandTitle: 'React Bulma Components',
6 | brandUrl: 'https://www.github.com/couds/react-bulma-components',
7 |
8 | colorPrimary: '#00D6B1',
9 | colorSecondary: '#00D6B1',
10 | });
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "12"
4 | before_install:
5 | - npm i -g npm@6.14.12
6 | script: npm run test:cov
7 | after_success: 'npm run coveralls'
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 John
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/babel.config.cjs:
--------------------------------------------------------------------------------
1 | module.exports = (api) => {
2 | // import statements must be compiled in test env
3 | // in other environments, modules must be set to false to enable tree shaking
4 | // more info: https://jestjs.io/docs/en/getting-started#using-babel
5 |
6 | let modules = api.env(['test']) ? 'commonjs' : (process.env.TARGET || 'esm');
7 |
8 | return {
9 | plugins: ['babel-plugin-transform-react-remove-prop-types'],
10 | presets: [
11 | [
12 | '@babel/preset-env',
13 | {
14 | bugfixes: true,
15 | debug: process.env.RBC_BUILD_VERBOSE === 'true',
16 | modules: modules === 'esm' ? false : modules,
17 | },
18 | ],
19 | ['@babel/preset-react'],
20 | ],
21 | };
22 | };
23 |
--------------------------------------------------------------------------------
/index.esm.mjs:
--------------------------------------------------------------------------------
1 | export * from './esm';
2 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | setupFilesAfterEnv: ['./__test__/setup.js'],
3 | rootDir: 'src',
4 | testMatch: ['**/*.test.js'],
5 | coverageDirectory: '/../.coverage',
6 | collectCoverageFrom: [
7 | '**/*.js',
8 | '!**/node_modules/**',
9 | '!**/*.story.js',
10 | '!**/*.test.js',
11 | ],
12 | coverageReporters: ['lcov', 'text', 'text-summary'],
13 | moduleDirectories: ['node_modules', ''],
14 | coverageThreshold: {
15 | global: {
16 | branches: 80,
17 | functions: 80,
18 | lines: 80,
19 | statements: 80,
20 | },
21 | },
22 | moduleNameMapper: {
23 | '\\.(css|less|s(c|a)ss)$': '/../__mocks__/style.js',
24 | 'services(.*)$': '/services$1',
25 | },
26 | };
27 |
--------------------------------------------------------------------------------
/src/__test__/__snapshots__/index.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`ReactBulmaComponents component Should Exports all components 1`] = `
4 | Object {
5 | "Block": [Function],
6 | "Box": [Function],
7 | "Breadcrumb": [Function],
8 | "Button": [Function],
9 | "Card": [Function],
10 | "Columns": [Function],
11 | "Container": [Function],
12 | "Content": [Function],
13 | "Dropdown": [Function],
14 | "Element": [Function],
15 | "Footer": [Function],
16 | "Form": Object {
17 | "Checkbox": [Function],
18 | "Control": [Function],
19 | "Field": [Function],
20 | "Help": [Function],
21 | "Input": [Function],
22 | "InputFile": [Function],
23 | "Label": [Function],
24 | "Radio": [Function],
25 | "Select": [Function],
26 | "Textarea": [Function],
27 | },
28 | "Heading": [Function],
29 | "Hero": [Function],
30 | "Icon": [Function],
31 | "Image": [Function],
32 | "Level": [Function],
33 | "Loader": [Function],
34 | "Media": [Function],
35 | "Menu": [Function],
36 | "Message": [Function],
37 | "Modal": [Function],
38 | "Navbar": [Function],
39 | "Notification": [Function],
40 | "Pagination": [Function],
41 | "Panel": [Function],
42 | "Progress": [Function],
43 | "Section": [Function],
44 | "Table": [Function],
45 | "Tabs": [Function],
46 | "Tag": [Function],
47 | "Tile": [Function],
48 | }
49 | `;
50 |
--------------------------------------------------------------------------------
/src/__test__/index.test.js:
--------------------------------------------------------------------------------
1 | import * as ReactBulmaComponents from '..';
2 |
3 | describe('ReactBulmaComponents component', () => {
4 | it('Should Exports all components', () => {
5 | expect(ReactBulmaComponents).toMatchSnapshot();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/src/__test__/setup.js:
--------------------------------------------------------------------------------
1 | require('raf/polyfill');
2 | const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
3 | const enzyme = require('enzyme');
4 |
5 | enzyme.configure({ adapter: new Adapter() });
6 |
--------------------------------------------------------------------------------
/src/changelog.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Description } from '@storybook/addon-docs/blocks';
2 | import ChangeLog from '../CHANGELOG.md';
3 |
4 |
5 |
6 |
7 | {ChangeLog}
8 |
9 |
--------------------------------------------------------------------------------
/src/components/block/__test__/__snapshots__/block.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Box component Should concat Bulma class with classes in props 1`] = `
4 |
7 | Facebook
8 |
9 | `;
10 |
11 | exports[`Box component Should have box classname 1`] = `
12 |
15 | Facebook
16 |
17 | `;
18 |
--------------------------------------------------------------------------------
/src/components/block/__test__/block.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Block from '..';
4 |
5 | describe('Box component', () => {
6 | it('Should Exist', () => {
7 | expect(Block).toBeDefined();
8 | });
9 | it('Should have box classname', () => {
10 | const component = renderer.create(Facebook);
11 | expect(component.toJSON()).toMatchSnapshot();
12 | });
13 | it('Should concat Bulma class with classes in props', () => {
14 | const component = renderer.create(
15 | Facebook,
16 | );
17 | expect(component.toJSON()).toMatchSnapshot();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/block/block.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import Element from '../element';
4 |
5 | const Block = ({ className, ...props }) => {
6 | return ;
7 | };
8 |
9 | Block.propTypes = {};
10 |
11 | Block.defaultProps = {};
12 |
13 | export default Block;
14 |
--------------------------------------------------------------------------------
/src/components/block/block.story.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/prop-types */
2 | import React from 'react';
3 |
4 | import { Box, Block, Notification } from '../..';
5 |
6 | export const Blocks = ({ withoutBlock }) => {
7 | return (
8 |
9 | {withoutBlock ? (
10 | <>
11 |
12 | Some text
13 |
14 |
15 | Some more text
16 |
17 |
18 |
19 | All of this are evently spaced
20 |
21 |
22 |
23 |
24 | This one does not generate extra margin at the bottom
25 |
26 |
27 | >
28 | ) : (
29 | <>
30 |
31 | Some text
32 |
33 |
34 | Some more text
35 |
36 |
37 |
38 | All of this are evently spaced
39 |
40 |
41 |
42 |
43 | This one does not generate extra margin at the bottom
44 |
45 |
46 | >
47 | )}
48 |
49 | );
50 | };
51 |
52 | Blocks.args = {
53 | withoutBlock: false,
54 | };
55 |
--------------------------------------------------------------------------------
/src/components/block/block.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './block.story';
3 | import { Block } from '../..'
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Block
9 |
10 | The block element its the simplest of the components on Bulma, his only function its to add margin between the elements
11 |
12 |
13 |
14 |
15 |
16 | ## Example
17 |
18 |
21 |
22 |
23 | ## Related
24 |
25 | - [Official documentation](https://bulma.io/documentation/elements/block)
26 |
--------------------------------------------------------------------------------
/src/components/block/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | interface ContentProps {
4 | }
5 |
6 | declare const Block: BulmaComponent;
7 |
8 | export default Block;
9 |
--------------------------------------------------------------------------------
/src/components/block/index.js:
--------------------------------------------------------------------------------
1 | import Block from './block';
2 |
3 | export default Block;
4 |
--------------------------------------------------------------------------------
/src/components/box/__test__/__snapshots__/box.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Box component Should Exist 1`] = `[Function]`;
4 |
5 | exports[`Box component Should accept a react Element as renderAs prop 1`] = `
6 |
9 | Custom
10 | This should be a p element
11 |
12 | `;
13 |
14 | exports[`Box component Should concat Bulma class with classes in props 1`] = `
15 |
18 | Facebook
19 |
20 | `;
21 |
22 | exports[`Box component Should have box classname 1`] = `
23 |
26 | Facebook
27 |
28 | `;
29 |
30 | exports[`Box component Should have custom inline styles 1`] = `
31 |
40 | This should be a section with custom styles
41 |
42 | `;
43 |
44 | exports[`Box component Should render as an html section 1`] = `
45 |
48 | This should be a section
49 |
50 | `;
51 |
--------------------------------------------------------------------------------
/src/components/box/box.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import Element from '../element';
4 |
5 | const Box = ({ children, className, ...props }) => {
6 | return (
7 |
8 | {children}
9 |
10 | );
11 | };
12 |
13 | Box.propTypes = {};
14 |
15 | Box.defaultProps = {};
16 |
17 | export default Box;
18 |
--------------------------------------------------------------------------------
/src/components/box/box.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { Box, Form, Button } from '../..';
4 |
5 | export const Default = () => {
6 | return (
7 |
8 |
10 | Email
11 |
12 |
16 |
17 |
18 |
19 | Password
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | );
30 | };
31 |
--------------------------------------------------------------------------------
/src/components/box/box.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './box.story';
3 | import { Box } from '../..'
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Box
9 |
10 | A white box element to contain other elements
11 |
12 |
13 |
14 |
15 |
16 | ## Example
17 |
20 |
21 | ## Related
22 |
23 | - [Official documentation](https://bulma.io/documentation/elements/box)
24 |
--------------------------------------------------------------------------------
/src/components/box/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | declare const Box: BulmaComponent<{}, 'div'>;
4 |
5 | export default Box;
--------------------------------------------------------------------------------
/src/components/box/index.js:
--------------------------------------------------------------------------------
1 | import Box from './box';
2 |
3 | export default Box;
4 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/breadcrumb.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import Element from '../element';
5 | import BreadcrumbItem from './components/item';
6 |
7 | const Breadcrumb = ({
8 | className,
9 | separator,
10 | size,
11 | align,
12 | children,
13 | ...props
14 | }) => {
15 | return (
16 |
24 |
25 |
26 | );
27 | };
28 |
29 | Breadcrumb.Item = BreadcrumbItem;
30 |
31 | Breadcrumb.propTypes = {
32 | separator: PropTypes.oneOf(['arrow', 'bullet', 'dot', 'succeeds']),
33 | size: PropTypes.oneOfType([
34 | PropTypes.oneOf(['small', 'medium', 'large']),
35 | PropTypes.string,
36 | ]),
37 | align: PropTypes.oneOf(['right', 'center']),
38 | renderAs: PropTypes.oneOfType([
39 | PropTypes.func,
40 | PropTypes.string,
41 | PropTypes.object,
42 | ]),
43 | };
44 |
45 | Breadcrumb.defaultProps = {
46 | separator: undefined,
47 | renderAs: 'nav',
48 | size: undefined,
49 | align: undefined,
50 | };
51 |
52 | export default Breadcrumb;
53 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/breadcrumb.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { Box, Breadcrumb } from '../..';
4 |
5 | export const Default = (args) => {
6 | return (
7 |
22 | );
23 | };
24 |
25 | Default.argTypes = {
26 | separator: {
27 | control: {
28 | type: 'select',
29 | options: ['arrow', 'dot', 'bullet', 'succeeds'],
30 | },
31 | },
32 | align: {
33 | control: {
34 | type: 'select',
35 | options: ['center', 'right'],
36 | },
37 | },
38 | size: {
39 | control: {
40 | type: 'select',
41 | options: ['default', 'small', 'medium', 'large'],
42 | },
43 | },
44 | };
45 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/breadcrumb.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './breadcrumb.story';
3 | import Breadcrumb from './breadcrumb';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Breadcrumb
9 |
10 | A simple navigation component with a customizable separator. Suitable for hierarchical navigations.
11 |
12 | You can inform the current page using the active props in `Breadcrumb.Item` component. It will disable the navigation of inner links.
13 |
14 | ## Props
15 |
16 | ### Breadcrumb
17 |
18 |
19 |
20 | ### Breadcrumb.Item
21 |
22 |
23 |
24 |
25 |
26 | ## Example
27 |
28 |
31 |
32 | ## Related
33 |
34 | - [Official documentation](https://bulma.io/documentation/components/breadcrumb)
35 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/components/item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classNames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const BreadcrumbItem = ({ className, active, children, ...props }) => {
8 | return (
9 |
15 | {children}
16 |
17 | );
18 | };
19 |
20 | BreadcrumbItem.propTypes = {
21 | active: PropTypes.bool,
22 | renderAs: PropTypes.oneOfType([
23 | PropTypes.func,
24 | PropTypes.string,
25 | PropTypes.object,
26 | ]),
27 | };
28 |
29 | BreadcrumbItem.defaultProps = {
30 | renderAs: 'li',
31 | };
32 |
33 | export default BreadcrumbItem;
34 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Size } from '..';
3 |
4 | interface BreadcrumbProps {
5 | separator?: 'arrow' | 'bullet' | 'dot' | 'succeeds';
6 | size?: Size;
7 | align?: 'right' | 'center';
8 | }
9 |
10 | interface BreadcrumbItemProps {
11 | active?: boolean;
12 | }
13 |
14 | declare const Breadcrumb: BulmaComponent & {
15 | Item: BulmaComponent;
16 | };
17 |
18 | export default Breadcrumb;
19 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/index.js:
--------------------------------------------------------------------------------
1 | import Breadcrumb from './breadcrumb';
2 |
3 | export default Breadcrumb;
4 |
--------------------------------------------------------------------------------
/src/components/button/button.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import Button from '.';
3 | import * as stories from './button.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Button
9 |
10 | A basic UI component that allows users to perform action.
11 |
12 | ## Props
13 |
14 | Props that Button accepts, on top of modifier props. Go to canvas to play with the props.
15 |
16 |
17 |
18 | ## Button group
19 |
20 | Multiple buttons can be grouped together to form a group, using the `
23 |
24 |
25 |
26 | ## Example
27 |
28 |
31 |
32 | ## Related
33 |
34 | - [Official documentation](https://bulma.io/documentation/elements/button)
--------------------------------------------------------------------------------
/src/components/button/components/button-group.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import Element from '../../element';
5 | import { normalizeAlign } from '../../../services/normalizer';
6 |
7 | const ButtonGroup = ({ className, hasAddons, align, size, ...props }) => {
8 | return (
9 |
17 | );
18 | };
19 |
20 | ButtonGroup.propTypes = {
21 | hasAddons: PropTypes.bool,
22 | /**
23 | * The size of *all* the buttons in the group.
24 | */
25 | size: PropTypes.oneOf(['small', 'medium', 'large']),
26 | /**
27 | * Align of the group. By default, it is left-aligned.
28 | */
29 | align: PropTypes.oneOf(['center', 'right']),
30 | renderAs: PropTypes.oneOfType([
31 | PropTypes.func,
32 | PropTypes.string,
33 | PropTypes.object,
34 | ]),
35 | };
36 |
37 | ButtonGroup.defaultProps = {
38 | renderAs: 'div',
39 | };
40 |
41 | export default ButtonGroup;
42 |
--------------------------------------------------------------------------------
/src/components/button/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color, Size } from '..';
3 |
4 | interface ButtonProps {
5 | color?: Color
6 | | 'ghost'
7 | | 'black-bis'
8 | | 'black-ter'
9 | | 'white-bis'
10 | | 'white-ter'
11 | | 'grey-darker'
12 | | 'grey-dark'
13 | | 'grey-light'
14 | | 'grey-lighter';
15 | size?: Size;
16 | state?: 'hover' | 'focus' | 'active';
17 | outlined?: boolean;
18 | inverted?: boolean;
19 | submit?: boolean;
20 | reset?: boolean;
21 | loading?: boolean;
22 | fullwidth?: boolean;
23 | disabled?: boolean;
24 | remove?: boolean;
25 | isSelected?: boolean;
26 | isStatic?: boolean;
27 | rounded?: boolean;
28 | text?: boolean;
29 | }
30 |
31 | interface ButtonGroupProps {
32 | size?: Size;
33 | hasAddons?: boolean;
34 | align?: 'center' | 'right';
35 | }
36 |
37 | declare const Button: BulmaComponent & {
38 | Group: BulmaComponent;
39 | };
40 |
41 | export default Button
--------------------------------------------------------------------------------
/src/components/button/index.js:
--------------------------------------------------------------------------------
1 | import Button from './button';
2 |
3 | export default Button;
4 |
--------------------------------------------------------------------------------
/src/components/card/__test__/__snapshots__/card.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Card component Should have card classname 1`] = `
4 |
7 | Card Content
8 |
9 | `;
10 |
11 | exports[`Card component Should have card-content classname 1`] = `
12 |
15 | Content
16 |
17 | `;
18 |
19 | exports[`Card component Should have card-footer's classname 1`] = `
20 |
23 |
26 |
29 | Yes
30 |
31 |
34 | No
35 |
36 |
37 |
38 | `;
39 |
40 | exports[`Card component Should have card-header's classname 1`] = `
41 |
44 |
47 |
50 | Title
51 |
52 |
55 |
58 |
59 |
60 |
61 | `;
62 |
63 | exports[`Card component Should have card-image classname 1`] = `
64 |
67 |
70 |
75 |
76 |
77 | `;
78 |
--------------------------------------------------------------------------------
/src/components/card/__test__/card.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Card from '..';
4 |
5 | describe('Card component', () => {
6 | it('Should have card classname', () => {
7 | const component = renderer.create(Card Content);
8 | expect(component.toJSON()).toMatchSnapshot();
9 | });
10 | it('Should have card-image classname', () => {
11 | const component = renderer.create(
12 | ,
16 | );
17 | expect(component.toJSON()).toMatchSnapshot();
18 | });
19 | it('Should have card-content classname', () => {
20 | const component = renderer.create(Content);
21 | expect(component.toJSON()).toMatchSnapshot();
22 | });
23 | it("Should have card-header's classname", () => {
24 | const component = renderer.create(
25 |
26 |
27 | Title
28 |
29 |
30 |
31 |
32 | ,
33 | );
34 | expect(component.toJSON()).toMatchSnapshot();
35 | });
36 | it("Should have card-footer's classname", () => {
37 | const component = renderer.create(
38 |
39 |
40 | Yes
41 | No
42 |
43 | ,
44 | );
45 | expect(component.toJSON()).toMatchSnapshot();
46 | });
47 | });
48 |
--------------------------------------------------------------------------------
/src/components/card/card.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import CardImage from './components/image';
5 | import CardContent from './components/content';
6 | import CardHeader from './components/header';
7 | import CardFooter from './components/footer';
8 |
9 | import Element from '../element';
10 |
11 | const Card = ({ className, children, ...props }) => {
12 | return (
13 |
14 | {children}
15 |
16 | );
17 | };
18 |
19 | Card.Image = CardImage;
20 |
21 | Card.Content = CardContent;
22 |
23 | Card.Header = CardHeader;
24 |
25 | Card.Footer = CardFooter;
26 |
27 | Card.propTypes = {};
28 |
29 | Card.defaultProps = {};
30 |
31 | export default Card;
32 |
--------------------------------------------------------------------------------
/src/components/card/components/content.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const CardContent = ({ className, ...props }) => {
7 | return (
8 |
9 | );
10 | };
11 |
12 | CardContent.propTypes = {};
13 |
14 | CardContent.defaultProps = {};
15 |
16 | export default CardContent;
17 |
--------------------------------------------------------------------------------
/src/components/card/components/footer/components/footer-item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import Element from '../../../../element';
4 |
5 | const CardFooterItem = ({ className, ...props }) => {
6 | return (
7 |
8 | );
9 | };
10 |
11 | CardFooterItem.propTypes = {};
12 |
13 | CardFooterItem.defaultProps = {};
14 |
15 | export default CardFooterItem;
16 |
--------------------------------------------------------------------------------
/src/components/card/components/footer/footer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import CardFooterItem from './components/footer-item';
4 |
5 | import Element from '../../../element';
6 |
7 | const CardFooter = ({ className, ...props }) => {
8 | return (
9 |
10 | );
11 | };
12 |
13 | CardFooter.Item = CardFooterItem;
14 |
15 | CardFooter.propTypes = {};
16 |
17 | CardFooter.defaultProps = {};
18 |
19 | export default CardFooter;
20 |
--------------------------------------------------------------------------------
/src/components/card/components/footer/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './footer';
2 |
--------------------------------------------------------------------------------
/src/components/card/components/header/components/header-icon.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../../../element';
5 |
6 | const CardHeaderIcon = ({ className, ...props }) => {
7 | return (
8 |
9 | );
10 | };
11 |
12 | CardHeaderIcon.propTypes = {};
13 |
14 | CardHeaderIcon.defaultProps = {};
15 |
16 | export default CardHeaderIcon;
17 |
--------------------------------------------------------------------------------
/src/components/card/components/header/components/header-title.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../../../element';
5 |
6 | const CardHeaderTitle = ({ className, ...props }) => {
7 | return (
8 |
12 | );
13 | };
14 |
15 | CardHeaderTitle.propTypes = {};
16 |
17 | CardHeaderTitle.defaultProps = {};
18 |
19 | export default CardHeaderTitle;
20 |
--------------------------------------------------------------------------------
/src/components/card/components/header/header.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import CardHeaderTitle from './components/header-title';
4 | import CardHeaderIcon from './components/header-icon';
5 |
6 | import Element from '../../../element';
7 |
8 | const CardHeader = ({ className, ...props }) => {
9 | return (
10 |
11 | );
12 | };
13 |
14 | CardHeader.Title = CardHeaderTitle;
15 |
16 | CardHeader.Icon = CardHeaderIcon;
17 |
18 | CardHeader.propTypes = {};
19 |
20 | CardHeader.defaultProps = {};
21 |
22 | export default CardHeader;
23 |
--------------------------------------------------------------------------------
/src/components/card/components/header/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './header';
2 |
--------------------------------------------------------------------------------
/src/components/card/components/image.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import Image from '../../image';
4 |
5 | import Element from '../../element';
6 |
7 | const CardImage = ({ className, domRef, ...props }) => {
8 | return (
9 |
10 |
11 |
12 | );
13 | };
14 |
15 | CardImage.propTypes = {};
16 |
17 | CardImage.defaultProps = {};
18 |
19 | export default CardImage;
20 |
--------------------------------------------------------------------------------
/src/components/card/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import ImageProps from '../image';
3 |
4 | declare const Card: BulmaComponent<{}, 'div'> & {
5 | Image: BulmaComponent;
6 | Content: BulmaComponent<{}, 'div'>;
7 | Header: BulmaComponent<{}, 'div'> & {
8 | Title: BulmaComponent<{}, 'div'>;
9 | Icon: BulmaComponent<{}, 'div'>;
10 | };
11 | Footer: BulmaComponent<{}, 'div'> & {
12 | Item: BulmaComponent<{}, 'div'>;
13 | };
14 | };
15 |
16 | export default Card
17 |
--------------------------------------------------------------------------------
/src/components/card/index.js:
--------------------------------------------------------------------------------
1 | import Card from './card';
2 |
3 | export default Card;
4 |
--------------------------------------------------------------------------------
/src/components/columns/constants.js:
--------------------------------------------------------------------------------
1 | export default {
2 | SIZES: {
3 | THREEQUARTERS: 'three-quarters',
4 | TWOTHIRDS: 'two-thirds',
5 | HALF: 'half',
6 | ONETHIRD: 'one-third',
7 | ONEQUARTER: 'one-quarter',
8 | ONEFIFTH: 'one-fifth',
9 | TWOFIFTHS: 'two-fifths',
10 | THREEFIFTHS: 'three-fifths',
11 | FOURFIFTHS: 'four-fifths',
12 | },
13 | };
14 |
--------------------------------------------------------------------------------
/src/components/columns/index.js:
--------------------------------------------------------------------------------
1 | import Columns from './columns';
2 |
3 | export default Columns;
4 |
--------------------------------------------------------------------------------
/src/components/columns/stories/columns-1-basics.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Columns, Message, Notification } from '../../..';
3 | import CommonProps from '../../../../.storybook/common-props';
4 | import * as stories from './columns.story';
5 |
6 |
7 |
8 | # Columns using Flexbox
9 |
10 | You can build columns very easily:
11 |
12 | 1. Add a `` component
13 | 2. Put as many `` as you want inside it.
14 |
15 | Each column will have an equal width, no matter the number of columns.
16 |
17 | ## Basic
18 |
19 |
22 |
23 | ## Props
24 |
25 |
26 |
27 | ### `Columns`
28 |
29 |
30 |
31 | ### `Columns.Column`
32 |
33 |
34 |
35 |
36 |
37 | ## Related
38 |
39 | - [Official documentation](https://bulma.io/documentation/columns/basics/)
--------------------------------------------------------------------------------
/src/components/columns/stories/columns-3-responsiveness.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Columns, Message, Notification } from '../../..';
3 | import * as stories from './columns.story';
4 |
5 |
6 |
7 | # Responsiveness
8 |
9 | You can handle different column size/offseet for each breakpoint independently.
10 |
11 | ## Mobile Columns
12 |
13 | You can use the `breakpoint` prop on the `Column` component to specify at what viewport size `Columns`
14 | should be "activated", meaning it will display `Columns.Column` in a row. Any viewport smaller
15 | than the specified viewport size will cause `Columns` to display `Columns.Column`
16 | in a row.
17 |
18 | By default, the value is `'tablet'`. Any viewport smaller than `'tablet'` will cause `Columns` to stack
19 | `Columns.Column` on top of each other.
20 |
21 | ## Different column sizes/offsets/narrowness per breakpoint
22 |
23 | You can define this values for each viewport size passing a configuration object on a prop named as the
24 | viewport you are targeting mobile, tablet, desktop, widescreen and fullhd). The configuration object looks like this
25 |
26 | Note that you can also use the common responsive props here (like `textAlign`, `textSize`)
27 |
28 | ```javascript
29 | {
30 | size: "ANY VALID SIZE",
31 | offset: "ANY VALID SIZE",
32 | narrow: Boolean
33 | }
34 | ```
35 |
38 |
39 | ## Related
40 |
41 | - [Official documentation](https://bulma.io/documentation/columns/responsiveness/)
--------------------------------------------------------------------------------
/src/components/columns/stories/columns-4-nesting.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Columns, Message, Notification } from '../../..';
3 | import * as stories from './columns.story';
4 |
5 |
6 |
7 | # Nesting
8 |
9 | You can nest `Columns` inside any `Columns.Column` indefinitely to create more complex layout
10 |
11 | The difference with multiline columns is the order in the HTML code: all the blue columns appear before the red ones. Resize to a narrower viewport to see the result.
12 |
13 | In this example, the numbers represent the nesting level the `Columns.Column` is in.
14 |
15 |
16 |
17 | ## Related
18 |
19 | - [Official documentation](https://bulma.io/documentation/columns/nesting/)
--------------------------------------------------------------------------------
/src/components/columns/stories/columns-5-gap.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Columns, Message, Notification } from '../../..';
3 | import * as stories from './columns.story';
4 |
5 |
6 |
7 | # Colums gap
8 |
9 | You can customize the gaps between columns
10 |
11 | You can configure the gap between columns for all breakpoints with the `gap` prop, or specify per breakpoint using the responsive gap for each breakpoint (`mobile.gap`, `desktop.gap`, ...)
12 |
13 | ## Example
14 |
15 |
18 |
19 | ## Related
20 |
21 | - [Official documentation](https://bulma.io/documentation/columns/gap/)
--------------------------------------------------------------------------------
/src/components/columns/stories/columns-6-Options.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Columns, Message, Notification } from '../../..';
3 | import * as stories from './columns.story';
4 |
5 |
6 |
7 | #Options
8 |
9 | Here you will find some other options that will help you to customize the behaviour of the columns
10 |
11 | ## Columns Alignment
12 |
13 | You can center columns vertically, to do it add the vCentered prop to the `Column` component. Also you can center horizontaly adding the centered prop
14 |
15 | ## Multiline
16 |
17 | By default, the columns will break into a new line when do not have enough space, you can disable this with `multiline={false}`
18 |
19 |
20 |
23 |
24 | ## Related
25 |
26 | - [Official documentation](https://bulma.io/documentation/columns/options/)
--------------------------------------------------------------------------------
/src/components/container/__test__/__snapshots__/container.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Container component Should have container classname 1`] = `
4 |
7 |
10 |
11 | Default
12 |
13 |
14 | Container
15 |
16 |
17 |
18 | `;
19 |
20 | exports[`Container component Should ignore max prop on non desktop and non widescreen breakpoint 1`] = `
21 |
24 |
27 |
28 | Default
29 |
30 |
31 | Container
32 |
33 |
34 |
35 | `;
36 |
37 | exports[`Container component Should use max prop on desktop breakpoint 1`] = `
38 |
41 |
44 |
45 | Default
46 |
47 |
48 | Container
49 |
50 |
51 |
52 | `;
53 |
--------------------------------------------------------------------------------
/src/components/container/__test__/container.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Container from '..';
4 |
5 | describe('Container component', () => {
6 | it('Should have container classname', () => {
7 | const component = renderer.create(
8 |
9 |
10 |
Default
11 | Container
12 |
13 | ,
14 | );
15 | expect(component.toJSON()).toMatchSnapshot();
16 | });
17 | it('Should use max prop on desktop breakpoint', () => {
18 | const component = renderer.create(
19 |
20 |
21 |
Default
22 | Container
23 |
24 | ,
25 | );
26 | expect(component.toJSON()).toMatchSnapshot();
27 | });
28 | it('Should ignore max prop on non desktop and non widescreen breakpoint', () => {
29 | const component = renderer.create(
30 |
31 |
32 |
Default
33 | Container
34 |
35 | ,
36 | );
37 | expect(component.toJSON()).toMatchSnapshot();
38 | });
39 | });
40 |
--------------------------------------------------------------------------------
/src/components/container/container.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../element';
6 |
7 | const Container = ({ children, max, breakpoint, className, ...props }) => {
8 | const canSetMax = ['desktop', 'widescreen'].includes(breakpoint);
9 | return (
10 |
16 | {children}
17 |
18 | );
19 | };
20 |
21 | Container.propTypes = {
22 | /**
23 | * Specifies the breakpoint at which the container will stop being fullwidth.
24 | */
25 | breakpoint: PropTypes.oneOf([
26 | 'mobile',
27 | 'tablet',
28 | 'desktop',
29 | 'widescreen',
30 | 'fullhd',
31 | 'fluid',
32 | ]),
33 | /**
34 | * Only work for `desktop` and `widescreen` breakpoints, Check the [bulma documentation](https://bulma.io/documentation/layout/container/#overview)
35 | */
36 | max: PropTypes.bool,
37 | };
38 |
39 | Container.defaultProps = {};
40 |
41 | export default Container;
42 |
--------------------------------------------------------------------------------
/src/components/container/container.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { Container, Notification } from '../..';
4 |
5 | export const ContainerExample = (args) => {
6 | return (
7 |
8 |
9 |
10 | This container will strech depending of the breakpoint you choose
11 |
12 |
13 |
14 | );
15 | };
16 |
17 | ContainerExample.argTypes = {
18 | breakpoint: {
19 | control: {
20 | type: 'select',
21 | options: ['mobile', 'tablet', 'desktop', 'widescreen', 'fullhd', 'fluid'],
22 | },
23 | },
24 | max: {
25 | control: {
26 | type: 'boolean',
27 | },
28 | },
29 | };
30 |
--------------------------------------------------------------------------------
/src/components/container/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Breakpoint } from '..';
3 |
4 | interface ContainerProps {
5 | max?: boolean;
6 | breakpoint?: Breakpoint | 'fluid';
7 | }
8 |
9 | declare const Container: BulmaComponent;
10 |
11 | export default Container;
--------------------------------------------------------------------------------
/src/components/container/index.js:
--------------------------------------------------------------------------------
1 | import Container from './container';
2 |
3 | export default Container;
4 |
--------------------------------------------------------------------------------
/src/components/content/__test__/__snapshots__/content.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Content component Should have content classname 1`] = `
4 |
7 |
10 |
11 | Default
12 |
13 |
14 | Container
15 |
16 |
17 |
18 | `;
19 |
--------------------------------------------------------------------------------
/src/components/content/__test__/content.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Content from '..';
4 |
5 | describe('Content component', () => {
6 | it('Should have content classname', () => {
7 | const component = renderer.create(
8 |
9 |
10 |
Default
11 | Container
12 |
13 | ,
14 | );
15 | expect(component.toJSON()).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/content/content.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../element';
6 |
7 | const Content = ({ children, className, size, ...props }) => {
8 | return (
9 |
15 | {children}
16 |
17 | );
18 | };
19 |
20 | Content.propTypes = {
21 | size: PropTypes.oneOfType([
22 | PropTypes.oneOf(['small', 'medium', 'large']),
23 | PropTypes.string,
24 | ]),
25 | };
26 |
27 | Content.defaultProps = {};
28 |
29 | export default Content;
30 |
--------------------------------------------------------------------------------
/src/components/content/content.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Content } from '../..';
3 | import * as stories from './content.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Content
9 |
10 | This component handles WYSIWYG/plain HTML content.
11 | The example below demonstrates the formatting of different HTML elements.
12 |
13 |
14 | ## Props
15 |
16 |
17 |
18 |
19 |
20 | ## Size
21 |
22 | You can adjust the size of the content with the `size` prop.
23 | There are three sizes available:
24 |
25 | - `'small'`
26 | - `'medium'`
27 | - `'large'`
28 |
29 | ## List styles
30 |
31 | Although this library does not provide components that let you change item markers of `` inside ``,
32 | you can still use the following Bulma classes via the `className` prop to do just that:
33 |
34 | - `is-lower-alpha`
35 | - `is-lower-roman`
36 | - `is-upper-alpha`
37 | - `is-upper-roman`
38 |
39 | Alternatively, you can use the HTML `type` attribute of `` to achieve the same effect.
40 |
41 | ## Example
42 |
43 |
46 |
47 | ## Related
48 |
49 | - [Official documentation](https://bulma.io/documentation/elements/content/)
50 |
--------------------------------------------------------------------------------
/src/components/content/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Size } from '..';
3 |
4 | interface ContentProps {
5 | size?: Size;
6 | }
7 |
8 | declare const Content: BulmaComponent;
9 |
10 | export default Content;
--------------------------------------------------------------------------------
/src/components/content/index.js:
--------------------------------------------------------------------------------
1 | import Content from './content';
2 |
3 | export default Content;
4 |
--------------------------------------------------------------------------------
/src/components/delete/delete.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Canvas, Story } from '@storybook/addon-docs/blocks';
2 | import { Button } from '../..';
3 |
4 |
5 |
6 | # Delete
7 |
8 | A versatile delete cross, This is included inside the `Button` component passing the `remove` prop
9 |
10 | ## Example
11 |
12 |
17 |
18 | ## Related
19 |
20 | - [Official documentation](https://bulma.io/documentation/elements/delete/)
--------------------------------------------------------------------------------
/src/components/dropdown/components/divider.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const DropdownDivider = ({ className, ...props }) => {
7 | return (
8 |
9 | );
10 | };
11 |
12 | DropdownDivider.propTypes = {};
13 |
14 | DropdownDivider.defaultProps = {
15 | renderAs: 'hr',
16 | };
17 |
18 | export default DropdownDivider;
19 |
--------------------------------------------------------------------------------
/src/components/dropdown/components/item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const DropdownItem = ({ active, children, value, className, ...props }) => {
8 | return (
9 |
17 | {children}
18 |
19 | );
20 | };
21 |
22 | DropdownItem.propTypes = {
23 | /**
24 | * Whether this dropdown item is currently selected.
25 | * Shows a highlighted effect if true.
26 | * Note that the effect only works when this item is rendered as an anchor
27 | * (``).
28 | */
29 | active: PropTypes.bool,
30 | /**
31 | * The value this dropdown item holds. When this item is clicked,
32 | * this value is passed to the onChange callback of ``.
33 | * The value is used to determine if this item is active or not.
34 | */
35 | value: PropTypes.any.isRequired,
36 | };
37 |
38 | DropdownItem.defaultProps = {};
39 |
40 | export default DropdownItem;
41 |
--------------------------------------------------------------------------------
/src/components/dropdown/dropdown.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Dropdown } from '../..';
3 | import * as stories from './dropdown.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Dropdown
9 |
10 | A component for implementing dropdown menu patterns that incorporates the button and the menu elements.
11 |
12 | ## Components
13 |
14 | The `Dropdown` component contains the following components:
15 |
16 | - ``: Defines an item in the dropdown menu.
17 | - ``: Draws a divider in the dropdown menu.
18 |
19 | ## Props
20 |
21 |
22 |
23 | ### `Dropdown`
24 |
25 |
26 |
27 | ### `Dropdown.Item`
28 |
29 |
30 |
31 | ### `Dropdown.Divider`
32 |
33 |
34 |
35 |
36 |
37 | ## Example
38 |
39 |
42 |
43 | ## Related
44 |
45 | - [Official documentation](https://bulma.io/documentation/components/dropdown/)
--------------------------------------------------------------------------------
/src/components/dropdown/index.d.ts:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { ElementProps, RenderAsComponent } from '..';
3 | import { Color } from '..';
4 |
5 | interface DropdownProps {
6 | value?: T;
7 | onChange?: (newValue: T) => void;
8 | color?: Color;
9 | hoverable?: boolean;
10 | label?: React.ReactNode;
11 | closeOnSelect?: boolean;
12 | right?: boolean;
13 | up?: boolean;
14 | align?: 'right';
15 | icon?: React.ReactNode;
16 | disabled?: boolean;
17 | menuId?: string;
18 | }
19 |
20 | interface DropdownItemProps {
21 | value: T;
22 | }
23 |
24 | declare const Dropdown: ((
25 | props: DropdownProps &
26 | ElementProps, TComponent>,
27 | ) => React.ReactElement) & {
28 | Item: (
29 | props: DropdownItemProps &
30 | ElementProps, TComponent>,
31 | ) => React.ReactElement;
32 | Divider: (
33 | props: Omit, 'renderAs'>,
34 | ) => React.ReactElement;
35 | };
36 |
37 | export default Dropdown;
--------------------------------------------------------------------------------
/src/components/dropdown/index.js:
--------------------------------------------------------------------------------
1 | import Dropdown from './dropdown';
2 |
3 | export default Dropdown;
4 |
--------------------------------------------------------------------------------
/src/components/element/__test__/__snapshots__/element.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Element component Should Exist 1`] = `[Function]`;
4 |
5 | exports[`Element component Should accept a react Element as renderAs prop 1`] = `
6 |
7 | Custom
8 | This should be a p element
9 |
10 | `;
11 |
12 | exports[`Element component Should have helpers classnames 1`] = `
13 |
16 | Facebook
17 |
18 | `;
19 |
--------------------------------------------------------------------------------
/src/components/element/__test__/element.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import renderer from 'react-test-renderer';
4 | import Element from '..';
5 |
6 | describe('Element component', () => {
7 | it('Should Exist', () => {
8 | expect(Element).toMatchSnapshot();
9 | });
10 | it('Should have helpers classnames', () => {
11 | const component = renderer.create(
12 |
13 | Facebook
14 | ,
15 | );
16 | expect(component.toJSON()).toMatchSnapshot();
17 | });
18 | it('Should accept a react Element as renderAs prop', () => {
19 | // eslint-disable-next-line react/prop-types
20 | const Custom = props => (
21 |
22 | Custom
23 | {props.children}
24 |
25 | );
26 |
27 | Custom.propTypes = { children: PropTypes.node.isRequired };
28 |
29 | const component = renderer.create(
30 | This should be a p element,
31 | );
32 | expect(component.toJSON()).toMatchSnapshot();
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/src/components/element/element.story.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couds/react-bulma-components/3fc281a9823a1f7bce913873e06485b28eb43dcf/src/components/element/element.story.js
--------------------------------------------------------------------------------
/src/components/element/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | declare const Element: BulmaComponent<{}, 'div'>;
4 |
5 | export default Element;
6 |
--------------------------------------------------------------------------------
/src/components/element/index.js:
--------------------------------------------------------------------------------
1 | import Element from './element';
2 |
3 | export default Element;
4 |
--------------------------------------------------------------------------------
/src/components/element/stories/element-2-proptypes.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Block, Card, Columns, Container, Message, Notification, Table, Element } from '../../..';
3 |
4 |
5 |
6 | # The Element component
7 | ### Common Props
8 |
9 | All (Or almost all) helpers and modifiers of bulma are implemented as a prop inside the
10 | Element component (and on every component on the react-bulma-component library), here you
11 | can find a list of all common props between all components
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/components/element/stories/element-5-customization.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta } from '@storybook/addon-docs/blocks';
2 | import { Message, Button, Notification, Block } from '../../..';
3 |
4 |
5 |
6 | # Extend and Customize
7 | ## You can add your own sizes and color in addition of the one provided by Bulma.
8 |
9 | To enable this feature you need to enable the `Sass` support on your project and follow the [Bulma Documantation](https://bulma.io/documentation/customize/concepts/)
10 |
11 | Then create a `$custom-colors` variable with the list of colors you want to add.
12 |
13 |
14 | Note that each color come in pairs (The color and the inverse)
15 |
16 |
17 | ## For Example
18 |
19 | In your `Sass file`
20 |
21 | ```scss
22 | $custom-colors: ("brand": (#8A4D76, #FFF), "custom": (#f88fa1,#000));
23 | ```
24 |
25 | Then you can use the colors defined in any color prop like this
26 |
27 | ```jsx
28 |
29 |
30 |
31 | My Notification
32 |
33 | ```
34 |
35 |
36 |
37 |
38 |
39 |
40 | My Secondary Notification
41 |
--------------------------------------------------------------------------------
/src/components/footer/__test__/__snapshots__/footer.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Footer component Should have footer classname 1`] = `
4 |
18 | `;
19 |
--------------------------------------------------------------------------------
/src/components/footer/__test__/footer.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Footer from '..';
4 |
5 | describe('Footer component', () => {
6 | it('Should have footer classname', () => {
7 | const component = renderer.create(
8 | ,
14 | );
15 | expect(component.toJSON()).toMatchSnapshot();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/src/components/footer/footer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../element';
6 |
7 | const Footer = ({ className, ...props }) => {
8 | return ;
9 | };
10 |
11 | Footer.propTypes = {
12 | renderAs: PropTypes.oneOfType([
13 | PropTypes.func,
14 | PropTypes.string,
15 | PropTypes.object,
16 | ]),
17 | };
18 |
19 | Footer.defaultProps = {
20 | renderAs: 'footer',
21 | };
22 |
23 | export default Footer;
24 |
--------------------------------------------------------------------------------
/src/components/footer/footer.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { Footer, Container, Content, Hero } from '../..';
4 |
5 | export const Default = () => {
6 | return (
7 |
8 |
9 |
10 |
11 |
12 |
32 |
33 |
34 |
35 | );
36 | };
37 |
--------------------------------------------------------------------------------
/src/components/footer/footer.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import Footer from '.';
3 | import CommonProps from '../../../.storybook/common-props';
4 | import * as stories from './footer.story';
5 |
6 |
7 |
8 | # Footer
9 |
10 | A responsive footer that can contain other components.
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 | ## Related
25 |
26 | - [Official documentation](https://bulma.io/documentation/layout/footer/)
--------------------------------------------------------------------------------
/src/components/footer/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | declare const Footer: BulmaComponent<{}, 'div'>;
4 |
5 | export default Footer;
6 |
--------------------------------------------------------------------------------
/src/components/footer/index.js:
--------------------------------------------------------------------------------
1 | import Footer from './footer';
2 |
3 | export default Footer;
4 |
--------------------------------------------------------------------------------
/src/components/form/__test__/__snapshots__/index.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Form component Should expose all Form elements 1`] = `
4 | Object {
5 | "Checkbox": [Function],
6 | "Control": [Function],
7 | "Field": [Function],
8 | "Help": [Function],
9 | "Input": [Function],
10 | "InputFile": [Function],
11 | "Label": [Function],
12 | "Radio": [Function],
13 | "Select": [Function],
14 | "Textarea": [Function],
15 | }
16 | `;
17 |
--------------------------------------------------------------------------------
/src/components/form/__test__/index.test.js:
--------------------------------------------------------------------------------
1 | import * as Form from '..';
2 |
3 | describe('Form component', () => {
4 | it('Should expose all Form elements', () => {
5 | expect(Form).toMatchSnapshot();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/checkbox.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Checkbox component Should Exists 1`] = `[Function]`;
4 |
5 | exports[`Checkbox component Should have checkbox classname 1`] = `
6 |
15 | `;
16 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/control.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Control component Should concat classname in props with Bulma classname 1`] = `
4 |
11 | `;
12 |
13 | exports[`Control component Should exist 1`] = `[Function]`;
14 |
15 | exports[`Control component Should have control classname 1`] = `
16 |
19 |
22 |
23 | Default
24 |
25 |
26 | Container
27 |
28 |
29 |
30 | `;
31 |
32 | exports[`Control component Should render as a html section element 1`] = `
33 |
36 |
37 | Default
38 |
39 |
40 | `;
41 |
42 | exports[`Control component Should use inline styles 1`] = `
43 |
51 |
52 | Default
53 |
54 |
55 | `;
56 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/help.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Help component Should be displayed as a successful message 1`] = `
4 |
7 |
8 | Default
9 |
10 |
11 | `;
12 |
13 | exports[`Help component Should concat classname in props with Bulma classname 1`] = `
14 |
17 |
18 | Default
19 |
20 |
21 | `;
22 |
23 | exports[`Help component Should exist 1`] = `[Function]`;
24 |
25 | exports[`Help component Should have help classname 1`] = `
26 |
29 |
32 |
33 | Default
34 |
35 |
36 | Container
37 |
38 |
39 |
40 | `;
41 |
42 | exports[`Help component Should use inline styles 1`] = `
43 |
51 |
52 | Default
53 |
54 |
55 | `;
56 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/input.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Input component Should be disabled with placeholder and value 1`] = `
4 |
10 | `;
11 |
12 | exports[`Input component Should be large and readOnly 1`] = `
13 |
17 | `;
18 |
19 | exports[`Input component Should be rounded 1`] = `
20 |
23 | `;
24 |
25 | exports[`Input component Should be type email and a with success colors 1`] = `
26 |
30 | `;
31 |
32 | exports[`Input component Should concat classname in props with Bulma classname 1`] = `
33 |
36 | `;
37 |
38 | exports[`Input component Should exist 1`] = `[Function]`;
39 |
40 | exports[`Input component Should have input classname 1`] = `
41 |
44 | `;
45 |
46 | exports[`Input component Should support focus state 1`] = `
47 |
50 | `;
51 |
52 | exports[`Input component Should support hovered state 1`] = `
53 |
56 | `;
57 |
58 | exports[`Input component Should use inline styles 1`] = `
59 |
67 | `;
68 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/label.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Label component Should concat classname in props with Bulma classname 1`] = `
4 |
11 | `;
12 |
13 | exports[`Label component Should exist 1`] = `[Function]`;
14 |
15 | exports[`Label component Should have label classname 1`] = `
16 |
24 | `;
25 |
26 | exports[`Label component Should use inline styles 1`] = `
27 |
39 | `;
40 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/radio.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Radio component Should be disabled, checked and with value 1`] = `
4 |
20 | `;
21 |
22 | exports[`Radio component Should concat classname in props with Bulma classname 1`] = `
23 |
35 | `;
36 |
37 | exports[`Radio component Should exist 1`] = `[Function]`;
38 |
39 | exports[`Radio component Should have radio classname 1`] = `
40 |
53 | `;
54 |
55 | exports[`Radio component Should use inline styles 1`] = `
56 |
73 | `;
74 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/__snapshots__/textarea.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Textarea component Should concat classname in props with Bulma classname 1`] = `
4 |
7 | `;
8 |
9 | exports[`Textarea component Should exist 1`] = `[Function]`;
10 |
11 | exports[`Textarea component Should have a fixed size 1`] = `
12 |
15 | `;
16 |
17 | exports[`Textarea component Should have textarea classname 1`] = `
18 |
21 | `;
22 |
23 | exports[`Textarea component Should support focus state 1`] = `
24 |
27 | `;
28 |
29 | exports[`Textarea component Should support hover state 1`] = `
30 |
33 | `;
34 |
35 | exports[`Textarea component Should use inline styles 1`] = `
36 |
44 | `;
45 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/checkbox.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import { mount, render } from 'enzyme';
4 | import Checkbox from '../checkbox';
5 |
6 | describe('Checkbox component', () => {
7 | it('Should Exists', () => {
8 | expect(Checkbox).toMatchSnapshot();
9 | });
10 | it('Should have checkbox classname', () => {
11 | const component = renderer.create(Text);
12 | expect(component.toJSON()).toMatchSnapshot();
13 | });
14 | it('Should change value on change event', () => {
15 | const spy = jest.fn();
16 | const component = mount(Text);
17 | component.find('input').simulate('change');
18 | expect(spy).toHaveBeenCalledTimes(1);
19 | });
20 | it('Should set input checked if checked', () => {
21 | const component = render( {}} />);
22 | expect(component.find('input')).toHaveLength(1);
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/control.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Control from '../control';
4 |
5 | describe('Control component', () => {
6 | it('Should exist', () => {
7 | expect(Control).toMatchSnapshot();
8 | });
9 | it('Should have control classname', () => {
10 | const component = renderer.create(
11 |
12 |
13 |
Default
14 | Container
15 |
16 | ,
17 | );
18 | expect(component.toJSON()).toMatchSnapshot();
19 | });
20 | it('Should concat classname in props with Bulma classname', () => {
21 | const component = renderer.create(
22 |
23 | Default
24 | ,
25 | );
26 | expect(component.toJSON()).toMatchSnapshot();
27 | });
28 | it('Should use inline styles', () => {
29 | const component = renderer.create(
30 |
31 | Default
32 | ,
33 | );
34 | expect(component.toJSON()).toMatchSnapshot();
35 | });
36 | it('Should render as a html section element', () => {
37 | const component = renderer.create(
38 |
39 | Default
40 | ,
41 | );
42 | expect(component.toJSON()).toMatchSnapshot();
43 | });
44 | });
45 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/help.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Help from '../help';
4 |
5 | describe('Help component', () => {
6 | it('Should exist', () => {
7 | expect(Help).toMatchSnapshot();
8 | });
9 | it('Should have help classname', () => {
10 | const component = renderer.create(
11 |
12 |
13 |
Default
14 | Container
15 |
16 | ,
17 | );
18 | expect(component.toJSON()).toMatchSnapshot();
19 | });
20 | it('Should concat classname in props with Bulma classname', () => {
21 | const component = renderer.create(
22 |
23 | Default
24 | ,
25 | );
26 | expect(component.toJSON()).toMatchSnapshot();
27 | });
28 | it('Should use inline styles', () => {
29 | const component = renderer.create(
30 |
31 | Default
32 | ,
33 | );
34 | expect(component.toJSON()).toMatchSnapshot();
35 | });
36 | it('Should be displayed as a successful message', () => {
37 | const component = renderer.create(
38 |
39 | Default
40 | ,
41 | );
42 | expect(component.toJSON()).toMatchSnapshot();
43 | });
44 | });
45 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/label.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Label from '../label';
4 |
5 | describe('Label component', () => {
6 | it('Should exist', () => {
7 | expect(Label).toMatchSnapshot();
8 | });
9 | it('Should have label classname', () => {
10 | const component = renderer.create(
11 | ,
14 | );
15 | expect(component.toJSON()).toMatchSnapshot();
16 | });
17 | it('Should concat classname in props with Bulma classname', () => {
18 | const component = renderer.create(
19 | ,
22 | );
23 | expect(component.toJSON()).toMatchSnapshot();
24 | });
25 | it('Should use inline styles', () => {
26 | const component = renderer.create(
27 | ,
30 | );
31 | expect(component.toJSON()).toMatchSnapshot();
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/radio.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Radio from '../radio';
4 |
5 | describe('Radio component', () => {
6 | it('Should exist', () => {
7 | expect(Radio).toMatchSnapshot();
8 | });
9 | it('Should have radio classname', () => {
10 | const component = renderer.create(
11 |
12 | Test Give me
13 | ,
14 | );
15 | expect(component.toJSON()).toMatchSnapshot();
16 | });
17 | it('Should concat classname in props with Bulma classname', () => {
18 | const component = renderer.create(
19 |
20 | Default
21 | ,
22 | );
23 | expect(component.toJSON()).toMatchSnapshot();
24 | });
25 | it('Should use inline styles', () => {
26 | const component = renderer.create(
27 |
28 | Default
29 | ,
30 | );
31 | expect(component.toJSON()).toMatchSnapshot();
32 | });
33 | it('Should be disabled, checked and with value', () => {
34 | const component = renderer.create(
35 |
36 | Default
37 | ,
38 | );
39 | expect(component.toJSON()).toMatchSnapshot();
40 | });
41 | });
42 |
--------------------------------------------------------------------------------
/src/components/form/components/__test__/textarea.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Textarea from '../textarea';
4 |
5 | describe('Textarea component', () => {
6 | it('Should exist', () => {
7 | expect(Textarea).toMatchSnapshot();
8 | });
9 | it('Should have textarea classname', () => {
10 | const component = renderer.create();
11 | expect(component.toJSON()).toMatchSnapshot();
12 | });
13 | it('Should concat classname in props with Bulma classname', () => {
14 | const component = renderer.create(
15 | ,
16 | );
17 | expect(component.toJSON()).toMatchSnapshot();
18 | });
19 | it('Should use inline styles', () => {
20 | const component = renderer.create();
21 | expect(component.toJSON()).toMatchSnapshot();
22 | });
23 | it('Should support hover state', () => {
24 | const component = renderer.create();
25 | expect(component.toJSON()).toMatchSnapshot();
26 | });
27 | it('Should support focus state', () => {
28 | const component = renderer.create();
29 | expect(component.toJSON()).toMatchSnapshot();
30 | });
31 | it('Should have a fixed size', () => {
32 | const component = renderer.create();
33 | expect(component.toJSON()).toMatchSnapshot();
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/src/components/form/components/checkbox.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const Checkbox = ({
8 | className,
9 | style,
10 | disabled,
11 | children,
12 | domRef,
13 | ...props
14 | }) => {
15 | return (
16 |
23 | {children}
24 |
25 | );
26 | };
27 |
28 | Checkbox.propTypes = {
29 | disabled: PropTypes.bool,
30 | renderAs: PropTypes.oneOfType([
31 | PropTypes.func,
32 | PropTypes.string,
33 | PropTypes.object,
34 | ]),
35 | };
36 |
37 | Checkbox.defaultProps = {
38 | renderAs: 'input',
39 | };
40 |
41 | export default Checkbox;
42 |
--------------------------------------------------------------------------------
/src/components/form/components/field/context.js:
--------------------------------------------------------------------------------
1 | import React, { useContext } from 'react';
2 |
3 | export const FieldContext = React.createContext({
4 | size: undefined,
5 | });
6 |
7 | const useFieldContext = () => {
8 | return useContext(FieldContext);
9 | };
10 |
11 | export default useFieldContext;
12 |
--------------------------------------------------------------------------------
/src/components/form/components/field/field-body.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../../element';
5 |
6 | const FieldBody = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | FieldBody.propTypes = {};
15 |
16 | FieldBody.defaultProps = {};
17 |
18 | export default FieldBody;
19 |
--------------------------------------------------------------------------------
/src/components/form/components/field/field-label.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../../element';
6 | import useFieldContext from './context';
7 |
8 | const FieldLabel = ({ className, size, ...props }) => {
9 | const context = useFieldContext();
10 | return (
11 |
17 | );
18 | };
19 |
20 | FieldLabel.propTypes = {
21 | size: PropTypes.oneOf(['small', 'normal', 'medium', 'large']),
22 | };
23 |
24 | FieldLabel.defaultProps = {};
25 |
26 | export default FieldLabel;
27 |
--------------------------------------------------------------------------------
/src/components/form/components/field/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './field';
2 |
--------------------------------------------------------------------------------
/src/components/form/components/help.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const Help = ({ className, children, color, ...props }) => {
8 | return (
9 |
15 | {children}
16 |
17 | );
18 | };
19 |
20 | Help.propTypes = {
21 | color: PropTypes.oneOfType([
22 | PropTypes.oneOf([
23 | 'primary',
24 | 'link',
25 | 'info',
26 | 'success',
27 | 'warning',
28 | 'danger',
29 | 'dark',
30 | 'text',
31 | ]),
32 | PropTypes.string,
33 | ]),
34 | renderAs: PropTypes.oneOfType([
35 | PropTypes.func,
36 | PropTypes.string,
37 | PropTypes.object,
38 | ]),
39 | };
40 |
41 | Help.defaultProps = {
42 | renderAs: 'p',
43 | };
44 |
45 | export default Help;
46 |
--------------------------------------------------------------------------------
/src/components/form/components/label.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 | import useFieldContext from './field/context';
7 |
8 | const Label = ({ children, className, size, ...props }) => {
9 | const context = useFieldContext();
10 | const calculatedSize = size || context.size;
11 | return (
12 |
18 | {children}
19 |
20 | );
21 | };
22 |
23 | Label.propTypes = {
24 | size: PropTypes.oneOfType([
25 | PropTypes.oneOf(['small', 'medium', 'large']),
26 | PropTypes.string,
27 | ]),
28 | renderAs: PropTypes.oneOfType([
29 | PropTypes.func,
30 | PropTypes.string,
31 | PropTypes.object,
32 | ]),
33 | };
34 |
35 | Label.defaultProps = {
36 | renderAs: 'label',
37 | };
38 |
39 | export default Label;
40 |
--------------------------------------------------------------------------------
/src/components/form/index.js:
--------------------------------------------------------------------------------
1 | import Field from './components/field';
2 | import Control from './components/control';
3 | import Input from './components/input';
4 | import Label from './components/label';
5 | import Textarea from './components/textarea';
6 | import Select from './components/select';
7 | import Checkbox from './components/checkbox';
8 | import Radio from './components/radio';
9 | import Help from './components/help';
10 | import InputFile from './components/input-file';
11 |
12 | export {
13 | Field,
14 | Control,
15 | Input,
16 | Label,
17 | Textarea,
18 | Select,
19 | Checkbox,
20 | Radio,
21 | Help,
22 | InputFile,
23 | };
24 |
--------------------------------------------------------------------------------
/src/components/form/stories/form-2-label.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Label
10 |
11 | A `Label` container display the name of usage of the current `Form.Field`
12 |
13 | ## Props
14 |
15 |
16 |
17 |
18 |
19 | ## Example
20 |
21 |
24 |
25 |
26 | ## Related
27 |
28 | - [Official documentation](https://bulma.io/documentation/form/general/#form-field)
--------------------------------------------------------------------------------
/src/components/form/stories/form-3-field.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Field
10 |
11 | A `Field` container to wrap `Form.Label`, `Form.Control` and/or `Form.Help`, this allow you to keep the spaces consistents
12 |
13 | ## Props
14 |
15 |
16 |
17 | ## Components
18 |
19 | ### `Field.Label`
20 |
21 | When you are using a horizontal Field (Means that the label and the form control are in the same row) you need to use
22 | this component to identify the left part (the label)
23 |
24 |
25 |
26 | ### `Field.Body`
27 |
28 | This component will be a container for another `Field` that will include the form control you want to use (Check the code of the story for details)
29 |
30 |
31 |
32 |
33 |
34 |
35 | ## Example
36 |
37 |
40 |
41 |
42 | ## Related
43 |
44 | - [Official documentation](https://bulma.io/documentation/form/general/#form-field)
--------------------------------------------------------------------------------
/src/components/form/stories/form-4-control.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Control
10 |
11 | The Control is a versatile container meant to enhance single `Form` component. Because it has the same height as the element that it wraps, it can only contain the following Bulma elements:
12 |
13 | - `Form.Input`
14 | - `Form.Select`
15 | - `Button`
16 | - `Icon`
17 |
18 | This container gives the ability to:
19 |
20 | - Keep the spacing consistent
21 | - Combine form controls into a group
22 | - Combine form controls into a list
23 | - Append and prepend icons to a form control, when an icon with `align="left"` or `align="right"` is found the control will automatically add the bulma class `has-icon-left` and/or `has-icon-right`
24 |
25 | ## Props
26 |
27 |
28 |
29 |
30 |
31 | ## Example
32 |
33 |
36 |
37 |
38 | ## Related
39 |
40 | - [Official documentation](https://bulma.io/documentation/form/general/#form-control)
--------------------------------------------------------------------------------
/src/components/form/stories/form-5-input.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Input
10 | The text input and its variations
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 |
25 | ## Related
26 |
27 | - [Official documentation](https://bulma.io/documentation/form/input)
--------------------------------------------------------------------------------
/src/components/form/stories/form-6-textarea.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Textarea
10 | The multiline textarea and its variations
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 |
25 | ## Related
26 |
27 | - [Official documentation](https://bulma.io/documentation/form/textarea)
--------------------------------------------------------------------------------
/src/components/form/stories/form-7-select.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Select
10 | The browser built-in **select dropdown**, styled accordingly
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 |
25 | ## Related
26 |
27 | - [Official documentation](https://bulma.io/documentation/form/select)
--------------------------------------------------------------------------------
/src/components/form/stories/form-8-checkbox.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Checkbox
10 | The old fashion 2-state native checkbox
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 |
25 | ## Related
26 |
27 | - [Official documentation](https://bulma.io/documentation/form/checkbox)
--------------------------------------------------------------------------------
/src/components/form/stories/form-9-radio.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Form } from '../../..';
3 | import * as stories from './form.story';
4 | import CommonProps from '../../../../.storybook/common-props';
5 |
6 |
7 |
8 |
9 | # Checkbox
10 | The `` component is a simple wrapper around the ` HTML element.
11 | The radio buttons are not styled to preserve cross browser compatibility.
12 |
13 | ## Props
14 |
15 |
16 |
17 |
18 |
19 | ## Example
20 |
21 |
24 |
25 |
26 | ## Related
27 |
28 | - [Official documentation](https://bulma.io/documentation/form/radio)
--------------------------------------------------------------------------------
/src/components/form/stories/form-99-input-file.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Story, Meta, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import { Message, Form } from '../../..';
3 | import * as stories from './form.story';
4 |
5 |
6 |
7 | # InputFile
8 |
9 |
10 | The `InputFile` component combines different HTML elements and Bulma classes required to
11 | construct a Bulma file input into one React component.
12 |
13 |
14 | ## Props
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 |
25 | ## Related
26 |
27 | - [Official documentation](https://bulma.io/documentation/form/file)
--------------------------------------------------------------------------------
/src/components/heading/__test__/__snapshots__/heading.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Heading component Should be a subtitle with size rendered as P 1`] = `
4 |
7 | Subtitle
8 |
9 | `;
10 |
11 | exports[`Heading component Should be spaced 1`] = `
12 |
15 | Subtitle
16 |
17 | `;
18 |
19 | exports[`Heading component Should concat classname in props with Bulma classname 1`] = `
20 |
23 |
24 | Default
25 |
26 |
27 | `;
28 |
29 | exports[`Heading component Should exist 1`] = `[Function]`;
30 |
31 | exports[`Heading component Should have title classname 1`] = `
32 |
40 | `;
41 |
42 | exports[`Heading component Should not be spaced because is subtitle 1`] = `
43 |
46 | Subtitle
47 |
48 | `;
49 |
50 | exports[`Heading component Should use inline styles 1`] = `
51 |
59 |
60 | Default
61 |
62 |
63 | `;
64 |
--------------------------------------------------------------------------------
/src/components/heading/heading.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../element';
6 |
7 | const Heading = ({
8 | children,
9 | className,
10 | size,
11 | subtitle,
12 | weight,
13 | spaced,
14 | heading,
15 | ...props
16 | }) => {
17 | return (
18 |
29 | {children}
30 |
31 | );
32 | };
33 |
34 | Heading.propTypes = {
35 | size: PropTypes.oneOfType([
36 | PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
37 | PropTypes.string,
38 | PropTypes.number,
39 | ]),
40 | weight: PropTypes.oneOf(['light', 'normal', 'semibold', 'bold']),
41 | subtitle: PropTypes.bool,
42 | heading: PropTypes.bool,
43 | spaced: PropTypes.bool,
44 | renderAs: PropTypes.oneOfType([
45 | PropTypes.func,
46 | PropTypes.string,
47 | PropTypes.object,
48 | ]),
49 | };
50 |
51 | Heading.defaultProps = {
52 | renderAs: 'h1',
53 | };
54 |
55 | export default Heading;
56 |
--------------------------------------------------------------------------------
/src/components/heading/heading.story.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/prop-types */
2 | import React from 'react';
3 | import Heading from './heading';
4 |
5 | export const Default = ({ titleSize, titleWeight, spaced }) => {
6 | return (
7 | <>
8 |
9 | Title
10 |
11 | Subtitle
12 | >
13 | );
14 | };
15 |
16 | Default.argTypes = {
17 | titleSize: {
18 | name: 'size',
19 | table: {
20 | category: 'Title',
21 | },
22 | control: {
23 | type: 'select',
24 | options: ['default', 1, 2, 3, 4, 5, 6],
25 | },
26 | },
27 | titleWeight: {
28 | name: 'weight',
29 | table: {
30 | category: 'Title',
31 | },
32 | control: {
33 | type: 'select',
34 | options: ['default', 'light', 'normal', 'semibold', 'bold'],
35 | },
36 | },
37 | spaced: {
38 | table: {
39 | category: 'Title',
40 | },
41 | control: {
42 | type: 'boolean',
43 | },
44 | },
45 | };
46 |
--------------------------------------------------------------------------------
/src/components/heading/heading.story.mdx:
--------------------------------------------------------------------------------
1 | import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './heading.story';
3 | import { Heading } from '../..';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Heading
9 |
10 | The `Heading` component combines **title** and **subtitle** styles into one component.
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Spacing
19 |
20 | When you put title and subtitle together the spacing between them will be reduced.
21 | The official documentation recommends that the size difference between title and subtitle should be 2.
22 | For example, if your title has a size of 5, your subtitle should have a size of 3.
23 |
24 | ## Example
25 |
26 |
29 |
30 | ## Related
31 |
32 | - [Official documentation](https://bulma.io/documentation/elements/title/)
--------------------------------------------------------------------------------
/src/components/heading/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | interface HeadingProps {
4 | size?: 1 | 2 | 3 | 4 | 5 | 6;
5 | weight?: 'light' | 'normal' | 'semibold' | 'bold';
6 | subtitle?: boolean;
7 | heading?: boolean;
8 | spaced?: boolean;
9 | }
10 |
11 | declare const Heading: BulmaComponent;
12 |
13 | export default Heading;
--------------------------------------------------------------------------------
/src/components/heading/index.js:
--------------------------------------------------------------------------------
1 | import Heading from './heading';
2 |
3 | export default Heading;
4 |
--------------------------------------------------------------------------------
/src/components/hero/components/hero-body.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const HeroBody = ({ className, ...props }) => {
8 | return ;
9 | };
10 |
11 | HeroBody.defaultProps = {
12 | renderAs: 'div',
13 | };
14 |
15 | HeroBody.propTypes = {
16 | renderAs: PropTypes.oneOfType([
17 | PropTypes.func,
18 | PropTypes.string,
19 | PropTypes.object,
20 | ]),
21 | };
22 |
23 | export default HeroBody;
24 |
--------------------------------------------------------------------------------
/src/components/hero/components/hero-footer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const HeroFooter = ({ className, ...props }) => {
8 | return ;
9 | };
10 |
11 | HeroFooter.propTypes = {
12 | renderAs: PropTypes.oneOfType([
13 | PropTypes.func,
14 | PropTypes.string,
15 | PropTypes.object,
16 | ]),
17 | };
18 |
19 | HeroFooter.defaultProps = {
20 | renderAs: 'footer',
21 | };
22 |
23 | export default HeroFooter;
24 |
--------------------------------------------------------------------------------
/src/components/hero/components/hero-header.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const HeroHeader = ({ className, ...props }) => {
8 | return ;
9 | };
10 |
11 | HeroHeader.propTypes = {
12 | renderAs: PropTypes.oneOfType([
13 | PropTypes.func,
14 | PropTypes.string,
15 | PropTypes.object,
16 | ]),
17 | };
18 |
19 | HeroHeader.defaultProps = {
20 | renderAs: 'header',
21 | };
22 |
23 | export default HeroHeader;
24 |
--------------------------------------------------------------------------------
/src/components/hero/hero.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { Hero, Heading, Container } from '../..';
4 | import CONSTANTS from '../../constants';
5 |
6 | export const Default = (args) => {
7 | return (
8 |
9 |
10 | Header
11 |
12 |
13 | Hero title Info
14 |
15 | Subtitle
16 |
17 |
18 |
19 | Footer
20 |
21 |
22 | );
23 | };
24 |
25 | Default.argTypes = {
26 | color: {
27 | control: {
28 | type: 'select',
29 | options: ['default'].concat(Object.values(CONSTANTS.COLORS)),
30 | },
31 | },
32 | size: {
33 | control: {
34 | type: 'select',
35 | options: [
36 | 'default',
37 | 'small',
38 | 'medium',
39 | 'large',
40 | 'halfheight',
41 | 'fullheight',
42 | ],
43 | },
44 | },
45 | };
46 |
--------------------------------------------------------------------------------
/src/components/hero/hero.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Hero } from '../..';
3 | import * as stories from './hero.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Hero
9 |
10 | An imposing hero banner to showcase something
11 |
12 | The hero component allows you to add a full width banner to your webpage, which can optionally cover the full height of the page as well.
13 |
14 | The basic requirement of this component are:
15 |
16 | - `Hero` as the main container
17 | - `Hero.Body` as a direct child, in which you can put all your content
18 | - For the `fullheight` props to work, you will also need a hero-head and a hero-foot.
19 |
20 | ## Components
21 |
22 | The `Hero` component contains the following components:
23 |
24 | - ``: Defines an item in the dropdown menu.
25 | - ``: Defines an item in the dropdown menu.
26 | - ``: Draws a divider in the dropdown menu.
27 |
28 | ## Props
29 |
30 | ### `Hero`
31 |
32 |
33 |
34 | ### `Hero.Header`
35 |
36 |
37 |
38 | ### `Hero.Body`
39 |
40 |
41 |
42 | ### `Hero.Footer`
43 |
44 |
45 |
46 |
47 |
48 | ## Example
49 |
50 |
53 |
54 | ## Related
55 |
56 | - [Official documentation](https://bulma.io/documentation/layout/hero/)
--------------------------------------------------------------------------------
/src/components/hero/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color, Size } from '..';
3 |
4 | interface HeroProps {
5 | color?: Color;
6 | gradient?: boolean;
7 | size?: Size | 'halfheight'| 'fullheight';
8 | hasNavbar?: boolean;
9 | }
10 |
11 | declare const Hero: BulmaComponent & {
12 | Header: BulmaComponent<{}, 'div'>;
13 | Body: BulmaComponent<{}, 'div'>;
14 | Footer: BulmaComponent<{}, 'div'>;
15 | };
16 |
17 | export default Hero;
--------------------------------------------------------------------------------
/src/components/hero/index.js:
--------------------------------------------------------------------------------
1 | import Hero from './hero';
2 |
3 | export default Hero;
4 |
--------------------------------------------------------------------------------
/src/components/icon/__test__/__snapshots__/icon.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Icon component Should Exist 1`] = `[Function]`;
4 |
5 | exports[`Icon component Should concat Bulma class with classes in props 1`] = `
6 |
10 | `;
11 |
12 | exports[`Icon component Should have box classname 1`] = `
13 |
17 | `;
18 |
19 | exports[`Icon component Should render wrapped on icon-text class 1`] = `
20 |
23 |
27 |
28 | `;
29 |
--------------------------------------------------------------------------------
/src/components/icon/__test__/icon.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Icon from '..';
4 |
5 | describe('Icon component', () => {
6 | it('Should Exist', () => {
7 | expect(Icon).toMatchSnapshot();
8 | });
9 | it('Should have box classname', () => {
10 | const component = renderer.create();
11 | expect(component.toJSON()).toMatchSnapshot();
12 | });
13 | it('Should concat Bulma class with classes in props', () => {
14 | const component = renderer.create(
15 | ,
16 | );
17 | expect(component.toJSON()).toMatchSnapshot();
18 | });
19 | it('Should render wrapped on icon-text class', () => {
20 | const component = renderer.create();
21 | expect(component.toJSON()).toMatchSnapshot();
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/components/icon/components/text/index.js:
--------------------------------------------------------------------------------
1 | import Text from './text';
2 |
3 | export default Text;
4 |
--------------------------------------------------------------------------------
/src/components/icon/components/text/text.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classNames from 'classnames';
4 | import Element from '../../../element';
5 |
6 | const Text = ({ className, ...props }) => {
7 | return ;
8 | };
9 |
10 | Text.propTypes = {
11 | renderAs: PropTypes.oneOfType([
12 | PropTypes.func,
13 | PropTypes.string,
14 | PropTypes.object,
15 | ]),
16 | };
17 |
18 | Text.defaultProps = {
19 | renderAs: 'span',
20 | };
21 |
22 | export default Text;
23 |
--------------------------------------------------------------------------------
/src/components/icon/icon.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import Text from './components/text';
5 |
6 | import Element from '../element';
7 |
8 | const Icon = ({ size, color, className, align, text, ...props }) => {
9 | if (text !== undefined) {
10 | console.warn(
11 | '[Deprecation] Text prop for Icon Component its deprecated, please use Icon.Text Component instead',
12 | );
13 | }
14 | return (
15 |
25 | );
26 | };
27 |
28 | Icon.propTypes = {
29 | size: PropTypes.oneOfType([
30 | PropTypes.oneOf(['small', 'medium', 'large']),
31 | PropTypes.string,
32 | ]),
33 | /**
34 | * Used when the icon is inside a `Form.Control`
35 | */
36 | align: PropTypes.oneOf(['left', 'right']),
37 | color: PropTypes.oneOfType([
38 | PropTypes.oneOf([
39 | 'primary',
40 | 'link',
41 | 'info',
42 | 'success',
43 | 'warning',
44 | 'danger',
45 | 'dark',
46 | 'text',
47 | ]),
48 | PropTypes.string,
49 | ]),
50 | renderAs: PropTypes.oneOfType([
51 | PropTypes.func,
52 | PropTypes.string,
53 | PropTypes.object,
54 | ]),
55 | };
56 |
57 | Icon.defaultProps = {
58 | renderAs: 'span',
59 | };
60 |
61 | Icon.Text = Text;
62 |
63 | export default Icon;
64 |
--------------------------------------------------------------------------------
/src/components/icon/icon.story.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/prop-types */
2 | import React from 'react';
3 | import classnames from 'classnames';
4 | import { Box, Icon } from '../..';
5 | import CONSTANTS from '../../constants';
6 | import Element from '../element';
7 |
8 | const faSizeMapper = {
9 | small: '',
10 | medium: 'lg',
11 | large: '2x',
12 | };
13 |
14 | export const Default = ({ size, useIconText, ...args }) => {
15 | const Wrapper = useIconText ? Icon.Text : React.Fragment;
16 | return (
17 |
18 |
19 |
20 |
25 |
26 | Some text in a span
27 |
28 |
29 | );
30 | };
31 |
32 | Default.args = {
33 | useIconText: false,
34 | };
35 |
36 | Default.argTypes = {
37 | color: {
38 | control: {
39 | type: 'select',
40 | options: ['default'].concat(Object.values(CONSTANTS.COLORS)),
41 | },
42 | },
43 | size: {
44 | control: {
45 | type: 'select',
46 | options: ['default', 'small', 'medium', 'large'],
47 | },
48 | },
49 | };
50 |
--------------------------------------------------------------------------------
/src/components/icon/icon.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './icon.story.js'
3 | import { Icon } from '../..';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Icon
9 |
10 | This component reserve a square space for the icon
11 |
12 | ## Props
13 |
14 |
15 |
16 | ### `Icon`
17 |
18 |
19 |
20 | ### `Icon.Text`
21 |
22 |
23 |
24 |
25 |
26 | ## Example
27 |
28 |
31 |
32 |
33 | ## Related
34 |
35 | - [Official documentation](https://bulma.io/documentation/elements/icon/)
--------------------------------------------------------------------------------
/src/components/icon/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color, Size } from '..';
3 |
4 | interface IconProps {
5 | icon?: string;
6 | size?: Size | 'auto';
7 | align?: 'left' | 'right';
8 | color?: Color;
9 | text?: Boolean;
10 | }
11 |
12 | declare const Icon: BulmaComponent & {
13 | Text: BulmaComponent<{}, 'span'>;
14 | };
15 |
16 | export default Icon;
--------------------------------------------------------------------------------
/src/components/icon/index.js:
--------------------------------------------------------------------------------
1 | import Icon from './icon';
2 |
3 | export default Icon;
4 |
--------------------------------------------------------------------------------
/src/components/image/__test__/__snapshots__/image.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Image component Should be 32x32 1`] = `
4 |
7 |
12 |
13 | `;
14 |
15 | exports[`Image component Should be rounded 1`] = `
16 |
19 |
24 |
25 | `;
26 |
27 | exports[`Image component Should be square 1`] = `
28 |
31 |
36 |
37 | `;
38 |
39 | exports[`Image component Should exist 1`] = `[Function]`;
40 |
41 | exports[`Image component Should have image classname 1`] = `
42 |
45 |
50 |
51 | `;
52 |
53 | exports[`Image component should be fullwidth 1`] = `
54 |
57 |
62 |
63 | `;
64 |
--------------------------------------------------------------------------------
/src/components/image/constants.js:
--------------------------------------------------------------------------------
1 | export default {
2 | SIZES: [
3 | 16,
4 | 24,
5 | 32,
6 | 48,
7 | 64,
8 | 96,
9 | 128,
10 | 'square',
11 | '1by1',
12 | '4by3',
13 | '3by2',
14 | '16by9',
15 | '2by1',
16 | '5by4',
17 | '5by3',
18 | '3by1',
19 | '4by5',
20 | '3by4',
21 | '2by3',
22 | '3by5',
23 | '9by16',
24 | '1by2',
25 | '1by3',
26 | ],
27 | };
28 |
--------------------------------------------------------------------------------
/src/components/image/image.story.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/prop-types */
2 | import React from 'react';
3 | import { Box, Image, Block } from '../..';
4 |
5 | export const Default = (args) => {
6 | return (
7 |
8 | This text is above the image
9 |
10 |
11 |
12 |
13 | And this is below and it is where it should be even before the image is
14 | loaded
15 |
16 |
17 | );
18 | };
19 |
20 | Default.args = {
21 | src: 'https://wallpapercave.com/wp/tU89SSy.jpg',
22 | fullwidth: false,
23 | rounded: false,
24 | fallback:
25 | 'https://nosequemepasa.com/wp-content/themes/wishful-blog/wishfulthemes/assets/images/fallback-image-one.jpg',
26 | };
27 |
28 | Default.argTypes = {
29 | size: {
30 | control: {
31 | type: 'select',
32 | options: [
33 | 16,
34 | 24,
35 | 32,
36 | 48,
37 | 64,
38 | 96,
39 | 128,
40 | 'square',
41 | '1by1',
42 | '4by3',
43 | '3by2',
44 | '16by9',
45 | '2by1',
46 | '5by4',
47 | '5by3',
48 | '3by1',
49 | '4by5',
50 | '3by4',
51 | '2by3',
52 | '3by5',
53 | '9by16',
54 | '1by2',
55 | '1by3',
56 | ],
57 | },
58 | },
59 | };
60 |
--------------------------------------------------------------------------------
/src/components/image/image.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './image.story.js'
3 | import { Box, Image } from '../..';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Image
9 |
10 | Responsive images made easy. Images take time to load (if they load at all), for that is a good practice to
11 | reserve the space before loading the image to avoid the page to jump around.
12 |
13 | This Component also allow you to setup a fallback image in case the image its not loaded correctly,
14 | try on the `Canvas` tab changing the src control to a unexisting image route and see what happens
15 |
16 | ## Props
17 |
18 |
19 |
20 |
21 |
22 | ## Example
23 |
24 |
27 |
28 |
29 | ## Related
30 |
31 | - [Official documentation](https://bulma.io/documentation/elements/image/)
--------------------------------------------------------------------------------
/src/components/image/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponentWithoutRenderAs } from '..';
2 |
3 | interface ImageProps {
4 | src: string;
5 | alt?: string;
6 | rounded?: boolean;
7 | size?:
8 | | 16
9 | | 24
10 | | 32
11 | | 48
12 | | 64
13 | | 96
14 | | 128
15 | | 'square'
16 | | '1by1'
17 | | '4by3'
18 | | '3by2'
19 | | '16by9'
20 | | '2by1'
21 | | '5by4'
22 | | '5by3'
23 | | '3by1'
24 | | '4by5'
25 | | '3by4'
26 | | '2by3'
27 | | '3by5'
28 | | '9by16'
29 | | '1by2'
30 | | '1by3'
31 | | String
32 | | Number;
33 | fallback?: string;
34 | fullwidth?: boolean;
35 | }
36 |
37 | declare const Image: BulmaComponentWithoutRenderAs;
38 |
39 | export default Image;
--------------------------------------------------------------------------------
/src/components/image/index.js:
--------------------------------------------------------------------------------
1 | import Image from './image';
2 |
3 | export default Image;
4 |
--------------------------------------------------------------------------------
/src/components/level/components/level-item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const LevelItem = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | LevelItem.propTypes = {};
15 |
16 | export default LevelItem;
17 |
--------------------------------------------------------------------------------
/src/components/level/components/level-side.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const LevelSide = ({ className, align, ...props }) => {
8 | return (
9 |
15 | );
16 | };
17 |
18 | LevelSide.propTypes = {
19 | align: PropTypes.oneOf(['left', 'right']),
20 | };
21 |
22 | LevelSide.defaultProps = {
23 | align: 'left',
24 | };
25 |
26 | export default LevelSide;
27 |
--------------------------------------------------------------------------------
/src/components/level/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | interface LevelProps {
4 | breakpoint?: | 'mobile';
5 | }
6 |
7 | interface LevelSideProps {
8 | align?: 'left' | 'right';
9 | }
10 |
11 | declare const Level: BulmaComponent & {
12 | Side: BulmaComponent;
13 | Item: BulmaComponent<{}, 'div'>;
14 | };
15 | export default Level;
--------------------------------------------------------------------------------
/src/components/level/index.js:
--------------------------------------------------------------------------------
1 | import Level from './level';
2 |
3 | export default Level;
4 |
--------------------------------------------------------------------------------
/src/components/level/level.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import LevelSide from './components/level-side';
5 | import LevelItem from './components/level-item';
6 |
7 | import Element from '../element';
8 |
9 | const Level = ({ children, className, breakpoint, ...props }) => {
10 | return (
11 |
17 | {children}
18 |
19 | );
20 | };
21 |
22 | Level.Side = LevelSide;
23 |
24 | Level.Item = LevelItem;
25 |
26 | Level.propTypes = {
27 | breakpoint: PropTypes.oneOf(['mobile']),
28 | renderAs: PropTypes.oneOfType([
29 | PropTypes.func,
30 | PropTypes.string,
31 | PropTypes.object,
32 | ]),
33 | };
34 |
35 | Level.defaultProps = {
36 | renderAs: 'nav',
37 | };
38 |
39 | export default Level;
40 |
--------------------------------------------------------------------------------
/src/components/level/level.story.mdx:
--------------------------------------------------------------------------------
1 | import { Story, Meta, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import CommonProps from '../../../.storybook/common-props';
3 | import Level from '.';
4 | import * as stories from './level.story';
5 |
6 |
7 |
8 | # Level
9 |
10 | A layout component that aligns children horizontally.
11 |
12 | The `Level` component has the following structured:
13 |
14 | - ``: The main container
15 | - `` aligns its children to the left side of `Level`
16 | - `` aligns its children to the right side of `Level`
17 | - `` represents the individual items in `Level`. **Content of `Level.Item` will be vertically centerd**.
18 |
19 | If you use the `Level.Item` directly as a child of `Level` the items will be centered.
20 |
21 | ## Props
22 |
23 |
24 |
25 | ## Components
26 |
27 | ### Level.Side
28 |
29 |
30 |
31 | ### Level.Item
32 |
33 |
34 |
35 |
36 |
37 | ## Example
38 |
39 |
42 |
43 |
44 | ## Related
45 |
46 | - [Official documentation](https://bulma.io/documentation/layout/level)
--------------------------------------------------------------------------------
/src/components/loader/__test__/__snapshots__/loader.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Box component Should Exist 1`] = `[Function]`;
4 |
5 | exports[`Box component Should concat Bulma class with classes in props 1`] = `
6 |
9 | `;
10 |
11 | exports[`Box component Should have box classname 1`] = `
12 |
15 | `;
16 |
17 | exports[`Box component Should have custom inline styles 1`] = `
18 |
27 | `;
28 |
29 | exports[`Box component Should render as an html section 1`] = `
30 |
33 | `;
34 |
--------------------------------------------------------------------------------
/src/components/loader/__test__/loader.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderer from 'react-test-renderer';
3 | import Loader from '..';
4 |
5 | describe('Box component', () => {
6 | it('Should Exist', () => {
7 | expect(Loader).toMatchSnapshot();
8 | });
9 | it('Should have box classname', () => {
10 | const component = renderer.create();
11 | expect(component.toJSON()).toMatchSnapshot();
12 | });
13 | it('Should concat Bulma class with classes in props', () => {
14 | const component = renderer.create();
15 | expect(component.toJSON()).toMatchSnapshot();
16 | });
17 | it('Should render as an html section', () => {
18 | const component = renderer.create();
19 | expect(component.toJSON()).toMatchSnapshot();
20 | });
21 | it('Should have custom inline styles', () => {
22 | const component = renderer.create(
23 | ,
24 | );
25 | expect(component.toJSON()).toMatchSnapshot();
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/src/components/loader/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | declare const Loader: BulmaComponent<{}, 'div'>;
4 |
5 | export default Loader;
6 |
--------------------------------------------------------------------------------
/src/components/loader/index.js:
--------------------------------------------------------------------------------
1 | import Loader from './loader';
2 |
3 | export default Loader;
4 |
--------------------------------------------------------------------------------
/src/components/loader/loader.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../element';
5 |
6 | const Loader = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | Loader.propTypes = {};
15 |
16 | export default Loader;
17 |
--------------------------------------------------------------------------------
/src/components/loader/loader.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { storiesOf } from '@storybook/react';
4 |
5 | import { Loader } from '../..';
6 |
7 | storiesOf('Loader', module)
8 | .add('Default', () => {
9 | return ;
10 | })
11 | .add('with inline style', () => {
12 | return (
13 |
22 | );
23 | })
24 | .add('with other classes', () => {
25 | return ;
26 | });
27 |
--------------------------------------------------------------------------------
/src/components/media/__test__/__snapshots__/media.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Media component Should concat classname in props with Bulma classname 1`] = `
4 |
7 |
8 | Default
9 |
10 |
11 | `;
12 |
13 | exports[`Media component Should exist 1`] = `[Function]`;
14 |
15 | exports[`Media component Should expose Level Side and Item 1`] = `[Function]`;
16 |
17 | exports[`Media component Should have media classname 1`] = `
18 |
21 |
25 |
26 | `;
27 |
28 | exports[`Media component Should hbe a Media Item 1`] = `
29 |
32 |
36 |
37 | `;
38 |
39 | exports[`Media component Should hbe a Media Item Centered 1`] = `
40 |
43 |
47 |
48 | `;
49 |
50 | exports[`Media component Should use inline styles 1`] = `
51 |
59 |
60 | Default
61 |
62 |
63 | `;
64 |
--------------------------------------------------------------------------------
/src/components/media/components/media-item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const MediaItem = ({ children, className, align, ...props }) => {
8 | const p = align === 'center' ? 'content' : align;
9 | return (
10 |
16 | {children}
17 |
18 | );
19 | };
20 |
21 | MediaItem.propTypes = {
22 | align: PropTypes.oneOf(['center', 'right', 'left']),
23 | };
24 |
25 | MediaItem.defaultProps = {
26 | align: 'center',
27 | };
28 |
29 | export default MediaItem;
30 |
--------------------------------------------------------------------------------
/src/components/media/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 |
3 | interface MediaItemProps {
4 | align?: 'center' | 'right' | 'left';
5 | }
6 |
7 | declare const Media: BulmaComponent<{}, 'article'> & {
8 | Item: BulmaComponent;
9 | };
10 |
11 | export default Media;
12 |
--------------------------------------------------------------------------------
/src/components/media/index.js:
--------------------------------------------------------------------------------
1 | import Media from './media';
2 |
3 | export default Media;
4 |
--------------------------------------------------------------------------------
/src/components/media/media.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import MediaItem from './components/media-item';
6 |
7 | import Element from '../element';
8 |
9 | const Media = ({ children, className, ...props }) => {
10 | return (
11 |
12 | {children}
13 |
14 | );
15 | };
16 |
17 | Media.Item = MediaItem;
18 |
19 | Media.propTypes = {
20 | renderAs: PropTypes.oneOfType([
21 | PropTypes.func,
22 | PropTypes.string,
23 | PropTypes.object,
24 | ]),
25 | };
26 |
27 | Media.defaultProps = {
28 | renderAs: 'article',
29 | };
30 |
31 | export default Media;
32 |
--------------------------------------------------------------------------------
/src/components/media/media.story.mdx:
--------------------------------------------------------------------------------
1 | import { Story, Meta, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import CommonProps from '../../../.storybook/common-props';
3 | import Media from '.';
4 | import * as stories from './media.story';
5 |
6 |
7 |
8 | # Media
9 |
10 | The famous media object prevalent in social media interfaces, but useful in any context
11 |
12 | ## Props
13 |
14 |
15 |
16 | ## Components
17 |
18 | ### Media.Content
19 |
20 |
21 |
22 | ### Media.Item
23 |
24 |
25 |
26 |
27 |
28 | ## Example
29 |
30 |
33 |
34 |
35 | ## Related
36 |
37 | - [Official documentation](https://bulma.io/documentation/layout/level)
--------------------------------------------------------------------------------
/src/components/menu/components/list/components/item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | /* eslint-disable-next-line import/no-cycle */
5 | import List from '../list';
6 |
7 | import Element from '../../../../element';
8 |
9 | const MenuListItem = ({
10 | children,
11 | active,
12 | className,
13 | domRef: ref,
14 | ...props
15 | }) => {
16 | if (
17 | typeof children !== 'string' &&
18 | React.Children.toArray(children).length === 1 &&
19 | React.Children.only(children).type === List
20 | ) {
21 | const child = React.Children.only(children);
22 | return (
23 | -
24 |
28 | {child.props.title}
29 |
30 | {React.cloneElement(child, { title: undefined })}
31 |
32 | );
33 | }
34 |
35 | return (
36 | -
37 |
41 | {children}
42 |
43 |
44 | );
45 | };
46 |
47 | MenuListItem.propTypes = {
48 | active: PropTypes.bool,
49 | renderAs: PropTypes.oneOfType([
50 | PropTypes.func,
51 | PropTypes.string,
52 | PropTypes.object,
53 | ]),
54 | };
55 |
56 | MenuListItem.defaultProps = {
57 | renderAs: 'a',
58 | };
59 |
60 | export default MenuListItem;
61 |
--------------------------------------------------------------------------------
/src/components/menu/components/list/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './list';
2 |
--------------------------------------------------------------------------------
/src/components/menu/components/list/list.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | /* eslint-disable-next-line import/no-cycle */
5 | import MenuListItem from './components/item';
6 |
7 | import Element from '../../../element';
8 |
9 | const MenuList = ({ className, title, ...props }) => {
10 | return (
11 | <>
12 | {title && {title}
}
13 |
14 | >
15 | );
16 | };
17 |
18 | MenuList.Item = MenuListItem;
19 |
20 | MenuList.propTypes = {
21 | /**
22 | * The title of this list in the menu.
23 | */
24 | title: PropTypes.node,
25 | renderAs: PropTypes.oneOfType([
26 | PropTypes.func,
27 | PropTypes.string,
28 | PropTypes.object,
29 | ]),
30 | };
31 |
32 | MenuList.defaultProps = {
33 | renderAs: 'ul',
34 | };
35 |
36 | export default MenuList;
37 |
--------------------------------------------------------------------------------
/src/components/menu/index.d.ts:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { BulmaComponent, BulmaComponentWithoutRenderAs } from '..';
3 |
4 | interface MenuListComponentProps {
5 | title?: React.ReactNode;
6 | }
7 |
8 | interface MenuListItemProps {
9 | active?: boolean;
10 | children?: React.ReactNode;
11 | }
12 |
13 | declare const Menu: BulmaComponent<{}, 'aside'> & {
14 | List: BulmaComponentWithoutRenderAs & {
15 | Item: BulmaComponent;
16 | };
17 | };
18 |
19 | export default Menu;
20 |
--------------------------------------------------------------------------------
/src/components/menu/index.js:
--------------------------------------------------------------------------------
1 | import Menu from './menu';
2 |
3 | export default Menu;
4 |
--------------------------------------------------------------------------------
/src/components/menu/menu.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import MenuList from './components/list';
5 |
6 | import Element from '../element';
7 |
8 | const Menu = ({ className, ...props }) => {
9 | return ;
10 | };
11 |
12 | Menu.List = MenuList;
13 |
14 | Menu.propTypes = {
15 | renderAs: PropTypes.oneOfType([
16 | PropTypes.func,
17 | PropTypes.string,
18 | PropTypes.object,
19 | ]),
20 | };
21 |
22 | Menu.defaultProps = {
23 | renderAs: 'aside',
24 | };
25 |
26 | export default Menu;
27 |
--------------------------------------------------------------------------------
/src/components/menu/menu.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Menu from './menu';
3 |
4 | export const BasicUsage = () => {
5 | return (
6 |
31 | );
32 | };
33 |
--------------------------------------------------------------------------------
/src/components/menu/menu.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Props, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import Menu from './menu';
3 | import * as stories from './menu.story';
4 | import { Message } from '../../index';
5 | import CommonProps from '../../../.storybook/common-props';
6 |
7 |
8 |
9 |
10 | # Menu
11 |
12 | The `Menu` component allows you to create vertical navigation menus. It has two sub-components:
13 |
14 | - `Menu.List` defines a section in the menu with a title.
15 | - `Menu.List.Item` defines an item in a section. Can be shown as selected using the `active` prop.
16 | To create nested lists, simply put `Menu.List` as a direct child of `Menu.List.Item`.
17 |
18 |
19 |
20 | You can create nested menu using Menu.List as a only children of a Menu.Item
21 |
22 |
23 |
24 | ## Props
25 |
26 |
27 |
28 | ### `Menu`
29 |
30 |
31 |
32 | ### `Menu.List`
33 |
34 |
35 |
36 | ### `Menu.List.Item`
37 |
38 |
39 |
40 |
41 |
42 | ## Example
43 |
44 |
47 |
48 |
49 | ## Related
50 |
51 | - [Official documentation](https://bulma.io/documentation/components/menu/)
--------------------------------------------------------------------------------
/src/components/message/__test__/__snapshots__/message.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`Message component Should Exist 1`] = `[Function]`;
4 |
5 | exports[`Message component Should accept a react Element as renderAs prop 1`] = `
6 |
9 | Custom
10 | This should be a p element
11 |
12 | `;
13 |
14 | exports[`Message component Should concat Bulma class with classes in props 1`] = `
15 |
18 |
21 | Lorem Ipsum
22 |
23 |
26 | Lorem Ipsum
27 |
28 |
29 | `;
30 |
31 | exports[`Message component Should have custom inline styles 1`] = `
32 |
41 | This should be a section with custom styles
42 |
43 | `;
44 |
45 | exports[`Message component Should have message classnames 1`] = `
46 |
49 |
52 | Lorem Ipsum
53 |
54 |
57 | Lorem Ipsum
58 |
59 |
60 | `;
61 |
62 | exports[`Message component Should render as an html section 1`] = `
63 |
66 | This should be a section
67 |
68 | `;
69 |
--------------------------------------------------------------------------------
/src/components/message/components/body.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const MessageBody = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | MessageBody.propTypes = {};
15 |
16 | export default MessageBody;
17 |
--------------------------------------------------------------------------------
/src/components/message/components/header.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const MessageHeader = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | MessageHeader.propTypes = {};
15 |
16 | export default MessageHeader;
17 |
--------------------------------------------------------------------------------
/src/components/message/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color, Size } from '..';
3 |
4 | interface MessageProps {
5 | size?: Size;
6 | color?: Color;
7 | }
8 |
9 | declare const Message: BulmaComponent & {
10 | Body: BulmaComponent<{}, 'div'>;
11 | Header: BulmaComponent<{}, 'div'>;
12 | };
13 |
14 | export default Message;
15 |
--------------------------------------------------------------------------------
/src/components/message/index.js:
--------------------------------------------------------------------------------
1 | import Message from './message';
2 |
3 | export default Message;
4 |
--------------------------------------------------------------------------------
/src/components/message/message.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import MessageBody from './components/body';
5 | import MessageHeader from './components/header';
6 |
7 | import Element from '../element';
8 |
9 | const Message = ({ children, className, color, size, ...props }) => {
10 | return (
11 |
18 | {children}
19 |
20 | );
21 | };
22 |
23 | Message.Body = MessageBody;
24 |
25 | Message.Header = MessageHeader;
26 |
27 | Message.propTypes = {
28 | /**
29 | * Adjusts the size of the message block.
30 | */
31 | size: PropTypes.oneOfType([
32 | PropTypes.oneOf(['small', 'medium', 'large']),
33 | PropTypes.string,
34 | ]),
35 | /**
36 | * Adjusts the color of the message block. Can be any Bulma color values.
37 | */
38 | color: PropTypes.oneOfType([
39 | PropTypes.oneOf([
40 | 'primary',
41 | 'link',
42 | 'info',
43 | 'success',
44 | 'warning',
45 | 'danger',
46 | 'dark',
47 | 'text',
48 | ]),
49 | PropTypes.string,
50 | ]),
51 | renderAs: PropTypes.oneOfType([
52 | PropTypes.func,
53 | PropTypes.string,
54 | PropTypes.object,
55 | ]),
56 | };
57 |
58 | Message.defaultProps = {
59 | renderAs: 'article',
60 | };
61 |
62 | export default Message;
63 |
--------------------------------------------------------------------------------
/src/components/message/message.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Message } from '../../index';
3 | import * as stories from './message.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Message
9 |
10 | A colored message block that can be used to emphasize content or used as a notification banner. Use `Message.Header`
11 | to create a header of the block, and `Message.Body` for the body of the block.
12 |
13 | The style of the message change depending if the Header is included or not, Play with the Controls in the canvas to
14 | see how this component behave with different props
15 |
16 | ## Props
17 |
18 |
19 |
20 | ## Components
21 |
22 | ### `Message.Title`
23 |
24 |
25 |
26 | ### `Message.Body`
27 |
28 |
29 |
30 |
31 |
32 | ## Example
33 |
34 |
37 |
38 | ## Related
39 |
40 | - [Official documentation](https://bulma.io/documentation/components/message/)
--------------------------------------------------------------------------------
/src/components/modal/components/card/body.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import Element from '../../../element';
5 |
6 | const ModalCardBody = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | ModalCardBody.propTypes = {
15 | renderAs: PropTypes.oneOfType([
16 | PropTypes.func,
17 | PropTypes.string,
18 | PropTypes.object,
19 | ]),
20 | };
21 |
22 | ModalCardBody.defaultProps = {
23 | renderAs: 'section',
24 | };
25 |
26 | export default ModalCardBody;
27 |
--------------------------------------------------------------------------------
/src/components/modal/components/card/card.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import ModalCardHeader from './header';
5 | import ModalCardBody from './body';
6 | import ModalCardFooter from './footer';
7 | import ModalCardTitle from './title';
8 |
9 | import Element from '../../../element';
10 |
11 | const ModalCard = ({ className, onClose, children, ...props }) => {
12 | return (
13 |
14 | {children}
15 |
16 | );
17 | };
18 |
19 | ModalCard.Header = ModalCardHeader;
20 |
21 | ModalCard.Body = ModalCardBody;
22 |
23 | ModalCard.Footer = ModalCardFooter;
24 |
25 | ModalCard.Title = ModalCardTitle;
26 |
27 | ModalCard.propTypes = {};
28 |
29 | ModalCard.defaultProps = {};
30 |
31 | export default ModalCard;
32 |
--------------------------------------------------------------------------------
/src/components/modal/components/card/footer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../../element';
6 |
7 | const ModalCardFoot = ({ children, className, ...props }) => {
8 | return (
9 |
10 | {children}
11 |
12 | );
13 | };
14 |
15 | ModalCardFoot.propTypes = {
16 | renderAs: PropTypes.oneOfType([
17 | PropTypes.func,
18 | PropTypes.string,
19 | PropTypes.object,
20 | ]),
21 | };
22 |
23 | ModalCardFoot.defaultProps = {
24 | renderAs: 'footer',
25 | };
26 |
27 | export default ModalCardFoot;
28 |
--------------------------------------------------------------------------------
/src/components/modal/components/card/header.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Button from '../../../button';
6 |
7 | import Element from '../../../element';
8 | import useModalContext from '../../context';
9 |
10 | const ModalCardHead = ({ children, className, showClose, ...props }) => {
11 | const { onClose } = useModalContext();
12 | return (
13 |
14 | {children}
15 | {showClose && }
16 |
17 | );
18 | };
19 |
20 | ModalCardHead.propTypes = {
21 | /**
22 | * True if the card should display the close button on the header of the modal card
23 | */
24 | showClose: PropTypes.bool,
25 | renderAs: PropTypes.oneOfType([
26 | PropTypes.func,
27 | PropTypes.string,
28 | PropTypes.object,
29 | ]),
30 | };
31 |
32 | ModalCardHead.defaultProps = {
33 | showClose: true,
34 | renderAs: 'header',
35 | };
36 |
37 | export default ModalCardHead;
38 |
--------------------------------------------------------------------------------
/src/components/modal/components/card/index.js:
--------------------------------------------------------------------------------
1 | import Card from './card';
2 |
3 | export default Card;
4 |
--------------------------------------------------------------------------------
/src/components/modal/components/card/title.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../../element';
6 |
7 | const ModalCardTitle = ({ children, className, ...props }) => {
8 | return (
9 |
10 | {children}
11 |
12 | );
13 | };
14 |
15 | ModalCardTitle.propTypes = {
16 | renderAs: PropTypes.oneOfType([
17 | PropTypes.func,
18 | PropTypes.string,
19 | PropTypes.object,
20 | ]),
21 | };
22 |
23 | ModalCardTitle.defaultProps = {
24 | renderAs: 'p',
25 | };
26 |
27 | export default ModalCardTitle;
28 |
--------------------------------------------------------------------------------
/src/components/modal/components/content.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const ModalContent = ({ children, className, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | ModalContent.propTypes = {};
15 |
16 | export default ModalContent;
17 |
--------------------------------------------------------------------------------
/src/components/modal/context.js:
--------------------------------------------------------------------------------
1 | import React, { useContext } from 'react';
2 |
3 | export const ModalContext = React.createContext({
4 | onClose: () => {},
5 | });
6 |
7 | const useModalContext = () => {
8 | return useContext(ModalContext);
9 | };
10 |
11 | export default useModalContext;
12 |
--------------------------------------------------------------------------------
/src/components/modal/index.d.ts:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { BulmaComponent, BulmaComponentWithoutModifiers } from '..';
3 |
4 | interface ModalProps {
5 | show?: boolean;
6 | onClose?: () => void;
7 | closeOnEsc?: boolean;
8 | closeOnBlur?: boolean;
9 | showClose?: boolean;
10 | domRef?: React.RefObject;
11 | document?: Document;
12 | children: React.ReactNode;
13 | className?: string;
14 | }
15 |
16 | interface ModalCardHeaderProps {
17 | showClose?: boolean;
18 | onClose?: () => void;
19 | }
20 |
21 | declare const Modal: BulmaComponentWithoutModifiers & {
22 | Content: BulmaComponent<{}, 'div'>;
23 | Card: BulmaComponent<{}, 'div'> & {
24 | Header: BulmaComponent;
25 | Body: BulmaComponent<{}, 'section'>;
26 | Footer: BulmaComponent<{}, 'footer'>;
27 | Title: BulmaComponent<{}, 'p'>;
28 | };
29 | };
30 |
31 | export default Modal;
32 |
--------------------------------------------------------------------------------
/src/components/modal/index.js:
--------------------------------------------------------------------------------
1 | import Modal from './modal';
2 |
3 | export default Modal;
4 |
--------------------------------------------------------------------------------
/src/components/navbar/components/brand.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const NavbarBrand = ({ className, children, ...props }) => {
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | NavbarBrand.propTypes = {};
15 |
16 | NavbarBrand.defaultProps = {};
17 |
18 | export default NavbarBrand;
19 |
--------------------------------------------------------------------------------
/src/components/navbar/components/burger.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import { ShowContext } from '../context';
5 |
6 | import Element from '../../element';
7 |
8 | const NavbarBurger = ({ style, className, ...props }) => {
9 | return (
10 |
11 | {(active) => {
12 | return (
13 |
22 |
23 |
24 |
25 |
26 | );
27 | }}
28 |
29 | );
30 | };
31 |
32 | NavbarBurger.propTypes = {};
33 |
34 | NavbarBurger.defaultProps = {};
35 |
36 | export default NavbarBurger;
37 |
--------------------------------------------------------------------------------
/src/components/navbar/components/container.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const alignMapper = {
8 | left: 'start',
9 | right: 'end',
10 | };
11 |
12 | const NavbarContainer = ({ className, children, align, ...props }) => {
13 | return (
14 |
23 | {children}
24 |
25 | );
26 | };
27 |
28 | NavbarContainer.propTypes = {
29 | align: PropTypes.oneOf(['left', 'right']),
30 | };
31 |
32 | NavbarContainer.defaultProps = {
33 | align: 'left',
34 | };
35 |
36 | export default NavbarContainer;
37 |
--------------------------------------------------------------------------------
/src/components/navbar/components/divider.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const NavbarDivider = ({ className, ...props }) => {
8 | return (
9 |
10 | );
11 | };
12 |
13 | NavbarDivider.propTypes = {
14 | renderAs: PropTypes.oneOfType([
15 | PropTypes.func,
16 | PropTypes.string,
17 | PropTypes.object,
18 | ]),
19 | };
20 |
21 | NavbarDivider.defaultProps = {
22 | renderAs: 'hr',
23 | };
24 |
25 | export default NavbarDivider;
26 |
--------------------------------------------------------------------------------
/src/components/navbar/components/dropdown.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const NavbarDropdown = ({ className, boxed, right, children, ...props }) => {
8 | return (
9 |
16 | {children}
17 |
18 | );
19 | };
20 |
21 | NavbarDropdown.propTypes = {
22 | boxed: PropTypes.bool,
23 | /**
24 | * If your parent `Navbar.Container` is on the right side, you can align the dropdown to start from the right setting this to true.
25 | */
26 | right: PropTypes.bool,
27 | /**
28 | * Open the dropdown upward instead of downward (default behaviour)
29 | */
30 | up: PropTypes.bool,
31 | renderAs: PropTypes.oneOfType([
32 | PropTypes.func,
33 | PropTypes.string,
34 | PropTypes.object,
35 | ]),
36 | };
37 |
38 | NavbarDropdown.defaultProps = {
39 | renderAs: 'div',
40 | };
41 |
42 | export default NavbarDropdown;
43 |
--------------------------------------------------------------------------------
/src/components/navbar/components/item.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 | import NavbarDropdown from './dropdown';
5 |
6 | import Element from '../../element';
7 |
8 | const NavbarItem = ({
9 | className,
10 | active,
11 | children,
12 | hoverable,
13 | renderAs,
14 | arrowless,
15 | ...props
16 | }) => {
17 | let as = renderAs;
18 |
19 | const dropdown = React.Children.toArray(children).find((child) => {
20 | return child.type === NavbarDropdown;
21 | });
22 |
23 | if (dropdown && renderAs === 'a') {
24 | as = 'div';
25 | }
26 | return (
27 |
38 | {children}
39 |
40 | );
41 | };
42 |
43 | NavbarItem.propTypes = {
44 | /**
45 | * If the item has a dropdown, control if the dropdown is displayed
46 | */
47 | active: PropTypes.bool,
48 | /**
49 | * Control if the dropdown should be displayed on mouse over
50 | * This prop will be ignored if `active=true`
51 | */
52 | hoverable: PropTypes.bool,
53 | arrowless: PropTypes.bool,
54 | renderAs: PropTypes.oneOfType([
55 | PropTypes.func,
56 | PropTypes.string,
57 | PropTypes.object,
58 | ]),
59 | };
60 |
61 | NavbarItem.defaultProps = {
62 | renderAs: 'a',
63 | };
64 |
65 | export default NavbarItem;
66 |
--------------------------------------------------------------------------------
/src/components/navbar/components/link.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const NavbarLink = ({ className, children, arrowless, ...props }) => {
8 | return (
9 |
15 | {children}
16 |
17 | );
18 | };
19 |
20 | NavbarLink.propTypes = {
21 | arrowless: PropTypes.bool,
22 | renderAs: PropTypes.oneOfType([
23 | PropTypes.func,
24 | PropTypes.string,
25 | PropTypes.object,
26 | ]),
27 | };
28 |
29 | NavbarLink.defaultProps = {
30 | renderAs: 'span',
31 | };
32 |
33 | export default NavbarLink;
34 |
--------------------------------------------------------------------------------
/src/components/navbar/components/menu.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import { ShowContext } from '../context';
5 |
6 | import Element from '../../element';
7 |
8 | const NavbarMenu = ({ className, children, ...props }) => {
9 | return (
10 |
11 | {(active) => {
12 | return (
13 |
19 | {children}
20 |
21 | );
22 | }}
23 |
24 | );
25 | };
26 |
27 | NavbarMenu.propTypes = {};
28 |
29 | NavbarMenu.defaultProps = {};
30 |
31 | export default NavbarMenu;
32 |
--------------------------------------------------------------------------------
/src/components/navbar/context.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export const ShowContext = React.createContext(false);
4 |
--------------------------------------------------------------------------------
/src/components/navbar/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color } from '..';
3 |
4 | interface NavbarProps {
5 | transparent?: boolean;
6 | fixed?: 'top' | 'bottom';
7 | size?: 'large';
8 | color?: Color;
9 | active?: boolean;
10 | }
11 |
12 | interface NavbarBurgerProps {
13 | onClick?: () => void;
14 | }
15 |
16 | interface NavbarItemProps {
17 | active?: boolean;
18 | hoverable?: boolean;
19 | arrowless?: boolean;
20 | }
21 |
22 | interface NavbarDropdownProps {
23 | boxed?: boolean;
24 | right?: boolean;
25 | up?: boolean;
26 | }
27 |
28 | interface NavbarLinkProps {
29 | arrowless?: boolean;
30 | }
31 |
32 | interface NavbarContainerProps {
33 | align?: 'left' | 'right';
34 | }
35 |
36 | declare const Navbar: BulmaComponent & {
37 | Brand: BulmaComponent<{}, 'div'>;
38 | Burger: BulmaComponent;
39 | Menu: BulmaComponent<{}, 'div'>;
40 | Item: BulmaComponent;
41 | Dropdown: BulmaComponent;
42 | Link: BulmaComponent;
43 | Divider: BulmaComponent<{}, 'div'>;
44 | Container: BulmaComponent;
45 | };
46 |
47 | export default Navbar;
48 |
--------------------------------------------------------------------------------
/src/components/navbar/index.js:
--------------------------------------------------------------------------------
1 | import Navbar from './navbar';
2 |
3 | export default Navbar;
4 |
--------------------------------------------------------------------------------
/src/components/notification/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color } from '..';
3 |
4 | interface NotificationProps {
5 | color?: Color;
6 | light?: Boolean;
7 | }
8 |
9 | declare const Notification: BulmaComponent;
10 |
11 | export default Notification;
12 |
--------------------------------------------------------------------------------
/src/components/notification/index.js:
--------------------------------------------------------------------------------
1 | import Notification from './notification';
2 |
3 | export default Notification;
4 |
--------------------------------------------------------------------------------
/src/components/notification/notification.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../element';
6 |
7 | const Notification = ({ className, color, light, ...props }) => {
8 | return (
9 |
20 | );
21 | };
22 |
23 | Notification.propTypes = {
24 | color: PropTypes.oneOfType([
25 | PropTypes.oneOf([
26 | 'primary',
27 | 'link',
28 | 'info',
29 | 'success',
30 | 'warning',
31 | 'danger',
32 | 'dark',
33 | 'text',
34 | ]),
35 | PropTypes.string,
36 | ]),
37 | light: PropTypes.bool,
38 | };
39 |
40 | export default Notification;
41 |
--------------------------------------------------------------------------------
/src/components/notification/notification.story.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/prop-types */
2 | import React from 'react';
3 | import { Notification, Button, Block } from '../..';
4 | import CONSTANTS from '../../constants';
5 |
6 | export const Default = (args) => {
7 | return (
8 |
9 |
10 | Lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum
11 | dolor. Pellentesque risus mi, tempus quis placerat ut,
12 | porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam
13 | gravida purus diam, et dictum felis venenatis efficitur.
14 | Sit amet, consectetur adipiscing elit
15 |
16 |
17 |
18 | );
19 | };
20 |
21 | Default.argTypes = {
22 | color: {
23 | control: {
24 | type: 'select',
25 | options: ['default'].concat(Object.values(CONSTANTS.COLORS)),
26 | },
27 | },
28 | };
29 |
--------------------------------------------------------------------------------
/src/components/notification/notification.story.mdx:
--------------------------------------------------------------------------------
1 | import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs/blocks';
2 | import * as stories from './notification.story.js'
3 | import { Box, Notification } from '../..';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Notification
9 |
10 | A simple notification block to alert your users when something happen
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 |
25 | ## Related
26 |
27 | - [Official documentation](https://bulma.io/documentation/elements/notification/)
--------------------------------------------------------------------------------
/src/components/pagination/index.d.ts:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { BulmaComponent } from '..';
3 | import { Size } from '..';
4 |
5 | interface PaginationProps {
6 | current?: number;
7 | disabled?: boolean;
8 | total?: number;
9 | delta?: number;
10 | onChange?: (page: number) => void;
11 | next?: React.ReactNode;
12 | previous?: React.ReactNode;
13 | showPrevNext?: boolean;
14 | showFirstLast?: boolean;
15 | size?: Size;
16 | align?: 'center' | 'right';
17 | rounded?: boolean;
18 | autoHide?: boolean;
19 | }
20 |
21 | declare const Pagination: BulmaComponent;
22 |
23 | export default Pagination;
24 |
--------------------------------------------------------------------------------
/src/components/pagination/index.js:
--------------------------------------------------------------------------------
1 | import Pagination from './pagination';
2 |
3 | export default Pagination;
4 |
--------------------------------------------------------------------------------
/src/components/pagination/pagination.story.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Pagination } from '../..';
3 |
4 | export const Default = (args) => {
5 | return ;
6 | };
7 |
8 | Default.argTypes = {
9 | showFirstLast: {
10 | control: {
11 | type: 'boolean',
12 | },
13 | defaultValue: true,
14 | },
15 | showPrevNext: {
16 | control: {
17 | type: 'boolean',
18 | },
19 | defaultValue: true,
20 | },
21 | current: {
22 | control: {
23 | type: 'number',
24 | },
25 | defaultValue: 3,
26 | },
27 | total: {
28 | control: {
29 | type: 'number',
30 | },
31 | defaultValue: 5,
32 | },
33 | delta: {
34 | control: {
35 | type: 'number',
36 | },
37 | defaultValue: 1,
38 | },
39 | disabled: {
40 | control: {
41 | type: 'boolean',
42 | },
43 | },
44 | rounded: {
45 | control: {
46 | type: 'boolean',
47 | },
48 | },
49 | size: {
50 | control: {
51 | type: 'select',
52 | options: ['small', 'medium', 'large'],
53 | },
54 | },
55 | align: {
56 | control: {
57 | type: 'select',
58 | options: ['center', 'right'],
59 | },
60 | },
61 | previous: {
62 | control: {
63 | type: 'text',
64 | },
65 | defaultValue: 'Previous',
66 | },
67 | next: {
68 | control: {
69 | type: 'text',
70 | },
71 | defaultValue: 'Next',
72 | },
73 | };
74 |
--------------------------------------------------------------------------------
/src/components/pagination/pagination.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Pagination } from '../..';
3 | import * as stories from './pagination.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Pagination
9 |
10 | A responsive, usable, and flexible pagination
11 |
12 | ## Props
13 |
14 |
15 |
16 |
17 |
18 | ## Example
19 |
20 |
23 |
24 | ## Related
25 |
26 | - [Official documentation](https://bulma.io/documentation/components/pagination/)
--------------------------------------------------------------------------------
/src/components/panel/components/block.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const PanelBlock = ({ className, active, ...props }) => {
8 | return (
9 |
15 | );
16 | };
17 |
18 | PanelBlock.propTypes = {
19 | active: PropTypes.bool,
20 | };
21 |
22 | export default PanelBlock;
23 |
--------------------------------------------------------------------------------
/src/components/panel/components/header.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 |
4 | import Element from '../../element';
5 |
6 | const PanelHeader = ({ className, ...props }) => {
7 | return (
8 |
9 | );
10 | };
11 |
12 | PanelHeader.propTypes = {};
13 |
14 | export default PanelHeader;
15 |
--------------------------------------------------------------------------------
/src/components/panel/components/icon.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../element';
6 |
7 | const PanelIcon = ({ className, ...props }) => {
8 | return ;
9 | };
10 |
11 | PanelIcon.propTypes = {
12 | renderAs: PropTypes.oneOfType([
13 | PropTypes.func,
14 | PropTypes.string,
15 | PropTypes.object,
16 | ]),
17 | };
18 |
19 | PanelIcon.defaultProps = {
20 | renderAs: 'span',
21 | };
22 |
23 | export default PanelIcon;
24 |
--------------------------------------------------------------------------------
/src/components/panel/components/tabs/components/tab.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Element from '../../../../element';
6 |
7 | const PanelTabsTab = ({ className, active, ...props }) => {
8 | return (
9 |
15 | );
16 | };
17 |
18 | PanelTabsTab.propTypes = {
19 | active: PropTypes.bool,
20 | renderAs: PropTypes.oneOfType([
21 | PropTypes.func,
22 | PropTypes.string,
23 | PropTypes.object,
24 | ]),
25 | };
26 |
27 | PanelTabsTab.defaultProps = {
28 | renderAs: 'a',
29 | };
30 |
31 | export default PanelTabsTab;
32 |
--------------------------------------------------------------------------------
/src/components/panel/components/tabs/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './tabs';
2 |
--------------------------------------------------------------------------------
/src/components/panel/components/tabs/tabs.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import Tab from './components/tab';
4 |
5 | import Element from '../../../element';
6 |
7 | const PanelTabs = ({ className, ...props }) => {
8 | return ;
9 | };
10 |
11 | PanelTabs.Tab = Tab;
12 |
13 | PanelTabs.propTypes = {};
14 |
15 | export default PanelTabs;
16 |
--------------------------------------------------------------------------------
/src/components/panel/index.d.ts:
--------------------------------------------------------------------------------
1 | import { BulmaComponent } from '..';
2 | import { Color } from '..';
3 |
4 | interface PanelProps {
5 | color?: Color;
6 | }
7 |
8 | interface PanelTabProps {
9 | active?: boolean;
10 | }
11 |
12 | interface PanelBlockProps {
13 | active?: boolean;
14 | }
15 |
16 | declare const Panel: BulmaComponent & {
17 | Header: BulmaComponent<{}, 'div'>;
18 | Tabs: BulmaComponent<{}, 'div'> & {
19 | Tab: BulmaComponent;
20 | };
21 | Block: BulmaComponent;
22 | Icon: BulmaComponent<{}, 'span'>;
23 | };
24 |
25 | export default Panel;
26 |
--------------------------------------------------------------------------------
/src/components/panel/index.js:
--------------------------------------------------------------------------------
1 | import Panel from './panel';
2 |
3 | export default Panel;
4 |
--------------------------------------------------------------------------------
/src/components/panel/panel.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import classnames from 'classnames';
4 |
5 | import Block from './components/block';
6 | import Header from './components/header';
7 | import Icon from './components/icon';
8 | import Tabs from './components/tabs';
9 |
10 | import Element from '../element';
11 |
12 | const Panel = ({ color, className, ...props }) => {
13 | return (
14 |
20 | );
21 | };
22 |
23 | Panel.Header = Header;
24 |
25 | Panel.Tabs = Tabs;
26 |
27 | Panel.Block = Block;
28 |
29 | Panel.Icon = Icon;
30 |
31 | Panel.propTypes = {
32 | color: PropTypes.oneOfType([
33 | PropTypes.oneOf([
34 | 'primary',
35 | 'link',
36 | 'info',
37 | 'success',
38 | 'warning',
39 | 'danger',
40 | 'dark',
41 | 'text',
42 | ]),
43 | PropTypes.string,
44 | ]),
45 | renderAs: PropTypes.oneOfType([
46 | PropTypes.func,
47 | PropTypes.string,
48 | PropTypes.object,
49 | ]),
50 | };
51 |
52 | Panel.defaultProps = {
53 | renderAs: 'nav',
54 | };
55 |
56 | export default Panel;
57 |
--------------------------------------------------------------------------------
/src/components/panel/panel.story.mdx:
--------------------------------------------------------------------------------
1 | import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2 | import { Panel } from '../..';
3 | import * as stories from './panel.story';
4 | import CommonProps from '../../../.storybook/common-props';
5 |
6 |
7 |
8 | # Panel
9 |
10 | A composable panel, for compact controls
11 |
12 | The panel is a container for several types:
13 |
14 | - `Panel.Header` as the first child
15 | - `Panel.Tabs` for navigation
16 | - `Panel.Block` which can contain other elements, like:
17 | - `Form.Control`
18 | - `Form.Input`
19 | - `Button`
20 | - `Panel.Icon`
21 |
22 | The `Panel.Block` can be an anchor tag `` or a label `