@bronzelabs/oakma-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.cjs +25 -0
- package/.storybook/components/ActionButton.tsx +44 -0
- package/.storybook/components/DummyIcons.tsx +47 -0
- package/.storybook/components/index.ts +2 -0
- package/.storybook/docs/blocks/ImportStatement.tsx +52 -0
- package/.storybook/docs/blocks/index.ts +1 -0
- package/.storybook/docs/page.tsx +41 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/postcss.config.cjs +8 -0
- package/.storybook/preview-body.html +20 -0
- package/.storybook/preview-head.html +6 -0
- package/.storybook/preview.tsx +30 -0
- package/.storybook/tailwind.css +6 -0
- package/.storybook/utils/index.ts +2 -0
- package/.storybook/utils/renderAsReact.tsx +30 -0
- package/.storybook/utils/renderDocsWithProps.tsx +22 -0
- package/@types/markdown.d.ts +4 -0
- package/README.md +3 -0
- package/eslint.config.js +91 -0
- package/package.json +63 -0
- package/postcss.config.cjs +8 -0
- package/scripts/release.sh +76 -0
- package/src/components/Button/Button.stories.tsx +314 -0
- package/src/components/Button/Button.tsx +132 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Button/types.ts +19 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +152 -0
- package/src/components/Checkbox/Checkbox.tsx +90 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Checkbox/types.ts +6 -0
- package/src/components/Chip/Chip.stories.tsx +146 -0
- package/src/components/Chip/Chip.tsx +59 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/Chip/types.ts +6 -0
- package/src/components/Drawer/Drawer.docs.md +88 -0
- package/src/components/Drawer/Drawer.stories.tsx +239 -0
- package/src/components/Drawer/Drawer.tsx +194 -0
- package/src/components/Drawer/index.ts +3 -0
- package/src/components/Drawer/types.ts +3 -0
- package/src/components/Dropdown/AsyncDropdown.tsx +105 -0
- package/src/components/Dropdown/Dropdown.docs.md +33 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +419 -0
- package/src/components/Dropdown/Dropdown.tsx +104 -0
- package/src/components/Dropdown/MultiValue.tsx +19 -0
- package/src/components/Dropdown/ValueContainer.tsx +114 -0
- package/src/components/Dropdown/index.ts +4 -0
- package/src/components/Dropdown/types.ts +29 -0
- package/src/components/Dropdown/useDropdown.tsx +257 -0
- package/src/components/Logo/Logo.stories.tsx +130 -0
- package/src/components/Logo/Logo.tsx +80 -0
- package/src/components/Logo/index.ts +2 -0
- package/src/components/Modal/Modal.docs.md +94 -0
- package/src/components/Modal/Modal.stories.tsx +318 -0
- package/src/components/Modal/Modal.tsx +217 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/MultiSelect/AsyncMultiSelect.tsx +47 -0
- package/src/components/MultiSelect/MultiSelect.docs.md +37 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +493 -0
- package/src/components/MultiSelect/MultiSelect.tsx +81 -0
- package/src/components/MultiSelect/index.ts +2 -0
- package/src/components/Notification/Notification.stories.tsx +158 -0
- package/src/components/Notification/Notification.tsx +110 -0
- package/src/components/Notification/index.ts +1 -0
- package/src/components/Notification/types.ts +11 -0
- package/src/components/Notifications/Notifications.docs.md +103 -0
- package/src/components/Notifications/Notifications.stories.tsx +159 -0
- package/src/components/Notifications/Notifications.tsx +90 -0
- package/src/components/Notifications/NotificationsContext.tsx +90 -0
- package/src/components/Notifications/index.ts +7 -0
- package/src/components/Select/Select.stories.tsx +234 -0
- package/src/components/Select/Select.tsx +129 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Select/types.ts +1 -0
- package/src/components/Spinner/Spinner.stories.tsx +55 -0
- package/src/components/Spinner/Spinner.tsx +48 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Spinner/types.ts +8 -0
- package/src/components/TextArea/TextArea.stories.tsx +243 -0
- package/src/components/TextArea/TextArea.tsx +133 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextArea/types.ts +4 -0
- package/src/components/TextField/Container.tsx +68 -0
- package/src/components/TextField/ErrorMessage.tsx +37 -0
- package/src/components/TextField/Icon.tsx +77 -0
- package/src/components/TextField/Label.tsx +56 -0
- package/src/components/TextField/NotchBorder.tsx +67 -0
- package/src/components/TextField/index.ts +14 -0
- package/src/components/TextField/types.ts +15 -0
- package/src/components/TextField/useInputKeyboardFocus.tsx +63 -0
- package/src/components/TextInput/TextInput.stories.tsx +384 -0
- package/src/components/TextInput/TextInput.tsx +255 -0
- package/src/components/TextInput/index.ts +2 -0
- package/src/components/TextInput/types.ts +4 -0
- package/src/components/Toggle/Toggle.stories.tsx +142 -0
- package/src/components/Toggle/Toggle.tsx +69 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useCombinedRefs.ts +37 -0
- package/src/hooks/useEventListener.ts +87 -0
- package/src/hooks/useFocusTrap/createAriaHider.ts +62 -0
- package/src/hooks/useFocusTrap/index.ts +1 -0
- package/src/hooks/useFocusTrap/scopeTab.ts +46 -0
- package/src/hooks/useFocusTrap/tabbable.ts +107 -0
- package/src/hooks/useFocusTrap/useFocusTrap.ts +97 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +14 -0
- package/src/hooks/useLockBodyScroll.ts +24 -0
- package/src/hooks/useOnClickOutside.ts +53 -0
- package/src/index.ts +22 -0
- package/src/tailwind.css +4 -0
- package/src/types/helpers.ts +11 -0
- package/src/types/polymorphic.ts +39 -0
- package/src/utils/animation/variants.ts +21 -0
- package/src/utils/array/index.ts +1 -0
- package/src/utils/array/uniqBy.ts +12 -0
- package/src/utils/common/index.ts +1 -0
- package/src/utils/common/isFunction.ts +17 -0
- package/src/utils/react/extractDisplayName.ts +15 -0
- package/src/utils/react/index.ts +1 -0
- package/tsconfig.json +16 -0
- package/tsconfig.production.json +19 -0
- package/tsup.config.ts +16 -0
package/.prettierrc.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 100,
|
|
3
|
+
trailingComma: "all",
|
|
4
|
+
semi: false,
|
|
5
|
+
bracketSpacing: true,
|
|
6
|
+
arrowParens: "avoid",
|
|
7
|
+
quoteProps: "as-needed",
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.d.ts"],
|
|
11
|
+
options: {
|
|
12
|
+
parser: "typescript",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
files: ["./src/index.ts"],
|
|
17
|
+
options: {
|
|
18
|
+
printWidth: 180,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
tailwindFunctions: ["clsx"],
|
|
23
|
+
plugins: ["prettier-plugin-tailwindcss"],
|
|
24
|
+
tailwindStylesheet: "./src/tailwind.css",
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react"
|
|
2
|
+
|
|
3
|
+
// Utils
|
|
4
|
+
import { clsx } from "clsx"
|
|
5
|
+
|
|
6
|
+
// Params
|
|
7
|
+
interface Props extends HTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
type?: React.JSX.IntrinsicElements["button"]["type"]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const StorybookActionButton = React.forwardRef<HTMLButtonElement, Props>(
|
|
19
|
+
({ className, children, ...rest }, ref) => {
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
className={clsx("bg-surface-20 hover:bg-surface-50", className)}
|
|
23
|
+
ref={ref}
|
|
24
|
+
style={{
|
|
25
|
+
position: "relative",
|
|
26
|
+
padding: 14,
|
|
27
|
+
borderRadius: 9999,
|
|
28
|
+
border: "none",
|
|
29
|
+
cursor: "pointer",
|
|
30
|
+
minWidth: 64,
|
|
31
|
+
fontSize: 13.3333,
|
|
32
|
+
// color: "ButtonText",
|
|
33
|
+
fontFamily: "Arial, sans-serif",
|
|
34
|
+
transition: ".1s ease-in-out",
|
|
35
|
+
}}
|
|
36
|
+
{...rest}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</button>
|
|
40
|
+
)
|
|
41
|
+
},
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
export default StorybookActionButton
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export function DummyPhoneIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
12
|
+
return (
|
|
13
|
+
<svg
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
viewBox="0 0 20 20"
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
<path
|
|
21
|
+
fillRule="evenodd"
|
|
22
|
+
d="M2 3.5A1.5 1.5 0 0 1 3.5 2h1.148a1.5 1.5 0 0 1 1.465 1.175l.716 3.223a1.5 1.5 0 0 1-1.052 1.767l-.933.267c-.41.117-.643.555-.48.95a11.542 11.542 0 0 0 6.254 6.254c.395.163.833-.07.95-.48l.267-.933a1.5 1.5 0 0 1 1.767-1.052l3.223.716A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15c-1.149 0-2.263-.15-3.326-.43A13.022 13.022 0 0 1 2.43 8.326 13.019 13.019 0 0 1 2 5V3.5Z"
|
|
23
|
+
clipRule="evenodd"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function DummyChevronDownIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
30
|
+
return (
|
|
31
|
+
<svg
|
|
32
|
+
width="20"
|
|
33
|
+
height="20"
|
|
34
|
+
viewBox="0 0 20 20"
|
|
35
|
+
fill="none"
|
|
36
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
<path
|
|
40
|
+
fillRule="evenodd"
|
|
41
|
+
clipRule="evenodd"
|
|
42
|
+
d="M5.21967 8.21967C5.51256 7.92678 5.98744 7.92678 6.28033 8.21967L10 11.9393L13.7197 8.21967C14.0126 7.92678 14.4874 7.92678 14.7803 8.21967C15.0732 8.51256 15.0732 8.98744 14.7803 9.28033L10.5303 13.5303C10.3897 13.671 10.1989 13.75 10 13.75C9.80109 13.75 9.61032 13.671 9.46967 13.5303L5.21967 9.28033C4.92678 8.98744 4.92678 8.51256 5.21967 8.21967Z"
|
|
43
|
+
fill="currentColor"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
// Components
|
|
4
|
+
import { Source, useOf } from "@storybook/addon-docs/blocks"
|
|
5
|
+
|
|
6
|
+
// Helpers
|
|
7
|
+
const getStoryName = (name?: string): string | undefined => name?.split("/").pop()
|
|
8
|
+
|
|
9
|
+
// Props
|
|
10
|
+
export interface ImportStatementProps {
|
|
11
|
+
source?: string
|
|
12
|
+
override?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const ImportStatement: React.FC<ImportStatementProps> = ({ source, override }) => {
|
|
23
|
+
const { story } = useOf<"story">("story")
|
|
24
|
+
|
|
25
|
+
const componentName = getStoryName(story.title)
|
|
26
|
+
|
|
27
|
+
const importStatement = override ?? `import { ${componentName} } from '@bronzelabs/oakma-ui';`
|
|
28
|
+
|
|
29
|
+
if (!componentName) {
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="mx-0 my-6 flex flex-col gap-2">
|
|
35
|
+
<a
|
|
36
|
+
className="self-end text-sm"
|
|
37
|
+
style={{ color: "#0000ff" }}
|
|
38
|
+
href={`https://github.com/BronzeLabs/oakma-ui${
|
|
39
|
+
source ?? `/tree/master/src/components/${componentName}`
|
|
40
|
+
}`}
|
|
41
|
+
target="_blank"
|
|
42
|
+
>
|
|
43
|
+
View Source
|
|
44
|
+
</a>
|
|
45
|
+
<div id="import-src">
|
|
46
|
+
<Source code={importStatement} />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default ImportStatement
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ImportStatement } from "./ImportStatement"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
// Components
|
|
4
|
+
import {
|
|
5
|
+
Title,
|
|
6
|
+
Subtitle,
|
|
7
|
+
Description,
|
|
8
|
+
Primary,
|
|
9
|
+
Controls,
|
|
10
|
+
Stories,
|
|
11
|
+
Markdown,
|
|
12
|
+
} from "@storybook/addon-docs/blocks"
|
|
13
|
+
import ImportStatement, { type ImportStatementProps } from "./blocks/ImportStatement"
|
|
14
|
+
|
|
15
|
+
// Props
|
|
16
|
+
export interface DocsProps {
|
|
17
|
+
importStatementProps?: ImportStatementProps
|
|
18
|
+
extraDocs?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const Docs: React.FC<DocsProps> = ({ importStatementProps, extraDocs }) => (
|
|
29
|
+
<>
|
|
30
|
+
<Title />
|
|
31
|
+
<Subtitle />
|
|
32
|
+
<ImportStatement {...importStatementProps} />
|
|
33
|
+
<Description />
|
|
34
|
+
<Primary />
|
|
35
|
+
<Controls />
|
|
36
|
+
<Stories />
|
|
37
|
+
{extraDocs && <Markdown>{extraDocs}</Markdown>}
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
export default Docs
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-webpack5"
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
5
|
+
addons: [
|
|
6
|
+
"@storybook/addon-webpack5-compiler-swc",
|
|
7
|
+
"@storybook/addon-a11y",
|
|
8
|
+
"@storybook/addon-docs",
|
|
9
|
+
"@storybook/addon-onboarding",
|
|
10
|
+
],
|
|
11
|
+
framework: "@storybook/react-webpack5",
|
|
12
|
+
webpackFinal: async config => {
|
|
13
|
+
config.module?.rules?.forEach((rule: any) => {
|
|
14
|
+
if (rule && typeof rule === "object" && rule.test?.test?.("test.css")) {
|
|
15
|
+
rule.use?.push("postcss-loader")
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
return config
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
export default config
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
html {
|
|
3
|
+
font-size: 16px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.docs-story {
|
|
7
|
+
background: #ffffff;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@media (prefers-color-scheme: dark) {
|
|
11
|
+
.docs-story,
|
|
12
|
+
.sb-main-centered {
|
|
13
|
+
background: #0f212b;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#import-src .docblock-source.sb-unstyled {
|
|
18
|
+
margin: 0 !important;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
2
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
3
|
+
<link
|
|
4
|
+
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Lora:ital,wght@0,400..700;1,400..700&display=swap"
|
|
5
|
+
rel="stylesheet"
|
|
6
|
+
/>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Preview } from "@storybook/react-webpack5"
|
|
2
|
+
|
|
3
|
+
// Styles
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import "./tailwind.css"
|
|
6
|
+
|
|
7
|
+
// Components
|
|
8
|
+
import Docs from "./docs/page"
|
|
9
|
+
|
|
10
|
+
const preview: Preview = {
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: "centered",
|
|
13
|
+
docs: {
|
|
14
|
+
page: Docs,
|
|
15
|
+
source: {
|
|
16
|
+
excludeDecorators: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
controls: {
|
|
20
|
+
matchers: {
|
|
21
|
+
color: /(background|color)$/i,
|
|
22
|
+
date: /Date$/i,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default preview
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
// Types
|
|
4
|
+
import type { StoryFn } from "@storybook/react"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This occasionally needs to be added as a decorator to make Reacty-y stuff work
|
|
8
|
+
* in stories.Unless the story itself is called as a React component storybook will
|
|
9
|
+
* bypass React...
|
|
10
|
+
*
|
|
11
|
+
* This is a helpful explanation: https://stackoverflow.com/a/74281976
|
|
12
|
+
*
|
|
13
|
+
* @param {StoryFn} Story
|
|
14
|
+
* @param {any} args
|
|
15
|
+
* @returns {React.JSX.Element}
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const renderAsReact = (Story: StoryFn, args: any): React.JSX.Element => {
|
|
26
|
+
const Component = Story as unknown as React.ComponentType
|
|
27
|
+
return <Component {...args} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { renderAsReact }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
// Components
|
|
4
|
+
import Docs from "../docs/page"
|
|
5
|
+
|
|
6
|
+
// Types
|
|
7
|
+
import type { DocsProps } from "../docs/page"
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const renderDocsWithProps =
|
|
17
|
+
(props: DocsProps = {}) =>
|
|
18
|
+
() => {
|
|
19
|
+
return <Docs {...props} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { renderDocsWithProps }
|
package/README.md
ADDED
package/eslint.config.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
|
2
|
+
import storybook from "eslint-plugin-storybook"
|
|
3
|
+
|
|
4
|
+
import tseslint from "typescript-eslint"
|
|
5
|
+
import reactPlugin from "eslint-plugin-react"
|
|
6
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks"
|
|
7
|
+
import importPlugin from "eslint-plugin-import-x"
|
|
8
|
+
import betterTailwindcss from "eslint-plugin-better-tailwindcss"
|
|
9
|
+
|
|
10
|
+
export default tseslint.config(
|
|
11
|
+
{ ignores: ["dist/**", "node_modules/**"] },
|
|
12
|
+
{
|
|
13
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
14
|
+
extends: [tseslint.configs.recommended],
|
|
15
|
+
plugins: {
|
|
16
|
+
react: reactPlugin,
|
|
17
|
+
"react-hooks": reactHooksPlugin,
|
|
18
|
+
import: importPlugin,
|
|
19
|
+
"better-tailwindcss": betterTailwindcss,
|
|
20
|
+
},
|
|
21
|
+
settings: {
|
|
22
|
+
react: {
|
|
23
|
+
version: "detect",
|
|
24
|
+
},
|
|
25
|
+
"better-tailwindcss": {
|
|
26
|
+
entryPoint: "./src/tailwind.css",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
...reactPlugin.configs.recommended.rules,
|
|
31
|
+
...reactHooksPlugin.configs.recommended.rules,
|
|
32
|
+
|
|
33
|
+
"no-param-reassign": [2, { props: false }],
|
|
34
|
+
"no-console": 0,
|
|
35
|
+
"consistent-return": 0,
|
|
36
|
+
"no-nested-ternary": 0,
|
|
37
|
+
"no-constant-condition": [2, { checkLoops: false }],
|
|
38
|
+
|
|
39
|
+
// Import
|
|
40
|
+
"import/newline-after-import": 2,
|
|
41
|
+
"import/no-duplicates": 2,
|
|
42
|
+
"import/no-useless-path-segments": 1,
|
|
43
|
+
"import/order": 0,
|
|
44
|
+
"import/prefer-default-export": 0,
|
|
45
|
+
"import/extensions": 0,
|
|
46
|
+
"import/no-named-as-default-member": 0,
|
|
47
|
+
"import/no-cycle": 2,
|
|
48
|
+
|
|
49
|
+
// React
|
|
50
|
+
"react/react-in-jsx-scope": 0,
|
|
51
|
+
"react/prop-types": 0,
|
|
52
|
+
"react/jsx-props-no-spreading": 0,
|
|
53
|
+
"react/jsx-filename-extension": 0,
|
|
54
|
+
"react/no-array-index-key": 1,
|
|
55
|
+
"react/display-name": 0,
|
|
56
|
+
"react/no-unknown-property": 0,
|
|
57
|
+
"react/no-unescaped-entities": 1,
|
|
58
|
+
"react/jsx-no-comment-textnodes": 1,
|
|
59
|
+
"react/jsx-no-target-blank": 0,
|
|
60
|
+
|
|
61
|
+
// TypeScript
|
|
62
|
+
"@typescript-eslint/explicit-function-return-type": 0,
|
|
63
|
+
"@typescript-eslint/semi": 0,
|
|
64
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
65
|
+
"@typescript-eslint/no-inferrable-types": 0,
|
|
66
|
+
"@typescript-eslint/ban-ts-comment": 0,
|
|
67
|
+
"@typescript-eslint/no-restricted-types": 1,
|
|
68
|
+
"@typescript-eslint/no-empty-object-type": 1,
|
|
69
|
+
"@typescript-eslint/no-unsafe-function-type": 1,
|
|
70
|
+
"@typescript-eslint/no-wrapper-object-types": 1,
|
|
71
|
+
"@typescript-eslint/no-unused-vars": 1,
|
|
72
|
+
"@typescript-eslint/no-unused-expressions": 0,
|
|
73
|
+
|
|
74
|
+
// Tailwind CSS
|
|
75
|
+
"better-tailwindcss/enforce-consistent-line-wrapping": 0,
|
|
76
|
+
"better-tailwindcss/enforce-consistent-class-order": 0,
|
|
77
|
+
"better-tailwindcss/enforce-consistent-variable-syntax": 1,
|
|
78
|
+
"better-tailwindcss/enforce-consistent-important-position": 1,
|
|
79
|
+
"better-tailwindcss/enforce-shorthand-classes": 0,
|
|
80
|
+
"better-tailwindcss/enforce-canonical-classes": 1,
|
|
81
|
+
"better-tailwindcss/no-duplicate-classes": 1,
|
|
82
|
+
"better-tailwindcss/no-deprecated-classes": 1,
|
|
83
|
+
"better-tailwindcss/no-unnecessary-whitespace": 1,
|
|
84
|
+
"better-tailwindcss/no-unknown-classes": 0,
|
|
85
|
+
"better-tailwindcss/no-restricted-classes": 0,
|
|
86
|
+
"better-tailwindcss/no-conflicting-classes": 0,
|
|
87
|
+
"better-tailwindcss/sort-classes": 0,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
storybook.configs["flat/recommended"],
|
|
91
|
+
)
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bronzelabs/oakma-ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Oakma's component system for the web.",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/BronzeLabs/oakma-ui.git"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"registry": "https://registry.npmjs.org/",
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build:styles": "NODE_ENV=production npx @tailwindcss/cli -i ./src/tailwind.css -o ./dist/oakma-ui.css --minify",
|
|
19
|
+
"build:components": "tsup",
|
|
20
|
+
"build": "npm run build:components && npm run build:styles",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"lint:fix": "eslint . --fix",
|
|
23
|
+
"storybook": "storybook dev -p 6006",
|
|
24
|
+
"build-storybook": "storybook build",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"release": "rm -rf dist && npm run build && bash ./scripts/release.sh"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"clsx": "^2.1.1",
|
|
30
|
+
"react-select": "^5.10.2"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@bronzelabs/oakma-tailwind-preset": "^1.0.5",
|
|
34
|
+
"@storybook/addon-a11y": "^10.4.0",
|
|
35
|
+
"@storybook/addon-docs": "^10.4.0",
|
|
36
|
+
"@storybook/addon-onboarding": "^10.4.0",
|
|
37
|
+
"@storybook/addon-webpack5-compiler-swc": "^4.0.3",
|
|
38
|
+
"@storybook/react-webpack5": "^10.4.0",
|
|
39
|
+
"@tailwindcss/postcss": "^4.3.0",
|
|
40
|
+
"@types/react": "^19.2.14",
|
|
41
|
+
"@types/react-dom": "^19.2.3",
|
|
42
|
+
"eslint": "9.39.4",
|
|
43
|
+
"eslint-plugin-better-tailwindcss": "^4.5.0",
|
|
44
|
+
"eslint-plugin-import-x": "^4.0.0",
|
|
45
|
+
"eslint-plugin-react": "^7.37.0",
|
|
46
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
47
|
+
"eslint-plugin-storybook": "^10.4.0",
|
|
48
|
+
"postcss": "^8.5.14",
|
|
49
|
+
"postcss-loader": "^8.2.1",
|
|
50
|
+
"prettier": "^3.8.3",
|
|
51
|
+
"prettier-plugin-tailwindcss": "^0.8.0",
|
|
52
|
+
"storybook": "^10.4.0",
|
|
53
|
+
"tsup": "^8.5.1",
|
|
54
|
+
"typescript": "^6.0.3",
|
|
55
|
+
"typescript-eslint": "^8.0.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@heroicons/react": "^2.2.0",
|
|
59
|
+
"motion": "^12.40.0",
|
|
60
|
+
"react": "^19.2.4",
|
|
61
|
+
"react-dom": "^19.2.4"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Function to run a command and check its exit status
|
|
4
|
+
run_command() {
|
|
5
|
+
"$@"
|
|
6
|
+
if [ $? -ne 0 ]; then
|
|
7
|
+
echo "Command failed: $@"
|
|
8
|
+
exit 1
|
|
9
|
+
else
|
|
10
|
+
echo "Command succeeded: $@"
|
|
11
|
+
fi
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# Navigate to tribe tailwind preset
|
|
15
|
+
cd /Users/nathanhughes/Documents/Projects/Oakma/oakma-ui
|
|
16
|
+
|
|
17
|
+
# Get current version
|
|
18
|
+
current_version=$(node -p "require('./package.json').version")
|
|
19
|
+
|
|
20
|
+
echo "Current version: $current_version"
|
|
21
|
+
echo ""
|
|
22
|
+
echo "Select release option:"
|
|
23
|
+
echo "1) patch (e.g., $current_version -> $(node -p "'$current_version'.split('.').map((n,i)=>i===2?+n+1:n).join('.')"))"
|
|
24
|
+
echo "2) minor (e.g., $current_version -> $(node -p "'$current_version'.split('.').map((n,i)=>i===1?+n+1:i===2?0:n).join('.')"))"
|
|
25
|
+
echo "3) major (e.g., $current_version -> $(node -p "'$current_version'.split('.').map((n,i)=>i===0?+n+1:0).join('.')"))"
|
|
26
|
+
echo "4) Enter custom version"
|
|
27
|
+
read -p "Enter your choice (1, 2, 3, or 4): " choice
|
|
28
|
+
|
|
29
|
+
case $choice in
|
|
30
|
+
1)
|
|
31
|
+
bump_type="patch"
|
|
32
|
+
run_command npm version $bump_type --no-git-tag-version
|
|
33
|
+
;;
|
|
34
|
+
2)
|
|
35
|
+
bump_type="minor"
|
|
36
|
+
run_command npm version $bump_type --no-git-tag-version
|
|
37
|
+
;;
|
|
38
|
+
3)
|
|
39
|
+
bump_type="major"
|
|
40
|
+
run_command npm version $bump_type --no-git-tag-version
|
|
41
|
+
;;
|
|
42
|
+
4)
|
|
43
|
+
read -p "Enter the new version (e.g., 2.0.0): " custom_version
|
|
44
|
+
run_command npm version $custom_version --no-git-tag-version
|
|
45
|
+
;;
|
|
46
|
+
*)
|
|
47
|
+
echo "Invalid choice"
|
|
48
|
+
exit 1
|
|
49
|
+
;;
|
|
50
|
+
esac
|
|
51
|
+
|
|
52
|
+
# Get the new version
|
|
53
|
+
new_version=$(node -p "require('./package.json').version")
|
|
54
|
+
|
|
55
|
+
echo ""
|
|
56
|
+
echo "New version will be: $new_version"
|
|
57
|
+
read -p "Proceed with publishing? (y/n): " confirm
|
|
58
|
+
|
|
59
|
+
if [ "$confirm" != "y" ]; then
|
|
60
|
+
echo "Publish cancelled"
|
|
61
|
+
exit 1
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Publish the package
|
|
65
|
+
run_command npm publish
|
|
66
|
+
|
|
67
|
+
# Commit the changes
|
|
68
|
+
run_command git add .
|
|
69
|
+
run_command git commit -m "oakma-ui v$new_version" --no-verify
|
|
70
|
+
run_command git tag "oakma-ui/v$new_version"
|
|
71
|
+
run_command git push --no-verify
|
|
72
|
+
run_command git push --tags --no-verify
|
|
73
|
+
|
|
74
|
+
echo "oakma-ui v$new_version has been published!"
|
|
75
|
+
|
|
76
|
+
exit 0
|