@bsuite/ui 0.2.0 → 0.3.0
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/README.md +128 -0
- package/dist/branding/BrandingCard.d.ts +56 -0
- package/dist/branding/BrandingCard.d.ts.map +1 -0
- package/dist/branding/BrandingCard.js +73 -0
- package/dist/branding/ColorEditorSheet.d.ts +68 -0
- package/dist/branding/ColorEditorSheet.d.ts.map +1 -0
- package/dist/branding/ColorEditorSheet.js +73 -0
- package/dist/branding/OklchColorPicker.d.ts +18 -0
- package/dist/branding/OklchColorPicker.d.ts.map +1 -0
- package/dist/branding/OklchColorPicker.js +83 -0
- package/dist/branding/index.d.ts +7 -0
- package/dist/branding/index.d.ts.map +1 -0
- package/dist/branding/index.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -30,6 +30,113 @@ import { DotPattern } from '@bsuite/ui'
|
|
|
30
30
|
Colour control via Tailwind `text-*` utilities or inline `[color:var(...)]`
|
|
31
31
|
(dots use `fill="currentColor"`).
|
|
32
32
|
|
|
33
|
+
### `Logo`
|
|
34
|
+
|
|
35
|
+
Slot-aware, theme-aware, branding-aware logo component for all BSuite apps.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Logo } from '@bsuite/ui'
|
|
39
|
+
|
|
40
|
+
<Logo slot="header" colorScheme="auto" />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `D2CDefaultLogo`
|
|
44
|
+
|
|
45
|
+
Inline D2C Neon Electric SVG logo (no asset dependency).
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { D2CDefaultLogo } from '@bsuite/ui'
|
|
49
|
+
|
|
50
|
+
<D2CDefaultLogo className="h-8 w-auto" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Branding Components (v0.3.0+)
|
|
54
|
+
|
|
55
|
+
### `OklchColorPicker`
|
|
56
|
+
|
|
57
|
+
A color input component for OKLCH color format (BSuite standard).
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { OklchColorPicker } from '@bsuite/ui'
|
|
61
|
+
|
|
62
|
+
<OklchColorPicker
|
|
63
|
+
value="oklch(0.546 0.215 262.9)"
|
|
64
|
+
onChange={(value) => console.log(value)}
|
|
65
|
+
label="Primary Color"
|
|
66
|
+
description="Your brand's primary color in OKLCH format"
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Features:**
|
|
71
|
+
- Live color preview
|
|
72
|
+
- Input fields for L (lightness), C (chroma), H (hue)
|
|
73
|
+
- Slider controls for easy adjustment
|
|
74
|
+
- Validation of OKLCH format
|
|
75
|
+
- Accessible labels and error messages
|
|
76
|
+
|
|
77
|
+
### `ColorEditorSheet`
|
|
78
|
+
|
|
79
|
+
A sheet/dialog for editing branding colors with a slot-based color editor.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { ColorEditorSheet, OklchColorPicker } from '@bsuite/ui'
|
|
83
|
+
|
|
84
|
+
<ColorEditorSheet
|
|
85
|
+
open={isOpen}
|
|
86
|
+
onOpenChange={setIsOpen}
|
|
87
|
+
title="Edit Primary Color"
|
|
88
|
+
description="Adjust the OKLCH color values"
|
|
89
|
+
value="oklch(0.546 0.215 262.9)"
|
|
90
|
+
onSave={(value) => updateBranding('primary', value)}
|
|
91
|
+
renderEditor={(props) => <OklchColorPicker {...props} />}
|
|
92
|
+
/>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Features:**
|
|
96
|
+
- Slide-out sheet interface
|
|
97
|
+
- Slot-based color editor (inject your own picker)
|
|
98
|
+
- Save/Cancel actions
|
|
99
|
+
- Responsive design
|
|
100
|
+
- Accessible dialog implementation
|
|
101
|
+
|
|
102
|
+
### `BrandingCard`
|
|
103
|
+
|
|
104
|
+
A card component for displaying and editing tenant branding configuration.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { BrandingCard, OklchColorPicker } from '@bsuite/ui'
|
|
108
|
+
|
|
109
|
+
<BrandingCard
|
|
110
|
+
branding={{
|
|
111
|
+
primary: "oklch(0.546 0.215 262.9)",
|
|
112
|
+
accent: "oklch(0.769 0.132 191.7)",
|
|
113
|
+
logo_url: "https://example.com/logo.svg",
|
|
114
|
+
company_name: "Acme Corp"
|
|
115
|
+
}}
|
|
116
|
+
onUpdate={async (key, value) => {
|
|
117
|
+
await updateTenantBranding(key, value)
|
|
118
|
+
}}
|
|
119
|
+
renderColorEditor={(props) => <OklchColorPicker {...props} />}
|
|
120
|
+
/>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Features:**
|
|
124
|
+
- Display current branding values (colors, logos, company name)
|
|
125
|
+
- Edit buttons for each branding property
|
|
126
|
+
- Integrated color editing with ColorEditorSheet
|
|
127
|
+
- Image preview for logos
|
|
128
|
+
- Accessible and responsive design
|
|
129
|
+
- Support for light/dark mode logo variants
|
|
130
|
+
|
|
131
|
+
**Branding Properties:**
|
|
132
|
+
- `primary` - Primary action color (OKLCH)
|
|
133
|
+
- `accent` - Accent/secondary color (OKLCH)
|
|
134
|
+
- `logo_url` - Main logo URL
|
|
135
|
+
- `logo_light_url` - Light mode logo variant (optional)
|
|
136
|
+
- `logo_dark_url` - Dark mode logo variant (optional)
|
|
137
|
+
- `favicon_url` - Favicon URL (16x16 or 32x32)
|
|
138
|
+
- `company_name` - Company name for alt text
|
|
139
|
+
|
|
33
140
|
## Utils
|
|
34
141
|
|
|
35
142
|
### `cn(...classes)`
|
|
@@ -38,6 +145,27 @@ shadcn-style className merger — `clsx` + `tailwind-merge`. Available for
|
|
|
38
145
|
consumers that want to compose `@bsuite/ui` components with local overrides
|
|
39
146
|
without pulling shadcn again.
|
|
40
147
|
|
|
148
|
+
## Module Exports
|
|
149
|
+
|
|
150
|
+
The package provides subpath exports for better tree-shaking:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
// Main exports
|
|
154
|
+
import { Logo, BrandingCard } from '@bsuite/ui'
|
|
155
|
+
|
|
156
|
+
// Dot pattern only
|
|
157
|
+
import { DotPattern } from '@bsuite/ui/dot-pattern'
|
|
158
|
+
|
|
159
|
+
// Utils only
|
|
160
|
+
import { cn } from '@bsuite/ui/utils'
|
|
161
|
+
|
|
162
|
+
// Branding components only
|
|
163
|
+
import { BrandingCard, ColorEditorSheet, OklchColorPicker } from '@bsuite/ui/branding'
|
|
164
|
+
|
|
165
|
+
// SVG asset
|
|
166
|
+
import logoSvg from '@bsuite/ui/assets/d2c-default-logo.svg'
|
|
167
|
+
```
|
|
168
|
+
|
|
41
169
|
## Releases
|
|
42
170
|
|
|
43
171
|
1. Edit source under `src/`.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BrandingCard — A card component for displaying and editing branding settings
|
|
3
|
+
*
|
|
4
|
+
* This component provides a UI for viewing and editing tenant branding
|
|
5
|
+
* configuration, including colors, logos, and other brand properties.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Display current branding values
|
|
9
|
+
* - Edit buttons for each branding property
|
|
10
|
+
* - Integration with ColorEditorSheet for color editing
|
|
11
|
+
* - Accessible and responsive design
|
|
12
|
+
* - Supports OKLCH color format
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* <BrandingCard
|
|
16
|
+
* branding={{
|
|
17
|
+
* primary: "oklch(0.546 0.215 262.9)",
|
|
18
|
+
* accent: "oklch(0.769 0.132 191.7)",
|
|
19
|
+
* logo_url: "https://example.com/logo.svg"
|
|
20
|
+
* }}
|
|
21
|
+
* onUpdate={(key, value) => console.log('Updated:', key, value)}
|
|
22
|
+
* renderColorEditor={(props) => <OklchColorPicker {...props} />}
|
|
23
|
+
* />
|
|
24
|
+
*/
|
|
25
|
+
import { type ReactNode } from 'react';
|
|
26
|
+
export interface BrandingCardProps {
|
|
27
|
+
/** Current branding configuration */
|
|
28
|
+
branding: {
|
|
29
|
+
primary?: string;
|
|
30
|
+
accent?: string;
|
|
31
|
+
logo_url?: string;
|
|
32
|
+
logo_light_url?: string;
|
|
33
|
+
logo_dark_url?: string;
|
|
34
|
+
favicon_url?: string;
|
|
35
|
+
company_name?: string;
|
|
36
|
+
font_stack?: string | null;
|
|
37
|
+
};
|
|
38
|
+
/** Callback when a branding property is updated */
|
|
39
|
+
onUpdate: (key: string, value: string) => void | Promise<void>;
|
|
40
|
+
/** Render function for the color editor component */
|
|
41
|
+
renderColorEditor: (props: {
|
|
42
|
+
value: string;
|
|
43
|
+
onChange: (value: string) => void;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
}) => ReactNode;
|
|
46
|
+
/** Optional className for the card */
|
|
47
|
+
className?: string;
|
|
48
|
+
/** Whether editing is disabled */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Optional title for the card */
|
|
51
|
+
title?: string;
|
|
52
|
+
/** Optional description for the card */
|
|
53
|
+
description?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function BrandingCard({ branding, onUpdate, renderColorEditor, className, disabled, title, description, }: BrandingCardProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
//# sourceMappingURL=BrandingCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandingCard.d.ts","sourceRoot":"","sources":["../../src/branding/BrandingCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGhD,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,QAAQ,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAC3B,CAAA;IACD,mDAAmD;IACnD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,qDAAqD;IACrD,iBAAiB,EAAE,CAAC,KAAK,EAAE;QACzB,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;QACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,KAAK,SAAS,CAAA;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AASD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,QAAgB,EAChB,KAAwB,EACxB,WAAW,GACZ,EAAE,iBAAiB,2CA8QnB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* BrandingCard — A card component for displaying and editing branding settings
|
|
4
|
+
*
|
|
5
|
+
* This component provides a UI for viewing and editing tenant branding
|
|
6
|
+
* configuration, including colors, logos, and other brand properties.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Display current branding values
|
|
10
|
+
* - Edit buttons for each branding property
|
|
11
|
+
* - Integration with ColorEditorSheet for color editing
|
|
12
|
+
* - Accessible and responsive design
|
|
13
|
+
* - Supports OKLCH color format
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* <BrandingCard
|
|
17
|
+
* branding={{
|
|
18
|
+
* primary: "oklch(0.546 0.215 262.9)",
|
|
19
|
+
* accent: "oklch(0.769 0.132 191.7)",
|
|
20
|
+
* logo_url: "https://example.com/logo.svg"
|
|
21
|
+
* }}
|
|
22
|
+
* onUpdate={(key, value) => console.log('Updated:', key, value)}
|
|
23
|
+
* renderColorEditor={(props) => <OklchColorPicker {...props} />}
|
|
24
|
+
* />
|
|
25
|
+
*/
|
|
26
|
+
import { useState } from 'react';
|
|
27
|
+
import { cn } from '../utils.js';
|
|
28
|
+
export function BrandingCard({ branding, onUpdate, renderColorEditor, className, disabled = false, title = 'Brand Settings', description, }) {
|
|
29
|
+
const [colorEditor, setColorEditor] = useState({
|
|
30
|
+
open: false,
|
|
31
|
+
field: '',
|
|
32
|
+
label: '',
|
|
33
|
+
value: '',
|
|
34
|
+
});
|
|
35
|
+
const openColorEditor = (field, label, currentValue) => {
|
|
36
|
+
setColorEditor({
|
|
37
|
+
open: true,
|
|
38
|
+
field,
|
|
39
|
+
label,
|
|
40
|
+
value: currentValue || '',
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const closeColorEditor = () => {
|
|
44
|
+
setColorEditor(prev => ({ ...prev, open: false }));
|
|
45
|
+
};
|
|
46
|
+
const handleColorSave = async (value) => {
|
|
47
|
+
await onUpdate(colorEditor.field, value);
|
|
48
|
+
closeColorEditor();
|
|
49
|
+
};
|
|
50
|
+
const handleTextUpdate = async (field, value) => {
|
|
51
|
+
await onUpdate(field, value);
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn('rounded-lg border border-input bg-card text-card-foreground shadow-sm', className), children: [_jsxs("div", { className: "border-b border-border px-6 py-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: title }), description && (_jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: description }))] }), _jsxs("div", { className: "divide-y divide-border", children: [_jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("div", { className: "h-10 w-10 rounded border border-input shadow-sm", style: { backgroundColor: branding.primary || 'oklch(0.546 0.215 262.9)' }, "aria-label": "Primary color preview" }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: "Primary Color" }), _jsx("div", { className: "text-sm text-muted-foreground", children: branding.primary || 'Not set' })] })] }), _jsx("button", { type: "button", onClick: () => openColorEditor('primary', 'Primary Color', branding.primary || 'oklch(0.546 0.215 262.9)'), disabled: disabled, className: cn('rounded-md border border-input bg-background px-4 py-2 text-sm font-medium', 'hover:bg-accent hover:text-accent-foreground', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'disabled:cursor-not-allowed disabled:opacity-50'), children: "Edit" })] }), _jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("div", { className: "h-10 w-10 rounded border border-input shadow-sm", style: { backgroundColor: branding.accent || 'oklch(0.769 0.132 191.7)' }, "aria-label": "Accent color preview" }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: "Accent Color" }), _jsx("div", { className: "text-sm text-muted-foreground", children: branding.accent || 'Not set' })] })] }), _jsx("button", { type: "button", onClick: () => openColorEditor('accent', 'Accent Color', branding.accent || 'oklch(0.769 0.132 191.7)'), disabled: disabled, className: cn('rounded-md border border-input bg-background px-4 py-2 text-sm font-medium', 'hover:bg-accent hover:text-accent-foreground', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'disabled:cursor-not-allowed disabled:opacity-50'), children: "Edit" })] }), _jsxs("div", { className: "flex flex-col gap-2 px-6 py-4", children: [_jsx("label", { htmlFor: "company-name", className: "font-medium", children: "Company Name" }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("input", { id: "company-name", type: "text", value: branding.company_name || '', onChange: (e) => handleTextUpdate('company_name', e.target.value), disabled: disabled, placeholder: "Enter company name", className: cn('flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm', 'focus:outline-none focus:ring-2 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50') }) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Used in logo alt text and other branding contexts" })] }), _jsxs("div", { className: "flex flex-col gap-2 px-6 py-4", children: [_jsx("label", { htmlFor: "logo-url", className: "font-medium", children: "Logo URL" }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("input", { id: "logo-url", type: "url", value: branding.logo_url || '', onChange: (e) => handleTextUpdate('logo_url', e.target.value), disabled: disabled, placeholder: "https://example.com/logo.svg", className: cn('flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm', 'focus:outline-none focus:ring-2 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50') }) }), branding.logo_url && (_jsx("div", { className: "mt-2 flex items-center gap-2", children: _jsx("img", { src: branding.logo_url, alt: "Logo preview", className: "h-12 object-contain", onError: (e) => {
|
|
54
|
+
e.currentTarget.style.display = 'none';
|
|
55
|
+
} }) }))] }), _jsxs("div", { className: "flex flex-col gap-2 px-6 py-4", children: [_jsx("label", { htmlFor: "logo-light-url", className: "font-medium", children: "Logo URL (Light Mode)" }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("input", { id: "logo-light-url", type: "url", value: branding.logo_light_url || '', onChange: (e) => handleTextUpdate('logo_light_url', e.target.value), disabled: disabled, placeholder: "https://example.com/logo-light.svg", className: cn('flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm', 'focus:outline-none focus:ring-2 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50') }) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Optional: Use a different logo for light mode" })] }), _jsxs("div", { className: "flex flex-col gap-2 px-6 py-4", children: [_jsx("label", { htmlFor: "logo-dark-url", className: "font-medium", children: "Logo URL (Dark Mode)" }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("input", { id: "logo-dark-url", type: "url", value: branding.logo_dark_url || '', onChange: (e) => handleTextUpdate('logo_dark_url', e.target.value), disabled: disabled, placeholder: "https://example.com/logo-dark.svg", className: cn('flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm', 'focus:outline-none focus:ring-2 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50') }) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Optional: Use a different logo for dark mode" })] }), _jsxs("div", { className: "flex flex-col gap-2 px-6 py-4", children: [_jsx("label", { htmlFor: "favicon-url", className: "font-medium", children: "Favicon URL" }), _jsx("div", { className: "flex items-center gap-2", children: _jsx("input", { id: "favicon-url", type: "url", value: branding.favicon_url || '', onChange: (e) => handleTextUpdate('favicon_url', e.target.value), disabled: disabled, placeholder: "https://example.com/favicon.ico", className: cn('flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm', 'focus:outline-none focus:ring-2 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50') }) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Square icon shown in browser tabs (16x16 or 32x32)" })] })] })] }), colorEditor.open && (_jsx(ColorEditorSheetWrapper, { open: colorEditor.open, title: `Edit ${colorEditor.label}`, description: "Adjust the OKLCH color values using the sliders below", value: colorEditor.value, onSave: handleColorSave, onCancel: closeColorEditor, renderEditor: renderColorEditor }))] }));
|
|
56
|
+
}
|
|
57
|
+
function ColorEditorSheetWrapper({ open, title, description, value, onSave, onCancel, renderEditor, }) {
|
|
58
|
+
const [editValue, setEditValue] = useState(value);
|
|
59
|
+
const [hasChanges, setHasChanges] = useState(false);
|
|
60
|
+
const handleChange = (newValue) => {
|
|
61
|
+
setEditValue(newValue);
|
|
62
|
+
setHasChanges(newValue !== value);
|
|
63
|
+
};
|
|
64
|
+
const handleSave = () => {
|
|
65
|
+
onSave(editValue);
|
|
66
|
+
};
|
|
67
|
+
if (!open)
|
|
68
|
+
return null;
|
|
69
|
+
return (_jsxs("div", { className: "fixed inset-0 z-50 flex", role: "dialog", "aria-modal": "true", "aria-labelledby": "color-editor-title", "aria-describedby": "color-editor-description", children: [_jsx("div", { className: "fixed inset-0 bg-background/80 backdrop-blur-sm", onClick: onCancel, "aria-hidden": "true" }), _jsxs("div", { className: "fixed inset-y-0 right-0 z-50 flex w-full flex-col border-l bg-background shadow-lg sm:max-w-md", children: [_jsxs("div", { className: "flex items-center justify-between border-b px-6 py-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("h2", { id: "color-editor-title", className: "text-lg font-semibold text-foreground", children: title }), _jsx("p", { id: "color-editor-description", className: "text-sm text-muted-foreground", children: description })] }), _jsx("button", { type: "button", onClick: onCancel, className: cn('rounded-sm opacity-70 ring-offset-background transition-opacity', 'hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'), "aria-label": "Close", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "h-4 w-4", children: [_jsx("path", { d: "M18 6 6 18" }), _jsx("path", { d: "m6 6 12 12" })] }) })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: renderEditor({
|
|
70
|
+
value: editValue,
|
|
71
|
+
onChange: handleChange,
|
|
72
|
+
}) }), _jsxs("div", { className: "flex items-center justify-end gap-2 border-t px-6 py-4", children: [_jsx("button", { type: "button", onClick: onCancel, className: cn('inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium', 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'), children: "Cancel" }), _jsx("button", { type: "button", onClick: handleSave, disabled: !hasChanges, className: cn('inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium', 'bg-primary text-text-on-primary hover:bg-primary/90', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'disabled:cursor-not-allowed disabled:opacity-50'), children: "Save Changes" })] })] })] }));
|
|
73
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ColorEditorSheet — A sheet/dialog for editing branding colors
|
|
3
|
+
*
|
|
4
|
+
* This component provides a slide-out sheet interface for editing
|
|
5
|
+
* color values. It uses a slot-based design for the color editor
|
|
6
|
+
* to allow consumers to inject their own color picker implementation
|
|
7
|
+
* (e.g., OklchColorPicker, or a custom one).
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Slot-based color editor (renderEditor prop)
|
|
11
|
+
* - Save/Cancel actions
|
|
12
|
+
* - Accessible dialog implementation
|
|
13
|
+
* - Responsive design
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* <ColorEditorSheet
|
|
17
|
+
* open={isOpen}
|
|
18
|
+
* onOpenChange={setIsOpen}
|
|
19
|
+
* title="Edit Primary Color"
|
|
20
|
+
* value="oklch(0.546 0.215 262.9)"
|
|
21
|
+
* onSave={(value) => console.log('Saved:', value)}
|
|
22
|
+
* renderEditor={(props) => <OklchColorPicker {...props} />}
|
|
23
|
+
* />
|
|
24
|
+
*
|
|
25
|
+
* Note: Consumers must have shadcn Sheet component installed:
|
|
26
|
+
* npx shadcn@latest add sheet
|
|
27
|
+
*/
|
|
28
|
+
import { type ReactNode } from 'react';
|
|
29
|
+
export interface ColorEditorSheetProps {
|
|
30
|
+
/** Whether the sheet is open */
|
|
31
|
+
open: boolean;
|
|
32
|
+
/** Callback when open state changes */
|
|
33
|
+
onOpenChange: (open: boolean) => void;
|
|
34
|
+
/** Sheet title */
|
|
35
|
+
title?: string;
|
|
36
|
+
/** Description text */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Current color value */
|
|
39
|
+
value: string;
|
|
40
|
+
/** Callback when Save is clicked */
|
|
41
|
+
onSave: (value: string) => void;
|
|
42
|
+
/** Callback when Cancel is clicked (optional, defaults to closing sheet) */
|
|
43
|
+
onCancel?: () => void;
|
|
44
|
+
/** Render function for the color editor component */
|
|
45
|
+
renderEditor: (props: {
|
|
46
|
+
value: string;
|
|
47
|
+
onChange: (value: string) => void;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}) => ReactNode;
|
|
50
|
+
/** Optional className for the sheet content */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** Whether save button should be disabled */
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* ColorEditorSheet - Generic sheet for editing colors
|
|
57
|
+
*
|
|
58
|
+
* This is a "bring your own Sheet" component. Consumers must:
|
|
59
|
+
* 1. Have shadcn Sheet installed in their app
|
|
60
|
+
* 2. Pass this component to their app-specific Sheet wrapper
|
|
61
|
+
*
|
|
62
|
+
* For consumers WITHOUT shadcn Sheet, they can use this as a
|
|
63
|
+
* regular dialog/modal by wrapping it in their own dialog primitive.
|
|
64
|
+
*
|
|
65
|
+
* Internal implementation uses basic HTML + Tailwind for flexibility.
|
|
66
|
+
*/
|
|
67
|
+
export declare function ColorEditorSheet({ open, onOpenChange, title, description, value, onSave, onCancel, renderEditor, className, disabled, }: ColorEditorSheetProps): import("react/jsx-runtime").JSX.Element | null;
|
|
68
|
+
//# sourceMappingURL=ColorEditorSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorEditorSheet.d.ts","sourceRoot":"","sources":["../../src/branding/ColorEditorSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAG3D,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,uCAAuC;IACvC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,qDAAqD;IACrD,YAAY,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;QACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,KAAK,SAAS,CAAA;IACf,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,YAAY,EACZ,KAAoB,EACpB,WAAW,EACX,KAAK,EACL,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,QAAgB,GACjB,EAAE,qBAAqB,kDAuIvB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ColorEditorSheet — A sheet/dialog for editing branding colors
|
|
4
|
+
*
|
|
5
|
+
* This component provides a slide-out sheet interface for editing
|
|
6
|
+
* color values. It uses a slot-based design for the color editor
|
|
7
|
+
* to allow consumers to inject their own color picker implementation
|
|
8
|
+
* (e.g., OklchColorPicker, or a custom one).
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Slot-based color editor (renderEditor prop)
|
|
12
|
+
* - Save/Cancel actions
|
|
13
|
+
* - Accessible dialog implementation
|
|
14
|
+
* - Responsive design
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* <ColorEditorSheet
|
|
18
|
+
* open={isOpen}
|
|
19
|
+
* onOpenChange={setIsOpen}
|
|
20
|
+
* title="Edit Primary Color"
|
|
21
|
+
* value="oklch(0.546 0.215 262.9)"
|
|
22
|
+
* onSave={(value) => console.log('Saved:', value)}
|
|
23
|
+
* renderEditor={(props) => <OklchColorPicker {...props} />}
|
|
24
|
+
* />
|
|
25
|
+
*
|
|
26
|
+
* Note: Consumers must have shadcn Sheet component installed:
|
|
27
|
+
* npx shadcn@latest add sheet
|
|
28
|
+
*/
|
|
29
|
+
import { useState, useEffect } from 'react';
|
|
30
|
+
import { cn } from '../utils.js';
|
|
31
|
+
/**
|
|
32
|
+
* ColorEditorSheet - Generic sheet for editing colors
|
|
33
|
+
*
|
|
34
|
+
* This is a "bring your own Sheet" component. Consumers must:
|
|
35
|
+
* 1. Have shadcn Sheet installed in their app
|
|
36
|
+
* 2. Pass this component to their app-specific Sheet wrapper
|
|
37
|
+
*
|
|
38
|
+
* For consumers WITHOUT shadcn Sheet, they can use this as a
|
|
39
|
+
* regular dialog/modal by wrapping it in their own dialog primitive.
|
|
40
|
+
*
|
|
41
|
+
* Internal implementation uses basic HTML + Tailwind for flexibility.
|
|
42
|
+
*/
|
|
43
|
+
export function ColorEditorSheet({ open, onOpenChange, title = 'Edit Color', description, value, onSave, onCancel, renderEditor, className, disabled = false, }) {
|
|
44
|
+
const [editValue, setEditValue] = useState(value);
|
|
45
|
+
const [hasChanges, setHasChanges] = useState(false);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (open) {
|
|
48
|
+
setEditValue(value);
|
|
49
|
+
setHasChanges(false);
|
|
50
|
+
}
|
|
51
|
+
}, [open, value]);
|
|
52
|
+
const handleChange = (newValue) => {
|
|
53
|
+
setEditValue(newValue);
|
|
54
|
+
setHasChanges(newValue !== value);
|
|
55
|
+
};
|
|
56
|
+
const handleSave = () => {
|
|
57
|
+
onSave(editValue);
|
|
58
|
+
onOpenChange(false);
|
|
59
|
+
};
|
|
60
|
+
const handleCancel = () => {
|
|
61
|
+
if (onCancel) {
|
|
62
|
+
onCancel();
|
|
63
|
+
}
|
|
64
|
+
onOpenChange(false);
|
|
65
|
+
};
|
|
66
|
+
if (!open)
|
|
67
|
+
return null;
|
|
68
|
+
return (_jsxs("div", { className: "fixed inset-0 z-50 flex", role: "dialog", "aria-modal": "true", "aria-labelledby": "color-editor-title", "aria-describedby": description ? 'color-editor-description' : undefined, children: [_jsx("div", { className: "fixed inset-0 bg-background/80 backdrop-blur-sm", onClick: handleCancel, "aria-hidden": "true" }), _jsxs("div", { className: "fixed inset-y-0 right-0 z-50 flex w-full flex-col border-l bg-background shadow-lg sm:max-w-md", children: [_jsxs("div", { className: "flex items-center justify-between border-b px-6 py-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("h2", { id: "color-editor-title", className: "text-lg font-semibold text-foreground", children: title }), description && (_jsx("p", { id: "color-editor-description", className: "text-sm text-muted-foreground", children: description }))] }), _jsx("button", { type: "button", onClick: handleCancel, className: cn('rounded-sm opacity-70 ring-offset-background transition-opacity', 'hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'disabled:pointer-events-none'), "aria-label": "Close", disabled: disabled, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "h-4 w-4", children: [_jsx("path", { d: "M18 6 6 18" }), _jsx("path", { d: "m6 6 12 12" })] }) })] }), _jsx("div", { className: cn('flex-1 overflow-y-auto px-6 py-6', className), children: renderEditor({
|
|
69
|
+
value: editValue,
|
|
70
|
+
onChange: handleChange,
|
|
71
|
+
disabled,
|
|
72
|
+
}) }), _jsxs("div", { className: "flex items-center justify-end gap-2 border-t px-6 py-4", children: [_jsx("button", { type: "button", onClick: handleCancel, disabled: disabled, className: cn('inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium', 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'disabled:cursor-not-allowed disabled:opacity-50'), children: "Cancel" }), _jsx("button", { type: "button", onClick: handleSave, disabled: disabled || !hasChanges, className: cn('inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium', 'bg-primary text-text-on-primary hover:bg-primary/90', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'disabled:cursor-not-allowed disabled:opacity-50'), children: "Save Changes" })] })] })] }));
|
|
73
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface OklchColorPickerProps {
|
|
2
|
+
/** Current OKLCH color value, e.g. "oklch(0.546 0.215 262.9)" */
|
|
3
|
+
value?: string;
|
|
4
|
+
/** Callback when color changes */
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
/** Label for the color picker */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Whether the input is disabled */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Optional className for the container */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Optional description/helper text */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** Optional error message */
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function OklchColorPicker({ value, onChange, label, disabled, className, description, error, }: OklchColorPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=OklchColorPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OklchColorPicker.d.ts","sourceRoot":"","sources":["../../src/branding/OklchColorPicker.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AA+BD,wBAAgB,gBAAgB,CAAC,EAC/B,KAA0B,EAC1B,QAAQ,EACR,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,WAAW,EACX,KAAK,GACN,EAAE,qBAAqB,2CA8LvB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* OklchColorPicker — A color input component for OKLCH color format
|
|
4
|
+
*
|
|
5
|
+
* OKLCH is the BSuite standard color format for the D2C Neon Electric theme.
|
|
6
|
+
* This component provides a user-friendly interface for editing OKLCH colors
|
|
7
|
+
* with visual preview and validation.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Live preview of the selected color
|
|
11
|
+
* - Input fields for L (lightness), C (chroma), H (hue)
|
|
12
|
+
* - Validation of OKLCH format
|
|
13
|
+
* - Accessible labels and error messages
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* <OklchColorPicker
|
|
17
|
+
* value="oklch(0.546 0.215 262.9)"
|
|
18
|
+
* onChange={(value) => console.log(value)}
|
|
19
|
+
* label="Primary Color"
|
|
20
|
+
* />
|
|
21
|
+
*/
|
|
22
|
+
import { useState, useEffect } from 'react';
|
|
23
|
+
import { cn } from '../utils.js';
|
|
24
|
+
const OKLCH_RE = /^oklch\(\s*[\d.]+%?\s+[\d.]+%?\s+[\d.]+%?(?:\s*\/\s*[\d.]+%?)?\s*\)$/i;
|
|
25
|
+
function parseOklch(value) {
|
|
26
|
+
if (!value || !OKLCH_RE.test(value))
|
|
27
|
+
return null;
|
|
28
|
+
const match = value.match(/oklch\(\s*([\d.]+)%?\s+([\d.]+)%?\s+([\d.]+)%?(?:\s*\/\s*([\d.]+)%?)?\s*\)/i);
|
|
29
|
+
if (!match)
|
|
30
|
+
return null;
|
|
31
|
+
return {
|
|
32
|
+
l: parseFloat(match[1]),
|
|
33
|
+
c: parseFloat(match[2]),
|
|
34
|
+
h: parseFloat(match[3]),
|
|
35
|
+
alpha: match[4] ? parseFloat(match[4]) : undefined,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function formatOklch(components) {
|
|
39
|
+
const { l, c, h, alpha } = components;
|
|
40
|
+
if (alpha !== undefined && alpha !== 1) {
|
|
41
|
+
return `oklch(${l} ${c} ${h} / ${alpha})`;
|
|
42
|
+
}
|
|
43
|
+
return `oklch(${l} ${c} ${h})`;
|
|
44
|
+
}
|
|
45
|
+
export function OklchColorPicker({ value = 'oklch(0.5 0.1 0)', onChange, label, disabled = false, className, description, error, }) {
|
|
46
|
+
const parsed = parseOklch(value);
|
|
47
|
+
const [components, setComponents] = useState(parsed || { l: 0.5, c: 0.1, h: 0 });
|
|
48
|
+
const [inputValue, setInputValue] = useState(value);
|
|
49
|
+
const [isValid, setIsValid] = useState(true);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const newParsed = parseOklch(value);
|
|
52
|
+
if (newParsed) {
|
|
53
|
+
setComponents(newParsed);
|
|
54
|
+
setInputValue(value);
|
|
55
|
+
setIsValid(true);
|
|
56
|
+
}
|
|
57
|
+
}, [value]);
|
|
58
|
+
const handleComponentChange = (key, val) => {
|
|
59
|
+
const numVal = parseFloat(val);
|
|
60
|
+
if (isNaN(numVal))
|
|
61
|
+
return;
|
|
62
|
+
const newComponents = { ...components, [key]: numVal };
|
|
63
|
+
setComponents(newComponents);
|
|
64
|
+
const formatted = formatOklch(newComponents);
|
|
65
|
+
setInputValue(formatted);
|
|
66
|
+
setIsValid(true);
|
|
67
|
+
onChange?.(formatted);
|
|
68
|
+
};
|
|
69
|
+
const handleRawInputChange = (e) => {
|
|
70
|
+
const newValue = e.target.value;
|
|
71
|
+
setInputValue(newValue);
|
|
72
|
+
const newParsed = parseOklch(newValue);
|
|
73
|
+
if (newParsed) {
|
|
74
|
+
setComponents(newParsed);
|
|
75
|
+
setIsValid(true);
|
|
76
|
+
onChange?.(newValue);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
setIsValid(false);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return (_jsxs("div", { className: cn('space-y-3', className), children: [label && (_jsx("label", { className: "text-sm font-medium text-foreground", children: label })), description && (_jsx("p", { className: "text-sm text-muted-foreground", children: description })), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-12 w-12 rounded-md border-2 border-input shadow-sm", style: { backgroundColor: inputValue }, "aria-label": "Color preview" }), _jsx("div", { className: "flex-1", children: _jsx("input", { type: "text", value: inputValue, onChange: handleRawInputChange, disabled: disabled, className: cn('w-full rounded-md border border-input bg-background px-3 py-2 text-sm', 'focus:outline-none focus:ring-2 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50', !isValid && 'border-destructive'), placeholder: "oklch(0.5 0.1 0)", "aria-label": "OKLCH color value", "aria-invalid": !isValid }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "grid grid-cols-[80px_1fr_60px] items-center gap-2", children: [_jsx("label", { htmlFor: "oklch-l", className: "text-sm text-muted-foreground", children: "L (Light)" }), _jsx("input", { id: "oklch-l", type: "range", min: "0", max: "1", step: "0.01", value: components.l, onChange: (e) => handleComponentChange('l', e.target.value), disabled: disabled, className: "cursor-pointer disabled:cursor-not-allowed disabled:opacity-50", "aria-label": "Lightness" }), _jsx("input", { type: "number", min: "0", max: "1", step: "0.01", value: components.l.toFixed(2), onChange: (e) => handleComponentChange('l', e.target.value), disabled: disabled, className: cn('w-full rounded border border-input bg-background px-2 py-1 text-sm', 'focus:outline-none focus:ring-1 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50'), "aria-label": "Lightness value" })] }), _jsxs("div", { className: "grid grid-cols-[80px_1fr_60px] items-center gap-2", children: [_jsx("label", { htmlFor: "oklch-c", className: "text-sm text-muted-foreground", children: "C (Chroma)" }), _jsx("input", { id: "oklch-c", type: "range", min: "0", max: "0.4", step: "0.001", value: components.c, onChange: (e) => handleComponentChange('c', e.target.value), disabled: disabled, className: "cursor-pointer disabled:cursor-not-allowed disabled:opacity-50", "aria-label": "Chroma" }), _jsx("input", { type: "number", min: "0", max: "0.4", step: "0.001", value: components.c.toFixed(3), onChange: (e) => handleComponentChange('c', e.target.value), disabled: disabled, className: cn('w-full rounded border border-input bg-background px-2 py-1 text-sm', 'focus:outline-none focus:ring-1 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50'), "aria-label": "Chroma value" })] }), _jsxs("div", { className: "grid grid-cols-[80px_1fr_60px] items-center gap-2", children: [_jsx("label", { htmlFor: "oklch-h", className: "text-sm text-muted-foreground", children: "H (Hue)" }), _jsx("input", { id: "oklch-h", type: "range", min: "0", max: "360", step: "0.1", value: components.h, onChange: (e) => handleComponentChange('h', e.target.value), disabled: disabled, className: "cursor-pointer disabled:cursor-not-allowed disabled:opacity-50", "aria-label": "Hue" }), _jsx("input", { type: "number", min: "0", max: "360", step: "0.1", value: components.h.toFixed(1), onChange: (e) => handleComponentChange('h', e.target.value), disabled: disabled, className: cn('w-full rounded border border-input bg-background px-2 py-1 text-sm', 'focus:outline-none focus:ring-1 focus:ring-ring', 'disabled:cursor-not-allowed disabled:opacity-50'), "aria-label": "Hue value" })] })] }), (error || !isValid) && (_jsx("p", { className: "text-sm text-destructive", children: error || 'Invalid OKLCH format. Expected: oklch(L C H) where L is 0-1, C is 0-0.4, H is 0-360' }))] }));
|
|
83
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @bsuite/ui/branding — branding components
|
|
3
|
+
*/
|
|
4
|
+
export { BrandingCard, type BrandingCardProps } from './BrandingCard.js';
|
|
5
|
+
export { ColorEditorSheet, type ColorEditorSheetProps } from './ColorEditorSheet.js';
|
|
6
|
+
export { OklchColorPicker, type OklchColorPickerProps } from './OklchColorPicker.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/branding/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { DotPattern, type DotPatternProps } from './dot-pattern.js';
|
|
|
2
2
|
export { cn } from './utils.js';
|
|
3
3
|
export { Logo, resolveLogoUrl, type LogoProps, type LogoSlot, type LogoColorScheme, type LogoBranding, type ResolvedLogo, type AppSlug, } from './Logo.js';
|
|
4
4
|
export { D2CDefaultLogo, type D2CDefaultLogoProps } from './default-logo.js';
|
|
5
|
+
export { BrandingCard, ColorEditorSheet, OklchColorPicker, type BrandingCardProps, type ColorEditorSheetProps, type OklchColorPickerProps, } from './branding/index.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAC/B,OAAO,EACL,IAAI,EACJ,cAAc,EACd,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,GACb,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAC/B,OAAO,EACL,IAAI,EACJ,cAAc,EACd,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,GACb,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAG5E,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,3 +2,5 @@ export { DotPattern } from './dot-pattern.js';
|
|
|
2
2
|
export { cn } from './utils.js';
|
|
3
3
|
export { Logo, resolveLogoUrl, } from './Logo.js';
|
|
4
4
|
export { D2CDefaultLogo } from './default-logo.js';
|
|
5
|
+
// Branding components (v0.3.0+)
|
|
6
|
+
export { BrandingCard, ColorEditorSheet, OklchColorPicker, } from './branding/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsuite/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"import": "./dist/utils.js",
|
|
32
32
|
"types": "./dist/utils.d.ts"
|
|
33
33
|
},
|
|
34
|
+
"./branding": {
|
|
35
|
+
"import": "./dist/branding/index.js",
|
|
36
|
+
"types": "./dist/branding/index.d.ts"
|
|
37
|
+
},
|
|
34
38
|
"./assets/d2c-default-logo.svg": "./src/assets/d2c-default-logo.svg"
|
|
35
39
|
},
|
|
36
40
|
"scripts": {
|