├── .all-contributorsrc ├── .browserslistrc ├── .changeset ├── README.md ├── big-icons-report.md └── config.json ├── .codesandbox └── ci.json ├── .commitlintrc.json ├── .eslintignore ├── .eslintrc.js ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── semantic.yml └── workflows │ ├── pr.yml │ └── release.yml ├── .gitignore ├── .huskyrc ├── .lintstagedrc ├── .prettierrc ├── .storybook ├── addons.js ├── assets │ └── chakra.png ├── components │ └── Canvas.vue ├── config.js ├── preview-head.html ├── theme.js └── webpack.config.js ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets └── logos │ ├── kiwi-ui-logo-h.png │ ├── kiwi-ui-logo-h.svg │ ├── kiwi-ui-logo-v.png │ └── kiwi-ui-logo-v.svg ├── babel.config.js ├── bundlesize.config.json ├── config └── .env.defaults ├── examples └── nuxt-js │ ├── .editorconfig │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── components │ ├── NuxtLogo.vue │ └── Tutorial.vue │ ├── layouts │ └── default.vue │ ├── nuxt.config.js │ ├── package.json │ ├── pages │ └── index.vue │ ├── static │ └── favicon.ico │ ├── store │ └── README.md │ └── utils │ └── icons.js ├── jest.config.js ├── jsconfig.json ├── lerna.json ├── package.json ├── packages ├── chakra-ui-core │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── rollup.config.js │ ├── rollup.dev.config.js │ ├── src │ │ ├── CAccordion │ │ │ ├── CAccordion.js │ │ │ ├── CAccordion.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CAccordion.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CAccordion.test.js.snap │ │ ├── CAlert │ │ │ ├── CAlert.js │ │ │ ├── CAlert.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CAlert.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CAlert.test.js.snap │ │ │ └── utils │ │ │ │ └── alert.styles.js │ │ ├── CAlertDialog │ │ │ ├── CAlertDialog.js │ │ │ ├── CAlertDialog.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CAlertDialog.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CAlertDialog.test.js.snap │ │ ├── CAspectRatioBox │ │ │ ├── CAspectRatioBox.js │ │ │ ├── CAspectRatioBox.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CAspectRatioBox.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CAspectRatioBox.test.js.snap │ │ ├── CAvatar │ │ │ ├── CAvatar.js │ │ │ ├── CAvatar.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CAvatar.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CAvatar.test.js.snap │ │ │ └── utils │ │ │ │ └── avatar.styles.js │ │ ├── CAvatarGroup │ │ │ ├── CAvatarGroup.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CAvatarGroup.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CAvatarGroup.test.js.snap │ │ ├── CBadge │ │ │ ├── CBadge.js │ │ │ ├── CBadge.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CBadge.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CBadge.test.js.snap │ │ │ └── utils │ │ │ │ └── badge.styles.js │ │ ├── CBox │ │ │ ├── CBox.js │ │ │ ├── CBox.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CBox.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CBox.test.js.snap │ │ ├── CBreadcrumb │ │ │ ├── CBreadcrumb.js │ │ │ ├── CBreadcrumb.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CBreadcrumb.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CBreadcrumb.test.js.snap │ │ ├── CButton │ │ │ ├── CButton.js │ │ │ ├── CButton.stories.js │ │ │ ├── accesibility.md │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CButton.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CButton.test.js.snap │ │ │ └── utils │ │ │ │ ├── button.props.js │ │ │ │ └── button.styles.js │ │ ├── CButtonGroup │ │ │ ├── CButtonGroup.js │ │ │ ├── CButtonGroup.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CButtonGroup.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CButtonGroup.test.js.snap │ │ ├── CCheckbox │ │ │ ├── CCheckbox.js │ │ │ ├── CCheckbox.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CCheckbox.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CCheckbox.test.js.snap │ │ │ └── utils │ │ │ │ └── checkbox.styles.js │ │ ├── CCheckboxGroup │ │ │ ├── CCheckboxGroup.js │ │ │ ├── CCheckboxGroup.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CCheckboxGroup.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CCheckboxGroup.test.js.snap │ │ ├── CCircularProgress │ │ │ ├── CCircularProgress.js │ │ │ ├── CCircularProgress.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CCircularProgress.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CCircularProgress.test.js.snap │ │ │ └── utils │ │ │ │ └── circularprogress.styles.js │ │ ├── CClickOutside │ │ │ ├── CClickOutside.js │ │ │ └── index.js │ │ ├── CCloseButton │ │ │ ├── CCloseButton.js │ │ │ ├── CCloseButton.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CloseButton.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CloseButton.test.js.snap │ │ │ └── utils │ │ │ │ ├── closebutton.props.js │ │ │ │ └── closebutton.styles.js │ │ ├── CCode │ │ │ ├── CCode.js │ │ │ ├── CCode.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CCode.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CCode.test.js.snap │ │ ├── CCollapse │ │ │ ├── CCollapse.js │ │ │ ├── CCollapse.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CCollapse.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CCollapse.test.js.snap │ │ ├── CColorModeProvider │ │ │ ├── CColorModeProvider.js │ │ │ └── index.js │ │ ├── CControlBox │ │ │ ├── CControlBox.js │ │ │ ├── CControlBox.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CControlBox.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CControlBox.test.js.snap │ │ ├── CDivider │ │ │ ├── CDivider.js │ │ │ ├── CDivider.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CDivider.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CDivider.test.js.snap │ │ ├── CDrawer │ │ │ ├── CDrawer.js │ │ │ ├── CDrawer.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CDrawer.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CDrawer.test.js.snap │ │ ├── CEditable │ │ │ ├── CEditable.js │ │ │ ├── CEditable.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CEditable.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CEditable.test.js.snap │ │ ├── CFlex │ │ │ ├── CFlex.js │ │ │ ├── CFlex.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CFlex.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CFlex.test.js.snap │ │ │ └── utils │ │ │ │ └── flex.props.js │ │ ├── CFormControl │ │ │ ├── CFormControl.js │ │ │ ├── CFormControl.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CFormControl.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CFormControl.test.js.snap │ │ │ └── utils │ │ │ │ └── formcontrol.props.js │ │ ├── CFormErrorMessage │ │ │ ├── CFormErrorMessage.js │ │ │ └── index.js │ │ ├── CFormHelperText │ │ │ ├── CFormHelperText.js │ │ │ └── index.js │ │ ├── CFormLabel │ │ │ ├── CFormLabel.js │ │ │ └── index.js │ │ ├── CFragment │ │ │ ├── CFragment.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CFragment.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CFragment.test.js.snap │ │ ├── CGrid │ │ │ ├── CGrid.js │ │ │ ├── CGrid.stories.js │ │ │ ├── index.js │ │ │ └── test │ │ │ │ ├── CGrid.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CGrid.test.js.snap │ │ ├── CHeading │ │ │ ├── CHeading.js │ │ │ ├── CHeading.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CHeading.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CHeading.test.js.snap │ │ ├── CIcon │ │ │ ├── CIcon.js │ │ │ ├── CIcon.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CIcon.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CIcon.test.js.snap │ │ │ └── utils │ │ │ │ ├── icon.props.js │ │ │ │ └── icon.utils.js │ │ ├── CIconButton │ │ │ ├── CIconButton.js │ │ │ ├── CIconButton.stories.js │ │ │ ├── accessibility.md │ │ │ ├── icon-button.utils.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CIconButton.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CIconButton.test.js.snap │ │ ├── CImage │ │ │ ├── CImage.js │ │ │ ├── CImage.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CImage.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CImage.test.js.snap │ │ ├── CInput │ │ │ ├── CInput.js │ │ │ ├── CInput.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CInput.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CInput.test.js.snap │ │ │ └── utils │ │ │ │ ├── input.props.js │ │ │ │ └── input.styles.js │ │ ├── CInputAddon │ │ │ ├── CInputAddon.js │ │ │ └── index.js │ │ ├── CInputElement │ │ │ ├── CInputElement.js │ │ │ └── index.js │ │ ├── CInputGroup │ │ │ ├── CInputGroup.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CInputGroup.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CInputGroup.test.js.snap │ │ ├── CLink │ │ │ ├── CLink.js │ │ │ ├── accessibility.md │ │ │ └── index.js │ │ ├── CList │ │ │ ├── CList.js │ │ │ ├── CList.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CList.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CList.test.js.snap │ │ ├── CMenu │ │ │ ├── CMenu.js │ │ │ ├── CMenu.stories.js │ │ │ ├── CMenuOption.js │ │ │ ├── index.js │ │ │ └── utils │ │ │ │ └── menu.styles.js │ │ ├── CModal │ │ │ ├── CModal.js │ │ │ ├── CModal.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CModal.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CModal.test.js.snap │ │ │ └── utils │ │ │ │ └── modal.props.js │ │ ├── CNoSsr │ │ │ ├── NoSsr.js │ │ │ └── index.js │ │ ├── CNumberInput │ │ │ ├── CNumberInput.js │ │ │ ├── CNumberInput.stories.js │ │ │ ├── index.js │ │ │ └── utils │ │ │ │ ├── numberinput.styles.js │ │ │ │ └── numberinput.utils.js │ │ ├── CPopover │ │ │ ├── CPopover.js │ │ │ ├── CPopover.stories.js │ │ │ ├── index.js │ │ │ └── popover.test.js │ │ ├── CPopper │ │ │ ├── CPopper.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ └── popper.test.js │ │ │ └── utils │ │ │ │ └── popper.styles.js │ │ ├── CPortal │ │ │ ├── CPortal.js │ │ │ ├── index.js │ │ │ └── portal.test.js │ │ ├── CProgress │ │ │ ├── CProgress.js │ │ │ ├── CProgress.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CProgress.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CProgress.test.js.snap │ │ ├── CPseudoBox │ │ │ ├── CPseudoBox.js │ │ │ ├── CPseudoBox.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CPseudoBox.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CPseudoBox.test.js.snap │ │ ├── CRadio │ │ │ ├── CRadio.js │ │ │ ├── CRadio.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CRadio.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CRadio.test.js.snap │ │ ├── CRadioButtonGroup │ │ │ ├── CRadioButtonGroup.js │ │ │ ├── CRadioGroup.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CRadioButtonGroup.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CRadioButtonGroup.test.js.snap │ │ ├── CRadioGroup │ │ │ ├── CRadioGroup.js │ │ │ └── index.js │ │ ├── CReset │ │ │ ├── CReset.js │ │ │ ├── index.js │ │ │ ├── preflight.js │ │ │ └── tests │ │ │ │ ├── CReset.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CReset.test.js.snap │ │ ├── CSelect │ │ │ ├── CSelect.js │ │ │ ├── CSelect.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CSelect.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CSelect.test.js.snap │ │ │ └── utils │ │ │ │ └── select.utils.js │ │ ├── CSimpleGrid │ │ │ ├── CSimpleGrid.js │ │ │ ├── CSimpleGrid.stories.js │ │ │ ├── index.js │ │ │ └── utils │ │ │ │ └── grid.styles.js │ │ ├── CSkipNav │ │ │ ├── CSkipNav.js │ │ │ ├── CSkipNav.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ └── CSkipNav.test.js │ │ ├── CSlider │ │ │ ├── CSlider.js │ │ │ ├── CSlider.stories.js │ │ │ ├── index.js │ │ │ └── utils │ │ │ │ ├── slider.styles.js │ │ │ │ └── slider.utils.js │ │ ├── CSpinner │ │ │ ├── CSpinner.js │ │ │ ├── CSpinner.stories.js │ │ │ └── index.js │ │ ├── CStack │ │ │ ├── CStack.js │ │ │ ├── CStack.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CStack.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CStack.test.js.snap │ │ ├── CStat │ │ │ ├── CStat.js │ │ │ ├── CStat.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CStat.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CStat.test.js.snap │ │ ├── CSwitch │ │ │ ├── CSwitch.js │ │ │ ├── CSwitch.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CSwitch.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CSwitch.test.js.snap │ │ ├── CTabs │ │ │ ├── CTabs.js │ │ │ ├── CTabs.stories.js │ │ │ ├── index.js │ │ │ └── utils │ │ │ │ └── tabs.styles.js │ │ ├── CTag │ │ │ ├── CTag.js │ │ │ ├── CTag.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CTag.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CTag.test.js.snap │ │ ├── CText │ │ │ ├── CText.js │ │ │ ├── CText.stories.js │ │ │ ├── index.js │ │ │ ├── tests │ │ │ │ ├── CText.test.js │ │ │ │ └── __snapshots__ │ │ │ │ │ └── CText.test.js.snap │ │ │ └── utils │ │ │ │ └── text.utils.js │ │ ├── CTextarea │ │ │ ├── CTextarea.js │ │ │ ├── CTextarea.stories.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CTextarea.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CTextarea.test.js.snap │ │ ├── CThemeProvider │ │ │ ├── CThemeProvider.js │ │ │ ├── index.js │ │ │ └── tests │ │ │ │ ├── CThemeProvider.test.js │ │ │ │ └── __snapshots__ │ │ │ │ └── CThemeProvider.test.js.snap │ │ ├── CToast │ │ │ ├── CToast.d.ts │ │ │ ├── CToast.js │ │ │ ├── CToast.stories.js │ │ │ ├── index.d.ts │ │ │ └── index.js │ │ ├── CTooltip │ │ │ ├── CTooltip.js │ │ │ ├── CTooltip.stories.js │ │ │ ├── accessibility.md │ │ │ ├── index.js │ │ │ └── tooltip.test.js │ │ ├── CTransition │ │ │ ├── Transition.js │ │ │ └── index.js │ │ ├── CVisuallyHidden │ │ │ ├── CVisuallyHidden.js │ │ │ └── index.js │ │ ├── Chakra │ │ │ └── index.js │ │ ├── Css │ │ │ ├── Css.js │ │ │ └── index.js │ │ ├── babel.config.js │ │ ├── config │ │ │ ├── index.js │ │ │ └── props.types.js │ │ ├── directives │ │ │ ├── chakra.directive.js │ │ │ ├── chakra.stories.js │ │ │ ├── clickoutside.directive.js │ │ │ └── index.js │ │ ├── index.js │ │ ├── lib │ │ │ ├── index.js │ │ │ └── internal-icons.js │ │ └── utils │ │ │ ├── __snapshots__ │ │ │ ├── color-mode-observer.test.js.snap │ │ │ ├── component.test.js.snap │ │ │ └── styled-system.test.js.snap │ │ │ ├── color-mode-observer.js │ │ │ ├── color-mode-observer.test.js │ │ │ ├── color.js │ │ │ ├── component.test.js │ │ │ ├── components.js │ │ │ ├── dom-elements.js │ │ │ ├── dom.js │ │ │ ├── functions.js │ │ │ ├── generators.js │ │ │ ├── icons.js │ │ │ ├── index.js │ │ │ ├── logger.js │ │ │ ├── object.js │ │ │ ├── playground.stories.js │ │ │ ├── strings.js │ │ │ ├── styled-system.js │ │ │ ├── styled-system.test.js │ │ │ ├── transform.js │ │ │ ├── validators.js │ │ │ └── vdom.js │ └── types │ │ ├── chakra.d.ts │ │ ├── component.d.ts │ │ └── index.d.ts ├── chakra-ui-nuxt │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── babel.config.js │ ├── example │ │ ├── autoimport │ │ │ ├── layouts │ │ │ │ └── default.vue │ │ │ ├── nuxt.config.js │ │ │ ├── pages │ │ │ │ ├── directive.vue │ │ │ │ └── index.vue │ │ │ └── utils │ │ │ │ └── theme.js │ │ └── base │ │ │ ├── layouts │ │ │ └── default.vue │ │ │ ├── nuxt.config.js │ │ │ ├── pages │ │ │ ├── directive.vue │ │ │ └── index.vue │ │ │ └── utils │ │ │ └── theme.js │ ├── jest.config.js │ ├── lib │ │ ├── module.js │ │ └── plugin.js │ ├── package.json │ ├── renovate.json │ ├── test │ │ ├── auto-import.spec.js │ │ └── base.spec.js │ └── types │ │ └── index.d.ts └── chakra-ui-theme │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ ├── index.js │ └── theme │ │ ├── borders.js │ │ ├── breakpoints.js │ │ ├── colors.js │ │ ├── index.js │ │ ├── opacity.js │ │ ├── radii.js │ │ ├── shadows.js │ │ ├── sizes.js │ │ ├── typography.js │ │ ├── utils │ │ └── colors.js │ │ └── z-indices.js │ └── types │ └── index.d.ts ├── tests └── test-utils │ ├── index.js │ ├── module-mock.js │ ├── style-mock.js │ └── test-utils.js ├── website ├── .babelrc ├── .eslintignore ├── .gitignore ├── .nowignore ├── CHANGELOG.md ├── README.md ├── assets │ └── logo │ │ ├── chakra-ui-vue-blue.svg │ │ ├── chakra-ui-vue-blue@2x.png │ │ ├── chakra-ui-vue-logo.svg │ │ └── chakra-ui-vue-logo@2x.png ├── components │ ├── AlgoliaSearch.vue │ ├── BottomLink.vue │ ├── CarbonAd.js │ ├── ColorPalette.js │ ├── Example.vue │ ├── FileContributors.vue │ ├── Footer.vue │ ├── Hero.vue │ ├── Logo.vue │ ├── Lorem.vue │ ├── MDXComponents.js │ ├── MobileNav.vue │ ├── Navbar.vue │ ├── SEO.js │ ├── SideNavContent.vue │ ├── Sidebar.vue │ ├── chakra-icons.js │ ├── code │ │ ├── code-block.vue │ │ ├── code-group │ │ │ ├── code-group.vue │ │ │ └── code-tab.vue │ │ ├── index.js │ │ ├── live-editor │ │ │ ├── live-editor-layout.vue │ │ │ └── live-editor.vue │ │ ├── mixins.js │ │ └── utils.js │ ├── components.js │ ├── internal-icons.js │ └── nav-links.js ├── css │ ├── components.scss │ ├── fonts │ │ ├── Inter-Bold.woff2 │ │ ├── Inter-Light.woff2 │ │ ├── Inter-Regular.woff2 │ │ └── fonts.css │ ├── night-owl.css │ └── page.css ├── jsconfig.json ├── layouts │ ├── README.md │ ├── default.vue │ └── home.vue ├── modules │ └── routes.js ├── now.json ├── nuxt.config.js ├── package.json ├── pages │ ├── accessibility.mdx │ ├── accordion.mdx │ ├── alert.mdx │ ├── alertdialog.mdx │ ├── aspectratiobox.mdx │ ├── auto-import-components.mdx │ ├── avatar.mdx │ ├── badge.mdx │ ├── box.mdx │ ├── breadcrumb.mdx │ ├── button.mdx │ ├── checkbox.mdx │ ├── circularprogress.mdx │ ├── closebutton.mdx │ ├── code.mdx │ ├── collapse.mdx │ ├── color-mode.mdx │ ├── constraint-based-design.mdx │ ├── contributing.mdx │ ├── contributors.vue │ ├── controlbox.mdx │ ├── divider.mdx │ ├── drawer.mdx │ ├── editable.mdx │ ├── extending-theme.mdx │ ├── flex.mdx │ ├── formcontrol.mdx │ ├── getting-started.mdx │ ├── grid.mdx │ ├── heading.mdx │ ├── icon.mdx │ ├── iconbutton.mdx │ ├── image.mdx │ ├── index.vue │ ├── input.mdx │ ├── link.mdx │ ├── list.mdx │ ├── menu.mdx │ ├── modal.mdx │ ├── numberinput.mdx │ ├── overriding-component-styles.mdx │ ├── plugin-options.mdx │ ├── popover.mdx │ ├── principles.mdx │ ├── progress.mdx │ ├── pseudobox.mdx │ ├── radio.mdx │ ├── recipes.mdx │ ├── responsive-styles.mdx │ ├── select.mdx │ ├── simplegrid.mdx │ ├── slider.mdx │ ├── spinner.mdx │ ├── stack.mdx │ ├── starters.mdx │ ├── stat.mdx │ ├── storybook.mdx │ ├── style-props.mdx │ ├── switch.mdx │ ├── tabs.mdx │ ├── tag.mdx │ ├── text.mdx │ ├── textarea.mdx │ ├── theme.mdx │ ├── toast.mdx │ ├── tooltip.mdx │ ├── v-chakra.mdx │ ├── why-chakra-ui.mdx │ ├── with-nuxt.mdx │ └── with-vuepress.mdx ├── plugins │ ├── editor.js │ ├── globals.js │ ├── links.js │ ├── skip-to.js │ └── vue-meta.js ├── router.scrollBehaviour.js ├── static │ ├── chakra-icon.svg │ ├── chakra.png │ └── favicon.ico └── utils │ ├── all-routes.js │ ├── icons.js │ ├── index.js │ ├── load-script.js │ └── string.js └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/big-icons-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'nuxt-js': patch 3 | '@chakra-ui/vue': patch 4 | '@chakra-ui/nuxt': patch 5 | '@chakra-ui/theme-vue': patch 6 | 'chakra-ui-docs': patch 7 | --- 8 | 9 | Fixes skip link and textarea props 10 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@1.4.0/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { "repo": "chakra-ui/chakra-ui-vue" } 6 | ], 7 | "commit": false, 8 | "linked": [], 9 | "access": "public", 10 | "baseBranch": "master", 11 | "updateInternalDependencies": "patch", 12 | "ignore": [] 13 | } -------------------------------------------------------------------------------- /.codesandbox/ci.json: -------------------------------------------------------------------------------- 1 | { 2 | "installCommand": "csb:install", 3 | "buildCommand": "build", 4 | "packages": [ 5 | "packages/chakra-ui-core", 6 | "packages/chakra-ui-nuxt", 7 | "packages/chakra-ui-theme" 8 | ], 9 | "sandboxes": ["chakra-ui-vue-0x-starter-template-2sy0g", "chakra-ui-nuxt-demo-f8tq4"], 10 | "node": "14" 11 | } -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@commitlint/config-conventional" 4 | ] 5 | } -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | **/dist/* 2 | sw.js 3 | 4 | # Plugin 5 | **/lib/plugin.js 6 | **/.nuxt 7 | **/coverage 8 | node_modules -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | plugins: [ 7 | 'testing-library', 8 | '@emotion' 9 | ], 10 | extends: [ 11 | 'plugin:vue/essential', 12 | '@vue/standard', 13 | '@nuxtjs', 14 | 'plugin:testing-library/recommended', 15 | 'plugin:testing-library/vue' 16 | ], 17 | rules: { 18 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 19 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 20 | curly: 'off', 21 | 'testing-library/no-debug': 'error', 22 | 'testing-library/prefer-screen-queries': 'error', 23 | 'testing-library/await-fire-event': 'error', 24 | indent: [ 25 | 'error', 26 | 2, 27 | { 28 | SwitchCase: 1, 29 | ignoredNodes: [ 30 | 'TemplateLiteral' 31 | ] 32 | } 33 | ], 34 | 'template-curly-spacing': 0, 35 | '@emotion/pkg-renaming': 'error' 36 | }, 37 | parserOptions: { 38 | parser: 'babel-eslint' 39 | }, 40 | globals: { 41 | describe: false, 42 | expect: false, 43 | it: false 44 | }, 45 | overrides: [ 46 | { 47 | files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/*.{j,t}s?(x)'], 48 | env: { 49 | jest: true 50 | } 51 | } 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 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 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | ## Motivation and Context 7 | 8 | 9 | 10 | ## How Has This Been Tested? 11 | 12 | 13 | 14 | 15 | ## Screenshots (if appropriate): 16 | 17 | ## Types of changes 18 | 19 | - [ ] Bug fix (non-breaking change which fixes an issue) 20 | - [ ] New feature (non-breaking change which adds functionality) 21 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 22 | 23 | ## Checklist: 24 | 25 | 26 | - [ ] My code follows the code style of this project. 27 | - [ ] My change requires a change to the documentation. 28 | - [ ] I have updated the documentation accordingly. 29 | - [ ] I have added tests to cover my changes. 30 | - [ ] All new and existing tests passed. 31 | -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # Always validate the PR title, and ignore the commits 2 | titleOnly: true 3 | 4 | # Require at least one commit to be valid 5 | # this is only relevant when using commitsOnly: true or titleAndCommits: true, 6 | # which validate all commits by default 7 | anyCommit: true 8 | 9 | # Allow use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns") 10 | # this is only relevant when using commitsOnly: true (or titleAndCommits: true) 11 | allowMergeCommits: true 12 | 13 | # Allow use of Revert commits (eg on github: "Revert "feat: ride unicorns"") 14 | # this is only relevant when using commitsOnly: true (or titleAndCommits: true) 15 | allowRevertCommits: true -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: PR Workflow 5 | 6 | on: 7 | pull_request: 8 | branches: 9 | - master 10 | - develop 11 | push: 12 | branches: 13 | - develop 14 | 15 | jobs: 16 | build: 17 | runs-on: ubuntu-latest 18 | strategy: 19 | matrix: 20 | node-version: [12.x] 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v2 24 | 25 | - name: Use Node.js ${{ matrix.node-version }} 26 | uses: actions/setup-node@v1 27 | with: 28 | node-version: ${{ matrix.node-version }} 29 | 30 | - name: Install dependencies 31 | run: yarn install --frozen-lockfile && yarn bootstrap 32 | 33 | - name: Lint types and code 34 | run: yarn lint 35 | 36 | - name: Build packages 37 | run: yarn build 38 | 39 | - name: Run tests 40 | run: yarn test 41 | env: 42 | CI: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | **/dist/ 4 | /public 5 | /storybook-static 6 | 7 | /tests/e2e/videos/ 8 | /tests/e2e/screenshots/ 9 | 10 | # local env files 11 | .env.local 12 | .env.*.local 13 | 14 | # Log files 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* 18 | lerna-debug.log* 19 | 20 | # Editor directories and files 21 | .idea 22 | .vscode 23 | *.suo 24 | *.ntvs* 25 | *.njsproj 26 | *.sln 27 | *.sw? 28 | 29 | # Workspaces 30 | packages/*/coverage 31 | packages/*/dist 32 | packages/*/node_modules 33 | **/.nuxt/ 34 | lerna-debug.log 35 | .now 36 | config/.env 37 | packages/chakra-ui-nuxt/.github 38 | packages/chakra-ui-docs/static/sw.js 39 | website/static/sw.js 40 | .npmrc 41 | **/static/sw.js 42 | examples/nuxt-js/node_modules -------------------------------------------------------------------------------- /.huskyrc: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-commit": "lint-staged", 4 | "pre-push": "yarn test", 5 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js,vue}": "eslint --fix" 3 | } -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "arrowParens": "always", 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '@storybook/addon-actions/register'; 2 | import '@storybook/addon-links/register'; 3 | -------------------------------------------------------------------------------- /.storybook/assets/chakra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/.storybook/assets/chakra.png -------------------------------------------------------------------------------- /.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.storybook/theme.js: -------------------------------------------------------------------------------- 1 | import { create } from '@storybook/theming'; 2 | 3 | export default create({ 4 | base: 'light', 5 | brandTitle: 'chakra-ui/vue storybook', 6 | brandUrl: 'https://github.com/chakra-ui/chakra-ui-vue', 7 | brandImage: 'https://res.cloudinary.com/xtellar/image/upload/v1584242872/chakra-ui/chakra-ui-vue-beta.png' 8 | }); 9 | -------------------------------------------------------------------------------- /.storybook/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | // Export a function. Accept the base config as the only param. 4 | module.exports = async ({ config, mode }) => { 5 | // `mode` has a value of 'DEVELOPMENT' or 'PRODUCTION' 6 | // You can change the configuration based on that. 7 | // 'PRODUCTION' is used when building the static version of storybook. 8 | 9 | // Make whatever fine-grained changes you need 10 | config.module.rules.push({ 11 | test: /\.scss$/, 12 | use: [ 13 | 'vue-style-loader', 14 | 'css-loader', 15 | 'sass-loader' 16 | ], 17 | }); 18 | config.resolve.alias = { 19 | ...config.resolve.alias, 20 | "@/": path.resolve(__dirname, "./"), 21 | }; 22 | 23 | // Return the altered config 24 | return config; 25 | }; 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jonathan Bakebwa 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 | -------------------------------------------------------------------------------- /assets/logos/kiwi-ui-logo-h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/assets/logos/kiwi-ui-logo-h.png -------------------------------------------------------------------------------- /assets/logos/kiwi-ui-logo-v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/assets/logos/kiwi-ui-logo-v.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app', 4 | '@babel/preset-env', 5 | '@vue/babel-preset-jsx' 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /bundlesize.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | { 4 | "path": "./packages/chakra-ui-core/dist/cjs/*.js", 5 | "maxSize": "85kB" 6 | }, 7 | { 8 | "path": "./packages/chakra-ui-core/dist/esm/*.js", 9 | "maxSize": "85kB" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /config/.env.defaults: -------------------------------------------------------------------------------- 1 | BASE_URL=http://localhost:3000 2 | -------------------------------------------------------------------------------- /examples/nuxt-js/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /examples/nuxt-js/components/NuxtLogo.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /examples/nuxt-js/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 13 | 31 | -------------------------------------------------------------------------------- /examples/nuxt-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-js", 3 | "version": "1.2.1", 4 | "private": true, 5 | "scripts": { 6 | "dev": "nuxt", 7 | "build": "nuxt build", 8 | "start": "nuxt start", 9 | "generate": "nuxt generate" 10 | }, 11 | "dependencies": { 12 | "@chakra-ui/nuxt": "^0.7.0", 13 | "@nuxtjs/emotion": "^0.1.0", 14 | "core-js": "^3.15.1", 15 | "nuxt": "^2.15.7" 16 | }, 17 | "devDependencies": {} 18 | } 19 | -------------------------------------------------------------------------------- /examples/nuxt-js/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/examples/nuxt-js/static/favicon.ico -------------------------------------------------------------------------------- /examples/nuxt-js/store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Vuex Store files. 6 | Vuex Store option is implemented in the Nuxt.js framework. 7 | 8 | Creating a file in this directory automatically activates the option in the framework. 9 | 10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). 11 | -------------------------------------------------------------------------------- /examples/nuxt-js/utils/icons.js: -------------------------------------------------------------------------------- 1 | export { feUpload } from 'feather-icons-paths' 2 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleFileExtensions: [ 3 | 'js', 4 | 'jsx', 5 | 'json', 6 | 'vue' 7 | ], 8 | transform: { 9 | '^.+\\.vue$': 'vue-jest', 10 | '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', 11 | '^.+\\.(js|jsx)?$': 'babel-jest' 12 | }, 13 | transformIgnorePatterns: [ 14 | '/node_modules/(?!lodash-es)' 15 | ], 16 | moduleNameMapper: { 17 | '^@/(.*)$': '/$1', 18 | '@chakra-ui/theme-vue': require.resolve('./packages/chakra-ui-theme/src/index.js'), 19 | '\\.css$': require.resolve('./tests/test-utils/style-mock.js'), 20 | breadstick: require.resolve('./tests/test-utils/module-mock.js') 21 | }, 22 | snapshotSerializers: [ 23 | 'jest-serializer-vue', 24 | '@emotion/jest/serializer' 25 | ], 26 | testMatch: [ 27 | '**/**/*.test.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' 28 | ], 29 | testURL: 'http://localhost/', 30 | watchPlugins: [ 31 | 'jest-watch-typeahead/filename', 32 | 'jest-watch-typeahead/testname' 33 | ], 34 | testEnvironmentOptions: { resources: 'usable' } 35 | } 36 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "~/*": ["./*"], 6 | "@/*": ["./*"], 7 | "~~/*": ["./*"], 8 | "@@/*": ["./*"] 9 | } 10 | }, 11 | "exclude": ["node_modules", ".nuxt", "dist"] 12 | } 13 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*" 4 | ], 5 | "npmClient": "yarn", 6 | "useWorkspaces": true, 7 | "version": "independent", 8 | "registry": "https://registry.npmjs.org/", 9 | "command": { 10 | "publish": { 11 | "conventionalCommits": true, 12 | "message": "chore(release): publish" 13 | } 14 | }, 15 | "publishConfig": { 16 | "directory": "dist" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAccordion/index.js: -------------------------------------------------------------------------------- 1 | export * from './CAccordion' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAlert/accessibility.md: -------------------------------------------------------------------------------- 1 | # Alert | Accessibility ♿️ 2 | 3 | This report is adapted to list the [WAI-ARIA Authoring practices for Alerts](https://www.w3.org/TR/wai-aria-practices-1.2/#alert) supported by Chakra UI for the `CAlert` component. 4 | 5 | ### Description 6 | An alert is an element that displays a brief, important message in a way that attracts the user's attention without interrupting the user's task. Dynamically rendered alerts are automatically announced by most screen readers, and in some operating systems, they may trigger an alert sound. It is important to note that, at this time, screen readers do not inform users of alerts that are present on the page before page load completes. 7 | 8 | #### Components 9 | `@chakra-ui/vue` exports 4 Alert related components: 10 | - `CAlert` 11 | - `CAlertIcon` 12 | - `CAlertTitle` 13 | - `CAlertDescription` 14 | 15 | ### `CAlert` Keyboard Interaction 16 | Not applicable. This is because the `CAlert` component should not interfere with the users ability 17 | to continue working. Therefore, displaying the alert does not affect keyboard focus. 18 | 19 | ### `CAlert` WAI-ARIA Roles, States, and Properties: 20 | - [x] The `CAlert` component has a `role` of `alert`. 21 | 22 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAlert/index.js: -------------------------------------------------------------------------------- 1 | export * from './CAlert' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAlertDialog/index.js: -------------------------------------------------------------------------------- 1 | export * from './CAlertDialog' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAspectRatioBox/CAspectRatioBox.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CAspectRatioBox, CBox } from '..' 3 | 4 | storiesOf('UI | AspectRatioBox', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CAspectRatioBox, CBox }, 7 | template: ` 8 |
9 | 10 | 16 | 17 |
18 | `, 19 | data () { 20 | return { 21 | showCollapsed: true 22 | } 23 | } 24 | })) 25 | .add('Nested Elements', () => ({ 26 | components: { CAspectRatioBox, CBox }, 27 | template: ` 28 |
29 | 30 | 31 | 32 | See the Vue 33 | Vue makes front-end development a breeze. 34 | 35 | 36 | 37 |
38 | `, 39 | data () { 40 | return { 41 | showCollapsed: true 42 | } 43 | } 44 | })) 45 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAspectRatioBox/index.js: -------------------------------------------------------------------------------- 1 | import CAspectRatioBox from './CAspectRatioBox' 2 | export default CAspectRatioBox 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAspectRatioBox/tests/CAspectRatioBox.test.js: -------------------------------------------------------------------------------- 1 | import { CAspectRatioBox, CBox } from '../..' 2 | import { render, screen, getElementStyles } from '@/tests/test-utils' 3 | const renderComponent = (props) => { 4 | const inlineAttrs = (props && props.inlineAttrs) || '' 5 | const base = { 6 | components: { CAspectRatioBox, CBox }, 7 | template: ` 8 | 9 | 10 | 11 | 12 | 13 | `, 14 | ...props 15 | } 16 | return render(base) 17 | } 18 | 19 | it('should render correctly', () => { 20 | const inlineAttrs = ':ratio="1"' 21 | const { asFragment } = renderComponent({ inlineAttrs }) 22 | expect(asFragment()).toMatchSnapshot() 23 | 24 | const [emotionClassName] = [...screen.getByTestId('aspectRatioBox').classList] 25 | const pseudoStyles = getElementStyles(`.${emotionClassName}::before`) 26 | 27 | expect(pseudoStyles).toContain( 28 | ` 29 | padding-bottom: 100% 30 | `.trim() 31 | ) 32 | }) 33 | 34 | it('should have correct styles', () => { 35 | const inlineAttrs = ':ratio="2"' 36 | renderComponent({ inlineAttrs }) 37 | 38 | const [emotionClassName] = [...screen.getByTestId('aspectRatioBox').classList] 39 | const pseudoStyles = getElementStyles(`.${emotionClassName}::before`) 40 | 41 | expect(pseudoStyles).toContain( 42 | ` 43 | padding-bottom: 50% 44 | `.trim() 45 | ) 46 | }) 47 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAspectRatioBox/tests/__snapshots__/CAspectRatioBox.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 | .emotion-0 { 6 | position: relative; 7 | max-width: 400px; 8 | } 9 | 10 | .emotion-0::before { 11 | height: 0px; 12 | content: ""; 13 | display: block; 14 | padding-bottom: 100%; 15 | } 16 | 17 | .emotion-1 { 18 | position: absolute; 19 | width: var(--chakra-sizes-full); 20 | height: var(--chakra-sizes-full); 21 | top: var(--chakra-space-0); 22 | left: var(--chakra-space-0); 23 | } 24 | 25 | .emotion-2 { 26 | object-fit: cover; 27 | height: 100%; 28 | width: 100%; 29 | } 30 | 31 |
36 |
41 | naruto 48 |
49 |
50 |
51 | `; 52 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAvatar/index.js: -------------------------------------------------------------------------------- 1 | export * from './CAvatar' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CAvatarGroup/index.js: -------------------------------------------------------------------------------- 1 | import CAvatarGroup from './CAvatarGroup' 2 | export default CAvatarGroup 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBadge/CBadge.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CBadge } from '..' 3 | 4 | storiesOf('UI | Badge', module) 5 | .add('Default Badge', () => ({ 6 | components: { CBadge }, 7 | template: ` 8 |
9 | Default 10 |
11 | ` 12 | })) 13 | .add('With color', () => ({ 14 | components: { CBadge }, 15 | template: ` 16 |
17 | Default 18 | Success 19 | Removed 20 | New 21 |
22 | ` 23 | })) 24 | .add('With variant', () => ({ 25 | components: { CBadge }, 26 | template: ` 27 |
28 | Subtle 29 | Solid 30 | Outline 31 |
32 | ` 33 | })) 34 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBadge/index.js: -------------------------------------------------------------------------------- 1 | import CBadge from './CBadge' 2 | export default CBadge 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBadge/tests/CBadge.test.js: -------------------------------------------------------------------------------- 1 | import { CBadge, CStack } from '../..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CBadge, CStack }, 7 | template: '500', 8 | ...props 9 | } 10 | return render(base) 11 | } 12 | 13 | it('should render correctly', () => { 14 | const { asFragment } = renderComponent() 15 | expect(asFragment()).toMatchSnapshot() 16 | }) 17 | 18 | it('should apply variant styles corectly', () => { 19 | const { asFragment } = renderComponent({ 20 | template: ` 21 | 22 | Subtle 23 | Solid 24 | Outline 25 | 26 | ` 27 | }) 28 | 29 | expect(asFragment()).toMatchSnapshot() 30 | }) 31 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBox/CBox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue Box 3 | * 4 | * Box is the most abstract component on top of which all 5 | * other @chakra-ui/vue components are built. By default, it renders a `div` element 6 | * 7 | * @see Docs https://vue.chakra-ui.com/box 8 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CBox/CBox.js 9 | */ 10 | 11 | import { createStyledAttrsMixin } from '../utils' 12 | 13 | /** 14 | * CBox component 15 | * 16 | * Abstract component on top of which all other Chakra components are built. 17 | * 18 | * @see Docs https://vue.chakra-ui.com/box 19 | */ 20 | const CBox = { 21 | name: 'CBox', 22 | mixins: [createStyledAttrsMixin('CBox')], 23 | props: { 24 | as: { 25 | type: [String, Object], 26 | default: 'div' 27 | }, 28 | to: { 29 | type: [String, Object], 30 | default: '' 31 | } 32 | }, 33 | render (h) { 34 | return h(this.as, { 35 | props: { 36 | to: this.to 37 | }, 38 | class: this.className, 39 | on: this.listeners$, 40 | attrs: this.computedAttrs 41 | }, this.$slots.default) 42 | } 43 | } 44 | 45 | export default CBox 46 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBox/index.js: -------------------------------------------------------------------------------- 1 | import CBox from './CBox' 2 | export default CBox 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBox/tests/CBox.test.js: -------------------------------------------------------------------------------- 1 | import CBox from '../' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CBox }, 8 | template: `Box Works`, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | it('should render correctly', () => { 15 | const { asFragment } = renderComponent() 16 | expect(asFragment()).toMatchSnapshot() 17 | }) 18 | 19 | it('should change the style', () => { 20 | const inlineAttrs = ` 21 | d="flex" :w="['auto']" px="5" py="5" shadow="lg" 22 | my="5" mb="5" rounded="sm" font-family="body" 23 | background-color="blue.200" color="blue.700"` 24 | const { asFragment } = renderComponent({ inlineAttrs }) 25 | 26 | expect(asFragment()).toMatchSnapshot() 27 | }) 28 | 29 | it.each` 30 | as 31 | ${'header'} 32 | ${'p'}} 33 | `( 34 | 'should display CBox with type as $as', 35 | ({ as }) => { 36 | const inlineAttrs = `as=${as}` 37 | const { asFragment } = renderComponent({ inlineAttrs }) 38 | const box = screen.getByTestId('box') 39 | expect(box.tagName.toLowerCase()).toEqual(as) 40 | expect(asFragment()).toMatchSnapshot() 41 | } 42 | ) 43 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBreadcrumb/accessibility.md: -------------------------------------------------------------------------------- 1 | # Breadcrumb | Accessibility ♿️ 2 | 3 | This report is adapted to list the [WAI-ARIA Authoring practices for alert dialogs](https://www.w3.org/TR/wai-aria-practices-1.2/#breadcrumb) supported by Chakra UI for the `CBreadcrumb` component. 4 | 5 | ### Description 6 | A breadcrumb trail consists of a list of links to the parent pages of the current page in hierarchical order. It helps users find their place within a website or web application. Breadcrumbs are often placed horizontally before a page's main content. 7 | 8 | #### Components 9 | `@chakra-ui/vue` exports 4 Breadcrumb related components: 10 | - `CBreadcrumbSeparator` 11 | - `CBreadcrumbLink` 12 | - `CBreadcrumbItem` 13 | - `CBreadcrumb` 14 | 15 | ### `CBreadcrumb` Keyboard Interaction 16 | - Not applicable 17 | 18 | 19 | ### `CBreadcrumb` WAI-ARIA Roles, States, and Properties: 20 | - [x] `CBreadcrumb` trail is contained within a navigation landmark region. 21 | - [x] The `CBreadcrumb` The landmark region is labelled via `aria-label`. 22 | - [x] The link to the current page has `aria-current` set to page. If the element representing the current page is not a link, `aria-current` is optional. This is determined by setting the `isCurrentPage` boolean prop to the `CBreadcrumbLink` component 23 | 24 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CBreadcrumb/index.js: -------------------------------------------------------------------------------- 1 | export * from './CBreadcrumb' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CButton/index.js: -------------------------------------------------------------------------------- 1 | import CButton from './CButton' 2 | export default CButton 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CButton/utils/button.props.js: -------------------------------------------------------------------------------- 1 | export const buttonProps = { 2 | as: { 3 | type: [String, Object], 4 | default: 'button' 5 | }, 6 | to: [String, Object], 7 | type: { 8 | type: String, 9 | default: 'button' 10 | }, 11 | variant: { 12 | type: String, 13 | default: 'solid', 14 | validator: value => 15 | value.match(/^(solid|outline|ghost|flat|link|unstyled)$/) 16 | }, 17 | variantColor: { 18 | type: [String, Array], 19 | default: 'gray' 20 | }, 21 | isDisabled: { 22 | type: Boolean, 23 | default: false 24 | }, 25 | isLoading: { 26 | type: Boolean, 27 | default: false 28 | }, 29 | isActive: { 30 | type: Boolean, 31 | default: false 32 | }, 33 | size: { 34 | type: String, 35 | default: 'md', 36 | validator: value => value.match(/^(xs|sm|md|lg|xl)$/) 37 | }, 38 | loadingText: { 39 | type: String, 40 | default: null 41 | }, 42 | iconSpacing: { 43 | type: [String, Number], 44 | default: '1' 45 | }, 46 | leftIcon: { 47 | type: String, 48 | default: null 49 | }, 50 | rightIcon: { 51 | type: String, 52 | default: null 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CButtonGroup/CButtonGroup.stories.js: -------------------------------------------------------------------------------- 1 | import { action } from '@storybook/addon-actions' 2 | import { storiesOf } from '@storybook/vue' 3 | import { CButton, CButtonGroup } from '..' 4 | 5 | storiesOf('UI | ButtonGroup', module) 6 | .add('Button Group', () => ({ 7 | components: { CButton, CButtonGroup }, 8 | template: ` 9 |
10 | 11 | Button 1 12 | Button 2 13 | Button 3 14 | 15 |
16 | `, 17 | methods: { action: action('Button Clicked') } 18 | })) 19 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CButtonGroup/accessibility.md: -------------------------------------------------------------------------------- 1 | # ButtonGroup | Accessibility ♿️ 2 | 3 | This report is adapted to list the [WAI-ARIA Authoring practices for buttons](https://www.w3.org/TR/wai-aria-practices-1.2/#button) supported by Chakra UI for the `CButtonGroup` component. 4 | 5 | ### Description 6 | The `CButtonGroup` component provides a wrapping container with `role="group"` for multiple children button elements. 7 | 8 | #### Components 9 | `@chakra-ui/vue` exports 1 ButtonGroup related components: 10 | - `CButtonGroup` 11 | 12 | 13 | ### `CButton` WAI-ARIA Roles, States, and Properties: 14 | - The `CButtonGroup` component contains the `role="group"` for a group of child `CButton` components grouped together. 15 | 16 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) 17 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CButtonGroup/index.js: -------------------------------------------------------------------------------- 1 | import CButtonGroup from './CButtonGroup' 2 | export default CButtonGroup 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CButtonGroup/tests/CButtonGroup.test.js: -------------------------------------------------------------------------------- 1 | import { CButton, CButtonGroup } from '../..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { 7 | CButton, 8 | CButtonGroup 9 | }, 10 | template: ` 11 | 12 | Button1 13 | Button2 14 | `, 15 | ...props 16 | } 17 | return render(base) 18 | } 19 | 20 | it('should render correctly', () => { 21 | const { asFragment } = renderComponent() 22 | expect(asFragment()).toMatchSnapshot() 23 | }) 24 | 25 | it('should attach buttons when `is-attached` is passed', () => { 26 | const { asFragment } = renderComponent({ 27 | template: ` 28 | 29 | Button1 30 | Button2 31 | ` 32 | }) 33 | 34 | const button = screen.getByText('Button1') 35 | expect(button).toHaveStyle('border-top-right-radius: 0px; border-bottom-right-radius: 0px;') 36 | expect(asFragment()).toMatchSnapshot() 37 | }) 38 | 39 | it('should display children', () => { 40 | renderComponent() 41 | expect(screen.getByText('Button1')).toBeInTheDocument() 42 | expect(screen.getByText('Button2')).toBeInTheDocument() 43 | }) 44 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCheckbox/index.js: -------------------------------------------------------------------------------- 1 | import CCheckbox from './CCheckbox' 2 | export default CCheckbox 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCheckboxGroup/CCheckboxGroup.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CBox, CCheckbox, CCheckboxGroup } from '..' 3 | 4 | storiesOf('UI | CheckboxGroup', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CBox, CCheckbox, CCheckboxGroup }, 7 | template: ` 8 | 9 | 10 | One 11 | Two 12 | Three 13 | 14 | 15 | `, 16 | data () { 17 | return { 18 | selectedValues: ['two'] 19 | } 20 | } 21 | })) 22 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCheckboxGroup/index.js: -------------------------------------------------------------------------------- 1 | import CCheckboxGroup from './CCheckboxGroup' 2 | export default CCheckboxGroup 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCircularProgress/accessibility.md: -------------------------------------------------------------------------------- 1 | # Circular Progress | Accessibility ♿️ 2 | 3 | This report is adapted to list the accessiblity features supported by Chakra UI for the `CCircularProgress` component. 4 | 5 | ### Description 6 | The Circular Progress component is used to indicates the progress for both determinate and indeterminate processes. 7 | - Determinate progress fills the circular track with color, as the indicator moves from 0 to 360 degrees. 8 | - Indeterminate progress grow and shrink the indicator while moving along the circular track. 9 | 10 | #### Components 11 | `@chakra-ui/vue` exports 2 Circular Progress related components: 12 | - `CCircularProgress` 13 | - `CCircularProgressLabel` 14 | 15 | ### `CCircularProgress` WAI-ARIA compliance 16 | - `CCircularProgress` has a role set to progressbar to denote that it's a progress bar. 17 | - `CCircularProgress` has aria-valuenow set to the percentage completion value passed to the component, to ensure the progress percent is visible to screen readers. 18 | 19 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCircularProgress/index.js: -------------------------------------------------------------------------------- 1 | export * from './CCircularProgress' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCircularProgress/tests/CCircularProgress.test.js: -------------------------------------------------------------------------------- 1 | import { CCircularProgress, CCircularProgressLabel } from '../..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { 7 | CCircularProgress, 8 | CCircularProgressLabel 9 | }, 10 | template: ` 11 | `, 12 | ...props 13 | } 14 | return render(base) 15 | } 16 | 17 | it('should render correctly', () => { 18 | const { asFragment } = renderComponent() 19 | expect(asFragment()).toMatchSnapshot() 20 | }) 21 | 22 | it('should display a label', () => { 23 | renderComponent({ 24 | template: ` 25 | 26 | 40% 27 | ` 28 | }) 29 | 30 | expect(screen.getByText('40%')).toBeInTheDocument() 31 | }) 32 | 33 | test('a11y - progress has a "role" set to "progressbar"', () => { 34 | renderComponent() 35 | 36 | expect(screen.queryByRole('progressbar')).toBeInTheDocument() 37 | }) 38 | 39 | test('a11y - progress has a "aria-valuenow" set to the percentage completion value', () => { 40 | renderComponent() 41 | 42 | expect(screen.queryByTestId('CircularProgress')).toHaveAttribute( 43 | 'aria-valuenow', 44 | '40' 45 | ) 46 | }) 47 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CClickOutside/CClickOutside.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue CClickOutside 3 | * 4 | * The Click Outside component is used to call an event if a user clicks anywhere outside this element. 5 | * It also accepts a whitelist of elements to ignore when the `do()` function is called. 6 | * 7 | * Note: 8 | * This component is mostly used for internal use, and is not listed in Chakra UI Vue docs. 9 | * 10 | **/ 11 | 12 | import { canUseDOM } from '../utils' 13 | 14 | /** 15 | * CClickOutside component 16 | * 17 | * The component that listens to DOM click events and 18 | * executes a function based on component props and whitelisted nodes. 19 | * 20 | */ 21 | const CClickOutside = { 22 | name: 'CClickOutside', 23 | props: { 24 | whitelist: Array, 25 | do: Function, 26 | isDisabled: Boolean 27 | }, 28 | created () { 29 | if (!this.isDisabled) { 30 | const listener = (e, el) => { 31 | if ( 32 | e.target === el || 33 | el.contains(e.target) || 34 | (this.whitelist.includes(e.target)) 35 | ) return 36 | if (this.do) this.do() 37 | } 38 | 39 | canUseDOM && document.addEventListener('click', e => listener(e, this.$el)) 40 | 41 | this.$once('hook:beforeDestroy', () => { 42 | document.removeEventListener('click', e => listener(e, this.$el)) 43 | }) 44 | } 45 | }, 46 | render () { 47 | return this.$slots.default[0] 48 | } 49 | } 50 | 51 | export default CClickOutside 52 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CClickOutside/index.js: -------------------------------------------------------------------------------- 1 | import CClickOutside from './CClickOutside' 2 | export default CClickOutside 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCloseButton/CCloseButton.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { action } from '@storybook/addon-actions' 3 | import { CCloseButton } from '..' 4 | 5 | storiesOf('UI | CloseButton', module) 6 | .add('Default CloseButton', () => ({ 7 | components: { CCloseButton }, 8 | template: ` 9 |
10 | 11 |
12 | `, 13 | methods: { 14 | onClick: action('Close button clicked') 15 | } 16 | })) 17 | .add('With size', () => ({ 18 | components: { CCloseButton }, 19 | template: ` 20 |
21 | 22 | 23 | 24 |
25 | ` 26 | })) 27 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCloseButton/accessibility.md: -------------------------------------------------------------------------------- 1 | # CloseButton | Accessibility ♿️ 2 | 3 | This report is adapted to list the accessiblity features supported by Chakra UI for the `CCloseButton` component. 4 | 5 | ### Description 6 | The `CCloseButton` component renders a button element, so it's browser accessible by default. We only modify it's appearance 7 | by using theme styles. 8 | 9 | ### `CCloseButton` WAI-ARIA compliance 10 | - `CCloseButton` by default has an `aria-label` of "Close". This can be customized by passing the `aria-label` attribute. 11 | 12 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCloseButton/index.js: -------------------------------------------------------------------------------- 1 | import CCloseButton from './CCloseButton' 2 | export default CCloseButton 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCloseButton/tests/CloseButton.test.js: -------------------------------------------------------------------------------- 1 | import CloseButton from '../' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CloseButton }, 7 | template: '', 8 | ...props 9 | } 10 | return render(base) 11 | } 12 | it('should render correctly', () => { 13 | const { asFragment } = renderComponent() 14 | expect(asFragment()).toMatchSnapshot() 15 | }) 16 | it('should allow setting a custom aria-label for the button', () => { 17 | renderComponent({ template: '' }) 18 | 19 | expect(screen.getByLabelText('my aria label')).toHaveAttribute( 20 | 'aria-label', 21 | 'my aria label' 22 | ) 23 | }) 24 | 25 | test('a11y - should have aria-label set to "Close"', () => { 26 | renderComponent() 27 | 28 | expect(screen.getByLabelText('Close')).toHaveAttribute( 29 | 'aria-label', 30 | 'Close' 31 | ) 32 | }) 33 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCloseButton/utils/closebutton.props.js: -------------------------------------------------------------------------------- 1 | export default { 2 | size: { 3 | type: String, 4 | default: 'md', 5 | validator: value => value.match(/^(sm|md|lg)$/) 6 | }, 7 | isDisabled: { 8 | type: Boolean, 9 | default: false 10 | }, 11 | ariaLabel: { 12 | type: String, 13 | default: 'Close' 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCloseButton/utils/closebutton.styles.js: -------------------------------------------------------------------------------- 1 | export const baseProps = { 2 | display: 'inline-flex', 3 | alignItems: 'center', 4 | justifyContent: 'center', 5 | rounded: 'md', 6 | transition: 'all 0.2s', 7 | flex: '0 0 auto', 8 | _hover: { bg: 'blackAlpha.100' }, 9 | _active: { bg: 'blackAlpha.200' }, 10 | _disabled: { 11 | cursor: 'not-allowed' 12 | }, 13 | _focus: { 14 | boxShadow: 'outline' 15 | }, 16 | border: 'none', 17 | bg: 'blackAlpha.50' 18 | } 19 | 20 | export const sizes = { 21 | lg: { 22 | button: '40px', 23 | icon: '16px' 24 | }, 25 | md: { 26 | button: '32px', 27 | icon: '12px' 28 | }, 29 | sm: { 30 | button: '24px', 31 | icon: '10px' 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCode/CCode.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CReset, CCode, CStack } from '..' 3 | 4 | storiesOf('UI | Code', module) 5 | .add('Default Code', () => ({ 6 | components: { CReset, CCode }, 7 | template: ` 8 |
9 | 10 | Hello world 11 |
12 | ` 13 | })) 14 | .add('With variant color', () => ({ 15 | components: { CReset, CCode, CStack }, 16 | template: ` 17 |
18 | 19 | 20 | console.log(welcome) 21 | var chakra = 'awesome!' 22 | npm install chakra 23 | 24 |
25 | ` 26 | })) 27 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCode/index.js: -------------------------------------------------------------------------------- 1 | import CCode from './CCode' 2 | export default CCode 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCode/tests/CCode.test.js: -------------------------------------------------------------------------------- 1 | import CCode from '..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CCode }, 7 | template: 'content', 8 | ...props 9 | } 10 | return render(base) 11 | } 12 | 13 | it('should render correctly', () => { 14 | const { asFragment } = renderComponent() 15 | expect(asFragment()).toMatchSnapshot() 16 | }) 17 | 18 | it('should display children', () => { 19 | renderComponent() 20 | 21 | expect(screen.getByText('content')).toBeInTheDocument() 22 | }) 23 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCode/tests/__snapshots__/CCode.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 | .emotion-0 { 6 | display: inline-block; 7 | font-size: var(--chakra-fontSizes-sm); 8 | -webkit-padding-start: 0.2em; 9 | padding-inline-start: 0.2em; 10 | -webkit-padding-end: 0.2em; 11 | padding-inline-end: 0.2em; 12 | font-family: var(--chakra-fonts-mono); 13 | border-radius: var(--chakra-radii-sm); 14 | background-color: var(--chakra-colors-gray-100); 15 | color: var(--chakra-colors-gray-800); 16 | } 17 | 18 | 22 | content 23 | 24 | 25 | `; 26 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCollapse/index.js: -------------------------------------------------------------------------------- 1 | import CCollapse from './CCollapse' 2 | export default CCollapse 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCollapse/tests/CCollapse.test.js: -------------------------------------------------------------------------------- 1 | import CCollapse from '..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CCollapse }, 8 | template: `content`, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | it('should render correctly', () => { 15 | const { asFragment } = renderComponent() 16 | expect(asFragment()).toMatchSnapshot() 17 | }) 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CCollapse/tests/__snapshots__/CCollapse.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 |
9 |
13 | content 14 |
15 |
16 |
17 | `; 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CColorModeProvider/index.js: -------------------------------------------------------------------------------- 1 | import CColorModeProvider from './CColorModeProvider' 2 | export default CColorModeProvider 3 | export * from './CColorModeProvider' 4 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CControlBox/index.js: -------------------------------------------------------------------------------- 1 | import CControlBox from './CControlBox' 2 | export default CControlBox 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDivider/CDivider.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue Divider 3 | * 4 | * Dividers are used to display a thin horizontal or vertical line. 5 | * 6 | * @see Docs https://vue.chakra-ui.com/divider 7 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CDivider/CDivider.js 8 | * @see A11y https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CDivider/accessibility.md 9 | */ 10 | 11 | import { createStyledAttrsMixin } from '../utils' 12 | 13 | /** 14 | * CDivider component 15 | * 16 | * Creates a horizontal or vertical dividing rule between sibling 17 | * elements 18 | * 19 | * @see Docs https://vue.chakra-ui.com/divider 20 | */ 21 | const CDivider = { 22 | name: 'CDivider', 23 | mixins: [createStyledAttrsMixin('CDivider')], 24 | props: { 25 | orientation: { 26 | type: String, 27 | default: 'horizontal' 28 | } 29 | }, 30 | computed: { 31 | borderProps () { 32 | return this.orientation === 'vertical' 33 | ? { borderLeft: '0.0625rem solid', height: 'auto', mx: 2 } 34 | : { borderBottom: '0.0625rem solid', width: 'auto', my: 2 } 35 | }, 36 | componentStyles () { 37 | return { 38 | border: 0, 39 | ...this.borderProps, 40 | opacity: 0.6, 41 | borderColor: 'inherit' 42 | } 43 | } 44 | }, 45 | render (h) { 46 | return h('hr', { 47 | class: this.className, 48 | attrs: { 49 | 'aria-orientation': this.orientation, 50 | ...this.computedAttrs 51 | } 52 | }) 53 | } 54 | } 55 | 56 | export default CDivider 57 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDivider/CDivider.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CBox, CFlex, CDivider } from '..' 3 | 4 | storiesOf('UI | Divider', module) 5 | .add('Basic usage', () => ({ 6 | components: { CFlex, CDivider }, 7 | template: ` 8 | 9 | Part 1 10 | 11 | Part 2 12 | 13 | ` 14 | })) 15 | .add('changing border color', () => ({ 16 | components: { CBox, CDivider }, 17 | template: ` 18 | 19 | Part 1 20 | 21 | Part 2 22 | 23 | ` 24 | })) 25 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDivider/accessibility.md: -------------------------------------------------------------------------------- 1 | # Divider | Accessibility ♿️ 2 | 3 | This report is adapted to list the accessiblity features supported by Chakra UI for the `CDivider` component. 4 | 5 | ### Description 6 | The `CDivider` component is used to display a thin horizontal or vertical line between sibling elments 7 | to provide a visual queue between regions on the UI 8 | 9 | ### `CDivider` WAI-ARIA compliance 10 | 11 | #### `aria-` attributes 12 | - When the `orientation` prop is `horizontal`, the `aria-orientation` attribute is set to `horizontal`. 13 | - When the `orientation` prop is `vertical`, the `aria-orientation` attribute is set to `vertical`. 14 | 15 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDivider/index.js: -------------------------------------------------------------------------------- 1 | import CDivider from './CDivider' 2 | export default CDivider 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDivider/tests/CDivider.test.js: -------------------------------------------------------------------------------- 1 | import CDivider from '..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CDivider }, 8 | template: ``, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | it('should render correctly', () => { 15 | const { asFragment } = renderComponent() 16 | 17 | expect(asFragment()).toMatchSnapshot() 18 | }) 19 | 20 | it('should change orientation', () => { 21 | const inlineAttrs = 'orientation="vertical"' 22 | const { asFragment } = renderComponent({ inlineAttrs }) 23 | 24 | expect(asFragment()).toMatchSnapshot() 25 | }) 26 | 27 | it('should have corresponding aria-orientation attribute', () => { 28 | const inlineAttrs = 'orientation="horizontal"' 29 | renderComponent({ inlineAttrs }) 30 | 31 | const divider = screen.getByTestId('divider') 32 | expect(divider).toHaveAttribute('aria-orientation', 'horizontal') 33 | }) 34 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDivider/tests/__snapshots__/CDivider.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should change orientation 1`] = ` 4 | 5 | .emotion-0 { 6 | border: 0; 7 | border-left: 0.0625rem solid; 8 | height: auto; 9 | -webkit-margin-start: var(--chakra-space-2); 10 | margin-inline-start: var(--chakra-space-2); 11 | -webkit-margin-end: var(--chakra-space-2); 12 | margin-inline-end: var(--chakra-space-2); 13 | opacity: 0.6; 14 | border-color: inherit; 15 | } 16 | 17 |
23 |
24 | `; 25 | 26 | exports[`should render correctly 1`] = ` 27 | 28 | .emotion-0 { 29 | border: 0; 30 | border-bottom: 0.0625rem solid; 31 | width: auto; 32 | margin-top: var(--chakra-space-2); 33 | margin-bottom: var(--chakra-space-2); 34 | opacity: 0.6; 35 | border-color: inherit; 36 | } 37 | 38 |
44 |
45 | `; 46 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDrawer/CDrawer.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CFragment, CInput, CButton, CDrawer, CDrawerBody, CDrawerFooter, CDrawerHeader, CDrawerOverlay, CDrawerContent, CDrawerCloseButton } from '..' 3 | 4 | storiesOf('UI | Drawer', module) 5 | .add('Drawer', () => ({ 6 | components: { CFragment, CInput, CButton, CDrawer, CDrawerBody, CDrawerFooter, CDrawerHeader, CDrawerOverlay, CDrawerContent, CDrawerCloseButton }, 7 | data: () => ({ isOpen: false }), 8 | methods: { 9 | close () { 10 | this.isOpen = false 11 | } 12 | }, 13 | template: ` 14 | 15 | Open Drawer 16 | 17 | 18 | 19 | 20 | 21 | Create your account 22 | 23 | 24 | 25 | 26 | 27 | 28 | Cancel 29 | Save 30 | 31 | 32 | 33 | 34 | ` 35 | })) 36 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CDrawer/index.js: -------------------------------------------------------------------------------- 1 | export * from './CDrawer' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CEditable/index.js: -------------------------------------------------------------------------------- 1 | import CEditable from './CEditable' 2 | export default CEditable 3 | export * from './CEditable' 4 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFlex/CFlex.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue Flex 3 | * 4 | * `CFlex` is `CBox` with `display: flex` and comes with 5 | * helpful style shorthands. It renders a `div` element. 6 | * 7 | * @see Docs https://vue.chakra-ui.com/flex 8 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CFlex/CFlex.js 9 | */ 10 | 11 | import { createStyledAttrsMixin } from '../utils' 12 | import flexProps from './utils/flex.props.js' 13 | 14 | /** 15 | * CFlex component 16 | * 17 | * `CFlex` is `CBox` with display: flex and comes with helpful style shorthands. 18 | * 19 | * @see Docs https://vue.chakra-ui.com/flex 20 | */ 21 | const CFlex = { 22 | name: 'CFlex', 23 | mixins: [createStyledAttrsMixin('CFlex')], 24 | props: flexProps, 25 | computed: { 26 | componentStyles () { 27 | return { 28 | display: 'flex', 29 | flexDirection: this.direction, 30 | alignItems: this.align, 31 | justifyContent: this.justify, 32 | flexWrap: this.wrap, 33 | h: this.size, 34 | w: this.size 35 | } 36 | } 37 | }, 38 | render (h) { 39 | return h(this.as, { 40 | class: this.className, 41 | attrs: this.computedAttrs, 42 | on: this.computedListeners 43 | }, this.$slots.default) 44 | } 45 | } 46 | 47 | export default CFlex 48 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFlex/index.js: -------------------------------------------------------------------------------- 1 | import CFlex from './CFlex' 2 | export default CFlex 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFlex/tests/__snapshots__/CFlex.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`CFlex should change styles 1`] = ` 4 | 5 | .emotion-0 { 6 | display: -webkit-box; 7 | display: -webkit-flex; 8 | display: -ms-flexbox; 9 | display: flex; 10 | -webkit-flex-direction: column; 11 | -ms-flex-direction: column; 12 | flex-direction: column; 13 | -webkit-align-items: center; 14 | -webkit-box-align: center; 15 | -ms-flex-align: center; 16 | align-items: center; 17 | -webkit-box-pack: center; 18 | -ms-flex-pack: center; 19 | -webkit-justify-content: center; 20 | justify-content: center; 21 | } 22 | 23 |
28 | Flex Me 29 |
30 |
31 | `; 32 | 33 | exports[`CFlex should render correctly 1`] = ` 34 | 35 | .emotion-0 { 36 | display: -webkit-box; 37 | display: -webkit-flex; 38 | display: -ms-flexbox; 39 | display: flex; 40 | } 41 | 42 |
47 | Flex Me 48 |
49 |
50 | `; 51 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFlex/utils/flex.props.js: -------------------------------------------------------------------------------- 1 | import { SNA } from '../../config/props.types' 2 | 3 | const flexProps = { 4 | as: { 5 | type: String, 6 | default: 'div' 7 | }, 8 | align: SNA, 9 | justify: SNA, 10 | wrap: SNA, 11 | direction: SNA, 12 | size: SNA 13 | } 14 | 15 | export default flexProps 16 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormControl/accessibility.md: -------------------------------------------------------------------------------- 1 | # Form Control | Accessibility ♿️ 2 | 3 | This report is adapted to list the accessiblity features supported by Chakra UI for the `CFormControl` component. 4 | 5 | ### Description 6 | `CFormControl` provides context such as `isInvalid`, `isDisabled`, and `isRequired` to form elements. This context is used by the following components: 7 | 8 | - `CFormControl` - Provides context such as `isInvalid`, `isDisabled`, and `isRequired` to form elements. 9 | - `CFormLabel` - Label for the form input. 10 | - `CFormErrorMessage` - Displays validation message content if it received `isInvalid` from context. 11 | - `CFormHelperText` - Used to display helpful hints to the use on how to use an input. 12 | 13 | ### `CFormControl` WAI compliance 14 | - See [WAI specifications](https://www.w3.org/WAI/tutorials/forms/) for forms 15 | 16 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormControl/index.js: -------------------------------------------------------------------------------- 1 | import CFormControl from './CFormControl' 2 | export default CFormControl 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormControl/tests/CFormControl.test.js: -------------------------------------------------------------------------------- 1 | import { CFormControl, CInput, CFormLabel } from '../..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CFormControl, CFormLabel, CInput }, 8 | template: ` 9 | 10 | First name 11 | 12 | `, 13 | ...props 14 | } 15 | return render(base) 16 | } 17 | 18 | it('should render correctly', () => { 19 | const { asFragment } = renderComponent() 20 | 21 | expect(asFragment()).toMatchSnapshot() 22 | }) 23 | 24 | it('should provide formcontrol state via scoped slot', () => { 25 | renderComponent({ 26 | template: ` 27 | 28 |
29 |         {{ props }}
30 |       
31 |
` 32 | }) 33 | 34 | const pre = screen.getByTestId('pre') 35 | expect(JSON.parse(pre.textContent, null, 2)).toEqual({ 36 | isInvalid: false, 37 | isRequired: true, 38 | isDisabled: false, 39 | isReadOnly: true 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormControl/utils/formcontrol.props.js: -------------------------------------------------------------------------------- 1 | export const formControlProps = { 2 | isInvalid: Boolean, 3 | isRequired: Boolean, 4 | isDisabled: Boolean, 5 | isReadOnly: Boolean 6 | } 7 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormErrorMessage/index.js: -------------------------------------------------------------------------------- 1 | import CFormErrorMessage from './CFormErrorMessage' 2 | export default CFormErrorMessage 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormHelperText/CFormHelperText.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue CFormHelperText 3 | * 4 | * Used to display helpful hints to the use on how to 5 | * use an input. 6 | * 7 | * @see Docs https://vue.chakra-ui.com/formcontrol 8 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CFormHelperText/CFormHelperText.js 9 | * @see WAI https://www.w3.org/WAI/tutorials/forms/ 10 | */ 11 | 12 | import { createStyledAttrsMixin } from '../utils' 13 | 14 | /** 15 | * CFormHelperText component 16 | * 17 | * Used to display helpful hints to the use on how to 18 | * use an input. 19 | * 20 | * @extends CText 21 | * @see Docs https://vue.chakra-ui.com/formcontrol 22 | */ 23 | const CFormHelperText = { 24 | name: 'CFormHelperText', 25 | mixins: [createStyledAttrsMixin('CFormHelperText')], 26 | inject: ['$useFormControl'], 27 | computed: { 28 | formControl () { 29 | return this.$useFormControl(this.$props) 30 | }, 31 | componentStyles () { 32 | const color = { light: 'gray.500', dark: 'whiteAlpha.600' } 33 | return { 34 | mt: 2, 35 | color: color[this.colorMode], 36 | lineHeight: 'normal', 37 | fontSize: 'sm' 38 | } 39 | } 40 | }, 41 | render (h) { 42 | return h('p', { 43 | class: [this.className], 44 | attrs: { 45 | id: this.formControl.id ? `${this.formControl.id}-help-text` : null, 46 | ...this.computedAttrs 47 | }, 48 | on: this.computedListeners 49 | }, this.$slots.default) 50 | } 51 | } 52 | 53 | export default CFormHelperText 54 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormHelperText/index.js: -------------------------------------------------------------------------------- 1 | import CFormHelperText from './CFormHelperText' 2 | export default CFormHelperText 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFormLabel/index.js: -------------------------------------------------------------------------------- 1 | import CFormLabel from './CFormLabel' 2 | export default CFormLabel 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFragment/CFragment.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fragment component to render multiple child sibling nodes in the place of 3 | * their parent in the DOM. 4 | * Note: This is a temporary solution to create fragments in Vue 2 5 | * until Vue 3 releases internal Fragment support 6 | */ 7 | const CFragment = { 8 | name: 'CFragment', 9 | directives: { 10 | fragment: { 11 | inserted (el) { 12 | const fragment = document.createDocumentFragment() 13 | Array.from(el.childNodes).forEach(child => 14 | fragment.appendChild(child) 15 | ) 16 | el.parentNode.insertBefore(fragment, el) 17 | el.parentNode.removeChild(el) 18 | } 19 | } 20 | }, 21 | render (h) { 22 | // Here we render div but will remove it when node is inserted. 23 | // And replace it with children 24 | return h('div', { 25 | directives: [{ name: 'fragment' }] 26 | }, this.$slots.default) 27 | } 28 | } 29 | 30 | export default CFragment 31 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFragment/index.js: -------------------------------------------------------------------------------- 1 | import CFragment from './CFragment' 2 | export default CFragment 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFragment/tests/CFragment.test.js: -------------------------------------------------------------------------------- 1 | import CFragment from '..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CFragment }, 7 | template: '
12
', 8 | ...props 9 | } 10 | return render(base) 11 | } 12 | 13 | it('should render correctly', () => { 14 | const { asFragment } = renderComponent() 15 | 16 | expect(asFragment()).toMatchSnapshot() 17 | }) 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CFragment/tests/__snapshots__/CFragment.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 |
8 | 9 | 1 10 | 11 | 12 | 2 13 | 14 |
15 |
16 | `; 17 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CGrid/CGrid.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CReset, CGrid, CGridItem, CBox } from '..' 3 | 4 | storiesOf('UI | Grid', module) 5 | .add('Default Grid', () => ({ 6 | components: { CReset, CGrid, CBox }, 7 | template: ` 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | ` 19 | })) 20 | 21 | storiesOf('UI | Grid', module) 22 | .add('Grid Items', () => ({ 23 | components: { CReset, CGrid, CGridItem }, 24 | template: ` 25 |
26 | 27 | 28 | 29 | 30 | 31 |
32 | ` 33 | })) 34 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CGrid/index.js: -------------------------------------------------------------------------------- 1 | export * from './CGrid' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CGrid/test/CGrid.test.js: -------------------------------------------------------------------------------- 1 | import { CGrid, CGridItem } from '..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CGrid, CGridItem }, 8 | template: `Grid Me`, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | it('should render correctly', () => { 15 | const { asFragment } = renderComponent() 16 | 17 | expect(asFragment()).toMatchSnapshot() 18 | }) 19 | 20 | it('should change gap', () => { 21 | const inlineAttrs = 'w="600px" template-columns="repeat(5, 1fr)" gap="6"' 22 | const { asFragment } = renderComponent({ inlineAttrs }) 23 | 24 | expect(asFragment()).toMatchSnapshot() 25 | }) 26 | 27 | it('should offset columns', () => { 28 | const inlineAttrs = 'col-start="4" col-end="6"' 29 | const { asFragment } = renderComponent({ 30 | template: ` 31 | 32 | I'm in a grid item 33 | ` 34 | }) 35 | expect(asFragment()).toMatchSnapshot() 36 | }) 37 | 38 | it('should span columns', () => { 39 | const inlineAttrs = 'col-span="2"' 40 | const { asFragment } = renderComponent({ 41 | template: ` 42 | 43 | I'm in a grid item 44 | ` 45 | }) 46 | expect(asFragment()).toMatchSnapshot() 47 | }) 48 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CHeading/CHeading.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CHeading } from '..' 3 | 4 | storiesOf('UI | Heading', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CHeading }, 7 | template: ` 8 |
9 | Heading 1 10 | Heading 2 11 | Heading 3 12 | Heading 4 13 | Heading 5 14 | Heading 6 15 |
16 | ` 17 | })) 18 | .add('Is truncated', () => ({ 19 | components: { CHeading }, 20 | template: ` 21 |
22 | Extra super duper long naruto heading in the village hidden in the leaves by the first Hokage who used to be friedns with Madara Uchiha but they went their separate ways because they could find a common understing around the definition of peace in the ninja world. 23 |
24 | ` 25 | })) 26 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CHeading/index.js: -------------------------------------------------------------------------------- 1 | import CHeading from './CHeading' 2 | export default CHeading 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CHeading/tests/CHeading.test.js: -------------------------------------------------------------------------------- 1 | import CHeading from '..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CHeading }, 7 | template: 'Header', 8 | ...props 9 | } 10 | return render(base) 11 | } 12 | 13 | it('should render correctly', () => { 14 | const { asFragment } = renderComponent() 15 | 16 | expect(asFragment()).toMatchSnapshot() 17 | }) 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CHeading/tests/__snapshots__/CHeading.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 | .emotion-0 { 6 | font-size: var(--chakra-fontSizes-3xl); 7 | line-height: var(--chakra-lineHeights-shorter); 8 | font-weight: var(--chakra-fontWeights-bold); 9 | font-family: var(--chakra-fonts-heading); 10 | } 11 | 12 | @media screen and (min-width: 48em) { 13 | .emotion-0 { 14 | font-size: var(--chakra-fontSizes-4xl); 15 | } 16 | } 17 | 18 |

22 | Header 23 |

24 |
25 | `; 26 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIcon/CIcon.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CIcon } from '..' 3 | 4 | storiesOf('UI | Icon', module) 5 | .add('Base Icon', () => ({ 6 | components: { CIcon }, 7 | template: ` 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | ` 17 | })) 18 | .add('Custom Icon eg FA', () => ({ 19 | components: { CIcon }, 20 | template: ` 21 |
22 | 23 |
24 | ` 25 | })) 26 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIcon/index.js: -------------------------------------------------------------------------------- 1 | import CIcon from './CIcon' 2 | export default CIcon 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIcon/tests/CIcon.test.js: -------------------------------------------------------------------------------- 1 | import CIcon from '..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CIcon }, 7 | template: '', 8 | ...props 9 | } 10 | return render(base) 11 | } 12 | 13 | it('should render correctly', () => { 14 | const { asFragment } = renderComponent() 15 | 16 | expect(asFragment()).toMatchSnapshot() 17 | }) 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIcon/tests/__snapshots__/CIcon.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 | .emotion-0 { 6 | -webkit-flex-shrink: 0; 7 | -ms-flex-negative: 0; 8 | flex-shrink: 0; 9 | -webkit-backface-visibility: hidden; 10 | backface-visibility: hidden; 11 | } 12 | 13 | .emotion-0:not(:root) { 14 | overflow: hidden; 15 | } 16 | 17 | .emotion-1 { 18 | width: 1em; 19 | height: 1em; 20 | display: inline-block; 21 | vertical-align: middle; 22 | } 23 | 24 | 30 | 31 | 32 | 36 | 37 | 38 | 39 | 40 | `; 41 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIcon/utils/icon.props.js: -------------------------------------------------------------------------------- 1 | export const iconProps = { 2 | name: { 3 | type: [String, Array] 4 | }, 5 | use: { 6 | type: [String, Array], 7 | required: false 8 | }, 9 | pack: { 10 | type: String, 11 | required: false, 12 | default: 'fas', 13 | validator: value => value.match(/^(fas|fal|fad)$/) 14 | }, 15 | size: { 16 | type: [String, Number, Array], 17 | default: '1em' 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIcon/utils/icon.utils.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | /** 4 | * @description Evaluate icon size props 5 | * @param {Object} props - Props object 6 | * @property {String} size - Props object 7 | * @property {Object} theme - Props object 8 | * @returns {Object} Size style props object 9 | */ 10 | const sizeProps = ({ size, theme }) => { 11 | const _theme = theme() 12 | return { 13 | w: _theme.sizes[size], 14 | h: _theme.sizes[size] 15 | } 16 | } 17 | 18 | /** 19 | * @description Evaluate icon style props 20 | * @param {Object} props - Props object 21 | */ 22 | export const iconStyles = (props) => { 23 | return { 24 | ...sizeProps(props) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIconButton/accessibility.md: -------------------------------------------------------------------------------- 1 | # IconButton | Accessibility ♿️ 2 | 3 | This report is adapted to list the [WAI-ARIA Authoring practices for buttons](https://www.w3.org/TR/wai-aria-practices-1.2/#button) supported by Chakra UI for the `CIconButton` component. 4 | 5 | ### Description 6 | CIconButton is used to render icons that support click interactions. 7 | 8 | ### Composition 9 | The `CIconButton` componses teh `CButton` so, id inherits ths accessibility features supported by the `CButton`. 10 | 11 | To learn more about this component's accessibility, see the [Button component's accessibility report.](https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CButton/accessibility.md) 12 | 13 | oticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIconButton/icon-button.utils.js: -------------------------------------------------------------------------------- 1 | const iconSizes = { 2 | xs: { 3 | w: '0.75rem', 4 | h: '0.75rem' 5 | }, 6 | sm: { 7 | w: '0.8rem', 8 | h: '0.8rem' 9 | }, 10 | md: { 11 | w: '1.0rem', 12 | h: '1.0rem' 13 | }, 14 | lg: { 15 | w: '2rem', 16 | h: '2rem' 17 | }, 18 | xl: { 19 | w: '3rem', 20 | h: '3rem' 21 | } 22 | } 23 | 24 | const createCustomSize = (size) => { 25 | return { 26 | w: size, 27 | h: size 28 | } 29 | } 30 | 31 | /** 32 | * @description Evaluates button icon sizes and returns wight and height parameters 33 | * @param {Object} props 34 | */ 35 | export const setButtonIconSize = (props) => { 36 | return iconSizes[props.size] || createCustomSize(props.size) 37 | } 38 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CIconButton/index.js: -------------------------------------------------------------------------------- 1 | import CIconButton from './CIconButton' 2 | export default CIconButton 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CImage/CImage.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CImage } from '..' 3 | 4 | storiesOf('UI | Image', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CImage }, 7 | template: ` 8 | 14 | ` 15 | })) 16 | .add('Webpack required image', () => ({ 17 | components: { CImage }, 18 | template: ` 19 | 24 | ` 25 | })) 26 | .add('With size', () => ({ 27 | components: { CImage }, 28 | template: ` 29 | 36 | ` 37 | })) 38 | .add('With fallback src', () => ({ 39 | components: { CImage }, 40 | template: ` 41 | 45 | ` 46 | })) 47 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CImage/index.js: -------------------------------------------------------------------------------- 1 | import CImage from './CImage' 2 | export default CImage 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CImage/tests/__snapshots__/CImage.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`"srcset" should work and be prioritized over "src" if provided to CImage 1`] = ` 4 | 5 | My Image Description 12 | 13 | `; 14 | 15 | exports[`should render correctly 1`] = ` 16 | 17 | Mesut Koca 24 | 25 | `; 26 | 27 | exports[`should use src if srcset provided is undefined 1`] = ` 28 | 29 | My Image Description 36 | 37 | `; 38 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInput/index.js: -------------------------------------------------------------------------------- 1 | import CInput from './CInput' 2 | export default CInput 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInput/tests/CInput.test.js: -------------------------------------------------------------------------------- 1 | import { CInput } from '../..' 2 | import { render, screen, userEvent } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | data: () => ({ text: 'hello' }), 8 | components: { CInput }, 9 | template: ``, 10 | ...props 11 | } 12 | return render(base) 13 | } 14 | 15 | test('should render correctly', () => { 16 | const { asFragment } = renderComponent() 17 | expect(asFragment()).toMatchSnapshot() 18 | }) 19 | 20 | test('v-model works', () => { 21 | renderComponent() 22 | const input = screen.getByTestId('input') 23 | 24 | userEvent.type(input, ' world') 25 | expect(input).toHaveValue('hello world') 26 | }) 27 | 28 | test('readonly input renders correctly', () => { 29 | renderComponent({ inlineAttrs: 'isReadOnly' }) 30 | const input = screen.getByTestId('input') 31 | 32 | expect(input).toHaveAttribute('readonly') 33 | }) 34 | 35 | test('disabled input renders correctly', () => { 36 | renderComponent({ inlineAttrs: 'isDisabled' }) 37 | const input = screen.getByTestId('input') 38 | 39 | expect(input).toHaveAttribute('disabled') 40 | }) 41 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInput/utils/input.props.js: -------------------------------------------------------------------------------- 1 | import { SNA, StringArray } from '../../config/props.types' 2 | 3 | export const inputProps = { 4 | size: { 5 | type: SNA, 6 | default: 'md' 7 | }, 8 | variant: { 9 | type: StringArray, 10 | default: 'outline' 11 | }, 12 | as: { 13 | type: String, 14 | default: 'input' 15 | }, 16 | _ariaLabel: String, 17 | _ariaDescribedby: String, 18 | isFullWidth: { 19 | type: Boolean, 20 | default: true 21 | }, 22 | isReadOnly: Boolean, 23 | isDisabled: Boolean, 24 | isInvalid: Boolean, 25 | isRequired: Boolean, 26 | focusBorderColor: { 27 | type: String, 28 | default: 'blue.200' 29 | }, 30 | errorBorderColor: { 31 | type: String, 32 | default: 'red.300' 33 | }, 34 | value: { 35 | type: [String, Number], 36 | default: undefined 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInputAddon/index.js: -------------------------------------------------------------------------------- 1 | import CInputAddon from './CInputAddon' 2 | export default CInputAddon 3 | export * from './CInputAddon' 4 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInputElement/index.js: -------------------------------------------------------------------------------- 1 | import CInputElement from './CInputElement' 2 | export default CInputElement 3 | export * from './CInputElement' 4 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInputGroup/index.js: -------------------------------------------------------------------------------- 1 | import CInputGroup from './CInputGroup' 2 | export default CInputGroup 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CInputGroup/tests/CInputGroup.test.js: -------------------------------------------------------------------------------- 1 | import { CInputGroup, CInputLeftElement, CInputRightElement, CInput, CIcon } from '../..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | data: () => ({ text: 'hello' }), 7 | components: { CInputGroup, CInputLeftElement, CInputRightElement, CInput, CIcon }, 8 | template: ` 9 | 10 | ¥ 11 | 12 | 13 | 14 | `, 15 | ...props 16 | } 17 | return render(base) 18 | } 19 | 20 | test('should render correctly', () => { 21 | const { asFragment } = renderComponent() 22 | expect(asFragment()).toMatchSnapshot() 23 | }) 24 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CLink/accessibility.md: -------------------------------------------------------------------------------- 1 | # Link | Accessibility ♿️ 2 | 3 | This report is adapted to list the [WAI-ARIA Authoring practices for alert dialogs](https://www.w3.org/TR/wai-aria-practices-1.2/#link) supported by Chakra UI for the `CLink` component. 4 | 5 | ### Description 6 | A link widget provides an interactive reference to a resource. The target resource can be either external or local, i.e., either outside or within the current page or application. 7 | 8 | #### Components 9 | `@chakra-ui/vue` exports 1 checkbox related components: 10 | - `CLink` 11 | 12 | ### `CLink` Keyboard Interaction 13 | - [x] **`Enter`**: Executes the link and moves focus to the link target. 14 | 15 | ### `CLink` WAI-ARIA compliance 16 | The element containing the link text or graphic has role of link. 17 | Links are accessible elements used primarily for navigation. This component is styled to resemble a hyperlink and semantically renders an ``. 18 | 19 | The `CLink` component composes `CPseudoBox`, so you can pass all `CPseudoBox` props 20 | 21 | 22 | Noticed a bug or inconsistency with this component? [Open an issue](https://github.com/chakra-ui/chakra-ui-vue/issues/new/choose) 23 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CLink/index.js: -------------------------------------------------------------------------------- 1 | import CLink from './CLink' 2 | export default CLink 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CList/CList.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CBox, CList, CListItem, CListIcon } from '..' 3 | 4 | storiesOf('UI | List', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CBox, CList, CListItem, CListIcon }, 7 | template: ` 8 |
19 | 20 | 21 | 22 | Lorem ipsum dolor sit amet, consectetur adipisicing elit 23 | 24 | 25 | 26 | Assumenda, quia temporibus eveniet a libero incidunt suscipit 27 | 28 | 29 | 30 | Quidem, ipsam illum quis sed voluptatum quae eum fugit earum 31 | 32 | 33 | 34 | Quidem, ipsam illum quis sed voluptatum quae eum fugit earum 35 | 36 | 37 |
38 | ` 39 | })) 40 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CList/index.js: -------------------------------------------------------------------------------- 1 | import CList from './CList' 2 | export default CList 3 | export * from './CList' 4 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CList/tests/CList.test.js: -------------------------------------------------------------------------------- 1 | import { CList, CListItem, CListIcon } from '../..' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CList, CListItem, CListIcon }, 7 | template: ` 8 | 9 | 10 | Lorem ipsum dolor sit amet, consectetur adipisicing elit 11 | 12 | 13 | Assumenda, quia temporibus eveniet a libero incidunt suscipit 14 | 15 | `, 16 | ...props 17 | } 18 | return render(base) 19 | } 20 | 21 | it('should render correctly', () => { 22 | const { asFragment } = renderComponent() 23 | expect(asFragment()).toMatchSnapshot() 24 | }) 25 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CMenu/index.js: -------------------------------------------------------------------------------- 1 | export * from './CMenu' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CModal/index.js: -------------------------------------------------------------------------------- 1 | export * from './CModal' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CModal/utils/modal.props.js: -------------------------------------------------------------------------------- 1 | import { StringArray } from '../../config/props.types' 2 | import { HTMLElement } from '../../utils' 3 | 4 | export default { 5 | isOpen: Boolean, 6 | initialFocusRef: [HTMLElement, Object, String, Function], 7 | finalFocusRef: [HTMLElement, Object, String, Function], 8 | contentRef: [HTMLElement, Object, String], 9 | blockScrollOnMount: { 10 | type: Boolean, 11 | default: true 12 | }, 13 | closeOnEsc: { 14 | type: Boolean, 15 | default: true 16 | }, 17 | closeOnOverlayClick: { 18 | type: Boolean, 19 | default: true 20 | }, 21 | useInert: { 22 | type: Boolean, 23 | default: true 24 | }, 25 | scrollBehavior: { 26 | type: StringArray, 27 | default: 'outside' 28 | }, 29 | isCentered: Boolean, 30 | addAriaLabels: { 31 | type: [Boolean, Object], 32 | default: true 33 | }, 34 | preserveScrollBarGap: Boolean, 35 | formatIds: { 36 | type: Function, 37 | default: id => ({ 38 | content: `modal-${id}`, 39 | header: `modal-${id}-header`, 40 | body: `modal-${id}-body` 41 | }) 42 | }, 43 | container: HTMLElement, 44 | returnFocusOnClose: { 45 | type: Boolean, 46 | default: true 47 | }, 48 | id: String, 49 | size: { 50 | type: String, 51 | default: 'md' 52 | }, 53 | onClose: { 54 | type: Function, 55 | default: () => null 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CNoSsr/NoSsr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue NoSsr 3 | * 4 | * This component is used to defer the rendering of it's children to the client-side. 5 | * 6 | * This component is a modification of the fine work of @egoist 7 | * @see https://github.com/egoist/vue-client-only/blob/master/src/index.js 8 | */ 9 | 10 | const NoSsr = { 11 | name: 'NoSsr', 12 | functional: true, 13 | props: { 14 | placeholder: String, 15 | placeholderTag: { 16 | type: String, 17 | default: 'div' 18 | } 19 | }, 20 | render (h, { parent, slots, props }) { 21 | const { default: defaultSlot = [], placeholder: placeholderSlot } = slots() 22 | 23 | if (parent._isMounted) { 24 | return defaultSlot 25 | } 26 | 27 | parent.$once('hook:mounted', () => { 28 | parent.$forceUpdate() 29 | }) 30 | 31 | if (props.placeholderTag && (props.placeholder || placeholderSlot)) { 32 | return h( 33 | props.placeholderTag, 34 | { 35 | class: ['client-only-placeholder'], 36 | attrs: { 37 | 'data-chakra-component': 'CNoSsr' 38 | } 39 | }, 40 | props.placeholder || placeholderSlot 41 | ) 42 | } 43 | 44 | // Return a placeholder element for each child in the default slot 45 | // Or if no children return a single placeholder 46 | return defaultSlot.length > 0 ? defaultSlot.map(() => h(false)) : h(false) 47 | } 48 | } 49 | 50 | export default NoSsr 51 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CNoSsr/index.js: -------------------------------------------------------------------------------- 1 | import NoSsr from './NoSsr' 2 | export default NoSsr 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CNumberInput/index.js: -------------------------------------------------------------------------------- 1 | export * from './CNumberInput' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CNumberInput/utils/numberinput.styles.js: -------------------------------------------------------------------------------- 1 | const themedProps = { 2 | light: { 3 | borderColor: 'inherit', 4 | _active: { 5 | bg: 'gray.200' 6 | } 7 | }, 8 | dark: { 9 | color: 'whiteAlpha.800', 10 | borderColor: 'whiteAlpha.300', 11 | _active: { 12 | bg: 'whiteAlpha.300' 13 | } 14 | } 15 | } 16 | 17 | const styleProps = ({ colorMode, size }) => ({ 18 | borderLeft: '1px', 19 | _first: { 20 | roundedTopRight: size === 'sm' ? 1 : 3 21 | }, 22 | _last: { 23 | roundedBottomRight: size === 'sm' ? 1 : 3, 24 | mt: '-1px', 25 | borderTopWidth: 1 26 | }, 27 | _disabled: { 28 | opacity: 0.4, 29 | cursor: 'not-allowed' 30 | }, 31 | ...themedProps[colorMode] 32 | }) 33 | 34 | export default styleProps 35 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CNumberInput/utils/numberinput.utils.js: -------------------------------------------------------------------------------- 1 | export function isNumberKey (event) { 2 | const charCode = event.which ? event.which : event.keyCode 3 | if (event.key === '.') return true 4 | if ( 5 | charCode > 31 && 6 | (charCode < 48 || charCode > 57) && 7 | (charCode < 96 || charCode > 105) && 8 | charCode !== 110 9 | ) { return false } 10 | return true 11 | } 12 | 13 | export function preventNonNumberKey (event) { 14 | if (!isNumberKey(event)) { 15 | event.preventDefault() 16 | } 17 | } 18 | 19 | export function roundToPrecision (value, precision) { 20 | return value === '' 21 | ? parseFloat(0).toFixed(precision) 22 | : parseFloat(value).toFixed(precision) 23 | } 24 | 25 | /** 26 | * Calculates the precision of a value 27 | * @param {Number} value Value 28 | */ 29 | export function calculatePrecision (value) { 30 | const groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value)) 31 | if (!groups) { 32 | return 0 33 | } 34 | if (groups[1]) { 35 | return -groups[1].length 36 | } 37 | if (groups[2]) { 38 | return groups[2].length 39 | } 40 | return 0 41 | } 42 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPopover/index.js: -------------------------------------------------------------------------------- 1 | export * from './CPopover' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPopover/popover.test.js: -------------------------------------------------------------------------------- 1 | describe('Popover tests', () => { 2 | // Popover 3 | it.todo('should not finally render fragment node') 4 | it.todo('should locate trigger node when mounted') 5 | it.todo('should locate content node when mounted') 6 | it.todo('should create and assign ids to popover header, body and footer components') 7 | 8 | // PopoverTrigger 9 | it.todo('should clone and finally render child node.') 10 | it.todo('shoudl throw error and not render anything if no children are passed') 11 | it.todo('should call context method that toggles disclosure state when clicked') 12 | it.todo('should preserve inherited event listeners') 13 | 14 | // PopoverContent 15 | it.todo('should inject provided popover context') 16 | 17 | // PopoverArrow 18 | it.todo('should render arrow') 19 | 20 | // PopoverHeader 21 | it.todo('should render slot content') 22 | 23 | // PopoverBody 24 | it.todo('should render slot content') 25 | 26 | // PopoverFooter 27 | it.todo('should render slot content') 28 | }) 29 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPopper/index.js: -------------------------------------------------------------------------------- 1 | export * from './CPopper' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPopper/tests/popper.test.js: -------------------------------------------------------------------------------- 1 | describe('Popper tests', () => { 2 | it.todo('should create popper instance and mount children') 3 | it.todo('should emit close events when popper is closed') 4 | it.todo('should emit open events when popper is opened') 5 | it.todo('should display children only when popper is open') 6 | it.todo('should hide children only when popper is closed') 7 | it.todo('should render children component only when "usePortal" prop is sent to true') 8 | it.todo('should hide popper when user clicks away from popper and it\'s anchor') 9 | }) 10 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPortal/index.js: -------------------------------------------------------------------------------- 1 | import CPortal from './CPortal' 2 | export default CPortal 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPortal/portal.test.js: -------------------------------------------------------------------------------- 1 | describe('Chakra Portal Component', () => { 2 | it.todo('should render children in portal when active') 3 | it.todo('should behave renderlessly when portal is disabled') 4 | it.todo('should should keep reactivity in children') 5 | it.todo('should mount target before render') 6 | it.todo('should unmount when unmount is called') 7 | it.todo('should render target with transitions') 8 | }) 9 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CProgress/CProgress.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CReset, CProgress, CStack, CBox } from '..' 3 | 4 | storiesOf('UI | Progress', module) 5 | .addDecorator(story => ({ 6 | components: { CReset, CBox, story: story() }, 7 | template: ` 8 | 9 | 10 | 11 | ` 12 | })) 13 | 14 | .add('Default Progress', () => ({ 15 | components: { CProgress }, 16 | template: '' 17 | })) 18 | .add('With stripe', () => ({ 19 | components: { CProgress }, 20 | template: '' 21 | })) 22 | .add('With sizes', () => ({ 23 | components: { CProgress, CStack }, 24 | template: ` 25 | 26 | 27 | 28 | 29 | 30 | ` 31 | })) 32 | .add('With color', () => ({ 33 | components: { CProgress }, 34 | template: '' 35 | })) 36 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CProgress/index.js: -------------------------------------------------------------------------------- 1 | export * from './CProgress' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CProgress/tests/CProgress.test.js: -------------------------------------------------------------------------------- 1 | import { CProgress, CProgressLabel } from '../..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { 7 | CProgress, 8 | CProgressLabel 9 | }, 10 | template: '', 11 | ...props 12 | } 13 | return render(base) 14 | } 15 | 16 | it('should render correctly', () => { 17 | const { asFragment } = renderComponent() 18 | expect(asFragment()).toMatchSnapshot() 19 | }) 20 | 21 | it('should have the correct width', () => { 22 | renderComponent() 23 | 24 | expect(screen.queryByRole('progressbar')).toHaveStyle('width: 40%') 25 | }) 26 | 27 | it('should display a label', () => { 28 | renderComponent({ 29 | template: ` 30 | 31 | Label 32 | ` 33 | }) 34 | 35 | expect(screen.queryByText('Label')).toBeInTheDocument() 36 | }) 37 | 38 | test('a11y - progress has a "role" set to "progressbar"', () => { 39 | renderComponent() 40 | expect(screen.queryByRole('progressbar')).toBeInTheDocument() 41 | }) 42 | 43 | test('a11y - progress has a "aria-valuenow" set to the percentage completion value', () => { 44 | renderComponent() 45 | 46 | expect(screen.queryByRole('progressbar')).toHaveAttribute( 47 | 'aria-valuenow', 48 | '40' 49 | ) 50 | }) 51 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CProgress/tests/__snapshots__/CProgress.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should render correctly 1`] = ` 4 | 5 | .emotion-0 { 6 | position: relative; 7 | height: 0.5rem; 8 | overflow: hidden; 9 | width: 100%; 10 | background: var(--chakra-colors-gray-100); 11 | border-radius: var(--chakra-radii-sm); 12 | } 13 | 14 | .emotion-1 { 15 | height: 100%; 16 | -webkit-transition: all 0.3s; 17 | transition: all 0.3s; 18 | width: 40%; 19 | background-color: var(--chakra-colors-green-500); 20 | border-radius: var(--chakra-radii-sm); 21 | } 22 | 23 |
28 |
36 |
37 | 38 | `; 39 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPseudoBox/CPseudoBox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue PseudoBox 3 | * 4 | * The PseudoBox component 5 | * 6 | * @see Docs https://vue.chakra-ui.com/pseudobox 7 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CPseudoBox/CPseudoBox.js 8 | */ 9 | 10 | import { createStyledAttrsMixin } from '../utils' 11 | 12 | /** 13 | * CPseudoBox component 14 | * 15 | * The pseudobox component that accepts pseudo props 16 | * 17 | * @extends CBox 18 | * @see Docs https://vue.chakra-ui.com/pseudobox 19 | */ 20 | const CPseudoBox = { 21 | name: 'CPseudoBox', 22 | mixins: [createStyledAttrsMixin('CPseudoBox', true)], 23 | props: { 24 | as: { 25 | type: [String, Object], 26 | default: () => 'div' 27 | }, 28 | to: [String, Object] 29 | }, 30 | render (h) { 31 | return h(this.as, { 32 | props: { 33 | to: this.to 34 | }, 35 | class: this.className, 36 | on: this.listeners$, 37 | attrs: this.computedAttrs 38 | }, this.$slots.default) 39 | } 40 | } 41 | 42 | export default CPseudoBox 43 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPseudoBox/index.js: -------------------------------------------------------------------------------- 1 | import CPseudoBox from './CPseudoBox' 2 | export default CPseudoBox 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CPseudoBox/tests/CPseudoBox.test.js: -------------------------------------------------------------------------------- 1 | import CPseudoBox from '../' 2 | import { render, getTagName, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CPseudoBox }, 8 | template: `Box Works`, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | it('should render correctly', () => { 15 | const { asFragment } = renderComponent() 16 | expect(asFragment()).toMatchSnapshot() 17 | }) 18 | 19 | it('should change the style', () => { 20 | const inlineAttrs = ` 21 | d="flex" :w="['auto']" px="5" py="5" shadow="lg" 22 | my="5" mb="5" rounded="sm" font-family="body" 23 | background-color="blue.200" color="blue.700"` 24 | const { asFragment } = renderComponent({ inlineAttrs }) 25 | 26 | expect(asFragment()).toMatchSnapshot() 27 | }) 28 | 29 | it.each` 30 | as 31 | ${'header'} 32 | ${'p'}} 33 | `( 34 | 'should display Box with type as $as', 35 | ({ as }) => { 36 | const inlineAttrs = `as=${as}` 37 | const { asFragment } = renderComponent({ inlineAttrs }) 38 | expect(getTagName(screen.getByTestId('pseudobox'))).toEqual(as) 39 | expect(asFragment()).toMatchSnapshot() 40 | } 41 | ) 42 | 43 | // TODO: How to test _hover or focus styles? 44 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CRadio/index.js: -------------------------------------------------------------------------------- 1 | import CRadio from './CRadio' 2 | export default CRadio 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CRadioButtonGroup/index.js: -------------------------------------------------------------------------------- 1 | import CRadioButtonGroup from './CRadioButtonGroup' 2 | export default CRadioButtonGroup 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CRadioGroup/index.js: -------------------------------------------------------------------------------- 1 | import CRadioGroup from './CRadioGroup' 2 | export default CRadioGroup 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CReset/index.js: -------------------------------------------------------------------------------- 1 | import CReset from './CReset' 2 | export default CReset 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CReset/tests/CReset.test.js: -------------------------------------------------------------------------------- 1 | import CReset from '../' 2 | import { render } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CReset }, 8 | template: ``, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | describe('CReset.vue', () => { 15 | it('should render correctly', () => { 16 | const { asFragment } = renderComponent() 17 | 18 | expect(asFragment()).toMatchSnapshot() 19 | }) 20 | 21 | it('should inject global styles', () => { 22 | renderComponent() 23 | 24 | expect(document.head).toMatchSnapshot() 25 | }) 26 | 27 | it('should accept config prop', () => { 28 | const inlineAttrs = ':config="cssResetConfig"' 29 | const cssResetConfig = (_, defaults) => { 30 | const { light } = defaults 31 | return { 32 | ...defaults, light: { ...light, bg: 'pink', color: 'indigo', fontFamily: "'Comic Sans MS'" } 33 | } 34 | } 35 | 36 | renderComponent({ inlineAttrs, methods: { cssResetConfig } }) 37 | 38 | expect(document.head).toMatchSnapshot() 39 | }) 40 | }) 41 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSelect/index.js: -------------------------------------------------------------------------------- 1 | import CSelect from './CSelect' 2 | export default CSelect 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSelect/tests/CSelect.test.js: -------------------------------------------------------------------------------- 1 | import { CSelect } from '../..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | data: () => ({ value: 'option1' }), 8 | components: { CSelect }, 9 | template: ` 10 | 11 | 12 | 13 | `, 14 | ...props 15 | } 16 | return render(base) 17 | } 18 | 19 | test('should render correctly', () => { 20 | const { asFragment } = renderComponent() 21 | expect(asFragment()).toMatchSnapshot() 22 | }) 23 | 24 | test('disabled select renders correctly', () => { 25 | renderComponent({ inlineAttrs: 'isDisabled' }) 26 | const select = screen.getByRole('combobox') 27 | 28 | expect(select).toHaveAttribute('disabled') 29 | }) 30 | 31 | test('passes the ID directly to the select and not to the wrapper', () => { 32 | renderComponent() 33 | const select = screen.getByRole('combobox') 34 | const selectWrapper = screen.getByTestId('select') 35 | 36 | expect(select).toHaveAttribute('id') 37 | expect(selectWrapper).not.toHaveAttribute('id') 38 | }) 39 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSelect/utils/select.utils.js: -------------------------------------------------------------------------------- 1 | import { camelize } from '../../utils' 2 | 3 | const rootOptions = { 4 | m: true, 5 | mt: true, 6 | mr: true, 7 | mb: true, 8 | ml: true, 9 | mx: true, 10 | my: true, 11 | margin: true, 12 | marginTop: true, 13 | marginBottom: true, 14 | marginLeft: true, 15 | marginRight: true, 16 | marginY: true, 17 | marginX: true, 18 | flex: true, 19 | flexBasis: true, 20 | width: true, 21 | minWidth: true, 22 | maxWidth: true, 23 | maxW: true, 24 | minW: true, 25 | w: true, 26 | zIndex: true, 27 | top: true, 28 | right: true, 29 | bottom: true, 30 | left: true, 31 | position: true, 32 | pos: true 33 | } 34 | 35 | /** 36 | * Splits all input[type="select"] props from the root node props 37 | * @param {Object} props Props object 38 | * @returns {Array} 39 | */ 40 | const splitProps = (props) => { 41 | const rootProps = {} 42 | const selectProps = {} 43 | for (const key in props) { 44 | const _key = camelize(key) 45 | if (rootOptions[_key]) { 46 | rootProps[_key] = props[key] 47 | } else { 48 | selectProps[_key] = props[key] 49 | } 50 | } 51 | return [rootProps, selectProps] 52 | } 53 | 54 | export default splitProps 55 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSimpleGrid/CSimpleGrid.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue Simple Grid 3 | * 4 | * SimpleGrid provides a friendly interface to create 5 | * responsive grid layouts with ease. 6 | * 7 | * @see Docs https://vue.chakra-ui.com/simplegrid 8 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CSimpleGrid/CSimpleGrid.js 9 | */ 10 | 11 | import { CGrid } from '../CGrid' 12 | import { SNA } from '../config/props.types' 13 | import { createStyledAttrsMixin } from '../utils' 14 | import { countToColumns, widthToColumns } from './utils/grid.styles' 15 | 16 | /** 17 | * CSimpleGrid component 18 | * 19 | * The simple grid component provides basic grid functionalities. 20 | * 21 | * @extends CGrid 22 | * @see Docs https://vue.chakra-ui.com/select 23 | */ 24 | const CSimpleGrid = { 25 | name: 'CSimpleGrid', 26 | mixins: [createStyledAttrsMixin('CSimpleGrid')], 27 | props: { 28 | columns: SNA, 29 | spacingX: SNA, 30 | spacingY: SNA, 31 | spacing: SNA, 32 | minChildWidth: SNA 33 | }, 34 | computed: { 35 | templateColumns () { 36 | return this.minChildWidth 37 | ? widthToColumns(this.minChildWidth) 38 | : countToColumns(this.columns) 39 | } 40 | }, 41 | render (h) { 42 | return h(CGrid, { 43 | class: this.className, 44 | props: { 45 | gap: this.spacing, 46 | columnGap: this.spacingX, 47 | rowGap: this.spacingY, 48 | templateColumns: this.templateColumns 49 | }, 50 | attrs: this.computedAttrs 51 | }, this.$slots.default) 52 | } 53 | } 54 | 55 | export default CSimpleGrid 56 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSimpleGrid/CSimpleGrid.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CSimpleGrid, CBox } from '..' 3 | 4 | storiesOf('UI | Simple Grid component', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CSimpleGrid, CBox }, 7 | template: ` 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ` 19 | })) 20 | .add('Responsive values', () => ({ 21 | components: { CSimpleGrid, CBox }, 22 | template: ` 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | ` 33 | })) 34 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSimpleGrid/index.js: -------------------------------------------------------------------------------- 1 | import CSimpleGrid from './CSimpleGrid' 2 | export default CSimpleGrid 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSimpleGrid/utils/grid.styles.js: -------------------------------------------------------------------------------- 1 | /** 2 | * These helper functions are modified versions of the amazing work done by rebass library abd chakra-ui 3 | * https://github.com/rebassjs/rebass/blob/master/packages/layout/src/index.js 4 | */ 5 | 6 | const px = n => (typeof n === 'number' ? n + 'px' : n) 7 | 8 | export const widthToColumns = (width) => { 9 | if (Array.isArray(width)) { 10 | return width.map(widthToColumns) 11 | } 12 | 13 | if ( 14 | width !== null && 15 | typeof width === 'object' && 16 | Object.keys(width).length > 0 17 | ) { 18 | const acc = {} 19 | for (const key in width) { 20 | acc[key] = `repeat(auto-fit, minmax(${px(width[key])}, 1fr))` 21 | } 22 | return acc 23 | } 24 | 25 | if (width != null) { 26 | return `repeat(auto-fit, minmax(${px(width)}, 1fr))` 27 | } 28 | 29 | return null 30 | } 31 | 32 | export const countToColumns = (count) => { 33 | if (Array.isArray(count)) { 34 | return count.map(countToColumns) 35 | } 36 | 37 | if ( 38 | count !== null && 39 | typeof count === 'object' && 40 | Object.keys(count).length > 0 41 | ) { 42 | const acc = {} 43 | for (const key in count) { 44 | acc[key] = `repeat(${count[key]}, 1fr)` 45 | } 46 | return acc 47 | } 48 | 49 | if (count != null) { 50 | return `repeat(${count}, 1fr)` 51 | } 52 | 53 | return null 54 | } 55 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSkipNav/index.js: -------------------------------------------------------------------------------- 1 | export * from './CSkipNav' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSlider/CSlider.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CBox, CSlider, CSliderTrack, CSliderFilledTrack, CSliderThumb, CIcon } from '..' 3 | 4 | storiesOf('UI | Slider', module) 5 | .add('Basic Usage', () => ({ 6 | components: { CBox, CSlider, CSliderTrack, CSliderFilledTrack, CSliderThumb }, 7 | template: ` 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ` 16 | })) 17 | .add('Customized Slider', () => ({ 18 | components: { CBox, CIcon, CSlider, CSliderTrack, CSliderFilledTrack, CSliderThumb }, 19 | template: ` 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ` 30 | })) 31 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSlider/index.js: -------------------------------------------------------------------------------- 1 | import CSlider from './CSlider' 2 | export default CSlider 3 | export * from './CSlider' 4 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSlider/utils/slider.utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Conforms a value to provided precision 3 | * @param {Value} value Value 4 | * @param {Number} step step 5 | * @returns {Number} Precise value 6 | */ 7 | function makeValuePrecise (value, step) { 8 | const stepDecimalPart = step.toString().split('.')[1] 9 | const stepPrecision = stepDecimalPart ? stepDecimalPart.length : 0 10 | return Number(value.toFixed(stepPrecision)) 11 | } 12 | 13 | /** 14 | * Rounds off a value to the nearest step 15 | * @param {Number} value Value 16 | * @param {Number} step step 17 | * @returns {Number} rounded value 18 | */ 19 | export function roundValueToStep (value, step) { 20 | return makeValuePrecise(Math.round(value / step) * step, step) 21 | } 22 | 23 | /** 24 | * Clamps provided value within domain 25 | * @param {Number} val Value 26 | * @param {Number} min Minimum value 27 | * @param {Number} max Maximum value 28 | * @returns {Number} clamped value 29 | */ 30 | export function clampValue (val, min, max) { 31 | if (val > max) { 32 | return max 33 | } 34 | if (val < min) { 35 | return min 36 | } 37 | return val 38 | } 39 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSpinner/CSpinner.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CSpinner, CStack } from '..' 3 | 4 | const components = { CSpinner, CStack } 5 | 6 | storiesOf('UI | Spinner', module) 7 | .add('Basic Usage', () => ({ 8 | components, 9 | template: ` 10 | 11 | ` 12 | })) 13 | .add('With color', () => ({ 14 | components, 15 | template: ` 16 | 17 | ` 18 | })) 19 | .add('With size', () => ({ 20 | components, 21 | template: ` 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ` 30 | })) 31 | .add('With empty color area', () => ({ 32 | components, 33 | template: ` 34 | 41 | ` 42 | })) 43 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSpinner/index.js: -------------------------------------------------------------------------------- 1 | import Spinner from './CSpinner' 2 | export default Spinner 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CStack/index.js: -------------------------------------------------------------------------------- 1 | import CStack from './CStack' 2 | export default CStack 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CStat/CStat.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CStat, CStatGroup, CStatLabel, CStatNumber, CStatHelperText, CStatArrow } from '..' 3 | 4 | storiesOf('UI | Stat', module) 5 | .add('Basic usage', () => ({ 6 | components: { CStat, CStatLabel, CStatNumber, CStatHelperText }, 7 | template: ` 8 |
9 | 10 | Collected Fees 11 | £0.00 12 | Feb 12 - Feb 28 13 | 14 |
15 | ` 16 | })) 17 | .add('With indicators', () => ({ 18 | components: { CStat, CStatGroup, CStatLabel, CStatNumber, CStatHelperText, CStatArrow }, 19 | template: ` 20 |
21 | 22 | 23 | Sent 24 | 345,670 25 | 26 | 27 | 23.36% 28 | 29 | 30 | 31 | 32 | Clicked 33 | 45 34 | 35 | 36 | 9.05% 37 | 38 | 39 | 40 |
41 | ` 42 | })) 43 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CStat/index.js: -------------------------------------------------------------------------------- 1 | export * from './CStat' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CStat/tests/CStat.test.js: -------------------------------------------------------------------------------- 1 | import { CStat, CStatLabel, CStatNumber, CStatHelperText, CStatArrow } from '..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const base = { 6 | components: { CStat, CStatLabel, CStatNumber, CStatHelperText, CStatArrow }, 7 | template: ` 8 | 9 | Collected Fees 10 | £0.00 11 | Feb 12 - Feb 28 12 | 13 | `, 14 | ...props 15 | } 16 | return render(base) 17 | } 18 | 19 | it('should render correctly', () => { 20 | const { asFragment } = renderComponent() 21 | expect(asFragment()).toMatchSnapshot() 22 | }) 23 | 24 | it('should render children in DOM', () => { 25 | renderComponent() 26 | expect(screen.getByText('Collected Fees')).toBeInTheDocument() 27 | }) 28 | 29 | test('"CStatArrow" should display corresponding icon for "type" prop', () => { 30 | const types = ['increase', 'decrease'] 31 | const withTypeFragment = (type) => { 32 | const { asFragment } = renderComponent({ 33 | template: ` 34 | 35 | Sent 36 | 345,670 37 | 38 | 39 | 23.36% 40 | 41 | 42 | ` 43 | }) 44 | return asFragment 45 | } 46 | types.forEach(type => expect(withTypeFragment(type)()).toMatchSnapshot()) 47 | }) 48 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CSwitch/index.js: -------------------------------------------------------------------------------- 1 | import CSwitch from './CSwitch' 2 | export default CSwitch 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTabs/index.js: -------------------------------------------------------------------------------- 1 | export * from './CTabs' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTag/index.js: -------------------------------------------------------------------------------- 1 | export * from './CTag' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CText/CText.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue Text 3 | * 4 | * Text is the used to render text and paragraphs within an interface. It renders a

tag by default. 5 | * 6 | * @see Docs https://vue.chakra-ui.com/text 7 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CText/CText.js 8 | */ 9 | 10 | import { createStyledAttrsMixin } from '../utils' 11 | import { useTruncated } from './utils/text.utils' 12 | 13 | /** 14 | * CText component 15 | * 16 | * the text element component 17 | * 18 | * @see Docs https://vue.chakra-ui.com/text 19 | */ 20 | const CText = { 21 | name: 'CText', 22 | mixins: [createStyledAttrsMixin('CText')], 23 | props: { 24 | as: { 25 | type: [String, Array], 26 | default: 'p' 27 | }, 28 | isTruncated: Boolean, 29 | fontFamily: { 30 | type: [String, Array], 31 | default: 'body' 32 | } 33 | }, 34 | computed: { 35 | componentStyles () { 36 | return { 37 | fontFamily: this.as === 'kbd' ? 'mono' : this.fontFamily, 38 | ...this.isTruncated && useTruncated() 39 | } 40 | } 41 | }, 42 | render (h) { 43 | return h(this.as, { 44 | class: this.className, 45 | attrs: this.computedAttrs 46 | }, this.$slots.default) 47 | } 48 | } 49 | 50 | export default CText 51 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CText/index.js: -------------------------------------------------------------------------------- 1 | import CText from './CText' 2 | export default CText 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CText/tests/CText.test.js: -------------------------------------------------------------------------------- 1 | import CText from '..' 2 | import { render, screen } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | components: { CText }, 8 | template: `Text Works`, 9 | ...props 10 | } 11 | return render(base) 12 | } 13 | 14 | it('should render correctly', () => { 15 | const { asFragment } = renderComponent() 16 | 17 | expect(asFragment()).toMatchSnapshot() 18 | }) 19 | 20 | it('should change the style', () => { 21 | const inlineAttrs = 'd="flex"' 22 | const { asFragment } = renderComponent({ inlineAttrs }) 23 | 24 | const text = screen.getByTestId('text') 25 | 26 | expect(asFragment()).toMatchSnapshot() 27 | expect(text).toHaveStyle('display: flex') 28 | }) 29 | 30 | it.each` 31 | as 32 | ${'u'} 33 | ${'abbr'} 34 | ${'cite'} 35 | ${'del'} 36 | ${'em'} 37 | ${'ins'} 38 | ${'kbd'} 39 | ${'mark'} 40 | ${'s'} 41 | ${'sub'} 42 | ${'sup'}} 43 | `( 44 | 'should display text type as $as', 45 | ({ as }) => { 46 | const inlineAttrs = `as=${as}` 47 | renderComponent({ inlineAttrs }) 48 | const text = screen.getByTestId('text') 49 | expect(text.tagName.toLowerCase()).toEqual(as) 50 | } 51 | ) 52 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CText/tests/__snapshots__/CText.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should change the style 1`] = ` 4 | 5 | .emotion-0 { 6 | font-family: var(--chakra-fonts-body); 7 | display: -webkit-box; 8 | display: -webkit-flex; 9 | display: -ms-flexbox; 10 | display: flex; 11 | } 12 | 13 |

18 | Text Works 19 |

20 | 21 | `; 22 | 23 | exports[`should render correctly 1`] = ` 24 | 25 | .emotion-0 { 26 | font-family: var(--chakra-fonts-body); 27 | } 28 | 29 |

34 | Text Works 35 |

36 |
37 | `; 38 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CText/utils/text.utils.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Returns truncation style props for text elements. 4 | * @todo Add line-clamp features for text. 5 | */ 6 | export const useTruncated = () => ({ 7 | overflow: 'hidden', 8 | textOverflow: 'ellipsis', 9 | whiteSpace: 'nowrap' 10 | }) 11 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTextarea/CTextarea.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { action } from '@storybook/addon-actions' 3 | import { CBox, CTextarea } from '..' 4 | 5 | storiesOf('UI | Textarea', module) 6 | .add('Basic Usage', () => ({ 7 | components: { CBox, CTextarea }, 8 | template: ` 9 | 10 | 20 | 21 | `, 22 | data () { 23 | return { 24 | textareaContent: 'Jonathan Bakebwa is awesome' 25 | } 26 | }, 27 | methods: { 28 | action: action() 29 | } 30 | })) 31 | .add('Basic Usage with Event', () => ({ 32 | components: { CBox, CTextarea }, 33 | template: ` 34 | 35 | 45 | 46 | `, 47 | data () { 48 | return { 49 | textareaContent: 'Jonathan Bakebwa is awesome' 50 | } 51 | }, 52 | methods: { 53 | action: action(), 54 | handleChange (e) { 55 | this.textareaContent = 'You are beautiful :)' 56 | } 57 | } 58 | })) 59 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTextarea/index.js: -------------------------------------------------------------------------------- 1 | import CTextarea from './CTextarea' 2 | export default CTextarea 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTextarea/tests/CTextarea.test.js: -------------------------------------------------------------------------------- 1 | import { CTextarea } from '../..' 2 | import { render, screen, userEvent } from '@/tests/test-utils' 3 | 4 | const renderComponent = (props) => { 5 | const inlineAttrs = (props && props.inlineAttrs) || '' 6 | const base = { 7 | data: () => ({ text: 'hello' }), 8 | components: { CTextarea }, 9 | template: ``, 10 | ...props 11 | } 12 | return render(base) 13 | } 14 | 15 | test('should render correctly', () => { 16 | const { asFragment } = renderComponent() 17 | expect(asFragment()).toMatchSnapshot() 18 | }) 19 | 20 | test('v-model works', () => { 21 | renderComponent() 22 | const textarea = screen.getByTestId('textarea') 23 | 24 | userEvent.type(textarea, ' world') 25 | expect(textarea).toHaveValue('hello world') 26 | }) 27 | 28 | test('readonly textarea renders correctly', () => { 29 | renderComponent({ inlineAttrs: 'isReadOnly' }) 30 | const textarea = screen.getByTestId('textarea') 31 | 32 | expect(textarea).toHaveAttribute('readonly') 33 | }) 34 | 35 | test('disabled textarea renders correctly', () => { 36 | renderComponent({ inlineAttrs: 'isDisabled' }) 37 | const textarea = screen.getByTestId('textarea') 38 | 39 | expect(textarea).toHaveAttribute('disabled') 40 | }) 41 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CThemeProvider/index.js: -------------------------------------------------------------------------------- 1 | import CThemeProvider from './CThemeProvider' 2 | export default CThemeProvider 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CToast/CToast.d.ts: -------------------------------------------------------------------------------- 1 | interface ChakraToastOptions { 2 | position?: 'bottom' | 'top' | 'right' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' 3 | duration?: number 4 | render?: (options: { onClose?: VoidFunction, id: any }) => any 5 | title?: string 6 | description?: string 7 | status?: 'info' | 'warning' | 'success' | 'error' 8 | variant?: 'solid' | 'subtle' | 'top-accent' | 'left-accent' 9 | isClosable?: boolean 10 | } 11 | 12 | export type ToastFactory = (options: ChakraToastOptions) => void 13 | 14 | export function useToast(): ToastFactory 15 | 16 | export default useToast 17 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CToast/index.d.ts: -------------------------------------------------------------------------------- 1 | import CToast from './CToast' 2 | export default CToast 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CToast/index.js: -------------------------------------------------------------------------------- 1 | import CToast from './CToast' 2 | export default CToast 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTooltip/CTooltip.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | import { CReset, CTooltip, CText, CButton, CLink } from '..' 3 | 4 | storiesOf('UI | Tooltip', module) 5 | .add('With text element', () => ({ 6 | components: { CReset, CText, CTooltip, CLink }, 7 | template: ` 8 |
9 | Hello World! 10 | 11 | @codebender828 12 | 13 | will be joining us today! 14 | 15 |
16 | ` 17 | })) 18 | .add('With custom focusable element', () => ({ 19 | components: { CReset, CTooltip, CButton }, 20 | template: ` 21 |
22 | 23 | 24 | Delete Account 25 | 26 |
27 | ` 28 | })) 29 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTooltip/index.js: -------------------------------------------------------------------------------- 1 | import CTooltip from './CTooltip' 2 | export default CTooltip 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTooltip/tooltip.test.js: -------------------------------------------------------------------------------- 1 | describe('Tooltip tests', () => { 2 | it.todo('should display tooltip for test nodes') 3 | it.todo('should display tooltip for component children') 4 | it.todo('should announce tooltip value with screenreader for ally') 5 | it.todo('should place tooltip in corresponding placement') 6 | it.todo('should style tooltip accordingly') 7 | it.todo('should display tooltip with arrow') 8 | it.todo('should insert tooltip in portal') 9 | }) 10 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CTransition/index.js: -------------------------------------------------------------------------------- 1 | export * from './Transition' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CVisuallyHidden/CVisuallyHidden.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hey! Welcome to @chakra-ui/vue VisuallyHidden 3 | * 4 | * This component is used to visually hide elements that have custom 5 | * appearance. For example, see the CControlBox. 6 | * 7 | * @see Source https://github.com/chakra-ui/chakra-ui-vue/blob/master/packages/chakra-ui-core/src/CVisuallyHidden/CVisuallyHidden.js 8 | */ 9 | 10 | import { css } from '@emotion/css' 11 | 12 | /** 13 | * CVisuallyHidden component 14 | * 15 | * the visually hidden wrapper element 16 | */ 17 | const CVisuallyHidden = { 18 | name: 'CVisuallyHidden', 19 | functional: true, 20 | props: { 21 | as: { 22 | type: String, 23 | default: 'div' 24 | } 25 | }, 26 | render (h, { props, data, slots, listeners, ...rest }) { 27 | const { attrs, domProps, on } = data 28 | const className = css({ 29 | border: '0px', 30 | clip: 'rect(0px, 0px, 0px, 0px)', 31 | height: `${(attrs && attrs.w) || '1px'}`, 32 | width: `${(attrs && attrs.h) || '1px'}`, 33 | margin: '-1px', 34 | padding: '0px', 35 | overflow: 'hidden', 36 | whiteSpace: 'nowrap', 37 | position: `${(attrs && attrs.pos) || 'absolute'}` 38 | }) 39 | 40 | return h(props.as, { 41 | class: [className], 42 | attrs: { 43 | ...(attrs || {}), 44 | 'data-chakra-component': 'CVisuallyHidden' 45 | }, 46 | domProps, 47 | on: { 48 | ...listeners, 49 | ...on 50 | } 51 | }, slots().default) 52 | } 53 | } 54 | 55 | export default CVisuallyHidden 56 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/CVisuallyHidden/index.js: -------------------------------------------------------------------------------- 1 | import CVisuallyHidden from './CVisuallyHidden' 2 | export default CVisuallyHidden 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/Css/Css.js: -------------------------------------------------------------------------------- 1 | import { css } from '@chakra-ui/styled-system' 2 | 3 | /** 4 | * Build a CSS factory function, to create CSS object by given a theme 5 | * @param {Object} styleProps Styles object 6 | * @returns {Function} (theme) => CSSStyleObject 7 | */ 8 | const buildCssFn = styleProps => css(styleProps) 9 | export default buildCssFn 10 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/Css/index.js: -------------------------------------------------------------------------------- 1 | import Css from './Css' 2 | export default Css 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@babel/preset-env', 4 | 'env' 5 | ], 6 | env: { 7 | test: { 8 | plugins: [ 9 | 'transform-es2015-modules-commonjs', 10 | 'transform-vue-jsx' 11 | ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/config/index.js: -------------------------------------------------------------------------------- 1 | // to keep rollup work 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/config/props.types.js: -------------------------------------------------------------------------------- 1 | export const StringArray = [String, Array] 2 | export const SNA = [Number, String, Array, Object] 3 | export const StringNumber = [String, Number] 4 | export const ObjectArray = [Object, Array] 5 | export const ObjectFunction = [Object, Function] 6 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/directives/chakra.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue' 2 | 3 | storiesOf('Directives | Chakra', module) 4 | .add('Base usage - No arguments', () => ({ 5 | template: ` 6 |
7 |
Welcome to Chakra directive
8 |
9 | ` 10 | })) 11 | .add('With value | Styles object', () => ({ 12 | template: ` 13 |
14 |
21 |

Title

22 |

Text

23 |
24 |
25 | ` 26 | })) 27 | .add('With value | Function', () => ({ 28 | template: ` 29 |
30 |
39 |

Computed styles

40 |
41 |
42 | ` 43 | })) 44 | .add('Demo button', () => ({ 45 | template: ` 46 |
47 | 53 |
54 | ` 55 | })) 56 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/directives/index.js: -------------------------------------------------------------------------------- 1 | export { default as ClickOutsideDirective } from './clickoutside.directive' 2 | export * from './chakra.directive' 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/lib/index.js: -------------------------------------------------------------------------------- 1 | export { default as internalIcons } from './internal-icons' 2 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/__snapshots__/color-mode-observer.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`colorModeObserver \`colorModeObserver\` should provide and observe values 1`] = ` 4 | Object { 5 | "baseStyles": Object { 6 | "CButton": Object { 7 | "bg": "success", 8 | "borderRadius": "200px", 9 | "shadow": "inner", 10 | }, 11 | }, 12 | "colors": Object { 13 | "info": "#0000FF", 14 | }, 15 | "shadows": Object { 16 | "inner": "inset 0 2px 4px 0 rgba( 0, 0, 0, 0.06)", 17 | "outline": "0 0 0 3px rgba(66, 153, 225, 0.6)", 18 | }, 19 | } 20 | `; 21 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/__snapshots__/styled-system.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`__get should return correct value for given path 1`] = ` 4 | Object { 5 | "bg": "red.400", 6 | "color": "black", 7 | } 8 | `; 9 | 10 | exports[`__get should return correct value for given path 2`] = `"red.400"`; 11 | 12 | exports[`__get should return correct value for given path 3`] = `"black"`; 13 | 14 | exports[`__get should return correct value for given path 4`] = `"#ff0000"`; 15 | 16 | exports[`__get should return correct value for given path 5`] = ` 17 | Object { 18 | "bg": "red.400", 19 | "color": "black", 20 | } 21 | `; 22 | 23 | exports[`__get should return correct value for given path 6`] = `"red.400"`; 24 | 25 | exports[`__get should return correct value for given path 7`] = `"black"`; 26 | 27 | exports[`__get should return correct value for given path 8`] = `"#ff0000"`; 28 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/functions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Chains function arguments passed. 3 | * @param {...Function} funcs Functions to be chained 4 | */ 5 | export function createChainedFunction (...funcs) { 6 | return funcs.reduce( 7 | (acc, func) => { 8 | if (func == null) { 9 | return acc 10 | } 11 | 12 | return function chainedFunction (...args) { 13 | acc.apply(this, args) 14 | func.apply(this, args) 15 | } 16 | }, 17 | () => {} 18 | ) 19 | } 20 | 21 | /** 22 | * Computes a value if it's a function. Otherwise it returns the value 23 | * @param {Function|Any} value value to be computed 24 | * @param {Object|Any} props values to be passed as argument to function 25 | * @example 26 | * 27 | * const fn = (a, b) => a + b 28 | * const result = runIfFn(fn, 2,3) 29 | * console.log(result) // 5 30 | * 31 | * const obj = { m:3, p: 4 } 32 | * const withObj = runIfFn(obj, {m: 3}) 33 | * console.log(withObj) // { m:3, p: 4 } 34 | */ 35 | export const runIfFn = (value, ...props) => { 36 | if (typeof value === 'function') { 37 | return value(...props) 38 | } 39 | return value 40 | } 41 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/generators.js: -------------------------------------------------------------------------------- 1 | export function useId (size = 3) { 2 | let uuid = '' 3 | const dictionary = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' 4 | for (let i = 0; i < size; i++) { 5 | uuid += dictionary.charAt(Math.floor(Math.random() * dictionary.length)) 6 | } 7 | return uuid 8 | } 9 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export { default as Logger } from './logger' 2 | export { valueToPercent } from './transform' 3 | export { pickProperty as forwardProps } from './object' 4 | export * from './object' 5 | export * from './color' 6 | export { parsePackIcons } from './icons' 7 | export * from './dom' 8 | export * from './vdom' 9 | export * from './strings' 10 | export * from './generators' 11 | export * from './validators' 12 | export * from './functions' 13 | export * from './components' 14 | export * from './color-mode-observer' 15 | export * from './styled-system' 16 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/strings.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description Returns the substring after a certain character in a string. 3 | * @param {'String'} string 4 | * @param {'String'} char 5 | */ 6 | export function getSubstringAfterChar (string, char) { 7 | return string.slice(string.indexOf(char) + 1) 8 | } 9 | 10 | /** 11 | * @description Returns the substring before a certain character in a string. 12 | * @param {'String'} string 13 | * @param {'String'} char 14 | */ 15 | export function getSubstringBeforeChar (string, char) { 16 | return string.slice(0, string.indexOf(char)) 17 | } 18 | 19 | /** 20 | * Transforms a string to Kebab case 21 | * @param {String} text String to transform to kebab case 22 | */ 23 | export function kebabify (text) { 24 | return text && 25 | text 26 | .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) 27 | .map(x => x.toLowerCase()) 28 | .join('-') 29 | } 30 | 31 | /** 32 | * Converts a kebab-case string into camel case 33 | * @param {String} string 34 | */ 35 | export function camelize (string) { 36 | return string.replace(/[.-](\w|$)/g, function (_, x) { 37 | return x.toUpperCase() 38 | }) 39 | } 40 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/styled-system.js: -------------------------------------------------------------------------------- 1 | import { css } from '@chakra-ui/styled-system' 2 | 3 | /** 4 | * Existential getter function that can be used in any style declaration to get a value 5 | * from theme, with support for fallback values. This helps prevent errors from 6 | * throwing when a theme value is missing. 7 | * @param {Object} obj Theme property 8 | * @param {String} key Theme key 9 | * @param {String} def Definition if non-existent 10 | */ 11 | export const __get = (obj, key, def) => { 12 | const keys = key && key.split ? key.split('.') : [key] 13 | 14 | return ( 15 | keys.reduce((res, key) => res && res[key], obj) || def 16 | ) 17 | } 18 | 19 | export const composeSystem = (props = {}, theme = {}) => css(props)(theme) 20 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/transform.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Converts value to percentage 3 | * @param {Number} value Value 4 | * @param {Number} min Minimum value 5 | * @param {Number} max Maximum value 6 | * @returns {Number} Percentage value 7 | */ 8 | export function valueToPercent (value, min, max) { 9 | return ((value - min) * 100) / (max - min) 10 | } 11 | 12 | /** 13 | * Converts percentage to value 14 | * @param {Number} percent Percentage Value 15 | * @param {Number} min Minimum value 16 | * @param {Number} max Maximum value 17 | * @returns {Number} Numerical value 18 | */ 19 | export function percentToValue (percent, min, max) { 20 | return (max - min) * percent + min 21 | } 22 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/src/utils/validators.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a value is undefined 3 | * @param {*} v 4 | * @returns {Boolean} 5 | */ 6 | export function isUndef (v) { 7 | return v === undefined || v === null 8 | } 9 | 10 | /** 11 | * Checks if a value is defined 12 | * @param {*} v 13 | * @returns {Boolean} 14 | */ 15 | export function isDef (v) { 16 | return v !== undefined && v !== null 17 | } 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/types/chakra.d.ts: -------------------------------------------------------------------------------- 1 | import { PluginObject } from "vue" 2 | import { IconPack } from "@fortawesome/fontawesome-common-types" 3 | import { Theme } from "../../chakra-ui-theme/types" 4 | 5 | export type Icon = { 6 | path: string 7 | viewBox?: string 8 | attrs?: any 9 | } 10 | 11 | export type Options = { 12 | extendTheme: Theme 13 | icons: { 14 | extend: { [name: string]: Icon } 15 | iconPack: string 16 | iconSet: IconPack 17 | } 18 | } 19 | 20 | export type ChakraPlugin = PluginObject 21 | 22 | declare let chakra: ChakraPlugin 23 | export default chakra 24 | -------------------------------------------------------------------------------- /packages/chakra-ui-core/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import Chakra, { Icon } from "./chakra" 2 | import { Theme } from "../../chakra-ui-theme/types" 3 | import useToast from "../src/CToast" 4 | import { ToastFactory } from '../src/CToast/CToast' 5 | 6 | type ChakraIcons = { [name: string]: Icon }; 7 | 8 | declare module 'vue/types/vue' { 9 | export interface Vue { 10 | $toast: ToastFactory 11 | $chakra: { 12 | theme: Theme 13 | icons: ChakraIcons 14 | } 15 | } 16 | } 17 | 18 | declare module '../src/CColorModeProvider' { 19 | export interface Provides { 20 | $chakraColorMode: () => 'light' | 'dark' 21 | $toggleColorMode: () => void 22 | } 23 | } 24 | 25 | declare module '../src/CThemeProvider' { 26 | export interface Provides { 27 | $chakraTheme: Theme 28 | $chakraIcons: ChakraIcons 29 | $chakraColorMode: () => 'light' 30 | } 31 | } 32 | 33 | export { Provides as CColorModeProvides } from '../src/CColorModeProvider' 34 | export { Provides as CThemeProvides } from '../src/CThemeProvider' 35 | 36 | export const useToast: typeof useToast 37 | export const defaultTheme: Theme 38 | export * from './component' 39 | export { ChakraPlugin, Options } from './chakra' 40 | export default Chakra 41 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Kelvin Omereshone 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 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | [ 4 | '@babel/preset-env', 5 | { 6 | targets: { 7 | esmodules: true 8 | } 9 | } 10 | ] 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/autoimport/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/autoimport/nuxt.config.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require('path') 2 | const theme = require('./utils/theme') 3 | 4 | module.exports = { 5 | rootDir: resolve(__dirname, '../..'), 6 | buildDir: resolve(__dirname, '.nuxt'), 7 | srcDir: __dirname, 8 | modules: [ 9 | { handler: require('../../lib/module') }, 10 | { handler: require('@nuxtjs/emotion') } 11 | ], 12 | chakra: { 13 | extendTheme: theme 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/autoimport/pages/directive.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 65 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/autoimport/utils/theme.js: -------------------------------------------------------------------------------- 1 | const customTheme = { 2 | colors: { 3 | brand: { 4 | 50: '#daffff', 5 | 100: '#b1fbfb', 6 | 200: '#85f7f7', 7 | 300: '#58f3f3', 8 | 400: '#31f0f0', 9 | 500: '#1ed7d7', 10 | 600: '#0ca7a7', 11 | 700: '#007777', 12 | 800: '#004949', 13 | 900: '#001a1a' 14 | } 15 | } 16 | } 17 | 18 | module.exports = customTheme 19 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/base/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 13 | 31 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/base/nuxt.config.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require('path') 2 | const theme = require('./utils/theme') 3 | 4 | module.exports = { 5 | rootDir: resolve(__dirname, '../..'), 6 | buildDir: resolve(__dirname, '.nuxt'), 7 | srcDir: __dirname, 8 | modules: [ 9 | { handler: require('../../lib/module') }, 10 | { handler: require('@nuxtjs/emotion') } 11 | ], 12 | chakra: { 13 | config: { 14 | autoImport: false 15 | }, 16 | extendTheme: theme 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/base/pages/directive.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 65 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/example/base/utils/theme.js: -------------------------------------------------------------------------------- 1 | const customTheme = { 2 | colors: { 3 | brand: { 4 | 50: '#daffff', 5 | 100: '#b1fbfb', 6 | 200: '#85f7f7', 7 | 300: '#58f3f3', 8 | 400: '#31f0f0', 9 | 500: '#1ed7d7', 10 | 600: '#0ca7a7', 11 | 700: '#007777', 12 | 800: '#004949', 13 | 900: '#001a1a' 14 | } 15 | } 16 | } 17 | 18 | module.exports = customTheme 19 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'node', 3 | collectCoverage: true, 4 | collectCoverageFrom: [ 5 | 'lib/**/*.js', 6 | '!lib/plugin.js' 7 | ], 8 | moduleNameMapper: { 9 | '^~/(.*)$': '/lib/$1', 10 | '^~~$': '', 11 | '^@@$': '', 12 | '^@/(.*)$': '/lib/$1' 13 | }, 14 | transform: { 15 | '^.+\\.js$': 'babel-jest' 16 | }, 17 | testMatch: [ 18 | '**/**/*.spec.(js|jsx|ts|tsx)' 19 | ], 20 | transformIgnorePatterns: ['node_modules/(?!(lodash-es|@chakra-ui/vue|@nuxtjs/emotion))'] 21 | } 22 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@chakra-ui/nuxt", 3 | "version": "0.7.0", 4 | "description": "Chakra UI Module for Nuxt.js", 5 | "repository": "https://github.com/chakra-ui/chakra-ui-vue", 6 | "license": "MIT", 7 | "contributors": [ 8 | { 9 | "name": "Kelvin Omereshone " 10 | } 11 | ], 12 | "files": ["lib"], 13 | "main": "lib/module.js", 14 | "types": "types/index.d.ts", 15 | "scripts": { 16 | "dev": "nuxt example/base", 17 | "lint": "eslint --ext .js,.vue .", 18 | "release": "yarn test && standard-version", 19 | "test": "jest" 20 | }, 21 | "dependencies": { 22 | "@chakra-ui/theme-vue": "^0.6.0", 23 | "@chakra-ui/vue": "^0.13.0", 24 | "@emotion/css": "^11.0.0", 25 | "chakra-loader": "latest" 26 | }, 27 | "peerDependencies": { 28 | "@nuxtjs/emotion": "0.1.0", 29 | "defu": ">=6.0.0" 30 | }, 31 | "devDependencies": { 32 | "@babel/core": "^7.9.6", 33 | "@babel/preset-env": "^7.15.0", 34 | "@commitlint/cli": "^8.3.5", 35 | "@commitlint/config-conventional": "^8.3.4", 36 | "@nuxtjs/emotion": "^0.1.0", 37 | "@nuxtjs/eslint-config": "^3.0.0", 38 | "@nuxtjs/module-test-utils": "latest", 39 | "babel-eslint": "^10.1.0", 40 | "babel-jest": "^25.5.1", 41 | "core-js": "^3.15.1", 42 | "eslint": "^7.12.1", 43 | "husky": "^4.2.5", 44 | "jest": "^25.5.2", 45 | "nuxt": "^2.15.7", 46 | "standard-version": "^8.0.1" 47 | }, 48 | "publishConfig": { 49 | "access": "public" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@nuxtjs" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/test/auto-import.spec.js: -------------------------------------------------------------------------------- 1 | const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils') 2 | const customTheme = require('../example/autoimport/utils/theme') 3 | 4 | describe('module', () => { 5 | let nuxt 6 | 7 | beforeAll(async () => { 8 | ({ nuxt } = await setup(loadConfig(__dirname, '../../example/autoimport'))) 9 | }, 120000) 10 | 11 | afterAll(async () => { 12 | await nuxt.close() 13 | }) 14 | 15 | test('renders app', async () => { 16 | const html = await get('/') 17 | expect(html).toContain('⚡️ Hello chakra-ui/vue') 18 | }) 19 | 20 | test('renders ThemeProvider component', async () => { 21 | const html = await get('/') 22 | expect(html).toContain('data-chakra-component="CThemeProvider"') 23 | }) 24 | 25 | test('should accept extended variables nuxt config', async () => { 26 | const html = await get('/') 27 | expect(html).toContain(`data-test-custom-theme-color="${customTheme.colors.brand[200]}`) 28 | }) 29 | }) 30 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/test/base.spec.js: -------------------------------------------------------------------------------- 1 | const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils') 2 | const customTheme = require('../example/base/utils/theme') 3 | 4 | describe('module', () => { 5 | let nuxt 6 | 7 | beforeAll(async () => { 8 | ({ nuxt } = await setup(loadConfig(__dirname, '../../example/base'))) 9 | }, 120000) 10 | 11 | afterAll(async () => { 12 | await nuxt.close() 13 | }) 14 | 15 | test('renders app', async () => { 16 | const html = await get('/') 17 | expect(html).toContain('⚡️ Hello chakra-ui/vue') 18 | }) 19 | 20 | test('renders ThemeProvider component', async () => { 21 | const html = await get('/') 22 | expect(html).toContain('data-chakra-component="CThemeProvider"') 23 | }) 24 | 25 | test('should accept extended variables nuxt config', async () => { 26 | const html = await get('/') 27 | expect(html).toContain(`data-test-custom-theme-color="${customTheme.colors.brand[200]}`) 28 | }) 29 | }) 30 | -------------------------------------------------------------------------------- /packages/chakra-ui-nuxt/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import Chakra, { Icon } from "./chakra" 2 | import { Theme } from "../../chakra-ui-theme/types" 3 | import useToast from "../src/CToast" 4 | 5 | declare module '@nuxt/types' { 6 | interface Context { 7 | $toast?: ReturnType 8 | $chakra: { 9 | theme: Theme 10 | icons: { [name: string]: Icon } 11 | } 12 | } 13 | 14 | interface NuxtAppOptions { 15 | $toast?: ReturnType 16 | $chakra: { 17 | theme: Theme 18 | icons: { [name: string]: Icon } 19 | } 20 | } 21 | } 22 | 23 | declare module 'vue/types/vue' { 24 | interface Vue { 25 | $toast: ReturnType 26 | $chakra: { 27 | theme: Theme 28 | icons: { [name: string]: Icon } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@chakra-ui/theme-vue", 3 | "version": "0.6.0", 4 | "description": "Default theme for @chakra-ui/vue default theme object", 5 | "author": { 6 | "name": "Jonathan Bakebwa", 7 | "email": "codebender828@gmail.com", 8 | "url": "https://jbakebwa.dev" 9 | }, 10 | "keywords": [ 11 | "chakra", 12 | "ui", 13 | "vue", 14 | "theme" 15 | ], 16 | "homepage": "https://github.com/chakra-ui/chakra-ui-vue#readme", 17 | "license": "MIT", 18 | "main": "dist/index.js", 19 | "module": "src/index.js", 20 | "types": "types/index.d.ts", 21 | "files": [ 22 | "dist", 23 | "src" 24 | ], 25 | "publishConfig": { 26 | "access": "public" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/chakra-ui/chakra-ui-vue.git" 31 | }, 32 | "scripts": { 33 | "dev": "watch 'yarn build' src", 34 | "build": "yarn build:cjs && yarn build:esm", 35 | "build:cjs": "cross-env NODE_ENV=production BABEL_ENV=cjs babel src -d dist --copy-files", 36 | "build:esm": "cross-env NODE_ENV=production BABEL_ENV=esm babel src -d dist/esm --copy-files", 37 | "test": "echo \"Test: run test on theme\"" 38 | }, 39 | "babel": { 40 | "presets": [ 41 | "@babel/preset-env" 42 | ], 43 | "exclude": [ 44 | "node_modules" 45 | ] 46 | }, 47 | "bugs": { 48 | "url": "https://github.com/chakra-ui/chakra-ui-vue/issues" 49 | }, 50 | "gitHead": "cb7ffb7adeb926b99c75f195300d09780e8910e6" 51 | } 52 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/index.js: -------------------------------------------------------------------------------- 1 | import ChakraUITheme from './theme' 2 | export default ChakraUITheme 3 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/borders.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description These border styles were adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | const borders = { 5 | none: 0, 6 | '1px': '1px solid', 7 | '2px': '2px solid', 8 | '4px': '4px solid' 9 | } 10 | 11 | export const borderWidths = { 12 | sm: '1px', 13 | md: '2px', 14 | lg: '4px' 15 | } 16 | 17 | export default borders 18 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/breakpoints.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description These breakpoint styles were adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | 5 | const _breakpoints = { 6 | sm: '30em', 7 | md: '48em', 8 | lg: '62em', 9 | xl: '80em', 10 | '2xl': '96em' 11 | } 12 | 13 | export const createBreakpoints = ( 14 | config = {} 15 | ) => { 16 | return { base: '0em', ...config } 17 | } 18 | 19 | const breakpoints = createBreakpoints(_breakpoints) 20 | 21 | export default breakpoints 22 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/index.js: -------------------------------------------------------------------------------- 1 | import colors from './colors' 2 | import typography from './typography' 3 | import borders, { borderWidths } from './borders' 4 | import opacity from './opacity' 5 | import radii from './radii' 6 | import shadows from './shadows' 7 | import sizes, { baseSizes } from './sizes' 8 | import zIndices from './z-indices' 9 | import breakpoints from './breakpoints' 10 | 11 | const space = baseSizes 12 | 13 | const config = { 14 | useSystemColorMode: false, 15 | initialColorMode: 'light', 16 | cssVarPrefix: 'chakra' 17 | } 18 | 19 | const theme = { 20 | breakpoints, 21 | zIndices, 22 | radii, 23 | opacity, 24 | borders, 25 | colors, 26 | ...typography, 27 | borderWidths, 28 | sizes, 29 | shadows, 30 | space, 31 | config 32 | } 33 | 34 | export default theme 35 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/opacity.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description These opacity styles was adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | const opacity = { 5 | 0: '0', 6 | '20%': '0.2', 7 | '40%': '0.4', 8 | '60%': '0.6', 9 | '80%': '0.8', 10 | '100%': '1' 11 | } 12 | 13 | export default opacity 14 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/radii.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description These radii styles was adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | const radii = { 5 | none: '0', 6 | sm: '0.125rem', 7 | md: '0.25rem', 8 | lg: '0.5rem', 9 | full: '9999px' 10 | } 11 | 12 | export default radii 13 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/shadows.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description These shadow styles was adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | const shadows = { 5 | sm: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)', 6 | md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)', 7 | lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)', 8 | xl: 9 | '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)', 10 | '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)', 11 | outline: '0 0 0 3px rgba(66, 153, 225, 0.6)', 12 | inner: 'inset 0 2px 4px 0 rgba( 0, 0, 0, 0.06)', 13 | none: 'none' 14 | } 15 | 16 | export default shadows 17 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/sizes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description These sizes styles was adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | export const baseSizes = { 5 | px: '1px', 6 | 0: '0', 7 | 1: '0.25rem', 8 | 2: '0.5rem', 9 | 3: '0.75rem', 10 | 4: '1rem', 11 | 5: '1.25rem', 12 | 6: '1.5rem', 13 | 8: '2rem', 14 | 10: '2.5rem', 15 | 12: '3rem', 16 | 16: '4rem', 17 | 20: '5rem', 18 | 24: '6rem', 19 | 32: '8rem', 20 | 40: '10rem', 21 | 48: '12rem', 22 | 56: '14rem', 23 | 64: '16rem' 24 | } 25 | 26 | const largeSizes = { 27 | full: '100%', 28 | '3xs': '14rem', 29 | '2xs': '16rem', 30 | xs: '20rem', 31 | sm: '24rem', 32 | md: '28rem', 33 | lg: '32rem', 34 | xl: '36rem', 35 | '2xl': '42rem', 36 | '3xl': '48rem', 37 | '4xl': '56rem', 38 | '5xl': '64rem', 39 | '6xl': '72rem' 40 | } 41 | 42 | const containers = { 43 | sm: '640px', 44 | md: '768px', 45 | lg: '1024px', 46 | xl: '1280px' 47 | } 48 | 49 | const sizes = { 50 | ...baseSizes, 51 | ...largeSizes, 52 | containers 53 | } 54 | 55 | export default sizes 56 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/typography.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This typography style was adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | const typography = { 5 | letterSpacings: { 6 | tighter: '-0.05em', 7 | tight: '-0.025em', 8 | normal: '0', 9 | wide: '0.025em', 10 | wider: '0.05em', 11 | widest: '0.1em' 12 | }, 13 | lineHeights: { 14 | normal: 'normal', 15 | none: '1', 16 | shorter: '1.25', 17 | short: '1.375', 18 | base: '1.5', 19 | tall: '1.625', 20 | taller: '2' 21 | }, 22 | fontWeights: { 23 | hairline: 100, 24 | thin: 200, 25 | light: 300, 26 | normal: 400, 27 | medium: 500, 28 | semibold: 600, 29 | bold: 700, 30 | extrabold: 800, 31 | black: 900 32 | }, 33 | fonts: { 34 | heading: '-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', 35 | body: '-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', 36 | mono: 'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace' 37 | }, 38 | fontSizes: { 39 | xs: '0.75rem', 40 | sm: '0.875rem', 41 | md: '1rem', 42 | lg: '1.125rem', 43 | xl: '1.25rem', 44 | '2xl': '1.5rem', 45 | '3xl': '1.875rem', 46 | '4xl': '2.25rem', 47 | '5xl': '3rem', 48 | '6xl': '4rem' 49 | } 50 | } 51 | 52 | export default typography 53 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/utils/colors.js: -------------------------------------------------------------------------------- 1 | // Here we shall have files functions that manipulate colors based on the theme on a per component basis 2 | /** 3 | * An example would be in the `Badge` component 4 | * ```js 5 | * import { addOpacity } from '@/lib/theme/utils' 6 | * let foo = addOpacity('green') 7 | * ``` 8 | */ 9 | -------------------------------------------------------------------------------- /packages/chakra-ui-theme/src/theme/z-indices.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description This typography style was adapted from [@chakra-ui](https://chakra-ui.com/) 3 | */ 4 | const zIndices = { 5 | hide: -1, 6 | auto: 'auto', 7 | base: 0, 8 | docked: 10, 9 | dropdown: 1000, 10 | sticky: 1100, 11 | banner: 1200, 12 | overlay: 1300, 13 | modal: 1400, 14 | popover: 1500, 15 | skipLink: 1600, 16 | toast: 1700, 17 | tooltip: 1800 18 | } 19 | 20 | export default zIndices 21 | -------------------------------------------------------------------------------- /tests/test-utils/index.js: -------------------------------------------------------------------------------- 1 | export * from './test-utils' 2 | -------------------------------------------------------------------------------- /tests/test-utils/module-mock.js: -------------------------------------------------------------------------------- 1 | export default () => {} 2 | -------------------------------------------------------------------------------- /tests/test-utils/style-mock.js: -------------------------------------------------------------------------------- 1 | module.exports = {} 2 | -------------------------------------------------------------------------------- /website/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@vue/babel-preset-jsx" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /website/.eslintignore: -------------------------------------------------------------------------------- 1 | **/dist/* 2 | sw.js 3 | 4 | **/packages/chakra-ui-theme/* -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | .now -------------------------------------------------------------------------------- /website/.nowignore: -------------------------------------------------------------------------------- 1 | .nuxt -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # chakra-ui-docs 2 | 3 | > Chakra UI Vue documentation site 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | $ yarn install 10 | 11 | # serve with hot reload at localhost:3000 12 | $ yarn dev 13 | 14 | # build for production and launch server 15 | $ yarn build 16 | $ yarn start 17 | 18 | # generate static project 19 | $ yarn generate 20 | ``` 21 | 22 | For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). 23 | -------------------------------------------------------------------------------- /website/assets/logo/chakra-ui-vue-blue.svg: -------------------------------------------------------------------------------- 1 | chakra-ui-vue-bluechakra -------------------------------------------------------------------------------- /website/assets/logo/chakra-ui-vue-blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/assets/logo/chakra-ui-vue-blue@2x.png -------------------------------------------------------------------------------- /website/assets/logo/chakra-ui-vue-logo.svg: -------------------------------------------------------------------------------- 1 | chakra-ui-vue-logochakra -------------------------------------------------------------------------------- /website/assets/logo/chakra-ui-vue-logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/assets/logo/chakra-ui-vue-logo@2x.png -------------------------------------------------------------------------------- /website/components/FileContributors.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 39 | -------------------------------------------------------------------------------- /website/components/Lorem.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /website/components/MobileNav.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 54 | -------------------------------------------------------------------------------- /website/components/Sidebar.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 29 | -------------------------------------------------------------------------------- /website/components/code/code-group/code-tab.vue: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /website/components/code/index.js: -------------------------------------------------------------------------------- 1 | import CodeBlock from './code-block.vue' 2 | import LiveEditor from './live-editor/live-editor.vue' 3 | import CodeGroup from './code-group/code-group.vue' 4 | import CodeTab from './code-group/code-tab.vue' 5 | import { CopyTextMixin } from './mixins' 6 | 7 | const MDXCodeBlock = (props) => { 8 | const isReadOnly = !props.live 9 | const lang = props.className || props.lang || 'vue' 10 | 11 | return { 12 | name: 'CodeBlock', 13 | extend: CodeBlock, 14 | mixins: [CopyTextMixin], 15 | props: { 16 | ...CodeBlock.props, 17 | isReadOnly: { 18 | type: Boolean, 19 | default: isReadOnly 20 | }, 21 | lang: { 22 | type: String, 23 | default: lang 24 | } 25 | }, 26 | render: CodeBlock.render 27 | } 28 | } 29 | 30 | export { 31 | CodeBlock, 32 | CodeGroup, 33 | CodeTab, 34 | LiveEditor, 35 | MDXCodeBlock 36 | } 37 | -------------------------------------------------------------------------------- /website/components/code/mixins.js: -------------------------------------------------------------------------------- 1 | import copy from 'copy-to-clipboard' 2 | 3 | export const CopyTextMixin = { 4 | data () { 5 | return { 6 | text: undefined, 7 | copyTimeout: null, 8 | copyButtonText: 'Copy' 9 | } 10 | }, 11 | methods: { 12 | async copy () { 13 | // Copy text to clipboard 14 | await copy(this.text) 15 | 16 | // Handle timeouts for copy button text 17 | this.copyTimeout && clearTimeout(this.copyTimeout) 18 | 19 | this.copyButtonText = 'Copied!' 20 | this.copyTimeout = setTimeout(() => { 21 | this.copyButtonText = 'Copy' 22 | clearTimeout(this.copyTimeout) 23 | }, 1000) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /website/components/code/utils.js: -------------------------------------------------------------------------------- 1 | export function getLanguage (string) { 2 | return string.slice(string.indexOf('-') + 1) 3 | } 4 | 5 | export function tryParseBoolean (value) { 6 | if (typeof value === 'boolean') 7 | return value 8 | 9 | if (typeof value === 'string') 10 | return value.toLocaleLowerCase() === 'true' 11 | 12 | if (typeof value === 'number') 13 | return !!value 14 | 15 | return null 16 | } 17 | 18 | export function hasValue (value) { 19 | return ![null, undefined].includes(value) 20 | } 21 | -------------------------------------------------------------------------------- /website/components/components.js: -------------------------------------------------------------------------------- 1 | /** 2 | * NOTE: 3 | * 4 | * Dear maintainers, 5 | * Components listed in this file should be listed alphabetically. Thanks :) 6 | */ 7 | 8 | const components = [ 9 | 'Accordion', 10 | 'Alert', 11 | 'AlertDialog', 12 | 'AspectRatioBox', 13 | 'Avatar', 14 | 'Badge', 15 | 'Box', 16 | 'Breadcrumb', 17 | 'Button', 18 | 'Checkbox', 19 | 'CircularProgress', 20 | 'CloseButton', 21 | 'Code', 22 | 'Collapse', 23 | 'ControlBox', 24 | 'Divider', 25 | 'Drawer', 26 | 'Editable', 27 | 'Flex', 28 | 'FormControl', 29 | 'Grid', 30 | 'Heading', 31 | 'Icon', 32 | 'IconButton', 33 | 'Image', 34 | 'Input', 35 | 'Link', 36 | 'List', 37 | 'Menu', 38 | 'Modal', 39 | 'NumberInput', 40 | 'Popover', 41 | 'Progress', 42 | 'PseudoBox', 43 | 'Radio', 44 | 'SimpleGrid', 45 | 'Select', 46 | 'Slider', 47 | 'Spinner', 48 | 'Stat', 49 | 'Stack', 50 | 'Switch', 51 | 'Tabs', 52 | 'Tag', 53 | 'Text', 54 | 'Textarea', 55 | 'Toast', 56 | 'Tooltip' 57 | ] 58 | export default components 59 | -------------------------------------------------------------------------------- /website/components/internal-icons.js: -------------------------------------------------------------------------------- 1 | export { default as icons } from '@chakra-ui/vue/src/lib/internal-icons' 2 | -------------------------------------------------------------------------------- /website/components/nav-links.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/components/nav-links.js -------------------------------------------------------------------------------- /website/css/fonts/Inter-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/css/fonts/Inter-Bold.woff2 -------------------------------------------------------------------------------- /website/css/fonts/Inter-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/css/fonts/Inter-Light.woff2 -------------------------------------------------------------------------------- /website/css/fonts/Inter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/css/fonts/Inter-Regular.woff2 -------------------------------------------------------------------------------- /website/css/fonts/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Inter'; 3 | font-style: normal; 4 | font-weight: 300; 5 | font-display: swap; 6 | src: url("Inter-Light.woff2?v=3.12") format("woff2"); 7 | } 8 | 9 | @font-face { 10 | font-family: 'Inter'; 11 | font-style: normal; 12 | font-weight: 400; 13 | font-display: swap; 14 | src: url("Inter-Regular.woff2?v=3.12") format("woff2"); 15 | 16 | } 17 | @font-face { 18 | font-family: 'Inter'; 19 | font-style: normal; 20 | font-weight: 700; 21 | font-display: swap; 22 | src: url("Inter-Bold.woff2?v=3.12") format("woff2"); 23 | } 24 | -------------------------------------------------------------------------------- /website/css/page.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | margin: 0; 4 | } 5 | 6 | a { 7 | color: #3caa79; 8 | } 9 | 10 | .prism-editor__code { 11 | padding-top: 16px; 12 | } -------------------------------------------------------------------------------- /website/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "~/*": ["./*"], 6 | "@/*": ["./*"], 7 | "~~/*": ["./*"], 8 | "@@/*": ["./*"] 9 | } 10 | }, 11 | "exclude": ["node_modules", ".nuxt", "dist"] 12 | } 13 | -------------------------------------------------------------------------------- /website/layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Application Layouts. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). 8 | -------------------------------------------------------------------------------- /website/layouts/home.vue: -------------------------------------------------------------------------------- 1 | 24 | 39 | -------------------------------------------------------------------------------- /website/modules/routes.js: -------------------------------------------------------------------------------- 1 | export default function (options = {}) { 2 | // Add 'mdx' to build extensions 3 | this.options.build.additionalExtensions = ['mdx'] 4 | 5 | if (this.options.extensions) { 6 | // Add `mdx` to `extensions` option 7 | const extensions = this.options.extensions 8 | !extensions.includes('mdx') && extensions.push('mdx') 9 | 10 | // Add 'mdx' to `build.additionalExtensions` 11 | this.options.build.additionalExtensions = ['mdx'] 12 | 13 | // Extend webpack config 14 | this.extendBuild((config) => { 15 | // Here we '.mdx' to webpack's `resolve.extensions` option. 16 | if (config.resolve.extensions) { 17 | config.resolve.extensions.push('.mdx') 18 | } else { 19 | config.resolve.extensions = ['.mdx'] 20 | } 21 | 22 | // Use `@mdx-js/vue-loader` for `.mdx` files. 23 | config.module.rules.push({ 24 | test: /\.mdx$/, 25 | use: [ 26 | 'babel-loader', 27 | '@mdx-js/vue-loader' 28 | ] 29 | }) 30 | }) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /website/now.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2 3 | } 4 | 5 | -------------------------------------------------------------------------------- /website/pages/accessibility.mdx: -------------------------------------------------------------------------------- 1 | # Accessibility 2 | 3 | Chakra UI is built from the ground up with accessibility in mind. We do the 4 | heavy-lifting for you in order to allow you to focus on building your applications. 5 | 6 | All authored components are compliant with the WAI-ARIA standards for authored components. 7 | 8 | 9 | 10 | We've taken the time to write a summarized description of the accessibility support for 11 | all authored components in @chakra-ui/vue. We called this document an accessibility report 12 | and can be found in the `accessibility.md` file in the respective component's source directory. 13 | 14 | You will also be able to find this file linked in the documentation pages of components that have 15 | an accessibility report. 16 | -------------------------------------------------------------------------------- /website/pages/code.mdx: -------------------------------------------------------------------------------- 1 | import SEO from "../components/SEO"; 2 | 3 | 7 | 8 | # Code 9 | 10 | Code is a component used to display inline code. It is composed of the 11 | [Box](/box) component with a font family of `mono` for displaying code. 12 | 13 | 14 | 15 | ## Import 16 | 17 | ```js 18 | import { CCode } from '@chakra-ui/vue'; 19 | ``` 20 | 21 | 22 | ## Usage 23 | 24 | ```vue live=true 25 | Hello world 26 | ``` 27 | 28 | ### Colors 29 | 30 | You can change the color scheme of the component by passing the `variantColor` 31 | prop. 32 | 33 | ```vue live=true 34 | 35 | console.log(welcome) 36 | var chakra = 'awesome!'> 37 | npm install chakra 38 | 39 | ``` 40 | 41 | ## Props 42 | 43 | | Name | Type | Default | Description | 44 | | -------------- | ----------------- | ------- | ------------------------------------- | 45 | | `variantColor` | `string` | | The color scheme to use for the code. | 46 | 47 | ## Slots 48 | | Name | Description | 49 | | ---------- | --------------------------------------------------------------------------------- | 50 | | default | Used for the `CCode` content | 51 | -------------------------------------------------------------------------------- /website/pages/divider.mdx: -------------------------------------------------------------------------------- 1 | # Divider 2 | 3 | Dividers are used to display a thin horizontal or vertical line. 4 | 5 | Divider composes `CBox` so you can use all the style props and add responsive 6 | styles as well. It renders an `
` tag by default. 7 | 8 | 9 | 10 | ## Import 11 | 12 | ```js 13 | import { CDivider } from "@chakra-ui/vue"; 14 | ``` 15 | 16 | ## Usage 17 | 18 | It renders a horizontal divider by default. 19 | 20 | ```vue live=true 21 | 22 | ``` 23 | 24 | ### Changing the orientation 25 | 26 | To change the orientation of the divider, pass the `orientation` prop and set it 27 | to either `vertical` or `horizontal` 28 | 29 | ```vue live=true 30 | 31 | Part 1 32 | 33 | Part 2 34 | 35 | ``` 36 | 37 | ### Changing the border-color 38 | 39 | To change the border color of the divider, as you can guess, pass the 40 | `borderColor` prop. 41 | 42 | ```vue live=true 43 | 44 | Part 1 45 | 46 | Part 2 47 | 48 | ``` 49 | 50 | ## Props 51 | 52 | The `CDivider` composes the [Box](/box) component, so you can pass all `CBox` props. 53 | 54 | | Name | Type | Default | Description | 55 | | ------------- | ------------------------ | ------------ | --------------- | 56 | | `orientation` | `horizontal`, `vertical` | `horizontal` | The orientation | 57 | -------------------------------------------------------------------------------- /website/pages/flex.mdx: -------------------------------------------------------------------------------- 1 | import SEO from "../components/SEO"; 2 | 3 | 7 | 8 | # Flex 9 | 10 | Flex is [Box](/box) with `display: flex` and comes with some helpful style shorthands. 11 | It renders a `div` element. 12 | 13 | 14 | 15 | ## Import 16 | 17 | ```js 18 | import { CFlex } from "@chakra-ui/vue"; 19 | ``` 20 | 21 | ## Usage 22 | 23 | When using the Flex component, you can use some of the following helpful shorthand props: 24 | 25 | - `direction` for `flexDirection` 26 | - `wrap` for `flexWrap` 27 | - `align` for `alignItems` 28 | - `justify` for `justifyContent` 29 | 30 | While you can pass the verbose props, using the shorthand can save you some 31 | time. 32 | 33 | ```vue live=true 34 | 35 | 36 | Box 1 37 | 38 | 39 | 40 | Box 2 41 | 42 | 43 | 44 | 45 | Box 3 46 | 47 | 48 | 49 | ``` 50 | 51 | ## Props 52 | 53 | > `CFlex` composes the `CBox` component with these extra props. So all Box props apply here. See Box component for list of props 54 | -------------------------------------------------------------------------------- /website/pages/recipes.mdx: -------------------------------------------------------------------------------- 1 | # Recipes (WIP) 2 | 3 | > This recipes page is still a WIP! 4 | 5 | Check out our Chakra UI Vue [starter projects](/starters) 6 | 7 | -------------------------------------------------------------------------------- /website/pages/starters.mdx: -------------------------------------------------------------------------------- 1 | import SEO from '../components/SEO' 2 | 3 | 7 | 8 | # Chakra UI Vue starters 9 | We've made some starter projects help you get started with Chakra UI Vue. 10 | 11 | 12 | 13 | - **[Vue Starter](https://codesandbox.io/s/chakra-ui-vue-starter-2sy0g)** 14 | - **[Nuxt Starter](https://codesandbox.io/s/chakra-ui-nuxt-demo-f8tq4)** 15 | - **[Gridsome Starter](https://codesandbox.io/s/chakra-ui-gridsome-demo-038c9)** 16 | -------------------------------------------------------------------------------- /website/pages/stat.mdx: -------------------------------------------------------------------------------- 1 | import SEO from '../components/SEO' 2 | 3 | 7 | 8 | # Stat 9 | 10 | The Stat component is used to display a single statistic. 11 | 12 | 13 | 14 | ## Import 15 | 16 | ```js 17 | import { 18 | CStat, 19 | CStatLabel, 20 | CStatNumber, 21 | CStatHelpText, 22 | CStatArrow, 23 | CStatGroup 24 | } from '@chakra-ui/vue' 25 | ``` 26 | 27 | ## Usage 28 | 29 | ```vue live=true 30 | 31 | Collected Fees 32 | $500.00 33 | Feb 12 - Feb 28 34 | 35 | ``` 36 | 37 | ### Stat with Indicator 38 | 39 | ```vue live=true 40 | 41 | 42 | Sent 43 | 380,610 44 | 45 | 46 | 30.60% 47 | 48 | 49 | 50 | Clicked 51 | 45 52 | 53 | 54 | -5.20% 55 | 56 | 57 | 58 | ``` 59 | 60 | ## Props 61 | 62 | - CStatLabel, CStatHelperText, CStatNumber composes [CText](/text) component 63 | - CStatArrow composes [CIcon](/icon) component 64 | - CStat, CStatGroup composes [CBox](/box) component 65 | -------------------------------------------------------------------------------- /website/pages/storybook.mdx: -------------------------------------------------------------------------------- 1 | import SEO from '../components/SEO' 2 | 3 | 7 | 8 | # Chakra UI Vue Storybook 9 | You can browse all Chakra UI Vue components in Storybook here: 10 | 11 | 12 | 13 | - [Browse Chakra UI Storybook](https://chakra-ui-vue.netlify.com)! -------------------------------------------------------------------------------- /website/pages/textarea.mdx: -------------------------------------------------------------------------------- 1 | import SEO from '../components/SEO' 2 | 3 | 7 | 8 | # Textarea 9 | 10 | The Textarea component allows you to easily create multi-line text inputs. 11 | 12 | 13 | 14 | ## Import 15 | 16 | ```js 17 | import { CTextarea } from '@chakra-ui/vue' 18 | ``` 19 | 20 | ## Usage 21 | 22 | ```vue live=true 23 | 24 | ``` 25 | 26 | ## Disabled Textarea 27 | 28 | ```vue live=true 29 | 30 | ``` 31 | 32 | ## Invalid Textarea 33 | 34 | ```vue live=true 35 | 36 | ``` 37 | 38 | ## Props 39 | 40 | The Textarea composes the [Input](/input) component 41 | 42 | ## Event 43 | 44 | | Name | Description | 45 | | ------ | -------------------------------------------------------------- | 46 | | change | Handles what happens when the content of the textarea changes | 47 | -------------------------------------------------------------------------------- /website/pages/why-chakra-ui.mdx: -------------------------------------------------------------------------------- 1 | # Why Chakra UI Vue 2 | 3 | **@chakra-ui/vue** is a component library whose mission is to make building accessible 4 | and composable Vue.js web applications fun. 5 | 6 | In order to make our components as accessible as possible, we've carefully crafted each component 7 | to be WAI-ARIA compliant while still making it possible to customize Chakra components based on 8 | constraint-based design principles. 9 | 10 | Chakra UI is able to do this because of principles adopted from patterns in the web development space 11 | that proved to be successful. We've borrowed tons of knowledge and inspiration from React's 12 | [Chakra UI](http://chakra-ui.com) (The mother ship 😁) by Segun Adebayo, 13 | [Tailwind CSS](https://tailwindcss.com) by Adam Wathan, [Vuetify](https://vuetifyjs.com) by 14 | John Leider, [Buefy](https://buefy.org) by Walter Thomasi, [Reach UI](https://reacttraining.com/reach-ui/) 15 | from the folks over at React Training, and many other tools that make web development a colorful field. 16 | 17 | ## Core Concepts 18 | Chakra UI is built from the ground up with two main guiding principles in mind: 19 | 20 | 1. [Accessibility](/accessibility) 21 | 2. [Constraint based design](/constraint-based-design) 22 | 23 | ## Vision 24 | 25 | - Provide accessible components out of the box. 26 | - Bridge the gap between design and development, by providing a styling API that utilizes constraint-based design principles. 27 | - Provide composable components that consumers can extend to create their own custom components. 28 | - Find new ways to make building accessible Vue applications fun and fast. 29 | 30 | -------------------------------------------------------------------------------- /website/plugins/editor.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueLive from 'vue-live' 3 | import 'vue-prism-editor/dist/VuePrismEditor.css' 4 | import { CodeBlock, LiveEditor } from '~/components/code' 5 | 6 | Vue.use(VueLive) 7 | Vue.component(LiveEditor) 8 | Vue.component(CodeBlock) 9 | -------------------------------------------------------------------------------- /website/plugins/globals.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import * as Chakra from '@chakra-ui/vue' 3 | import Lorem from 'vue-lorem-ipsum' 4 | import CarbonAd from '@/components/CarbonAd' 5 | 6 | Vue.component('Lorem', Lorem) 7 | Vue.component('CarbonAd', CarbonAd) 8 | 9 | Object.keys(Chakra).forEach((key) => { 10 | if (typeof Chakra[key] === 'object' && Chakra[key].name) { 11 | Vue.component(Chakra[key].name, Chakra[key]) 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /website/plugins/links.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.component('NuxtLink', { 4 | render (h) { 5 | return h('nuxt-link', { 6 | props: this.$attrs 7 | }, this.$slots.default) 8 | } 9 | }) 10 | 11 | Vue.component('Wrapper', { 12 | render (h) { 13 | return h('div', this.$slots.default) 14 | } 15 | }) 16 | 17 | Vue.component('InlineCode', { 18 | render (h) { 19 | return h('code', this.$slots.default) 20 | } 21 | }) 22 | -------------------------------------------------------------------------------- /website/plugins/skip-to.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueSkipTo from '@vue-a11y/skip-to' 3 | 4 | Vue.use(VueSkipTo) 5 | -------------------------------------------------------------------------------- /website/plugins/vue-meta.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueMeta from 'vue-meta' 3 | 4 | Vue.use(VueMeta) 5 | -------------------------------------------------------------------------------- /website/router.scrollBehaviour.js: -------------------------------------------------------------------------------- 1 | export default function (to, from, savedPosition) { 2 | return { x: 0, y: 0 } 3 | } 4 | -------------------------------------------------------------------------------- /website/static/chakra-icon.svg: -------------------------------------------------------------------------------- 1 | chakra-ui-vue-logo-icon -------------------------------------------------------------------------------- /website/static/chakra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/static/chakra.png -------------------------------------------------------------------------------- /website/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chakra-ui/chakra-ui-vue/74618e9b619789d86303ea99f2a665792ea93007/website/static/favicon.ico -------------------------------------------------------------------------------- /website/utils/index.js: -------------------------------------------------------------------------------- 1 | export * from './string' 2 | export { default as loadScript } from './load-script' 3 | -------------------------------------------------------------------------------- /website/utils/load-script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @param {String} src Script source string 4 | * @param {HTMLElement} container container in which to insert script 5 | */ 6 | function loadCarbonScript (src, container) { 7 | const script = document.createElement('script') 8 | script.setAttribute('async', '') 9 | script.src = src 10 | container.appendChild(script) 11 | return script 12 | } 13 | 14 | export default loadCarbonScript 15 | -------------------------------------------------------------------------------- /website/utils/string.js: -------------------------------------------------------------------------------- 1 | import { topNavLinks, components, aboutNavLinks } from './all-routes' 2 | 3 | export const stringToUrl = (str, path = '/') => { 4 | return `${path}${str 5 | .toLowerCase() 6 | .split(' ') 7 | .join('-')}` 8 | } 9 | 10 | export const titleCase = (str) => { 11 | str = str.toLowerCase().split(' ') 12 | for (let i = 0; i < str.length; i++) { 13 | str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1) 14 | } 15 | return str.join(' ') 16 | } 17 | 18 | export const removeHyphenFromString = (hyphenatedString) => { 19 | const str = hyphenatedString.split('-') 20 | return str.join(' ') 21 | } 22 | 23 | export const findNextAndPrevRoute = (path) => { 24 | const orderedRoutes = [...topNavLinks, ...aboutNavLinks, ...components] 25 | 26 | let isValidRoutePath = false 27 | const extractedRoutes = [] 28 | orderedRoutes.forEach((singleRoute) => { 29 | const urlString = stringToUrl(singleRoute) 30 | if (urlString === path) { 31 | isValidRoutePath = true 32 | } 33 | extractedRoutes.push({ name: singleRoute, path: urlString }) 34 | }) 35 | if (isValidRoutePath === false) { 36 | return { prev: '', next: '' } 37 | } 38 | 39 | const currentRouteIndex = extractedRoutes.map(route => route.path).indexOf(path) 40 | 41 | const nextPage = extractedRoutes[currentRouteIndex + 1] 42 | const prevPage = extractedRoutes[currentRouteIndex - 1] 43 | 44 | return { prev: prevPage || '', next: nextPage || '' } 45 | } 46 | --------------------------------------------------------------------------------