Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0cc7464
WIP Storybook
jackmcdade Nov 6, 2025
0b715e3
move to root
jasonvarga Nov 20, 2025
46e5491
remove unnecessary addons
jasonvarga Nov 20, 2025
a2d7744
fix path
jasonvarga Nov 20, 2025
96abab8
fix compilation
jasonvarga Nov 20, 2025
23b9990
wip
jasonvarga Nov 20, 2025
7225866
Merge branch 'master' into storybook
jasonvarga Nov 20, 2025
5f08c47
remove filler temporarily
jasonvarga Nov 20, 2025
2506f31
Merge branch 'master' into storybook
jasonvarga Nov 20, 2025
b78332e
Merge branch 'master' into storybook
jasonvarga Nov 20, 2025
8032168
stop ide complaining
jasonvarga Nov 21, 2025
d679bdc
specificity instead of important
jasonvarga Nov 21, 2025
150f997
update css
jasonvarga Nov 21, 2025
95e3960
fix references
jasonvarga Nov 21, 2025
8c369c3
stop reopening browser
jasonvarga Nov 21, 2025
4bc53a4
missing quote
jasonvarga Nov 21, 2025
9c2d4a9
gradient in the js object was breaking the controls tab
jasonvarga Nov 21, 2025
58772a9
disable backgrounds. we'll probably just have a dark mode instead.
jasonvarga Nov 21, 2025
5421f06
Merge branch 'master' into storybook
jasonvarga Nov 21, 2025
bca9693
Merge branch 'master' into storybook
jasonvarga Nov 21, 2025
d28bb72
not needed
jasonvarga Nov 21, 2025
dc69fa1
Rather than mocking inertia, intercept the navigation with an alert.
jasonvarga Nov 21, 2025
dcc6599
remove mocks ...
jasonvarga Nov 21, 2025
b7949df
nitpick
jasonvarga Nov 21, 2025
0ffa8ce
as far as i can tell, none of this was needed
jasonvarga Nov 21, 2025
ac7287d
nitpick
jasonvarga Nov 21, 2025
ab667a6
use action
jasonvarga Nov 21, 2025
e5c8595
Use vue-component-meta ...
jasonvarga Nov 21, 2025
8dac28e
fix translation in test
jasonvarga Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ composer.lock
.env
bundle-stats.html
.claude
storybook-static
21 changes: 21 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { StorybookConfig } from '@storybook/vue3-vite';

const config: StorybookConfig = {
stories: [
'../resources/js/stories/**/*.mdx',
'../resources/js/stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'
],
addons: [
'@storybook/addon-docs',
'@storybook/addon-a11y'
],
staticDirs: ['./public'],
framework: {
name: '@storybook/vue3-vite',
options: {
docgen: 'vue-component-meta'
}
},
};

export default config;
3 changes: 3 additions & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500&display=swap" rel="stylesheet">
3 changes: 3 additions & 0 deletions .storybook/manager.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.sidebar-container {
background: linear-gradient(225deg, #e6f8ff, #f9e6ff, hsl(35deg 100% 95%)) !important;
}
16 changes: 16 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { addons } from 'storybook/manager-api';
import { create } from 'storybook/theming';
import './manager.css';

const theme = create({
base: 'light',
brandTitle: 'Statamic UI Components',
brandUrl: 'https://statamic.dev',
brandImage: '/logo.png',
fontBase: '"Lexend", sans-serif',
fontCode: '"Source Code Pro", monospace'
});

addons.setConfig({
theme,
});
7 changes: 7 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<link rel="preconnect" href="https://use.typekit.net" crossorigin>
<link rel="preconnect" href="https://p.typekit.net" crossorigin>
<link rel="stylesheet" href="https://use.typekit.net/wyy0pka.css"/>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lexend:[email protected]&family=Source+Code+Pro:ital,wght@0,200..800;1,200..900&display=swap" rel="stylesheet">
59 changes: 59 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import type { Preview } from '@storybook/vue3-vite';
import { setup } from '@storybook/vue3';
import { create as createTheme } from 'storybook/theming';
import { router } from '@inertiajs/vue3';
import { action } from 'storybook/actions';
import './storybook.css';
import './theme.css';
import { translate } from '@/translations/translator';
import registerUiComponents from '@/bootstrap/ui';
import DateFormatter from '@/components/DateFormatter';

// Intercept Inertia navigation and log to Actions tab.
router.on('before', (event) => {
action('inertia navigate')(event.detail.visit.url);
return false;
});

setup(async (app) => {
app.config.globalProperties.__ = translate;
app.config.globalProperties.$date = new DateFormatter;
await registerUiComponents(app);
});

const preview: Preview = {
parameters: {
layout: 'centered',

controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},

docs: {
theme: createTheme({
base: 'light',
fontBase: '"Lexend", sans-serif',
fontCode: '"Source Code Pro", monospace',
}),
},

a11y: {
test: "todo",
},

backgrounds: {
disable: true
},

options: {
storySort: {
order: ['Getting Started', 'Installation', '*', 'Components'],
},
},
},
};

export default preview;
Binary file added .storybook/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions .storybook/storybook.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@import 'tailwindcss';
@import '../resources/css/ui.css';
@custom-variant dark (&:where(.dark, .dark *));

.sbdocs h1,
.sbdocs h2,
.sbdocs h3,
.sbdocs h4,
.sbdocs h5,
.sbdocs h6 {
font-family: p22-mackinac-pro, serif;
}

.sbdocs h1 {
font-size: 2.5rem;
}

.sbdocs h2 {
font-size: 1.75rem;
font-weight: 600;
}

.sbdocs h3 {
font-size: 1.25rem;
}

.sbdocs p,
.sbdocs li {
font-size: 1rem;
line-height: 1.6;
font-weight: 350;
}

.prismjs {
font-size: 1rem;
}

.sbdocs.sbdocs-wrapper {
padding: 2rem 4rem;
}
42 changes: 42 additions & 0 deletions .storybook/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
These variables are copied from what gets output into the <head>
of the control panel. Since they are defined in PHP we have to
manually copy them here.
*/
:root {
--theme-color-primary: oklch(0.457 0.24 277.023);
--theme-color-gray-50: oklch(0.985 0 0);
--theme-color-gray-100: oklch(0.967 0.001 286.375);
--theme-color-gray-150: oklch(0.956 0.0022 286.32);
--theme-color-gray-200: oklch(0.92 0.004 286.32);
--theme-color-gray-300: oklch(0.871 0.006 286.286);
--theme-color-gray-400: oklch(0.705 0.015 286.067);
--theme-color-gray-500: oklch(0.552 0.016 285.938);
--theme-color-gray-600: oklch(0.442 0.017 285.786);
--theme-color-gray-700: oklch(0.37 0.013 285.805);
--theme-color-gray-800: oklch(0.274 0.006 286.033);
--theme-color-gray-850: oklch(0.236 0.006 286.015);
--theme-color-gray-900: oklch(0.21 0.006 285.885);
--theme-color-gray-925: oklch(0.1982 0.0042 285.73);
--theme-color-gray-950: oklch(0.141 0.005 285.823);
--theme-color-success: oklch(0.792 0.209 151.711);
--theme-color-danger: oklch(0.577 0.245 27.325);
--theme-color-body-bg: oklch(0.967 0.001 286.375);
--theme-color-body-border: transparent;
--theme-color-content-bg: white;
--theme-color-content-border: oklch(0.92 0.004 286.32);
--theme-color-global-header-bg: oklch(0.274 0.006 286.033);
--theme-color-progress-bar: oklch(0.457 0.24 277.023);
--theme-color-focus-outline: oklch(0.707 0.165 254.624);
--theme-color-ui-accent-bg: oklch(0.457 0.24 277.023);
--theme-color-ui-accent-text: var(--theme-color-ui-accent-bg);
--theme-color-switch-bg: var(--theme-color-ui-accent-bg);

&.dark {
--theme-color-body-bg: oklch(0.21 0.006 285.885);
--theme-color-body-border: oklch(0.141 0.005 285.823);
--theme-color-content-bg: oklch(0.21 0.006 285.885);
--theme-color-content-border: oklch(0.141 0.005 285.823);
--theme-color-ui-accent-text: oklch(0.673 0.182 276.935);
}
}
7 changes: 7 additions & 0 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
import { setProjectAnnotations } from '@storybook/vue3-vite';
import * as projectAnnotations from './preview';

// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
Loading