generated from bywhitebird/starter-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from bywhitebird/64-create-the-whitebird-ui-co…
…mponents 64 create the whitebird UI components
- Loading branch information
Showing
37 changed files
with
2,604 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Panda | ||
styled-system | ||
styled-system-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { join, dirname } from "path"; | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
*/ | ||
function getAbsolutePath(value) { | ||
return dirname(require.resolve(join(value, "package.json"))); | ||
} | ||
|
||
const config = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(ts)"], | ||
addons: [ | ||
getAbsolutePath("@storybook/addon-links"), | ||
getAbsolutePath("@storybook/addon-essentials"), | ||
getAbsolutePath("@storybook/addon-onboarding"), | ||
], | ||
framework: { | ||
name: getAbsolutePath("@whitebird/storybook-plugin-kaz-react-vite"), | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: "tag", | ||
}, | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script type="module"> | ||
import '../src/index.css' | ||
import '../src/fonts.css' | ||
import { token } from '../styled-system/tokens' | ||
|
||
document.head.insertAdjacentHTML( | ||
'beforeend', | ||
`<style> | ||
body, .docs-story { | ||
background-color: ${token.var('colors.appBackground')} !important; | ||
} | ||
</style>` | ||
) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const preview = { | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
className: { | ||
type: 'string', | ||
control: 'text', | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Whitebird UI | ||
|
||
> **Important** | ||
> To facilitate the development of the Whitebird UI, this project is currently in the repository of Kazam. Once Kazam is ready for production, the Whitebird UI will be moved to its own repository. | ||
Whitebird UI exports a set of components built for Whitebird and a [Panda CSS](https://panda-css.com) preset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ParserKaz } from '@whitebird/kazam-parser-kaz' | ||
import { TransformerReact } from '@whitebird/kazam-transformer-react' | ||
import { TransformerVue } from '@whitebird/kazam-transformer-vue' | ||
import { defineConfig } from 'kazam' | ||
|
||
export default defineConfig({ | ||
input: ['./src/components'], | ||
output: './dist', | ||
parsers: [ParserKaz], | ||
transformers: [TransformerReact, TransformerVue], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "@whitebird/ui", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"exports": { | ||
"./panda-preset": { | ||
"default": "./src/panda/whitebird-preset.ts" | ||
}, | ||
"./vue/*": "./dist/vue/*.vue", | ||
"./vue/*.vue": "./dist/vue/*.vue", | ||
"./react/*": "./dist/react/*", | ||
"./react/*.tsx": "./dist/react/*.tsx", | ||
"./css": "./dist/whitebird.css", | ||
"./css/whitebird": "./dist/whitebird.css", | ||
"./css/whitebird.css": "./dist/whitebird.css", | ||
"./css/fonts": "./src/fonts.css", | ||
"./css/fonts.css": "./src/fonts.css" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src/panda/whitebird-preset.ts", | ||
"src/fonts.css" | ||
], | ||
"scripts": { | ||
"prepare": "panda codegen", | ||
"prebuild": "panda cssgen --outfile dist/whitebird.css", | ||
"build": "kazam generate", | ||
"build:watch": "kazam generate --watch", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"dev": "run-p build:watch start-storybook", | ||
"start-storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"dependencies": { | ||
"@pandacss/dev": "^0.14.0", | ||
"@pandacss/preset-base": "^0.18.2", | ||
"@whitebird/kazam-parser-kaz": "workspace:*", | ||
"@whitebird/kazam-transformer-react": "workspace:*", | ||
"@whitebird/kazam-transformer-vue": "workspace:*", | ||
"kazam": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^7.5.1", | ||
"@storybook/addon-links": "^7.5.1", | ||
"@storybook/addon-onboarding": "^1.0.8", | ||
"@storybook/blocks": "^7.5.1", | ||
"@storybook/builder-vite": "^7.5.1", | ||
"@storybook/react": "^7.5.1", | ||
"@storybook/react-vite": "^7.5.1", | ||
"@storybook/testing-library": "^0.2.2", | ||
"@types/node": "^18.11.9", | ||
"@whitebird/storybook-plugin-kaz-react-vite": "workspace:*", | ||
"npm-run-all": "^4.1.5", | ||
"storybook": "^7.5.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { defineConfig } from '@pandacss/dev' | ||
|
||
import { whitebirdPreset } from './src/panda/whitebird-preset' | ||
|
||
export default defineConfig({ | ||
// Whether to use css reset | ||
preflight: true, | ||
|
||
include: [ | ||
'./src/components/**/*.{js,jsx,ts,tsx,kaz}', | ||
'./src/stories/**/*.{js,jsx,ts,tsx,kaz}', | ||
// NOTE: PandaCSS statically analyzes TSX files. However, it does not analyze | ||
// Kaz files. Therefore, we need to include the compiled TSX files. | ||
'./dist/react/**/*.{js,jsx,ts,tsx}', | ||
], | ||
|
||
// Files to exclude | ||
exclude: [], | ||
|
||
presets: [whitebirdPreset], | ||
|
||
// The output directory for your css system | ||
outdir: 'styled-system', | ||
|
||
prefix: 'wb', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
plugins: [require('@pandacss/dev/postcss')()], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
- import { css } from '../../styled-system/css' | ||
- import { cx } from '../../styled-system/css' | ||
|
||
- prop text: string | ||
- prop variant: ('primary' | 'secondary' | 'tertiary') = 'primary' | ||
- prop size: ('small' | 'normal') = 'normal' | ||
- prop iconName: (string | undefined) = undefined | ||
- prop onClick: () => void = () => {} | ||
- prop className: string = '' | ||
|
||
button( | ||
class={cx( | ||
css({ | ||
bg: variant === 'primary' ? 'highContrastForeground' : variant === 'secondary' ? 'uiElementBackground' : 'transparent', | ||
color: variant === 'primary' ? 'appBackground' : 'highContrastForeground', | ||
textStyle: 'label', | ||
paddingX: size === 'small' ? 'xsmall' : 'medium', | ||
paddingY: size === 'small' ? 'xxsmall' : 'medium', | ||
cursor: 'pointer', | ||
display: 'inline-flex', | ||
alignItems: 'center', | ||
outlineColor: 'transparent', | ||
outlineStyle: 'solid', | ||
outlineWidth: '2px', | ||
outlineOffset: '2px', | ||
_active: { | ||
outlineColor: 'border', | ||
}, | ||
_hover: { | ||
outlineColor: 'borderHover', | ||
}, | ||
}), | ||
className, | ||
)}, | ||
on:click={onClick} | ||
) { | ||
@if (iconName) { | ||
div( | ||
class={css({ | ||
display: 'inline-flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
marginRight: size === 'small' ? 'small' : 'medium', | ||
width: '1em', | ||
height: '1em', | ||
fontSize: size === 'small' ? '0.75em' : '1em', | ||
})} | ||
) { | ||
Icon(name={iconName}, size="1.5em", fill={false}) | ||
} | ||
} | ||
${text} | ||
} |
Oops, something went wrong.