@sensorario/sg-components 0.0.93 → 0.0.95
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/dist/App.d.ts +3 -0
- package/dist/components/Authenticator/Authenticator.d.ts +9 -0
- package/dist/components/Authenticator/Authenticator.stories.d.ts +7 -0
- package/dist/components/Button/Button.d.ts +10 -0
- package/dist/components/Button/Button.stories.d.ts +6 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +9 -0
- package/dist/components/ColorPicker/ColorPicker.stories.d.ts +6 -0
- package/dist/components/CookieConsent/CookieConsent.d.ts +6 -0
- package/dist/components/CookieConsent/CookieConsent.stories.d.ts +6 -0
- package/dist/components/FontPicker/FontPicker.d.ts +9 -0
- package/dist/components/FontPicker/FontPicker.stories.d.ts +6 -0
- package/dist/components/Footer/Footer.d.ts +11 -0
- package/dist/components/Footer/Footer.stories.d.ts +8 -0
- package/dist/components/Header/Header.d.ts +11 -0
- package/dist/components/Header/Header.stories.d.ts +6 -0
- package/dist/components/Icon/Icon.d.ts +9 -0
- package/dist/components/Icon/Icon.stories.d.ts +7 -0
- package/dist/components/Input/Input.d.ts +8 -0
- package/dist/components/Input/Input.stories.d.ts +7 -0
- package/dist/components/LoginModal/LoginModal.d.ts +9 -0
- package/dist/components/LoginModal/LoginModal.stories.d.ts +6 -0
- package/dist/components/Modal/Modal.d.ts +19 -0
- package/dist/components/Modal/Modal.stories.d.ts +8 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +7 -0
- package/dist/components/PasswordInput/PasswordInput.stories.d.ts +6 -0
- package/dist/components/Quadrato/Header/QuadratoHeader.d.ts +24 -0
- package/dist/components/Quadrato/Header/QuadratoHeader.stories.d.ts +7 -0
- package/dist/components/SG/Footer/SGFooter.d.ts +1 -0
- package/dist/components/SG/Footer/SGFooter.stories.d.ts +6 -0
- package/dist/components/SG/Header/SGHeader.d.ts +5 -0
- package/dist/components/SG/Header/SGHeader.stories.d.ts +6 -0
- package/dist/components/SetPasswordModal/SetPasswordModal.d.ts +9 -0
- package/dist/components/SetPasswordModal/SetPasswordModal.stories.d.ts +6 -0
- package/dist/components/Toggle/Toggle.d.ts +9 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +6 -0
- package/dist/index.d.ts +15 -0
- package/dist/main.d.ts +1 -0
- package/package.json +3 -3
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Authenticator.css';
|
|
3
|
+
type AuthenticatorProps = {
|
|
4
|
+
isLoggedIn: boolean;
|
|
5
|
+
handleLogin: () => void;
|
|
6
|
+
handleLogout: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const Authenticator: React.FC<AuthenticatorProps>;
|
|
9
|
+
export default Authenticator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Authenticator from './Authenticator';
|
|
3
|
+
declare const meta: Meta<typeof Authenticator>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Authenticator>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const LoggedIn: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Button.css';
|
|
3
|
+
import { type IconName } from '../Icon/Icon';
|
|
4
|
+
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: IconName;
|
|
7
|
+
iconOnly?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
10
|
+
export default Button;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './ColorPicker.css';
|
|
3
|
+
export interface ColorPickerProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (color: string) => void;
|
|
6
|
+
swatches: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const ColorPicker: React.FC<ColorPickerProps>;
|
|
9
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './FontPicker.css';
|
|
3
|
+
export interface FontPickerProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (fontFamily: string) => void;
|
|
6
|
+
options: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const FontPicker: React.FC<FontPickerProps>;
|
|
9
|
+
export default FontPicker;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './footer.css';
|
|
2
|
+
interface FooterProps {
|
|
3
|
+
copyright?: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
links?: {
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export declare const Footer: ({ copyright, href, links }: FooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Footer } from './Footer';
|
|
3
|
+
declare const meta: Meta<typeof Footer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Footer>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithLinks: Story;
|
|
8
|
+
export declare const CustomCopyright: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import './Header.css';
|
|
3
|
+
interface HeaderProps {
|
|
4
|
+
onNavigate?: (page: string) => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
homePageKey?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const Header: ({ onNavigate, title, homePageKey, children, className, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Icon.css';
|
|
3
|
+
export type IconName = 'menu' | 'layout' | 'edit' | 'help-circle' | 'check' | 'x' | 'file-plus' | 'link' | 'share-2' | 'download' | 'book' | 'printer' | 'eye' | 'columns' | 'sidebar-left' | 'sidebar-right' | 'play' | 'pause' | 'volume-2' | 'tech-node' | 'tech-go' | 'tech-php';
|
|
4
|
+
export interface IconProps extends React.SVGAttributes<SVGSVGElement> {
|
|
5
|
+
name: IconName;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const Icon: React.FC<IconProps>;
|
|
9
|
+
export default Icon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Icon } from './Icon';
|
|
3
|
+
declare const meta: Meta<typeof Icon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Icon>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const AllIcons: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Input from './Input';
|
|
3
|
+
declare const meta: Meta<typeof Input>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Input>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Invalid: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './LoginModal.css';
|
|
3
|
+
interface LoginModalProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onLogin: (username: string, password: string) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const LoginModal: React.FC<LoginModalProps>;
|
|
9
|
+
export default LoginModal;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Modal.css';
|
|
3
|
+
export type ModalButton = {
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
};
|
|
7
|
+
interface ModalProps {
|
|
8
|
+
open: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
title?: string;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
buttons?: ModalButton[];
|
|
14
|
+
footer?: React.ReactNode;
|
|
15
|
+
closeLabel?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Modal: React.FC<ModalProps>;
|
|
19
|
+
export default Modal;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Modal from './Modal';
|
|
3
|
+
declare const meta: Meta<typeof Modal>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Modal>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithIconAndButtons: Story;
|
|
8
|
+
export declare const WithCustomFooter: Story;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './QuadratoHeader.css';
|
|
2
|
+
interface QuadratoHeaderProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
homePageKey?: string;
|
|
5
|
+
onNavigate?: (page: string) => void;
|
|
6
|
+
/** Name of the shared .simonegentili.com auth cookie to check. */
|
|
7
|
+
cookieName?: string;
|
|
8
|
+
/** Username to display once authenticated. If omitted, falls back to decoding `usernameJwtField` from the JWT cookie. */
|
|
9
|
+
username?: string | null;
|
|
10
|
+
/** JWT claim to use as username when `username` prop is not provided. Default: 'sub' */
|
|
11
|
+
usernameJwtField?: string;
|
|
12
|
+
/** Delegated login call, e.g. AjaxRepository.authenticate. Must set the auth cookie on success. */
|
|
13
|
+
onLogin: (username: string, password: string) => void | Promise<void>;
|
|
14
|
+
/** Delegated logout call. Must clear the auth cookie. */
|
|
15
|
+
onLogout?: () => void;
|
|
16
|
+
/** Notified on mount and after every login/logout with the current auth state. */
|
|
17
|
+
onUserAuthenticated?: (isAuthenticated: boolean, username: string | null) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface QuadratoHeaderHandle {
|
|
20
|
+
/** Forces the login modal open, e.g. when a consumer action requires auth first. */
|
|
21
|
+
openLoginModal: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const QuadratoHeader: import("react").ForwardRefExoticComponent<QuadratoHeaderProps & import("react").RefAttributes<QuadratoHeaderHandle>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { QuadratoHeader } from './QuadratoHeader';
|
|
3
|
+
declare const meta: Meta<typeof QuadratoHeader>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof QuadratoHeader>;
|
|
6
|
+
export declare const LoggedOut: Story;
|
|
7
|
+
export declare const LoggedIn: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SGFooter: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SetPasswordModal.css';
|
|
3
|
+
interface SetPasswordModalProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onSubmit: (newPassword: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const SetPasswordModal: React.FC<SetPasswordModalProps>;
|
|
9
|
+
export default SetPasswordModal;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SetPasswordModal } from './SetPasswordModal';
|
|
3
|
+
declare const meta: Meta<typeof SetPasswordModal>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SetPasswordModal>;
|
|
6
|
+
export declare const Default: Story;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './components/Button/Button';
|
|
2
|
+
export * from './components/Icon/Icon';
|
|
3
|
+
export * from './components/Footer/Footer';
|
|
4
|
+
export * from './components/SG/Footer/SGFooter';
|
|
5
|
+
export * from './components/CookieConsent/CookieConsent';
|
|
6
|
+
export * from './components/Header/Header';
|
|
7
|
+
export * from './components/SG/Header/SGHeader';
|
|
8
|
+
export * from './components/Quadrato/Header/QuadratoHeader';
|
|
9
|
+
export * from './components/Authenticator/Authenticator';
|
|
10
|
+
export * from './components/LoginModal/LoginModal';
|
|
11
|
+
export * from './components/SetPasswordModal/SetPasswordModal';
|
|
12
|
+
export * from './components/Modal/Modal';
|
|
13
|
+
export * from './components/ColorPicker/ColorPicker';
|
|
14
|
+
export * from './components/FontPicker/FontPicker';
|
|
15
|
+
export * from './components/Toggle/Toggle';
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sensorario/sg-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"build": "
|
|
8
|
+
"build": "tsc -b && vite build && tsc -p tsconfig.build.json",
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"preview": "vite preview",
|
|
11
11
|
"storybook": "storybook dev -p 6006",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"import": "./dist/index.es.js",
|
|
26
25
|
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.es.js",
|
|
27
27
|
"style": "./dist/sg-components.css"
|
|
28
28
|
}
|
|
29
29
|
},
|