@digigov/react-experimental 2.0.0-8de46296 → 2.0.0-96651090
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/FloatingButton/index.d.ts +1 -1
- package/FloatingButton/index.js +15 -23
- package/Kitchensink/AllComponents.d.ts +2 -0
- package/Kitchensink/AllComponents.js +7 -0
- package/Kitchensink/KitchensinkByCategory.d.ts +6 -0
- package/Kitchensink/KitchensinkByCategory.js +25 -0
- package/Kitchensink/KitchensinkByLetter.d.ts +6 -0
- package/Kitchensink/KitchensinkByLetter.js +14 -0
- package/Kitchensink/KitchensinkComponent.d.ts +10 -0
- package/Kitchensink/KitchensinkComponent.js +29 -0
- package/Kitchensink/KitchensinkDashboard.d.ts +5 -0
- package/Kitchensink/KitchensinkDashboard.js +28 -0
- package/Kitchensink/index.d.ts +5 -0
- package/Kitchensink/index.js +5 -0
- package/OptionButtonBase/index.d.ts +5 -5
- package/OptionButtonBase/index.js +16 -23
- package/OptionButtonSteps/index.d.ts +10 -10
- package/OptionButtonSteps/index.js +21 -30
- package/index.d.ts +4 -3
- package/index.js +5 -4
- package/package.json +11 -13
- package/src/FloatingButton/__snapshots__/index.test.tsx.snap +37 -0
- package/src/FloatingButton/index.test.tsx +11 -5
- package/src/FloatingButton/index.tsx +1 -1
- package/src/Kitchensink/AllComponents.tsx +7 -0
- package/src/Kitchensink/KitchensinkByCategory.tsx +54 -0
- package/src/Kitchensink/KitchensinkByLetter.tsx +35 -0
- package/src/Kitchensink/KitchensinkComponent.tsx +70 -0
- package/src/Kitchensink/KitchensinkDashboard.tsx +56 -0
- package/src/Kitchensink/index.ts +5 -0
- package/src/OptionButtonBase/__snapshots__/index.test.tsx.snap +37 -0
- package/src/OptionButtonBase/index.test.tsx +11 -5
- package/src/OptionButtonBase/index.tsx +8 -9
- package/src/OptionButtonSteps/__snapshots__/index.test.tsx.snap +84 -0
- package/src/OptionButtonSteps/index.test.tsx +21 -7
- package/src/OptionButtonSteps/index.tsx +10 -11
- package/src/index.ts +1 -0
- package/FloatingButton/index.test/index.js +0 -19
- package/FloatingButton/index.test/package.json +0 -6
- package/FloatingButton/index.test.d.ts +0 -1
- package/FloatingButton/package.json +0 -6
- package/OptionButtonBase/index.test/index.js +0 -19
- package/OptionButtonBase/index.test/package.json +0 -6
- package/OptionButtonBase/index.test.d.ts +0 -1
- package/OptionButtonBase/package.json +0 -6
- package/OptionButtonSteps/index.test/index.js +0 -32
- package/OptionButtonSteps/index.test/package.json +0 -6
- package/OptionButtonSteps/index.test.d.ts +0 -1
- package/OptionButtonSteps/package.json +0 -6
- package/cjs/FloatingButton/index.js +0 -31
- package/cjs/FloatingButton/index.test/index.js +0 -22
- package/cjs/OptionButtonBase/index.js +0 -31
- package/cjs/OptionButtonBase/index.test/index.js +0 -22
- package/cjs/OptionButtonSteps/index.js +0 -38
- package/cjs/OptionButtonSteps/index.test/index.js +0 -35
- package/cjs/index.js +0 -38
|
@@ -17,5 +17,5 @@ export interface FloatingButtonProps extends ButtonProps {
|
|
|
17
17
|
* Use it primary in mobile applications.
|
|
18
18
|
* Avoid using text in this type of button, use icons instead.
|
|
19
19
|
*/
|
|
20
|
-
export declare const FloatingButton: React.ForwardRefExoticComponent<
|
|
20
|
+
export declare const FloatingButton: React.ForwardRefExoticComponent<Omit<FloatingButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
21
|
export default FloatingButton;
|
package/FloatingButton/index.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _ref$direction = _ref.direction,
|
|
15
|
-
direction = _ref$direction === void 0 ? 'right' : _ref$direction,
|
|
16
|
-
className = _ref.className,
|
|
17
|
-
children = _ref.children,
|
|
18
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
20
|
-
ref: ref,
|
|
21
|
-
className: clsx(className, direction === 'right' && 'ds-floating-btn--right', direction === 'left' && 'ds-floating-btn--left', true && 'ds-floating-btn')
|
|
22
|
-
}, props), children);
|
|
1
|
+
import react from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import Button from "@digigov/react-core/Button/index.js";
|
|
4
|
+
const FloatingButton_FloatingButton = /*#__PURE__*/ react.forwardRef(function({ direction = 'right', className, children, ...props }, ref) {
|
|
5
|
+
return /*#__PURE__*/ react.createElement(Button, {
|
|
6
|
+
ref: ref,
|
|
7
|
+
className: clsx(className, {
|
|
8
|
+
'ds-floating-btn': true,
|
|
9
|
+
'ds-floating-btn--right': 'right' === direction,
|
|
10
|
+
'ds-floating-btn--left': 'left' === direction
|
|
11
|
+
}),
|
|
12
|
+
...props
|
|
13
|
+
}, children);
|
|
23
14
|
});
|
|
24
|
-
|
|
15
|
+
const src_FloatingButton = FloatingButton_FloatingButton;
|
|
16
|
+
export { FloatingButton_FloatingButton as FloatingButton, src_FloatingButton as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { KitchenSinkDashboard } from "./KitchensinkDashboard.js";
|
|
3
|
+
import { stories } from "@digigov/ui/stories-registry";
|
|
4
|
+
const AllComponents = ()=>/*#__PURE__*/ react.createElement(KitchenSinkDashboard, {
|
|
5
|
+
stories: stories
|
|
6
|
+
});
|
|
7
|
+
export { AllComponents };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { KitchenSinkCategory } from "@digigov/react-core/KitchenSinkCategory/index.js";
|
|
3
|
+
import { KitchenSinkHeading } from "@digigov/react-core/KitchenSinkHeading/index.js";
|
|
4
|
+
import { KitchensinkByLetter } from "./KitchensinkByLetter.js";
|
|
5
|
+
const KitchensinkByCategory = ({ category, stories })=>{
|
|
6
|
+
const alphabeticalOrder = Object.keys(stories).reduce((abStories, componentStoriesKey)=>{
|
|
7
|
+
const componentStories = stories[componentStoriesKey];
|
|
8
|
+
if (!componentStories.default.component) throw new Error(`no component was found in ${componentStoriesKey}`);
|
|
9
|
+
const name = componentStories.default.displayName;
|
|
10
|
+
console.log('componentStories', componentStories, 'stories', stories);
|
|
11
|
+
if (!name) throw new Error(`no name was found for ${componentStoriesKey}`);
|
|
12
|
+
const letter = name[0];
|
|
13
|
+
if (abStories[letter]) abStories[letter].push(componentStories);
|
|
14
|
+
else abStories[letter] = [
|
|
15
|
+
componentStories
|
|
16
|
+
];
|
|
17
|
+
return abStories;
|
|
18
|
+
}, {});
|
|
19
|
+
return /*#__PURE__*/ react.createElement("div", null, /*#__PURE__*/ react.createElement(KitchenSinkHeading, null, category), /*#__PURE__*/ react.createElement(KitchenSinkCategory, null, Object.keys(alphabeticalOrder).sort().map((letter, index)=>/*#__PURE__*/ react.createElement(KitchensinkByLetter, {
|
|
20
|
+
letter: letter,
|
|
21
|
+
stories: alphabeticalOrder[letter],
|
|
22
|
+
key: index
|
|
23
|
+
}))));
|
|
24
|
+
};
|
|
25
|
+
export { KitchensinkByCategory };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import Heading from "@digigov/react-core/Heading/index.js";
|
|
3
|
+
import { KitchenSinkLetterContent } from "@digigov/react-core/KitchenSinkLetterContent/index.js";
|
|
4
|
+
import { KitchensinkComponent } from "./KitchensinkComponent.js";
|
|
5
|
+
const KitchensinkByLetter = ({ letter, stories })=>/*#__PURE__*/ react.createElement("div", null, /*#__PURE__*/ react.createElement(Heading, null, letter), /*#__PURE__*/ react.createElement(KitchenSinkLetterContent, null, stories.map((story, index)=>/*#__PURE__*/ react.createElement(KitchensinkComponent, {
|
|
6
|
+
tags: story.default.tags,
|
|
7
|
+
title: story.default.displayName,
|
|
8
|
+
description: story.default.description,
|
|
9
|
+
link: story.default.link,
|
|
10
|
+
width: story.default.defaultWidth,
|
|
11
|
+
stories: story,
|
|
12
|
+
key: index
|
|
13
|
+
}))));
|
|
14
|
+
export { KitchensinkByLetter };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface KitchensinkComponentInterface {
|
|
3
|
+
tags?: string[];
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
link?: string;
|
|
7
|
+
stories: React.ReactElement[];
|
|
8
|
+
width?: 'md' | 'lg';
|
|
9
|
+
}
|
|
10
|
+
export declare const KitchensinkComponent: ({ tags, title, description, link, stories, width, }: KitchensinkComponentInterface) => React.JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { KitchenSinkCard } from "@digigov/react-core/KitchenSinkCard/index.js";
|
|
3
|
+
import { KitchenSinkContent } from "@digigov/react-core/KitchenSinkContent/index.js";
|
|
4
|
+
import { KitchenSinkContentInfo } from "@digigov/react-core/KitchenSinkContentInfo/index.js";
|
|
5
|
+
import { KitchenSinkContentTags } from "@digigov/react-core/KitchenSinkContentTags/index.js";
|
|
6
|
+
import PhaseBanner, { PhaseBannerTag, PhaseBannerText } from "@digigov/ui/feedback/PhaseBanner/index.js";
|
|
7
|
+
import SectionBreak from "@digigov/ui/layouts/SectionBreak/index.js";
|
|
8
|
+
import Link from "@digigov/ui/navigation/Link/index.js";
|
|
9
|
+
import { Paragraph } from "@digigov/ui/typography/index.js";
|
|
10
|
+
import Heading from "@digigov/ui/typography/Heading/index.js";
|
|
11
|
+
const KitchensinkComponent = ({ tags = [], title, description, link, stories, width = 'md' })=>/*#__PURE__*/ react.createElement(KitchenSinkContent, {
|
|
12
|
+
wide: 'lg' === width
|
|
13
|
+
}, /*#__PURE__*/ react.createElement(KitchenSinkContentInfo, null, /*#__PURE__*/ react.createElement(KitchenSinkContentTags, null, tags && tags.map((tag, index)=>/*#__PURE__*/ react.createElement(PhaseBanner, {
|
|
14
|
+
key: index
|
|
15
|
+
}, /*#__PURE__*/ react.createElement(PhaseBannerTag, null, tag), /*#__PURE__*/ react.createElement(PhaseBannerText, null, "Αυτή είναι μία νέα υπηρεσία – τα", ' ', /*#__PURE__*/ react.createElement(Link, {
|
|
16
|
+
href: "#feedback"
|
|
17
|
+
}, "σχόλιά"), " σας θα μας βοηθήσουν να τη βελτιώσουμε.")))), /*#__PURE__*/ react.createElement(Heading, {
|
|
18
|
+
size: "lg"
|
|
19
|
+
}, title), /*#__PURE__*/ react.createElement(Paragraph, null, description), link && /*#__PURE__*/ react.createElement(Link, {
|
|
20
|
+
href: link
|
|
21
|
+
}, "View on GOV.GR Design System"), /*#__PURE__*/ react.createElement(SectionBreak, null)), Object.keys(stories).filter((story)=>'default' !== story).map((story, index)=>{
|
|
22
|
+
const Component = stories[story];
|
|
23
|
+
return /*#__PURE__*/ react.createElement("div", {
|
|
24
|
+
key: index
|
|
25
|
+
}, /*#__PURE__*/ react.createElement(SectionBreak, null), /*#__PURE__*/ react.createElement(Heading, {
|
|
26
|
+
size: "sm"
|
|
27
|
+
}, story), /*#__PURE__*/ react.createElement(KitchenSinkCard, null, /*#__PURE__*/ react.createElement(Component, null)));
|
|
28
|
+
}));
|
|
29
|
+
export { KitchensinkComponent };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { KitchenSinkAllComponents } from "@digigov/react-core/KitchenSinkAllComponents/index.js";
|
|
3
|
+
import Paragraph from "@digigov/react-core/Paragraph/index.js";
|
|
4
|
+
import { KitchensinkByCategory } from "./KitchensinkByCategory.js";
|
|
5
|
+
const KitchenSinkDashboard = ({ stories })=>{
|
|
6
|
+
const categoryOrder = Object.keys(stories).reduce((catStories, componentStoriesKey)=>{
|
|
7
|
+
const componentStories = stories[componentStoriesKey];
|
|
8
|
+
if (componentStories.default.ignore) return catStories;
|
|
9
|
+
if (!componentStories.default.component) throw new Error(`no component was found in ${componentStoriesKey}`);
|
|
10
|
+
const title = componentStories.default.title.split('/')[1];
|
|
11
|
+
if (!title) throw new Error(`no title was found for ${componentStoriesKey}`);
|
|
12
|
+
const category = title;
|
|
13
|
+
if (catStories[category]) catStories[category].push(componentStories);
|
|
14
|
+
else catStories[category] = [
|
|
15
|
+
componentStories
|
|
16
|
+
];
|
|
17
|
+
return catStories;
|
|
18
|
+
}, {});
|
|
19
|
+
return /*#__PURE__*/ react.createElement("div", null, /*#__PURE__*/ react.createElement(Paragraph, {
|
|
20
|
+
fontSize: 72,
|
|
21
|
+
fontWeight: "bold"
|
|
22
|
+
}, "Components"), /*#__PURE__*/ react.createElement(KitchenSinkAllComponents, null, Object.keys(categoryOrder).sort((a, b)=>a > b ? -1 : 1).map((category, index)=>/*#__PURE__*/ react.createElement(KitchensinkByCategory, {
|
|
23
|
+
category: category,
|
|
24
|
+
stories: categoryOrder[category],
|
|
25
|
+
key: index
|
|
26
|
+
}))));
|
|
27
|
+
};
|
|
28
|
+
export { KitchenSinkDashboard };
|
|
@@ -4,10 +4,10 @@ export interface OptionButtonBaseProps extends BaseProps<'button'> {
|
|
|
4
4
|
/**
|
|
5
5
|
* selected is optional.
|
|
6
6
|
* Use selected prop to set selected styling.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
* @value true
|
|
8
|
+
* @value false
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
11
|
selected?: boolean;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -15,5 +15,5 @@ export interface OptionButtonBaseProps extends BaseProps<'button'> {
|
|
|
15
15
|
* OptionButtonBases can be used to represent small blocks of information.
|
|
16
16
|
* OptionButtonBase component must be inside OptionButtonBaseSection component.
|
|
17
17
|
*/
|
|
18
|
-
export declare const OptionButtonBase: React.ForwardRefExoticComponent<
|
|
18
|
+
export declare const OptionButtonBase: React.ForwardRefExoticComponent<Omit<OptionButtonBaseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
19
19
|
export default OptionButtonBase;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className = _ref.className,
|
|
16
|
-
children = _ref.children,
|
|
17
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
19
|
-
as: "button",
|
|
20
|
-
ref: ref,
|
|
21
|
-
className: clsx(className, selected && 'ds-option-btn--selected', true && ['ds-btn', 'ds-option-btn'])
|
|
22
|
-
}, props), children);
|
|
1
|
+
import react from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import Base from "@digigov/react-core/Base/index.js";
|
|
4
|
+
const OptionButtonBase_OptionButtonBase = /*#__PURE__*/ react.forwardRef(function({ selected = false, className, children, ...props }, ref) {
|
|
5
|
+
return /*#__PURE__*/ react.createElement(Base, {
|
|
6
|
+
as: "button",
|
|
7
|
+
ref: ref,
|
|
8
|
+
className: clsx(className, {
|
|
9
|
+
'ds-btn': true,
|
|
10
|
+
'ds-option-btn': true,
|
|
11
|
+
'ds-option-btn--selected': selected
|
|
12
|
+
}),
|
|
13
|
+
...props
|
|
14
|
+
}, children);
|
|
23
15
|
});
|
|
24
|
-
|
|
16
|
+
const src_OptionButtonBase = OptionButtonBase_OptionButtonBase;
|
|
17
|
+
export { OptionButtonBase_OptionButtonBase as OptionButtonBase, src_OptionButtonBase as default };
|
|
@@ -2,17 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import { BaseProps } from '@digigov/react-core/Base';
|
|
3
3
|
export interface OptionButtonStepsProps extends BaseProps<'div'> {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
* @value 0
|
|
6
|
+
* @value 1
|
|
7
|
+
* @value 2
|
|
8
|
+
* @value 3
|
|
9
|
+
* @value 4
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
12
|
steps?: stepsProps;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* @default 0
|
|
15
|
+
*/
|
|
16
16
|
activeStep?: number;
|
|
17
17
|
}
|
|
18
18
|
export type stepsProps = 0 | 1 | 2 | 3 | 4;
|
|
@@ -21,5 +21,5 @@ export type stepsProps = 0 | 1 | 2 | 3 | 4;
|
|
|
21
21
|
* OptionButtonSteps can be used to represent small blocks of information.
|
|
22
22
|
* OptionButtonSteps component must be inside OptionButtonStepsSection component.
|
|
23
23
|
*/
|
|
24
|
-
export declare const OptionButtonSteps: React.ForwardRefExoticComponent<
|
|
24
|
+
export declare const OptionButtonSteps: React.ForwardRefExoticComponent<Omit<OptionButtonStepsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
25
|
export default OptionButtonSteps;
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return /*#__PURE__*/React.createElement(Base, {
|
|
21
|
-
as: "div",
|
|
22
|
-
className: clsx(className, activeStep >= step && 'ds-option-btn__step--active', true && 'ds-option-btn__step')
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
26
|
-
as: "div",
|
|
27
|
-
ref: ref,
|
|
28
|
-
className: clsx(className, true && 'ds-option-btn__steps')
|
|
29
|
-
}, props), steps >= 1 && renderStep(1), steps >= 2 && renderStep(2), steps >= 3 && renderStep(3), steps >= 4 && renderStep(4));
|
|
1
|
+
import react from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import Base from "@digigov/react-core/Base/index.js";
|
|
4
|
+
const OptionButtonSteps_OptionButtonSteps = /*#__PURE__*/ react.forwardRef(function({ steps = 0, activeStep = 0, className, ...props }, ref) {
|
|
5
|
+
const renderStep = (step)=>/*#__PURE__*/ react.createElement(Base, {
|
|
6
|
+
as: "div",
|
|
7
|
+
className: clsx(className, {
|
|
8
|
+
'ds-option-btn__step': true,
|
|
9
|
+
'ds-option-btn__step--active': activeStep >= step
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
return /*#__PURE__*/ react.createElement(Base, {
|
|
13
|
+
as: "div",
|
|
14
|
+
ref: ref,
|
|
15
|
+
className: clsx(className, {
|
|
16
|
+
'ds-option-btn__steps': true
|
|
17
|
+
}),
|
|
18
|
+
...props
|
|
19
|
+
}, steps >= 1 && renderStep(1), steps >= 2 && renderStep(2), steps >= 3 && renderStep(3), steps >= 4 && renderStep(4));
|
|
30
20
|
});
|
|
31
|
-
|
|
21
|
+
const src_OptionButtonSteps = OptionButtonSteps_OptionButtonSteps;
|
|
22
|
+
export { OptionButtonSteps_OptionButtonSteps as OptionButtonSteps, src_OptionButtonSteps as default };
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from '
|
|
3
|
-
export * from '
|
|
1
|
+
export * from './FloatingButton/index.js';
|
|
2
|
+
export * from './OptionButtonBase/index.js';
|
|
3
|
+
export * from './OptionButtonSteps/index.js';
|
|
4
|
+
export * from './Kitchensink/index.js';
|
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/** @license Digigov v2.0.0-
|
|
1
|
+
/** @license Digigov v2.0.0-96651090
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the BSD-2-Clause license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
5
5
|
*/
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
6
|
+
export * from "./FloatingButton/index.js";
|
|
7
|
+
export * from "./OptionButtonBase/index.js";
|
|
8
|
+
export * from "./OptionButtonSteps/index.js";
|
|
9
|
+
export * from "./Kitchensink/index.js";
|
package/package.json
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/react-experimental",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-96651090",
|
|
4
4
|
"description": "@digigov react experimental components",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
7
|
-
"
|
|
8
|
-
"module": "./index.js",
|
|
7
|
+
"type": "module",
|
|
9
8
|
"peerDependencies": {
|
|
10
|
-
"@digigov/css": "2.0.0-
|
|
11
|
-
"@digigov/react-
|
|
12
|
-
"@digigov/
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"react
|
|
16
|
-
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"ts-morph": "18.0.0"
|
|
9
|
+
"@digigov/css": "2.0.0-96651090",
|
|
10
|
+
"@digigov/react-icons": "2.0.0-96651090",
|
|
11
|
+
"@digigov/ui": "2.0.0-96651090",
|
|
12
|
+
"@digigov/react-core": "2.0.0-96651090",
|
|
13
|
+
"clsx": "2.1.1",
|
|
14
|
+
"react": "^18.3.0 || ^19.1.0",
|
|
15
|
+
"react-dom": "^18.3.0 || ^19.1.0"
|
|
19
16
|
},
|
|
20
17
|
"private": false,
|
|
21
|
-
"
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"module": "index.js"
|
|
22
20
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`renders the FloatingButton with direction="left" 1`] = `
|
|
4
|
+
<body>
|
|
5
|
+
<div>
|
|
6
|
+
<button
|
|
7
|
+
class="ds-print-hidden ds-floating-btn ds-floating-btn--left ds-btn ds-btn-primary"
|
|
8
|
+
>
|
|
9
|
+
+
|
|
10
|
+
</button>
|
|
11
|
+
</div>
|
|
12
|
+
</body>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`renders the FloatingButton with direction="right" 1`] = `
|
|
16
|
+
<body>
|
|
17
|
+
<div>
|
|
18
|
+
<button
|
|
19
|
+
class="ds-print-hidden ds-floating-btn ds-floating-btn--right ds-btn ds-btn-primary"
|
|
20
|
+
>
|
|
21
|
+
+
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
</body>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`renders the FloatingButton with no props 1`] = `
|
|
28
|
+
<body>
|
|
29
|
+
<div>
|
|
30
|
+
<button
|
|
31
|
+
class="ds-print-hidden ds-floating-btn ds-floating-btn--right ds-btn ds-btn-primary"
|
|
32
|
+
>
|
|
33
|
+
+
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
</body>
|
|
37
|
+
`;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import FloatingButton from '@digigov/react-experimental/FloatingButton';
|
|
5
5
|
|
|
6
6
|
it('renders the FloatingButton with no props', () => {
|
|
7
|
-
expect(
|
|
7
|
+
expect(
|
|
8
|
+
render(<FloatingButton>+</FloatingButton>).baseElement
|
|
9
|
+
).toMatchSnapshot();
|
|
8
10
|
});
|
|
9
11
|
it('renders the FloatingButton with direction="right"', () => {
|
|
10
|
-
expect(
|
|
12
|
+
expect(
|
|
13
|
+
render(<FloatingButton direction="right">+</FloatingButton>).baseElement
|
|
14
|
+
).toMatchSnapshot();
|
|
11
15
|
});
|
|
12
16
|
it('renders the FloatingButton with direction="left"', () => {
|
|
13
|
-
expect(
|
|
14
|
-
|
|
17
|
+
expect(
|
|
18
|
+
render(<FloatingButton direction="left">+</FloatingButton>).baseElement
|
|
19
|
+
).toMatchSnapshot();
|
|
20
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { KitchenSinkDashboard } from '@digigov/react-experimental/Kitchensink/KitchensinkDashboard';
|
|
4
|
+
// @ts-expect-error Registry not included in src files
|
|
5
|
+
import { stories } from '@digigov/ui/stories-registry';
|
|
6
|
+
|
|
7
|
+
export const AllComponents = () => <KitchenSinkDashboard stories={stories} />;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KitchenSinkCategory } from '@digigov/react-core/KitchenSinkCategory';
|
|
3
|
+
import { KitchenSinkHeading } from '@digigov/react-core/KitchenSinkHeading';
|
|
4
|
+
import { KitchensinkByLetter } from '@digigov/react-experimental/Kitchensink/KitchensinkByLetter';
|
|
5
|
+
|
|
6
|
+
export interface KitchensinkByCategoryInterface {
|
|
7
|
+
category: string;
|
|
8
|
+
stories: React.ReactElement[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const KitchensinkByCategory = ({
|
|
12
|
+
category,
|
|
13
|
+
stories,
|
|
14
|
+
}: KitchensinkByCategoryInterface) => {
|
|
15
|
+
const alphabeticalOrder = Object.keys(stories).reduce(
|
|
16
|
+
(abStories, componentStoriesKey) => {
|
|
17
|
+
const componentStories = stories[componentStoriesKey];
|
|
18
|
+
if (!componentStories.default.component) {
|
|
19
|
+
throw new Error(`no component was found in ${componentStoriesKey}`);
|
|
20
|
+
}
|
|
21
|
+
const name = componentStories.default.displayName;
|
|
22
|
+
console.log('componentStories', componentStories, 'stories', stories);
|
|
23
|
+
if (!name) {
|
|
24
|
+
throw new Error(`no name was found for ${componentStoriesKey}`);
|
|
25
|
+
}
|
|
26
|
+
const letter = name[0];
|
|
27
|
+
if (abStories[letter]) {
|
|
28
|
+
abStories[letter].push(componentStories);
|
|
29
|
+
} else {
|
|
30
|
+
abStories[letter] = [componentStories];
|
|
31
|
+
}
|
|
32
|
+
return abStories;
|
|
33
|
+
},
|
|
34
|
+
{}
|
|
35
|
+
);
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
<KitchenSinkHeading>{category}</KitchenSinkHeading>
|
|
39
|
+
<KitchenSinkCategory>
|
|
40
|
+
{Object.keys(alphabeticalOrder)
|
|
41
|
+
.sort()
|
|
42
|
+
.map((letter, index) => {
|
|
43
|
+
return (
|
|
44
|
+
<KitchensinkByLetter
|
|
45
|
+
letter={letter}
|
|
46
|
+
stories={alphabeticalOrder[letter]}
|
|
47
|
+
key={index}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
})}
|
|
51
|
+
</KitchenSinkCategory>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|