Skip to content

Commit

Permalink
chore: upgrade dependencies (#321)
Browse files Browse the repository at this point in the history
* chore: upgrade dependencies

* docs: regenerated  docs
  • Loading branch information
benjitrosch committed Apr 4, 2023
1 parent 8ee11b7 commit 688c72e
Show file tree
Hide file tree
Showing 360 changed files with 37,648 additions and 42,969 deletions.
55 changes: 27 additions & 28 deletions .storybook/story-layout.js → .storybook/StoryLayout.tsx
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { ReactNode, useEffect, useMemo, useState } from 'react'
import Highlight, { defaultProps } from "prism-react-renderer"
import theme from "prism-react-renderer/themes/vsDark"

Expand All @@ -9,14 +9,37 @@ import Navbar from '../src/Navbar'
import Tabs from '../src/Tabs'
import Theme from '../src/Theme'

const StoryLayout = ({ children, title, description, source }) => {
type Props = {
children: ReactNode | ReactNode[]
title: string
description: string
source: string
}

const StoryLayout = ({ children, title, description, source }: Props) => {
const [tab, setTab] = useState('preview')
const globalTheme = useGlobalTheme()

useEffect(() => {
document.getElementsByTagName('html')[0].setAttribute('data-theme', globalTheme)
}, [globalTheme])

const Code = () => useMemo(() => (
<Highlight {...defaultProps} theme={theme} code={source} language="jsx">
{({ tokens, getLineProps, getTokenProps }) => (
<pre slot="html">
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
), [theme, source])

return (
<Theme dataTheme={globalTheme} className="w-full h-screen p-8 bg-base-100">
<Navbar className="p-0 border-b border-neutral text-base-content">
Expand All @@ -33,19 +56,7 @@ const StoryLayout = ({ children, title, description, source }) => {
<div className='block sm:hidden'>
{children}
<CodeMockup className="w-full mb-8 mt-3">
<Highlight {...defaultProps} theme={theme} code={source} language="jsx">
{({ tokens, getLineProps, getTokenProps }) => (
<pre slot="html">
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
<Code />
</CodeMockup>
</div>

Expand Down Expand Up @@ -77,19 +88,7 @@ const StoryLayout = ({ children, title, description, source }) => {
</div>
) : (
<CodeMockup className="w-full mb-8">
<Highlight {...defaultProps} theme={theme} code={source} language="jsx">
{({ tokens, getLineProps, getTokenProps }) => (
<pre slot="html">
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
<Code />
</CodeMockup>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions .storybook/docs/components/CopyButton.tsx
Expand Up @@ -6,7 +6,7 @@ export type CopyButtonProps = ButtonProps & {
text?: string
}

export const CopyButton = ({ text = '', ...rest }: CopyButtonProps) => {
export const CopyButton = ({ text = '', ...props }: CopyButtonProps) => {
const [isCopied, setIsCopied] = useState(false)

const copy = async () => {
Expand All @@ -21,7 +21,7 @@ export const CopyButton = ({ text = '', ...rest }: CopyButtonProps) => {
}

return (
<Button {...rest} onClick={handleClick}>
<Button {...props} onClick={handleClick}>
{isCopied ? (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down
9 changes: 9 additions & 0 deletions .storybook/docs/pages/Welcome.mdx
@@ -0,0 +1,9 @@
import { Meta } from '@storybook/blocks'

import { HomePage } from './Welcome'

<Meta title="Welcome" />

<div className="sb-unstyled">
<HomePage />
</div>
7 changes: 0 additions & 7 deletions .storybook/docs/pages/Welcome.stories.mdx

This file was deleted.

31 changes: 0 additions & 31 deletions .storybook/main.cjs

This file was deleted.

22 changes: 22 additions & 0 deletions .storybook/main.ts
@@ -0,0 +1,22 @@
import { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['./docs/pages/Welcome.mdx', "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: ['@storybook/addon-actions', '@storybook/addon-storysource', {
name: '@storybook/addon-styling',
options: {
implementation: require("postcss"),
},
}, {
name: '@storybook/addon-essentials',
options: {
backgrounds: false
}
}],
framework: '@storybook/react-vite',
docs: {
autodocs: false
}
};

export default config;
6 changes: 0 additions & 6 deletions .storybook/manager.cjs

This file was deleted.

6 changes: 6 additions & 0 deletions .storybook/manager.ts
@@ -0,0 +1,6 @@
import { addons } from '@storybook/manager-api'
import theme from './theme'

addons.setConfig({
theme: theme,
})
131 changes: 70 additions & 61 deletions .storybook/preview.tsx
@@ -1,74 +1,83 @@
import React from 'react'
import type { Preview } from "@storybook/react";

import StoryLayout from './story-layout'
import StoryLayout from './StoryLayout'

import '../src/styles.css'
import { DEFAULT_THEME, STORAGE_KEY, THEME_PICKER_LIST } from './theming'
import { docsTheme } from './theme.cjs'
import theme from './theme'

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
previewTabs: {
'storybook/docs/panel': { hidden: true },
},
controls: {
matchers: {
date: /Date$/,
},
},
layout: 'fullscreen',
options: {
storySort: {
order: [
'Welcome',
'Utils',
'Actions',
'Data Display',
'Data Input',
'Layout',
'Navigation',
'Mockup',
],
const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
previewTabs: {
'storybook/docs/panel': { hidden: true },
},
},
themes: {
default: window.localStorage.getItem(STORAGE_KEY) || DEFAULT_THEME,
onChange: (theme) => {
// STORAGE_KEY does not work in onChange... not sure why
if (theme) {
window.localStorage.setItem(
'sb-react-daisyui-preview-theme',
theme.class
)
} else {
window.localStorage.removeItem('sb-react-daisyui-preview-theme')
}
controls: {
matchers: {
date: /Date$/,
},
},
list: THEME_PICKER_LIST,
},
docs: {
theme: docsTheme,
layout: 'fullscreen',
options: {
layout: 'fullscreen',
storySort: {
order: [
'Welcome',
'Utils',
'Actions',
'Data Display',
'Data Input',
'Layout',
'Navigation',
'Mockup',
],
},
},
themes: {
default: window.localStorage.getItem(STORAGE_KEY) || DEFAULT_THEME,
onChange: (theme) => {
// STORAGE_KEY does not work in onChange... not sure why
if (theme) {
window.localStorage.setItem(
'sb-react-daisyui-preview-theme',
theme.class
)
} else {
window.localStorage.removeItem('sb-react-daisyui-preview-theme')
}
},
list: THEME_PICKER_LIST,
},
docs: {
theme: theme,
options: {
layout: 'fullscreen',
},
},
},
decorators: [
(Story, options) => (
<StoryLayout
title={options.title}
description={options.name}
source={
options.parameters.docs.source.originalSource.
/* TODO: clean up all this string formatting/regex */
/* Removes the args arrow function */
replace(/^args\s*=>\s*\{\s*/, ' ').
replace(/\(.*args.*\)\s*=>\s*\{\s*\n/, ' ').
replace(/^(\s*)return\s+/, '$1').
replace(/_s\(\);/, '').
/* Removes the last occurence of a closing bracket (from the lambda) */
replace(/}([^}]*)$/, '$1')
/* Removes the last occurence of a semicolon */
.replace(/;(?=[^;]*$)/, '')
}
>
<Story />
</StoryLayout>
),
]
}

export const decorators = [
(Story, options) => (
<StoryLayout
title={options.title}
description={options.story}
source={
options.parameters.storySource.source.
/* TODO: clean up all this string formatting/regex */
/* Removes the args arrow function */
replace(/\(.*args.*\)\s*=>\s*\{\s*\n/, '').
/* Removes the last occurence of a closing bracket (from the lambda) */
replace(/}([^}]*)$/, '$1')
}
>
<Story />
</StoryLayout>
),
]
export default preview
9 changes: 2 additions & 7 deletions .storybook/theme.cjs → .storybook/theme.ts
@@ -1,6 +1,6 @@
import { create } from '@storybook/theming'
import { create, ThemeVars } from '@storybook/theming'

const baseTheme = {
const baseTheme: ThemeVars = {
base: 'dark',
brandTitle: 'react-daisyUI',
brandUrl: 'https://github.com/daisyui/react-daisyui',
Expand All @@ -24,9 +24,4 @@ const baseTheme = {
barBg: '#191D24',
}

export const docsTheme = {
...baseTheme,
maxWidth: '100%',
}

export default create(baseTheme)
3 changes: 0 additions & 3 deletions docs/0.de71a703.iframe.bundle.js

This file was deleted.

8 changes: 0 additions & 8 deletions docs/0.de71a703.iframe.bundle.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion docs/0.de71a703.iframe.bundle.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions docs/0.e3a114594603a4fc9e59.manager.bundle.js

This file was deleted.

8 changes: 0 additions & 8 deletions docs/0.e3a114594603a4fc9e59.manager.bundle.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion docs/1.16c514b0.iframe.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/1.bec044479eba4aff4be6.manager.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/2.430bf1e3.iframe.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/5.db00a605a1eb050fd9fa.manager.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/6.40c9b331.iframe.bundle.js

This file was deleted.

2 changes: 0 additions & 2 deletions docs/6.eef1b02339b84ee3ab46.manager.bundle.js

This file was deleted.

12 changes: 0 additions & 12 deletions docs/6.eef1b02339b84ee3ab46.manager.bundle.js.LICENSE.txt

This file was deleted.

0 comments on commit 688c72e

Please sign in to comment.