@extrachill/components 0.2.0 → 0.4.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.
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ActionRowProps {
3
+ children: ReactNode;
4
+ align?: 'start' | 'between' | 'end';
5
+ className?: string;
6
+ classPrefix?: string;
7
+ }
8
+ export declare function ActionRow({ children, align, className, classPrefix, }: ActionRowProps): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=ActionRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionRow.d.ts","sourceRoot":"","sources":["../src/ActionRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAE,EAC1B,QAAQ,EACR,KAAe,EACf,SAAc,EACd,WAA6B,GAC7B,EAAE,cAAc,2CAQhB"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function ActionRow({ children, align = 'start', className = '', classPrefix = 'ec-action-row', }) {
3
+ return (_jsx("div", { className: [classPrefix, `${classPrefix}--${align}`, className].filter(Boolean).join(' '), children: children }));
4
+ }
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface FieldGroupProps {
3
+ label?: ReactNode;
4
+ help?: ReactNode;
5
+ error?: ReactNode;
6
+ required?: boolean;
7
+ children: ReactNode;
8
+ className?: string;
9
+ classPrefix?: string;
10
+ htmlFor?: string;
11
+ }
12
+ export declare function FieldGroup({ label, help, error, required, children, className, classPrefix, htmlFor, }: FieldGroupProps): import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=FieldGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldGroup.d.ts","sourceRoot":"","sources":["../src/FieldGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAE,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAgB,EAChB,QAAQ,EACR,SAAc,EACd,WAA8B,EAC9B,OAAO,GACP,EAAE,eAAe,2CAcjB"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function FieldGroup({ label, help, error, required = false, children, className = '', classPrefix = 'ec-field-group', htmlFor, }) {
3
+ return (_jsxs("div", { className: [classPrefix, className].filter(Boolean).join(' '), children: [label && (_jsxs("label", { className: `${classPrefix}__label`, htmlFor: htmlFor, children: [label, required && _jsx("span", { className: `${classPrefix}__required`, children: " *" })] })), _jsx("div", { className: `${classPrefix}__control`, children: children }), help && _jsx("div", { className: `${classPrefix}__help`, children: help }), error && _jsx("div", { className: `${classPrefix}__error`, children: error })] }));
4
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ImagePreviewProps {
3
+ src: string;
4
+ alt?: string;
5
+ className?: string;
6
+ classPrefix?: string;
7
+ overlay?: ReactNode;
8
+ }
9
+ export declare function ImagePreview({ src, alt, className, classPrefix, overlay, }: ImagePreviewProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=ImagePreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImagePreview.d.ts","sourceRoot":"","sources":["../src/ImagePreview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAE,EAC7B,GAAG,EACH,GAAQ,EACR,SAAc,EACd,WAAgC,EAChC,OAAO,GACP,EAAE,iBAAiB,2CAOnB"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function ImagePreview({ src, alt = '', className = '', classPrefix = 'ec-image-preview', overlay, }) {
3
+ return (_jsxs("div", { className: [classPrefix, className].filter(Boolean).join(' '), children: [_jsx("img", { src: src, alt: alt, className: `${classPrefix}__image` }), overlay ? _jsx("div", { className: `${classPrefix}__overlay`, children: overlay }) : null] }));
4
+ }
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface InlineStatusProps {
3
+ children: ReactNode;
4
+ tone: 'success' | 'error' | 'warning' | 'info';
5
+ className?: string;
6
+ classPrefix?: string;
7
+ }
8
+ export declare function InlineStatus({ children, tone, className, classPrefix, }: InlineStatusProps): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=InlineStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineStatus.d.ts","sourceRoot":"","sources":["../src/InlineStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAE,EAC7B,QAAQ,EACR,IAAI,EACJ,SAAc,EACd,WAAgC,GAChC,EAAE,iBAAiB,2CAMnB"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function InlineStatus({ children, tone, className = '', classPrefix = 'ec-inline-status', }) {
3
+ return (_jsx("div", { className: [classPrefix, `${classPrefix}--${tone}`, className].filter(Boolean).join(' '), children: children }));
4
+ }
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface MediaFieldProps {
3
+ label?: ReactNode;
4
+ help?: ReactNode;
5
+ error?: ReactNode;
6
+ required?: boolean;
7
+ htmlFor?: string;
8
+ previewUrl?: string | null;
9
+ previewAlt?: string;
10
+ preview?: ReactNode;
11
+ empty?: ReactNode;
12
+ actions?: ReactNode;
13
+ children?: ReactNode;
14
+ className?: string;
15
+ classPrefix?: string;
16
+ }
17
+ export declare function MediaField({ label, help, error, required, htmlFor, previewUrl, previewAlt, preview, empty, actions, children, className, classPrefix, }: MediaFieldProps): import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=MediaField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaField.d.ts","sourceRoot":"","sources":["../src/MediaField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,WAAW,eAAe;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAE,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAgB,EAChB,OAAO,EACP,UAAU,EACV,UAAe,EACf,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAc,EACd,WAA8B,GAC9B,EAAE,eAAe,2CAkCjB"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ActionRow } from "./ActionRow.js";
3
+ import { FieldGroup } from "./FieldGroup.js";
4
+ import { ImagePreview } from "./ImagePreview.js";
5
+ export function MediaField({ label, help, error, required = false, htmlFor, previewUrl, previewAlt = '', preview, empty, actions, children, className = '', classPrefix = 'ec-media-field', }) {
6
+ const mediaClassName = [classPrefix, className].filter(Boolean).join(' ');
7
+ const hasMeta = Boolean(label || help || error || required);
8
+ const previewContent = preview || (previewUrl ? _jsx(ImagePreview, { src: previewUrl, alt: previewAlt }) : null);
9
+ const body = (_jsxs(_Fragment, { children: [children ? _jsx("div", { className: `${classPrefix}__input`, children: children }) : null, _jsx("div", { className: `${classPrefix}__surface`, children: previewContent ? (_jsx("div", { className: `${classPrefix}__preview`, children: previewContent })) : empty ? (_jsx("div", { className: `${classPrefix}__empty`, children: empty })) : null }), actions ? _jsx(ActionRow, { className: `${classPrefix}__actions`, children: actions }) : null] }));
10
+ if (hasMeta) {
11
+ return (_jsx(FieldGroup, { label: label, help: help, error: error, required: required, htmlFor: htmlFor, className: mediaClassName, children: body }));
12
+ }
13
+ return _jsx("div", { className: mediaClassName, children: body });
14
+ }
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PanelProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ classPrefix?: string;
6
+ compact?: boolean;
7
+ }
8
+ export declare function Panel({ children, className, classPrefix, compact, }: PanelProps): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=Panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../src/Panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,UAAU;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,KAAK,CAAE,EACtB,QAAQ,EACR,SAAc,EACd,WAAwB,EACxB,OAAe,GACf,EAAE,UAAU,2CAQZ"}
package/dist/Panel.js ADDED
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function Panel({ children, className = '', classPrefix = 'ec-panel', compact = false, }) {
3
+ const panelClass = [
4
+ classPrefix,
5
+ compact ? `${classPrefix}--compact` : '',
6
+ className,
7
+ ].filter(Boolean).join(' ');
8
+ return _jsx("div", { className: panelClass, children: children });
9
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PanelHeaderProps {
3
+ title?: ReactNode;
4
+ description?: ReactNode;
5
+ actions?: ReactNode;
6
+ className?: string;
7
+ classPrefix?: string;
8
+ }
9
+ export declare function PanelHeader({ title, description, actions, className, classPrefix, }: PanelHeaderProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=PanelHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../src/PanelHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAE,EAC5B,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAc,EACd,WAA+B,GAC/B,EAAE,gBAAgB,2CAUlB"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function PanelHeader({ title, description, actions, className = '', classPrefix = 'ec-panel-header', }) {
3
+ return (_jsxs("div", { className: [classPrefix, className].filter(Boolean).join(' '), children: [_jsxs("div", { className: `${classPrefix}__main`, children: [title && _jsx("div", { className: `${classPrefix}__title`, children: title }), description && _jsx("div", { className: `${classPrefix}__description`, children: description })] }), actions && _jsx("div", { className: `${classPrefix}__actions`, children: actions })] }));
4
+ }
package/dist/index.d.ts CHANGED
@@ -8,4 +8,11 @@ export { Pagination, type PaginationProps } from './Pagination.tsx';
8
8
  export { SearchBox, type SearchBoxProps } from './SearchBox.tsx';
9
9
  export { Modal, type ModalProps } from './Modal.tsx';
10
10
  export { Tabs, type TabsProps, type TabItem } from './Tabs.tsx';
11
+ export { Panel, type PanelProps } from './Panel.tsx';
12
+ export { PanelHeader, type PanelHeaderProps } from './PanelHeader.tsx';
13
+ export { ActionRow, type ActionRowProps } from './ActionRow.tsx';
14
+ export { FieldGroup, type FieldGroupProps } from './FieldGroup.tsx';
15
+ export { InlineStatus, type InlineStatusProps } from './InlineStatus.tsx';
16
+ export { ImagePreview, type ImagePreviewProps } from './ImagePreview.tsx';
17
+ export { MediaField, type MediaFieldProps } from './MediaField.tsx';
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -8,3 +8,10 @@ export { Pagination } from "./Pagination.js";
8
8
  export { SearchBox } from "./SearchBox.js";
9
9
  export { Modal } from "./Modal.js";
10
10
  export { Tabs } from "./Tabs.js";
11
+ export { Panel } from "./Panel.js";
12
+ export { PanelHeader } from "./PanelHeader.js";
13
+ export { ActionRow } from "./ActionRow.js";
14
+ export { FieldGroup } from "./FieldGroup.js";
15
+ export { InlineStatus } from "./InlineStatus.js";
16
+ export { ImagePreview } from "./ImagePreview.js";
17
+ export { MediaField } from "./MediaField.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrachill/components",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared React components for the Extra Chill Platform.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface ActionRowProps {
4
+ children: ReactNode;
5
+ align?: 'start' | 'between' | 'end';
6
+ className?: string;
7
+ classPrefix?: string;
8
+ }
9
+
10
+ export function ActionRow( {
11
+ children,
12
+ align = 'start',
13
+ className = '',
14
+ classPrefix = 'ec-action-row',
15
+ }: ActionRowProps ) {
16
+ return (
17
+ <div
18
+ className={ [ classPrefix, `${ classPrefix }--${ align }`, className ].filter( Boolean ).join( ' ' ) }
19
+ >
20
+ { children }
21
+ </div>
22
+ );
23
+ }
@@ -0,0 +1,37 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface FieldGroupProps {
4
+ label?: ReactNode;
5
+ help?: ReactNode;
6
+ error?: ReactNode;
7
+ required?: boolean;
8
+ children: ReactNode;
9
+ className?: string;
10
+ classPrefix?: string;
11
+ htmlFor?: string;
12
+ }
13
+
14
+ export function FieldGroup( {
15
+ label,
16
+ help,
17
+ error,
18
+ required = false,
19
+ children,
20
+ className = '',
21
+ classPrefix = 'ec-field-group',
22
+ htmlFor,
23
+ }: FieldGroupProps ) {
24
+ return (
25
+ <div className={ [ classPrefix, className ].filter( Boolean ).join( ' ' ) }>
26
+ { label && (
27
+ <label className={ `${ classPrefix }__label` } htmlFor={ htmlFor }>
28
+ { label }
29
+ { required && <span className={ `${ classPrefix }__required` }> *</span> }
30
+ </label>
31
+ ) }
32
+ <div className={ `${ classPrefix }__control` }>{ children }</div>
33
+ { help && <div className={ `${ classPrefix }__help` }>{ help }</div> }
34
+ { error && <div className={ `${ classPrefix }__error` }>{ error }</div> }
35
+ </div>
36
+ );
37
+ }
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface ImagePreviewProps {
4
+ src: string;
5
+ alt?: string;
6
+ className?: string;
7
+ classPrefix?: string;
8
+ overlay?: ReactNode;
9
+ }
10
+
11
+ export function ImagePreview( {
12
+ src,
13
+ alt = '',
14
+ className = '',
15
+ classPrefix = 'ec-image-preview',
16
+ overlay,
17
+ }: ImagePreviewProps ) {
18
+ return (
19
+ <div className={ [ classPrefix, className ].filter( Boolean ).join( ' ' ) }>
20
+ <img src={ src } alt={ alt } className={ `${ classPrefix }__image` } />
21
+ { overlay ? <div className={ `${ classPrefix }__overlay` }>{ overlay }</div> : null }
22
+ </div>
23
+ );
24
+ }
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface InlineStatusProps {
4
+ children: ReactNode;
5
+ tone: 'success' | 'error' | 'warning' | 'info';
6
+ className?: string;
7
+ classPrefix?: string;
8
+ }
9
+
10
+ export function InlineStatus( {
11
+ children,
12
+ tone,
13
+ className = '',
14
+ classPrefix = 'ec-inline-status',
15
+ }: InlineStatusProps ) {
16
+ return (
17
+ <div className={ [ classPrefix, `${ classPrefix }--${ tone }`, className ].filter( Boolean ).join( ' ' ) }>
18
+ { children }
19
+ </div>
20
+ );
21
+ }
@@ -0,0 +1,70 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ActionRow } from './ActionRow.tsx';
3
+ import { FieldGroup } from './FieldGroup.tsx';
4
+ import { ImagePreview } from './ImagePreview.tsx';
5
+
6
+ export interface MediaFieldProps {
7
+ label?: ReactNode;
8
+ help?: ReactNode;
9
+ error?: ReactNode;
10
+ required?: boolean;
11
+ htmlFor?: string;
12
+ previewUrl?: string | null;
13
+ previewAlt?: string;
14
+ preview?: ReactNode;
15
+ empty?: ReactNode;
16
+ actions?: ReactNode;
17
+ children?: ReactNode;
18
+ className?: string;
19
+ classPrefix?: string;
20
+ }
21
+
22
+ export function MediaField( {
23
+ label,
24
+ help,
25
+ error,
26
+ required = false,
27
+ htmlFor,
28
+ previewUrl,
29
+ previewAlt = '',
30
+ preview,
31
+ empty,
32
+ actions,
33
+ children,
34
+ className = '',
35
+ classPrefix = 'ec-media-field',
36
+ }: MediaFieldProps ) {
37
+ const mediaClassName = [ classPrefix, className ].filter( Boolean ).join( ' ' );
38
+ const hasMeta = Boolean( label || help || error || required );
39
+ const previewContent = preview || ( previewUrl ? <ImagePreview src={ previewUrl } alt={ previewAlt } /> : null );
40
+ const body = (
41
+ <>
42
+ { children ? <div className={ `${ classPrefix }__input` }>{ children }</div> : null }
43
+ <div className={ `${ classPrefix }__surface` }>
44
+ { previewContent ? (
45
+ <div className={ `${ classPrefix }__preview` }>{ previewContent }</div>
46
+ ) : empty ? (
47
+ <div className={ `${ classPrefix }__empty` }>{ empty }</div>
48
+ ) : null }
49
+ </div>
50
+ { actions ? <ActionRow className={ `${ classPrefix }__actions` }>{ actions }</ActionRow> : null }
51
+ </>
52
+ );
53
+
54
+ if ( hasMeta ) {
55
+ return (
56
+ <FieldGroup
57
+ label={ label }
58
+ help={ help }
59
+ error={ error }
60
+ required={ required }
61
+ htmlFor={ htmlFor }
62
+ className={ mediaClassName }
63
+ >
64
+ { body }
65
+ </FieldGroup>
66
+ );
67
+ }
68
+
69
+ return <div className={ mediaClassName }>{ body }</div>;
70
+ }
package/src/Panel.tsx ADDED
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface PanelProps {
4
+ children: ReactNode;
5
+ className?: string;
6
+ classPrefix?: string;
7
+ compact?: boolean;
8
+ }
9
+
10
+ export function Panel( {
11
+ children,
12
+ className = '',
13
+ classPrefix = 'ec-panel',
14
+ compact = false,
15
+ }: PanelProps ) {
16
+ const panelClass = [
17
+ classPrefix,
18
+ compact ? `${ classPrefix }--compact` : '',
19
+ className,
20
+ ].filter( Boolean ).join( ' ' );
21
+
22
+ return <div className={ panelClass }>{ children }</div>;
23
+ }
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface PanelHeaderProps {
4
+ title?: ReactNode;
5
+ description?: ReactNode;
6
+ actions?: ReactNode;
7
+ className?: string;
8
+ classPrefix?: string;
9
+ }
10
+
11
+ export function PanelHeader( {
12
+ title,
13
+ description,
14
+ actions,
15
+ className = '',
16
+ classPrefix = 'ec-panel-header',
17
+ }: PanelHeaderProps ) {
18
+ return (
19
+ <div className={ [ classPrefix, className ].filter( Boolean ).join( ' ' ) }>
20
+ <div className={ `${ classPrefix }__main` }>
21
+ { title && <div className={ `${ classPrefix }__title` }>{ title }</div> }
22
+ { description && <div className={ `${ classPrefix }__description` }>{ description }</div> }
23
+ </div>
24
+ { actions && <div className={ `${ classPrefix }__actions` }>{ actions }</div> }
25
+ </div>
26
+ );
27
+ }
package/src/index.tsx CHANGED
@@ -9,3 +9,10 @@ export { Pagination, type PaginationProps } from './Pagination.tsx';
9
9
  export { SearchBox, type SearchBoxProps } from './SearchBox.tsx';
10
10
  export { Modal, type ModalProps } from './Modal.tsx';
11
11
  export { Tabs, type TabsProps, type TabItem } from './Tabs.tsx';
12
+ export { Panel, type PanelProps } from './Panel.tsx';
13
+ export { PanelHeader, type PanelHeaderProps } from './PanelHeader.tsx';
14
+ export { ActionRow, type ActionRowProps } from './ActionRow.tsx';
15
+ export { FieldGroup, type FieldGroupProps } from './FieldGroup.tsx';
16
+ export { InlineStatus, type InlineStatusProps } from './InlineStatus.tsx';
17
+ export { ImagePreview, type ImagePreviewProps } from './ImagePreview.tsx';
18
+ export { MediaField, type MediaFieldProps } from './MediaField.tsx';
@@ -128,6 +128,191 @@
128
128
  }
129
129
  }
130
130
 
131
+ // Panel
132
+ .ec-panel {
133
+ border: 1px solid var(--border-color, #ddd);
134
+ border-radius: var(--border-radius-lg, 8px);
135
+ padding: var(--spacing-md, 1rem);
136
+ background: var(--card-background, #f8f8f8);
137
+ display: grid;
138
+ gap: var(--spacing-md, 1rem);
139
+ }
140
+
141
+ .ec-panel--compact {
142
+ padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
143
+ border-radius: var(--border-radius-md, 6px);
144
+ }
145
+
146
+ // Panel Header
147
+ .ec-panel-header {
148
+ display: flex;
149
+ justify-content: space-between;
150
+ align-items: center;
151
+ gap: var(--spacing-md, 1rem);
152
+ flex-wrap: wrap;
153
+ padding-bottom: var(--spacing-md, 1rem);
154
+ border-bottom: 1px solid var(--border-color, #ddd);
155
+ }
156
+
157
+ .ec-panel-header__main {
158
+ display: grid;
159
+ gap: var(--spacing-xs, 0.25rem);
160
+ }
161
+
162
+ .ec-panel-header__title {
163
+ margin: 0;
164
+ font-family: var(--font-family-heading, inherit);
165
+ font-weight: 600;
166
+ color: var(--text-color, #111);
167
+ }
168
+
169
+ .ec-panel-header__description {
170
+ color: var(--muted-text, #666);
171
+ font-size: var(--font-size-sm, 0.875rem);
172
+ }
173
+
174
+ .ec-panel-header__actions {
175
+ display: flex;
176
+ align-items: center;
177
+ gap: var(--spacing-sm, 0.5rem);
178
+ flex-wrap: wrap;
179
+ }
180
+
181
+ // Action Row
182
+ .ec-action-row {
183
+ display: flex;
184
+ align-items: center;
185
+ gap: var(--spacing-sm, 0.5rem);
186
+ flex-wrap: wrap;
187
+ }
188
+
189
+ .ec-action-row--between {
190
+ justify-content: space-between;
191
+ }
192
+
193
+ .ec-action-row--end {
194
+ justify-content: flex-end;
195
+ }
196
+
197
+ // Field Group
198
+ .ec-field-group {
199
+ display: grid;
200
+ gap: var(--spacing-xs, 0.25rem);
201
+ margin-bottom: var(--spacing-md, 1rem);
202
+ }
203
+
204
+ .ec-field-group__label {
205
+ display: block;
206
+ font-weight: 600;
207
+ color: var(--text-color, #111);
208
+ font-size: var(--font-size-sm, 0.875rem);
209
+ }
210
+
211
+ .ec-field-group__required {
212
+ color: var(--error-color, #dc3232);
213
+ }
214
+
215
+ .ec-field-group__control {
216
+ display: grid;
217
+ gap: var(--spacing-xs, 0.25rem);
218
+ }
219
+
220
+ .ec-field-group__help {
221
+ font-size: var(--font-size-sm, 0.875rem);
222
+ color: var(--muted-text, #666);
223
+ }
224
+
225
+ .ec-field-group__error {
226
+ font-size: var(--font-size-sm, 0.875rem);
227
+ color: var(--error-color, #dc3232);
228
+ }
229
+
230
+ // Inline Status
231
+ .ec-inline-status {
232
+ font-size: var(--font-size-sm, 0.875rem);
233
+ font-weight: 500;
234
+ }
235
+
236
+ .ec-inline-status--success {
237
+ color: var(--success-color, #2e7d32);
238
+ }
239
+
240
+ .ec-inline-status--error {
241
+ color: var(--error-color, #dc3232);
242
+ }
243
+
244
+ .ec-inline-status--warning {
245
+ color: #856404;
246
+ }
247
+
248
+ .ec-inline-status--info {
249
+ color: #004085;
250
+ }
251
+
252
+ // Image Preview
253
+ .ec-image-preview {
254
+ display: inline-flex;
255
+ align-items: center;
256
+ justify-content: center;
257
+ position: relative;
258
+ max-width: 100%;
259
+ overflow: hidden;
260
+ border: 1px solid var(--border-color, #ddd);
261
+ border-radius: var(--border-radius-md, 6px);
262
+ background: var(--background-color, #fff);
263
+ padding: var(--spacing-xs, 0.25rem);
264
+ box-sizing: border-box;
265
+ }
266
+
267
+ .ec-image-preview__image {
268
+ display: block;
269
+ max-width: min(100%, var(--ec-image-preview-max-width, 220px));
270
+ width: auto;
271
+ height: auto;
272
+ border-radius: inherit;
273
+ }
274
+
275
+ .ec-image-preview__overlay {
276
+ position: absolute;
277
+ inset: 0;
278
+ }
279
+
280
+ // Media Field
281
+ .ec-media-field {
282
+ display: grid;
283
+ gap: var(--spacing-sm, 0.5rem);
284
+ }
285
+
286
+ .ec-media-field__input {
287
+ display: grid;
288
+ gap: var(--spacing-xs, 0.25rem);
289
+ }
290
+
291
+ .ec-media-field__surface {
292
+ display: grid;
293
+ gap: var(--spacing-sm, 0.5rem);
294
+ }
295
+
296
+ .ec-media-field__preview,
297
+ .ec-media-field__empty {
298
+ display: grid;
299
+ gap: var(--spacing-sm, 0.5rem);
300
+ justify-items: start;
301
+ }
302
+
303
+ .ec-media-field__empty {
304
+ padding: var(--spacing-md, 1rem);
305
+ border: 1px dashed var(--border-color, #ddd);
306
+ border-radius: var(--border-radius-md, 6px);
307
+ background: var(--background-color, #fff);
308
+ color: var(--muted-text, #666);
309
+ font-size: var(--font-size-sm, 0.875rem);
310
+ }
311
+
312
+ .ec-media-field__actions {
313
+ margin-top: 0;
314
+ }
315
+
131
316
  // Badges (commonly used with tables)
132
317
  .ec-badge {
133
318
  display: inline-block;