@digigov/react-experimental 2.0.0-rc.28 → 2.0.0-rc.29

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.
Files changed (92) hide show
  1. package/.prettierrc.js +1 -0
  2. package/CHANGELOG.json +60 -0
  3. package/dist/CHANGELOG.md +16 -0
  4. package/dist/README.md +0 -0
  5. package/{index.js → dist/index.js} +1 -1
  6. package/dist/package.json +20 -0
  7. package/dist/src/FloatingButton/__snapshots__/index.test.tsx.snap +37 -0
  8. package/dist/src/FloatingButton/index.test.tsx +20 -0
  9. package/dist/src/FloatingButton/index.tsx +44 -0
  10. package/dist/src/Kitchensink/AllComponents.tsx +7 -0
  11. package/dist/src/Kitchensink/KitchensinkByCategory.tsx +54 -0
  12. package/dist/src/Kitchensink/KitchensinkByLetter.tsx +35 -0
  13. package/dist/src/Kitchensink/KitchensinkComponent.tsx +70 -0
  14. package/dist/src/Kitchensink/KitchensinkDashboard.tsx +56 -0
  15. package/dist/src/Kitchensink/index.ts +5 -0
  16. package/dist/src/OptionButtonBase/__snapshots__/index.test.tsx.snap +37 -0
  17. package/dist/src/OptionButtonBase/index.test.tsx +20 -0
  18. package/dist/src/OptionButtonBase/index.tsx +43 -0
  19. package/dist/src/OptionButtonSteps/__snapshots__/index.test.tsx.snap +84 -0
  20. package/dist/src/OptionButtonSteps/index.test.tsx +34 -0
  21. package/dist/src/OptionButtonSteps/index.tsx +61 -0
  22. package/dist/src/index.ts +4 -0
  23. package/eslint.config.mjs +3 -0
  24. package/package.json +30 -9
  25. package/react-experimental.build.log +9 -0
  26. package/rush-logs/react-experimental.build.log +6 -0
  27. package/rush-logs/react-experimental.lint.log +12 -0
  28. package/rush-logs/react-experimental.publint.log +15 -0
  29. package/rush-logs/react-experimental.test.log +15 -0
  30. package/tsconfig.json +24 -0
  31. /package/{FloatingButton → dist/FloatingButton}/index.d.ts +0 -0
  32. /package/{FloatingButton → dist/FloatingButton}/index.js +0 -0
  33. /package/{FloatingButton → dist/FloatingButton}/index.js.map +0 -0
  34. /package/{FloatingButton → dist/FloatingButton}/index.test.d.ts +0 -0
  35. /package/{FloatingButton → dist/FloatingButton}/package.json +0 -0
  36. /package/{Kitchensink → dist/Kitchensink}/AllComponents/index.js +0 -0
  37. /package/{Kitchensink → dist/Kitchensink}/AllComponents/package.json +0 -0
  38. /package/{Kitchensink → dist/Kitchensink}/AllComponents.d.ts +0 -0
  39. /package/{Kitchensink → dist/Kitchensink}/AllComponents.js.map +0 -0
  40. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByCategory/index.js +0 -0
  41. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByCategory/package.json +0 -0
  42. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByCategory.d.ts +0 -0
  43. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByCategory.js.map +0 -0
  44. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByLetter/index.js +0 -0
  45. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByLetter/package.json +0 -0
  46. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByLetter.d.ts +0 -0
  47. /package/{Kitchensink → dist/Kitchensink}/KitchensinkByLetter.js.map +0 -0
  48. /package/{Kitchensink → dist/Kitchensink}/KitchensinkComponent/index.js +0 -0
  49. /package/{Kitchensink → dist/Kitchensink}/KitchensinkComponent/package.json +0 -0
  50. /package/{Kitchensink → dist/Kitchensink}/KitchensinkComponent.d.ts +0 -0
  51. /package/{Kitchensink → dist/Kitchensink}/KitchensinkComponent.js.map +0 -0
  52. /package/{Kitchensink → dist/Kitchensink}/KitchensinkDashboard/index.js +0 -0
  53. /package/{Kitchensink → dist/Kitchensink}/KitchensinkDashboard/package.json +0 -0
  54. /package/{Kitchensink → dist/Kitchensink}/KitchensinkDashboard.d.ts +0 -0
  55. /package/{Kitchensink → dist/Kitchensink}/KitchensinkDashboard.js.map +0 -0
  56. /package/{Kitchensink → dist/Kitchensink}/index.d.ts +0 -0
  57. /package/{Kitchensink → dist/Kitchensink}/index.js +0 -0
  58. /package/{Kitchensink → dist/Kitchensink}/index.js.map +0 -0
  59. /package/{Kitchensink → dist/Kitchensink}/package.json +0 -0
  60. /package/{LICENSE → dist/LICENSE} +0 -0
  61. /package/{OptionButtonBase → dist/OptionButtonBase}/index.d.ts +0 -0
  62. /package/{OptionButtonBase → dist/OptionButtonBase}/index.js +0 -0
  63. /package/{OptionButtonBase → dist/OptionButtonBase}/index.js.map +0 -0
  64. /package/{OptionButtonBase → dist/OptionButtonBase}/index.test.d.ts +0 -0
  65. /package/{OptionButtonBase → dist/OptionButtonBase}/package.json +0 -0
  66. /package/{OptionButtonSteps → dist/OptionButtonSteps}/index.d.ts +0 -0
  67. /package/{OptionButtonSteps → dist/OptionButtonSteps}/index.js +0 -0
  68. /package/{OptionButtonSteps → dist/OptionButtonSteps}/index.js.map +0 -0
  69. /package/{OptionButtonSteps → dist/OptionButtonSteps}/index.test.d.ts +0 -0
  70. /package/{OptionButtonSteps → dist/OptionButtonSteps}/package.json +0 -0
  71. /package/{cjs → dist/cjs}/FloatingButton/index.js +0 -0
  72. /package/{cjs → dist/cjs}/FloatingButton/index.js.map +0 -0
  73. /package/{cjs → dist/cjs}/Kitchensink/AllComponents/index.js +0 -0
  74. /package/{cjs → dist/cjs}/Kitchensink/AllComponents.js.map +0 -0
  75. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkByCategory/index.js +0 -0
  76. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkByCategory.js.map +0 -0
  77. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkByLetter/index.js +0 -0
  78. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkByLetter.js.map +0 -0
  79. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkComponent/index.js +0 -0
  80. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkComponent.js.map +0 -0
  81. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkDashboard/index.js +0 -0
  82. /package/{cjs → dist/cjs}/Kitchensink/KitchensinkDashboard.js.map +0 -0
  83. /package/{cjs → dist/cjs}/Kitchensink/index.js +0 -0
  84. /package/{cjs → dist/cjs}/Kitchensink/index.js.map +0 -0
  85. /package/{cjs → dist/cjs}/OptionButtonBase/index.js +0 -0
  86. /package/{cjs → dist/cjs}/OptionButtonBase/index.js.map +0 -0
  87. /package/{cjs → dist/cjs}/OptionButtonSteps/index.js +0 -0
  88. /package/{cjs → dist/cjs}/OptionButtonSteps/index.js.map +0 -0
  89. /package/{cjs → dist/cjs}/index.js +0 -0
  90. /package/{cjs → dist/cjs}/index.js.map +0 -0
  91. /package/{index.d.ts → dist/index.d.ts} +0 -0
  92. /package/{index.js.map → dist/index.js.map} +0 -0
package/.prettierrc.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('@digigov/cli-lint/prettierrc')();
package/CHANGELOG.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@digigov/react-experimental",
3
+ "entries": [
4
+ {
5
+ "version": "1.1.2",
6
+ "tag": "@digigov/react-experimental_v1.1.2",
7
+ "date": "Fri, 16 Feb 2024 09:57:32 GMT",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "comment": "Upgrade ESLint & Prettier"
12
+ }
13
+ ],
14
+ "dependency": [
15
+ {
16
+ "comment": "Updating dependency \"@digigov/cli-lint\" from `1.0.3` to `1.0.4`"
17
+ },
18
+ {
19
+ "comment": "Updating dependency \"@digigov/css\" from `1.1.1` to `1.2.0`"
20
+ },
21
+ {
22
+ "comment": "Updating dependency \"@digigov/react-experimental\" from `1.1.1` to `1.1.2`"
23
+ },
24
+ {
25
+ "comment": "Updating dependency \"@digigov/react-icons\" from `1.1.1` to `1.1.2`"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ {
31
+ "version": "1.1.1",
32
+ "tag": "@digigov/react-experimental_v1.1.1",
33
+ "date": "Mon, 29 Jan 2024 17:45:11 GMT",
34
+ "comments": {
35
+ "patch": [
36
+ {
37
+ "comment": "Add react-experimental folder"
38
+ }
39
+ ],
40
+ "dependency": [
41
+ {
42
+ "comment": "Updating dependency \"@digigov/cli-lint\" from `1.0.2` to `1.0.3`"
43
+ },
44
+ {
45
+ "comment": "Updating dependency \"@digigov/cli-build\" from `1.1.0` to `1.1.1`"
46
+ },
47
+ {
48
+ "comment": "Updating dependency \"@digigov/css\" from `1.1.0` to `1.1.1`"
49
+ },
50
+ {
51
+ "comment": "Updating dependency \"@digigov/react-experimental\" from `1.1.0` to `1.1.1`"
52
+ },
53
+ {
54
+ "comment": "Updating dependency \"@digigov/react-icons\" from `1.1.0` to `1.1.1`"
55
+ }
56
+ ]
57
+ }
58
+ }
59
+ ]
60
+ }
@@ -0,0 +1,16 @@
1
+ # Change Log - @digigov/react-experimental
2
+
3
+ This log was last generated on Fri, 16 Feb 2024 09:57:32 GMT and should not be manually modified.
4
+
5
+ ## 1.1.2
6
+ Fri, 16 Feb 2024 09:57:32 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 1.1.1
11
+ Mon, 29 Jan 2024 17:45:11 GMT
12
+
13
+ ### Patches
14
+
15
+ - Add react-experimental folder
16
+
package/dist/README.md ADDED
File without changes
@@ -1,4 +1,4 @@
1
- /** @license Digigov v2.0.0-rc.28
1
+ /** @license Digigov v2.0.0-rc.29
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.
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@digigov/react-experimental",
3
+ "version": "2.0.0-rc.29",
4
+ "description": "@digigov react experimental components",
5
+ "author": "GRNET Developers <devs@lists.grnet.gr>",
6
+ "license": "BSD-2-Clause",
7
+ "main": "./cjs/index.js",
8
+ "module": "./index.js",
9
+ "peerDependencies": {
10
+ "@digigov/css": "workspace:2.0.0-rc.29",
11
+ "@digigov/react-icons": "workspace:2.0.0-rc.29",
12
+ "@digigov/ui": "workspace:2.0.0-rc.29",
13
+ "@digigov/react-core": "workspace:2.0.0-rc.29",
14
+ "clsx": "1.1.1",
15
+ "react": ">=16.8.0 <19.0.0",
16
+ "react-dom": ">=16.8.0 <19.0.0"
17
+ },
18
+ "private": false,
19
+ "typings": "./index.d.ts"
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
+ `;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
4
+ import FloatingButton from '@digigov/react-experimental/FloatingButton';
5
+
6
+ it('renders the FloatingButton with no props', () => {
7
+ expect(
8
+ render(<FloatingButton>+</FloatingButton>).baseElement
9
+ ).toMatchSnapshot();
10
+ });
11
+ it('renders the FloatingButton with direction="right"', () => {
12
+ expect(
13
+ render(<FloatingButton direction="right">+</FloatingButton>).baseElement
14
+ ).toMatchSnapshot();
15
+ });
16
+ it('renders the FloatingButton with direction="left"', () => {
17
+ expect(
18
+ render(<FloatingButton direction="left">+</FloatingButton>).baseElement
19
+ ).toMatchSnapshot();
20
+ });
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Button, { ButtonProps } from '@digigov/react-core/Button';
4
+
5
+ export interface FloatingButtonProps extends ButtonProps {
6
+ /**
7
+ * direction is optional.
8
+ * direction sets the position of the button to either left or right side of the screen.
9
+ * The default value is 'left'.
10
+ * @value 'right'
11
+ * @value 'left'
12
+ * @default 'left'
13
+ */
14
+ direction?: 'right' | 'left';
15
+ }
16
+ /**
17
+ *
18
+ * A FloatingButton performs the primary, or most common, action on a screen.
19
+ * Use it primary in mobile applications.
20
+ * Avoid using text in this type of button, use icons instead.
21
+ */
22
+ export const FloatingButton = React.forwardRef<
23
+ HTMLButtonElement,
24
+ FloatingButtonProps
25
+ >(function FloatingButton(
26
+ { direction = 'right', className, children, ...props },
27
+ ref
28
+ ) {
29
+ return (
30
+ <Button
31
+ ref={ref}
32
+ className={clsx(className, {
33
+ 'ds-floating-btn': true,
34
+ 'ds-floating-btn--right': direction === 'right',
35
+ 'ds-floating-btn--left': direction === 'left',
36
+ })}
37
+ {...props}
38
+ >
39
+ {children}
40
+ </Button>
41
+ );
42
+ });
43
+
44
+ export default FloatingButton;
@@ -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/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
+ };
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import Heading from '@digigov/react-core/Heading';
3
+ import { KitchenSinkLetterContent } from '@digigov/react-core/KitchenSinkLetterContent';
4
+ import { KitchensinkComponent } from '@digigov/react-experimental/Kitchensink/KitchensinkComponent';
5
+
6
+ export interface KitchensinkByLetterInterface {
7
+ letter: string;
8
+ stories: any;
9
+ }
10
+
11
+ export const KitchensinkByLetter = ({
12
+ letter,
13
+ stories,
14
+ }: KitchensinkByLetterInterface) => {
15
+ return (
16
+ <div>
17
+ <Heading>{letter}</Heading>
18
+ <KitchenSinkLetterContent>
19
+ {stories.map((story, index) => {
20
+ return (
21
+ <KitchensinkComponent
22
+ tags={story.default.tags}
23
+ title={story.default.displayName}
24
+ description={story.default.description}
25
+ link={story.default.link}
26
+ width={story.default.defaultWidth}
27
+ stories={story}
28
+ key={index}
29
+ />
30
+ );
31
+ })}
32
+ </KitchenSinkLetterContent>
33
+ </div>
34
+ );
35
+ };
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { KitchenSinkCard } from '@digigov/react-core/KitchenSinkCard';
3
+ import { KitchenSinkContent } from '@digigov/react-core/KitchenSinkContent';
4
+ import { KitchenSinkContentInfo } from '@digigov/react-core/KitchenSinkContentInfo';
5
+ import { KitchenSinkContentTags } from '@digigov/react-core/KitchenSinkContentTags';
6
+ import PhaseBanner, {
7
+ PhaseBannerTag,
8
+ PhaseBannerText,
9
+ } from '@digigov/ui/feedback/PhaseBanner';
10
+ import SectionBreak from '@digigov/ui/layouts/SectionBreak';
11
+ import Link from '@digigov/ui/navigation/Link';
12
+ import { Paragraph } from '@digigov/ui/typography';
13
+ import Heading from '@digigov/ui/typography/Heading';
14
+
15
+ export interface KitchensinkComponentInterface {
16
+ tags?: string[]; // ex. Experimental
17
+ title: string;
18
+ description?: string;
19
+ link?: string;
20
+ stories: React.ReactElement[];
21
+ width?: 'md' | 'lg';
22
+ }
23
+ export const KitchensinkComponent = ({
24
+ tags = [],
25
+ title,
26
+ description,
27
+ link,
28
+ stories,
29
+ width = 'md',
30
+ }: KitchensinkComponentInterface) => {
31
+ return (
32
+ <KitchenSinkContent wide={width === 'lg'}>
33
+ <KitchenSinkContentInfo>
34
+ <KitchenSinkContentTags>
35
+ {tags &&
36
+ tags.map((tag, index) => {
37
+ return (
38
+ <PhaseBanner key={index}>
39
+ <PhaseBannerTag>{tag}</PhaseBannerTag>
40
+ <PhaseBannerText>
41
+ Αυτή είναι μία νέα υπηρεσία – τα{' '}
42
+ <Link href="#feedback">σχόλιά</Link> σας θα μας βοηθήσουν να
43
+ τη βελτιώσουμε.
44
+ </PhaseBannerText>
45
+ </PhaseBanner>
46
+ );
47
+ })}
48
+ </KitchenSinkContentTags>
49
+ <Heading size="lg">{title}</Heading>
50
+ <Paragraph>{description}</Paragraph>
51
+ {link && <Link href={link}>View on GOV.GR Design System</Link>}
52
+ <SectionBreak />
53
+ </KitchenSinkContentInfo>
54
+ {Object.keys(stories)
55
+ .filter((story) => story !== 'default')
56
+ .map((story, index) => {
57
+ const Component = stories[story];
58
+ return (
59
+ <div key={index}>
60
+ <SectionBreak />
61
+ <Heading size="sm">{story}</Heading>
62
+ <KitchenSinkCard>
63
+ <Component />
64
+ </KitchenSinkCard>
65
+ </div>
66
+ );
67
+ })}
68
+ </KitchenSinkContent>
69
+ );
70
+ };
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { KitchenSinkAllComponents } from '@digigov/react-core/KitchenSinkAllComponents';
3
+ import Paragraph from '@digigov/react-core/Paragraph';
4
+ import { KitchensinkByCategory } from '@digigov/react-experimental/Kitchensink/KitchensinkByCategory';
5
+
6
+ export interface KitchenSinkDashboardInterface {
7
+ stories: any;
8
+ }
9
+
10
+ export const KitchenSinkDashboard = ({
11
+ stories,
12
+ }: KitchenSinkDashboardInterface) => {
13
+ const categoryOrder = Object.keys(stories).reduce(
14
+ (catStories, componentStoriesKey) => {
15
+ const componentStories = stories[componentStoriesKey];
16
+ if (componentStories.default.ignore) {
17
+ return catStories;
18
+ }
19
+ if (!componentStories.default.component) {
20
+ throw new Error(`no component was found in ${componentStoriesKey}`);
21
+ }
22
+ const title = componentStories.default.title.split('/')[1];
23
+ if (!title) {
24
+ throw new Error(`no title was found for ${componentStoriesKey}`);
25
+ }
26
+ const category = title;
27
+ if (catStories[category]) {
28
+ catStories[category].push(componentStories);
29
+ } else {
30
+ catStories[category] = [componentStories];
31
+ }
32
+ return catStories;
33
+ },
34
+ {}
35
+ );
36
+ return (
37
+ <div>
38
+ <Paragraph fontSize={72} fontWeight="bold">
39
+ Components
40
+ </Paragraph>
41
+ <KitchenSinkAllComponents>
42
+ {Object.keys(categoryOrder)
43
+ .sort((a, b) => (a > b ? -1 : 1))
44
+ .map((category, index) => {
45
+ return (
46
+ <KitchensinkByCategory
47
+ category={category}
48
+ stories={categoryOrder[category]}
49
+ key={index}
50
+ />
51
+ );
52
+ })}
53
+ </KitchenSinkAllComponents>
54
+ </div>
55
+ );
56
+ };
@@ -0,0 +1,5 @@
1
+ export * from '@digigov/react-experimental/Kitchensink/AllComponents';
2
+ export * from '@digigov/react-experimental/Kitchensink/KitchensinkByCategory';
3
+ export * from '@digigov/react-experimental/Kitchensink/KitchensinkByLetter';
4
+ export * from '@digigov/react-experimental/Kitchensink/KitchensinkComponent';
5
+ export * from '@digigov/react-experimental/Kitchensink/KitchensinkDashboard';
@@ -0,0 +1,37 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`renders the OptionButtonBase with selected=false 1`] = `
4
+ <body>
5
+ <div>
6
+ <button
7
+ class="ds-btn ds-option-btn"
8
+ >
9
+ +
10
+ </button>
11
+ </div>
12
+ </body>
13
+ `;
14
+
15
+ exports[`renders the OptionButtonBase with selected=true 1`] = `
16
+ <body>
17
+ <div>
18
+ <button
19
+ class="ds-btn ds-option-btn ds-option-btn--selected"
20
+ >
21
+ +
22
+ </button>
23
+ </div>
24
+ </body>
25
+ `;
26
+
27
+ exports[`renders the OptionButtonBase with no props 1`] = `
28
+ <body>
29
+ <div>
30
+ <button
31
+ class="ds-btn ds-option-btn"
32
+ >
33
+ +
34
+ </button>
35
+ </div>
36
+ </body>
37
+ `;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
4
+ import OptionButtonBase from '@digigov/react-experimental/OptionButtonBase';
5
+
6
+ it('renders the OptionButtonBase with no props', () => {
7
+ expect(
8
+ render(<OptionButtonBase>+</OptionButtonBase>).baseElement
9
+ ).toMatchSnapshot();
10
+ });
11
+ it('renders the OptionButtonBase with selected=true', () => {
12
+ expect(
13
+ render(<OptionButtonBase selected={true}>+</OptionButtonBase>).baseElement
14
+ ).toMatchSnapshot();
15
+ });
16
+ it('renders the OptionButtonBase with selected=false', () => {
17
+ expect(
18
+ render(<OptionButtonBase selected={false}>+</OptionButtonBase>).baseElement
19
+ ).toMatchSnapshot();
20
+ });
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Base, { BaseProps } from '@digigov/react-core/Base';
4
+
5
+ export interface OptionButtonBaseProps extends BaseProps<'button'> {
6
+ /**
7
+ * selected is optional.
8
+ * Use selected prop to set selected styling.
9
+ * @value true
10
+ * @value false
11
+ * @default false
12
+ */
13
+ selected?: boolean;
14
+ }
15
+ /**
16
+ *
17
+ * OptionButtonBases can be used to represent small blocks of information.
18
+ * OptionButtonBase component must be inside OptionButtonBaseSection component.
19
+ */
20
+ export const OptionButtonBase = React.forwardRef<
21
+ HTMLButtonElement,
22
+ OptionButtonBaseProps
23
+ >(function OptionButtonBase(
24
+ { selected = false, className, children, ...props },
25
+ ref
26
+ ) {
27
+ return (
28
+ <Base
29
+ as="button"
30
+ ref={ref}
31
+ className={clsx(className, {
32
+ 'ds-btn': true,
33
+ 'ds-option-btn': true,
34
+ 'ds-option-btn--selected': selected,
35
+ })}
36
+ {...props}
37
+ >
38
+ {children}
39
+ </Base>
40
+ );
41
+ });
42
+
43
+ export default OptionButtonBase;
@@ -0,0 +1,84 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`renders the OptionButtonSteps with activeStep=1 1`] = `
4
+ <body>
5
+ <div>
6
+ <div
7
+ class="ds-option-btn__steps"
8
+ />
9
+ </div>
10
+ </body>
11
+ `;
12
+
13
+ exports[`renders the OptionButtonSteps with no props 1`] = `
14
+ <body>
15
+ <div>
16
+ <div
17
+ class="ds-option-btn__steps"
18
+ />
19
+ </div>
20
+ </body>
21
+ `;
22
+
23
+ exports[`renders the OptionButtonSteps with steps="3" 1`] = `
24
+ <body>
25
+ <div>
26
+ <div
27
+ class="ds-option-btn__steps"
28
+ >
29
+ <div
30
+ class="ds-option-btn__step"
31
+ />
32
+ <div
33
+ class="ds-option-btn__step"
34
+ />
35
+ <div
36
+ class="ds-option-btn__step"
37
+ />
38
+ </div>
39
+ </div>
40
+ </body>
41
+ `;
42
+
43
+ exports[`renders the OptionButtonSteps with steps=3 activeStep=1 1`] = `
44
+ <body>
45
+ <div>
46
+ <div
47
+ class="ds-option-btn__steps"
48
+ >
49
+ <div
50
+ class="ds-option-btn__step ds-option-btn__step--active"
51
+ />
52
+ <div
53
+ class="ds-option-btn__step"
54
+ />
55
+ <div
56
+ class="ds-option-btn__step"
57
+ />
58
+ </div>
59
+ </div>
60
+ </body>
61
+ `;
62
+
63
+ exports[`renders the OptionButtonSteps with steps=4 1`] = `
64
+ <body>
65
+ <div>
66
+ <div
67
+ class="ds-option-btn__steps"
68
+ >
69
+ <div
70
+ class="ds-option-btn__step"
71
+ />
72
+ <div
73
+ class="ds-option-btn__step"
74
+ />
75
+ <div
76
+ class="ds-option-btn__step"
77
+ />
78
+ <div
79
+ class="ds-option-btn__step"
80
+ />
81
+ </div>
82
+ </div>
83
+ </body>
84
+ `;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
4
+ import OptionButtonSteps from '@digigov/react-experimental/OptionButtonSteps';
5
+
6
+ it('renders the OptionButtonSteps with no props', () => {
7
+ expect(
8
+ render(<OptionButtonSteps>+</OptionButtonSteps>).baseElement
9
+ ).toMatchSnapshot();
10
+ });
11
+ it('renders the OptionButtonSteps with steps="3"', () => {
12
+ expect(
13
+ render(<OptionButtonSteps steps={3}>+</OptionButtonSteps>).baseElement
14
+ ).toMatchSnapshot();
15
+ });
16
+ it('renders the OptionButtonSteps with steps=4', () => {
17
+ expect(
18
+ render(<OptionButtonSteps steps={4}>+</OptionButtonSteps>).baseElement
19
+ ).toMatchSnapshot();
20
+ });
21
+ it('renders the OptionButtonSteps with activeStep=1', () => {
22
+ expect(
23
+ render(<OptionButtonSteps activeStep={1}>+</OptionButtonSteps>).baseElement
24
+ ).toMatchSnapshot();
25
+ });
26
+ it('renders the OptionButtonSteps with steps=3 activeStep=1', () => {
27
+ expect(
28
+ render(
29
+ <OptionButtonSteps steps={3} activeStep={1}>
30
+ +
31
+ </OptionButtonSteps>
32
+ ).baseElement
33
+ ).toMatchSnapshot();
34
+ });
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Base, { BaseProps } from '@digigov/react-core/Base';
4
+
5
+ export interface OptionButtonStepsProps extends BaseProps<'div'> {
6
+ /**
7
+ * @value 0
8
+ * @value 1
9
+ * @value 2
10
+ * @value 3
11
+ * @value 4
12
+ * @default 0
13
+ */
14
+ steps?: stepsProps;
15
+ /**
16
+ * @default 0
17
+ */
18
+ activeStep?: number;
19
+ }
20
+
21
+ export type stepsProps = 0 | 1 | 2 | 3 | 4;
22
+ /**
23
+ *
24
+ * OptionButtonSteps can be used to represent small blocks of information.
25
+ * OptionButtonSteps component must be inside OptionButtonStepsSection component.
26
+ */
27
+ export const OptionButtonSteps = React.forwardRef<
28
+ HTMLDivElement,
29
+ OptionButtonStepsProps
30
+ >(function OptionButtonSteps(
31
+ { steps = 0, activeStep = 0, className, ...props },
32
+ ref
33
+ ) {
34
+ const renderStep = (step: number) => (
35
+ <Base
36
+ as="div"
37
+ className={clsx(className, {
38
+ 'ds-option-btn__step': true,
39
+ 'ds-option-btn__step--active': activeStep >= step,
40
+ })}
41
+ ></Base>
42
+ );
43
+
44
+ return (
45
+ <Base
46
+ as="div"
47
+ ref={ref}
48
+ className={clsx(className, {
49
+ 'ds-option-btn__steps': true,
50
+ })}
51
+ {...props}
52
+ >
53
+ {steps >= 1 && renderStep(1)}
54
+ {steps >= 2 && renderStep(2)}
55
+ {steps >= 3 && renderStep(3)}
56
+ {steps >= 4 && renderStep(4)}
57
+ </Base>
58
+ );
59
+ });
60
+
61
+ export default OptionButtonSteps;
@@ -0,0 +1,4 @@
1
+ export * from '@digigov/react-experimental/FloatingButton';
2
+ export * from '@digigov/react-experimental/OptionButtonBase';
3
+ export * from '@digigov/react-experimental/OptionButtonSteps';
4
+ export * from '@digigov/react-experimental/Kitchensink';
@@ -0,0 +1,3 @@
1
+ import config from '@digigov/cli-lint/eslint.config';
2
+
3
+ export default [...config];
package/package.json CHANGED
@@ -1,20 +1,41 @@
1
1
  {
2
2
  "name": "@digigov/react-experimental",
3
- "version": "2.0.0-rc.28",
3
+ "version": "2.0.0-rc.29",
4
4
  "description": "@digigov react experimental components",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
7
- "main": "./cjs/index.js",
8
- "module": "./index.js",
7
+ "main": "dist/index.js",
8
+ "module": "index.js",
9
9
  "peerDependencies": {
10
- "@digigov/css": "2.0.0-rc.28",
11
- "@digigov/react-icons": "2.0.0-rc.28",
12
- "@digigov/ui": "2.0.0-rc.28",
13
- "@digigov/react-core": "2.0.0-rc.28",
10
+ "@digigov/css": "2.0.0-rc.29",
11
+ "@digigov/react-icons": "2.0.0-rc.29",
12
+ "@digigov/ui": "2.0.0-rc.29",
13
+ "@digigov/react-core": "2.0.0-rc.29",
14
14
  "clsx": "1.1.1",
15
15
  "react": ">=16.8.0 <19.0.0",
16
16
  "react-dom": ">=16.8.0 <19.0.0"
17
17
  },
18
- "private": false,
19
- "typings": "./index.d.ts"
18
+ "devDependencies": {
19
+ "@digigov/cli": "2.0.0-rc.29",
20
+ "@digigov/cli-lint": "2.0.0-rc.29",
21
+ "@digigov/cli-build": "2.0.0-rc.29",
22
+ "@digigov/cli-test": "2.0.0-rc.29",
23
+ "typescript": "5.6.2",
24
+ "@types/node": "18.19.0",
25
+ "@types/react": "18.3.3",
26
+ "@types/react-dom": "18.3.0",
27
+ "eslint": "9.16.0",
28
+ "prettier": "3.4.2",
29
+ "publint": "0.1.8",
30
+ "vitest": "2.1.3",
31
+ "@testing-library/dom": "10.4.0",
32
+ "@testing-library/react": "16.0.1"
33
+ },
34
+ "scripts": {
35
+ "publint": "publint dist",
36
+ "lint": "digigov lint",
37
+ "test": "digigov test",
38
+ "build": "digigov build",
39
+ "prepublish": "digigov build"
40
+ }
20
41
  }
@@ -0,0 +1,9 @@
1
+ Invoking: digigov build
2
+ Running /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-build/node_modules/.bin/rimraf dist
3
+ Running /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/node_modules/.bin/tsc --emitDeclarationOnly --outDir dist
4
+ Created package.json in /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/dist/package.json
5
+ Copied /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/README.md to /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/dist/README.md
6
+ Copied /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/CHANGELOG.md to /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/dist/CHANGELOG.md
7
+ Copied /Users/dimitristsironis/grnet/digigov-sdk/LICENSE to /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/dist/LICENSE
8
+ Copied /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/src to /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/dist/src
9
+ Skipped license for ./index.mjs
@@ -0,0 +1,6 @@
1
+ Invoking: digigov build
2
+ LOG Running: rimraf dist
3
+ LOG Running: tsc --emitDeclarationOnly --outDir dist --project /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/tsconfig.json
4
+ LOG Running: esbuild for CJS format
5
+ LOG Running: esbuild for ESM format
6
+ ⏱️ "build" execution time: 3.053s
@@ -0,0 +1,12 @@
1
+ Invoking: digigov lint
2
+ LOG Running: eslint --no-error-on-unmatched-pattern
3
+
4
+ /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/src/Kitchensink/KitchensinkByLetter.tsx
5
+ 8:12 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
6
+
7
+ /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental/src/Kitchensink/KitchensinkDashboard.tsx
8
+ 7:12 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
9
+
10
+ ✖ 2 problems (0 errors, 2 warnings)
11
+
12
+ ⏱️ "lint" execution time: 2.750s
@@ -0,0 +1,15 @@
1
+ Invoking: publint dist
2
+ @digigov/react-experimental lint results:
3
+ Suggestions:
4
+ 1. pkg.module is used to output ESM, but pkg.exports is not defined. As NodeJS doesn't read pkg.module, the ESM output may be skipped. Consider adding pkg.exports to export the ESM output. pkg.module can usually be removed alongside too. (This will be a breaking change)
5
+ Warnings:
6
+ 1. /FloatingButton/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /FloatingButton/index.mjs
7
+ 2. /Kitchensink/KitchensinkByCategory/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /Kitchensink/KitchensinkByCategory/index.mjs
8
+ 3. /Kitchensink/KitchensinkByLetter/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /Kitchensink/KitchensinkByLetter/index.mjs
9
+ 4. /Kitchensink/AllComponents/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /Kitchensink/AllComponents/index.mjs
10
+ 5. /Kitchensink/KitchensinkComponent/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /Kitchensink/KitchensinkComponent/index.mjs
11
+ 6. /Kitchensink/KitchensinkDashboard/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /Kitchensink/KitchensinkDashboard/index.mjs
12
+ 7. /Kitchensink/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /Kitchensink/index.mjs
13
+ 8. /OptionButtonBase/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /OptionButtonBase/index.mjs
14
+ 9. /index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /index.mjs
15
+ 10. /OptionButtonSteps/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. /OptionButtonSteps/index.mjs
@@ -0,0 +1,15 @@
1
+ Invoking: digigov test
2
+ LOG Running: vitest --config /Users/dimitristsironis/grnet/digigov-sdk/tooling/cli-test/vitest.config.js
3
+
4
+ RUN v2.1.3 /Users/dimitristsironis/grnet/digigov-sdk/libs-ui/react-experimental
5
+
6
+ ✓ src/FloatingButton/index.test.tsx (3 tests) 14ms
7
+ ✓ src/OptionButtonSteps/index.test.tsx (5 tests) 19ms
8
+ ✓ src/OptionButtonBase/index.test.tsx (3 tests) 28ms
9
+
10
+ Test Files 3 passed (3)
11
+ Tests 11 passed (11)
12
+ Start at 11:58:51
13
+ Duration 1.87s (transform 153ms, setup 761ms, collect 615ms, tests 61ms, environment 2.69s, prepare 465ms)
14
+
15
+ ⏱️ "test" execution time: 3.392s
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "extends": "@digigov/cli-build/tsconfig.base",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "types": ["node", "vitest/globals", "react"],
6
+ "paths": {
7
+ "@digigov/react-icons": ["node_modules/@digigov/react-icons/src"],
8
+ "@digigov/react-icons/": ["node_modules/@digigov/react-icons/src/"],
9
+ "@digigov/react-icons/*": ["node_modules/@digigov/react-icons/src/*"],
10
+ "@digigov/react-core": ["node_modules/@digigov/react-core/src"],
11
+ "@digigov/react-core/": ["node_modules/@digigov/react-core/src/"],
12
+ "@digigov/react-core/*": ["node_modules/@digigov/react-core/src/*"],
13
+ "@digigov/ui": ["node_modules/@digigov/ui/src"],
14
+ "@digigov/ui/": ["node_modules/@digigov/ui/src/"],
15
+ "@digigov/ui/*": ["node_modules/@digigov/ui/src/*"],
16
+ "@digigov/react-experimental": ["./src"],
17
+ "@digigov/react-experimental/": ["./src/"],
18
+ "@digigov/react-experimental/*": ["./src/*"]
19
+ },
20
+ "baseUrl": "./"
21
+ },
22
+ "include": ["src"],
23
+ "exclude": ["node_modules", "dist"]
24
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes