@duetds/cli 4.0.50 → 4.1.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.
Files changed (95) hide show
  1. package/package.json +2 -2
  2. package/templates/angular/13.2.4/src/tests/playwright/playwright.test.ts-snapshots/angular-5-chromium-darwin.png +0 -0
  3. package/templates/angular/14.2.12/src/tests/playwright/playwright.test.ts-snapshots/angular-5-chromium-darwin.png +0 -0
  4. package/templates/angular/15.0.4/src/tests/playwright/playwright.test.ts-snapshots/angular-5-chromium-darwin.png +0 -0
  5. package/templates/angular/16.2.0/package.file +1 -1
  6. package/templates/angular/16.2.0/src/tests/playwright/playwright.test.ts-snapshots/angular-5-chromium-darwin.png +0 -0
  7. package/templates/angular/17.0.0/package.file +1 -1
  8. package/templates/angular/17.0.0/src/app/app.module.ts +10 -1
  9. package/templates/angular/17.0.0/src/app/investment-amount/investment-amount.component.html +2 -0
  10. package/templates/angular/17.0.0/src/app/investment-amount/investment-amount.component.ts +2 -12
  11. package/templates/angular/17.0.0/src/app/investment-origin/investment-origin.component.html +8 -8
  12. package/templates/angular/17.0.0/src/app/investment-origin/investment-origin.component.ts +2 -21
  13. package/templates/angular/17.0.0/src/app/value-accessors.ts +147 -0
  14. package/templates/angular/17.0.0/src/tests/playwright/playwright.test.ts-snapshots/angular-5-chromium-darwin.png +0 -0
  15. package/templates/react/16.14.0/package.file +1 -1
  16. package/templates/react/19rc/README.md +54 -0
  17. package/templates/react/19rc/package-lock.json +10713 -0
  18. package/templates/react/19rc/package.file +39 -0
  19. package/templates/{angular/12.2.16/playwright.config.ts → react/19rc/playwright.config.mjs} +7 -7
  20. package/templates/react/19rc/public/index.html +48 -0
  21. package/templates/react/19rc/src/App.js +140 -0
  22. package/templates/react/19rc/src/components/Footer.js +23 -0
  23. package/templates/react/19rc/src/components/Header.js +6 -0
  24. package/templates/react/19rc/src/components/InvestmentAmount.js +129 -0
  25. package/templates/react/19rc/src/components/InvestmentOrigin.js +88 -0
  26. package/templates/react/19rc/src/components/Summary.js +87 -0
  27. package/templates/react/19rc/src/index.js +17 -0
  28. package/templates/react/19rc/src/index.scss +2 -0
  29. package/templates/react/19rc/src/serviceWorker.js +141 -0
  30. package/templates/{angular/12.2.16/src/tests/playwright/playwright.test.ts → react/19rc/src/tests/playwright/playwright.test.mjs} +14 -14
  31. package/templates/react/19rc/src/tests/playwright/playwright.test.mjs-snapshots/app-1-chromium-darwin.png +0 -0
  32. package/templates/react/19rc/src/tests/playwright/playwright.test.mjs-snapshots/app-2-chromium-darwin.png +0 -0
  33. package/templates/react/19rc/src/tests/playwright/playwright.test.mjs-snapshots/app-3-chromium-darwin.png +0 -0
  34. package/templates/{angular/12.2.16/src/tests/playwright/playwright.test.ts-snapshots/angular-4-chromium-darwin.png → react/19rc/src/tests/playwright/playwright.test.mjs-snapshots/app-4-chromium-darwin.png} +0 -0
  35. package/templates/{angular/12.2.16/src/tests/playwright/playwright.test.ts-snapshots/angular-5-chromium-darwin.png → react/19rc/src/tests/playwright/playwright.test.mjs-snapshots/app-5-chromium-darwin.png} +0 -0
  36. package/templates/{angular/12.2.16/src/tests/playwright/playwright.test.ts-snapshots → react/19rc/src/tests/playwright/playwright.test.mjs-snapshots}/code-chromium-darwin.json +1 -1
  37. package/templates/angular/12.2.16/.browserlistrc +0 -16
  38. package/templates/angular/12.2.16/.depcheckrc +0 -2
  39. package/templates/angular/12.2.16/.editorconfig +0 -16
  40. package/templates/angular/12.2.16/.eslintrc.json +0 -51
  41. package/templates/angular/12.2.16/.prettierignore +0 -3
  42. package/templates/angular/12.2.16/.prettierrc +0 -14
  43. package/templates/angular/12.2.16/README.md +0 -32
  44. package/templates/angular/12.2.16/angular.json +0 -122
  45. package/templates/angular/12.2.16/config/jest.base.ts +0 -17
  46. package/templates/angular/12.2.16/config/jest.setup.ts +0 -24
  47. package/templates/angular/12.2.16/package.file +0 -58
  48. package/templates/angular/12.2.16/src/app/agreement.model.ts +0 -3
  49. package/templates/angular/12.2.16/src/app/app-routing.module.ts +0 -11
  50. package/templates/angular/12.2.16/src/app/app.component.html +0 -5
  51. package/templates/angular/12.2.16/src/app/app.component.scss +0 -0
  52. package/templates/angular/12.2.16/src/app/app.component.ts +0 -10
  53. package/templates/angular/12.2.16/src/app/app.module.ts +0 -21
  54. package/templates/angular/12.2.16/src/app/currency-formatter.service.ts +0 -12
  55. package/templates/angular/12.2.16/src/app/footer/footer.component.html +0 -22
  56. package/templates/angular/12.2.16/src/app/footer/footer.component.scss +0 -0
  57. package/templates/angular/12.2.16/src/app/footer/footer.component.ts +0 -10
  58. package/templates/angular/12.2.16/src/app/header/header.component.html +0 -1
  59. package/templates/angular/12.2.16/src/app/header/header.component.scss +0 -0
  60. package/templates/angular/12.2.16/src/app/header/header.component.ts +0 -10
  61. package/templates/angular/12.2.16/src/app/index-page/index-page.component.html +0 -49
  62. package/templates/angular/12.2.16/src/app/index-page/index-page.component.scss +0 -0
  63. package/templates/angular/12.2.16/src/app/index-page/index-page.component.ts +0 -61
  64. package/templates/angular/12.2.16/src/app/investment-amount/investment-amount.component.html +0 -87
  65. package/templates/angular/12.2.16/src/app/investment-amount/investment-amount.component.scss +0 -0
  66. package/templates/angular/12.2.16/src/app/investment-amount/investment-amount.component.ts +0 -31
  67. package/templates/angular/12.2.16/src/app/investment-origin/investment-origin.component.html +0 -12
  68. package/templates/angular/12.2.16/src/app/investment-origin/investment-origin.component.scss +0 -0
  69. package/templates/angular/12.2.16/src/app/investment-origin/investment-origin.component.ts +0 -24
  70. package/templates/angular/12.2.16/src/app/summary/summary.component.html +0 -74
  71. package/templates/angular/12.2.16/src/app/summary/summary.component.scss +0 -0
  72. package/templates/angular/12.2.16/src/app/summary/summary.component.ts +0 -16
  73. package/templates/angular/12.2.16/src/assets/.gitkeep +0 -0
  74. package/templates/angular/12.2.16/src/environments/environment.prod.ts +0 -3
  75. package/templates/angular/12.2.16/src/environments/environment.ts +0 -16
  76. package/templates/angular/12.2.16/src/index.html +0 -24
  77. package/templates/angular/12.2.16/src/main.ts +0 -13
  78. package/templates/angular/12.2.16/src/polyfills.ts +0 -62
  79. package/templates/angular/12.2.16/src/styles.scss +0 -3
  80. package/templates/angular/12.2.16/src/tests/app.test.ts +0 -13
  81. package/templates/angular/12.2.16/src/tests/playwright/playwright.test.ts-snapshots/angular-1-chromium-darwin.png +0 -0
  82. package/templates/angular/12.2.16/src/tests/playwright/playwright.test.ts-snapshots/angular-2-chromium-darwin.png +0 -0
  83. package/templates/angular/12.2.16/src/tests/playwright/playwright.test.ts-snapshots/angular-3-chromium-darwin.png +0 -0
  84. package/templates/angular/12.2.16/src/utils/string.utils.ts +0 -1
  85. package/templates/angular/12.2.16/tsconfig.app.json +0 -9
  86. package/templates/angular/12.2.16/tsconfig.base.json +0 -17
  87. package/templates/angular/12.2.16/tsconfig.json +0 -8
  88. package/templates/angular/12.2.16/tsconfig.spec.json +0 -15
  89. package/templates/angular/12.2.16/tslint.json +0 -92
  90. /package/templates/{angular/12.2.16 → react/19rc}/LICENSE.md +0 -0
  91. /package/templates/{angular/12.2.16/src → react/19rc/public}/assets/img/android-chrome-192x192.png +0 -0
  92. /package/templates/{angular/12.2.16/src → react/19rc/public}/assets/img/apple-touch-icon-180x180.png +0 -0
  93. /package/templates/{angular/12.2.16/src → react/19rc/public}/assets/img/splash-screen-icon-512x512.png +0 -0
  94. /package/templates/{angular/12.2.16/src → react/19rc/public}/favicon.ico +0 -0
  95. /package/templates/{angular/12.2.16/src → react/19rc/public}/manifest.json +0 -0
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "duet-react-template",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "start": "react-scripts start",
7
+ "build": "react-scripts build",
8
+ "eject": "react-scripts eject",
9
+ "playwright": "playwright test"
10
+ },
11
+ "devDependencies": {
12
+ "@playwright/test": "1.25.0"
13
+ },
14
+ "dependencies": {
15
+ "@duetds/components": "latest",
16
+ "@duetds/css": "latest",
17
+ "@duetds/icons": "latest",
18
+ "@duetds/tokens": "latest",
19
+ "react": "19.0.0-rc-512b09b2-20240718",
20
+ "react-dom": "19.0.0-rc-512b09b2-20240718",
21
+ "react-scripts": "5.0.1",
22
+ "sass": "1.49.9"
23
+ },
24
+ "eslintConfig": {
25
+ "extends": "react-app"
26
+ },
27
+ "browserslist": {
28
+ "production": [
29
+ ">0.2%",
30
+ "not dead",
31
+ "not op_mini all"
32
+ ],
33
+ "development": [
34
+ "last 1 chrome version",
35
+ "last 1 firefox version",
36
+ "last 1 safari version"
37
+ ]
38
+ }
39
+ }
@@ -1,18 +1,17 @@
1
- // playwright.config.ts
2
- import { PlaywrightTestConfig, devices } from '@playwright/test';
1
+ import { devices } from '@playwright/test'
3
2
 
4
- const config: PlaywrightTestConfig = {
3
+ const config = {
5
4
  testDir:"src/tests/playwright",
6
5
  retries: process.env.CI ? 2 : 0,
7
6
  use: {
8
7
  trace: 'on-first-retry',
9
8
  viewport: { width: 2080, height: 2020 },
10
- ignoreHTTPSErrors: true,
9
+ ignoreHTTPSErrors: true,
11
10
  video: 'on-first-retry'
12
11
  },
13
12
  webServer: {
14
- command: 'npx ng serve',
15
- url:"http://localhost:4200/#/",
13
+ command: 'npm start',
14
+ url:"http://0.0.0.0:3000/",
16
15
  timeout: 120 * 1000,
17
16
  reuseExistingServer: false
18
17
  },
@@ -22,5 +21,6 @@ const config: PlaywrightTestConfig = {
22
21
  use: { ...devices['Desktop Chrome'] },
23
22
  }
24
23
  ],
25
- };
24
+ }
25
+
26
26
  export default config;
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html>
2
+ <html lang="fi" class="duet-bg-gradient">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="author" content="LähiTapiola" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
+ <meta name="format-detection" content="telephone=no" />
8
+ <meta name="robots" content="noindex,nofollow" />
9
+ <title>LähiTapiola</title>
10
+
11
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/assets/img/apple-touch-icon-180x180.png" />
13
+ <link
14
+ rel="stylesheet"
15
+ href="https://cdn.duetds.com/api/fonts/1.3.12/lib/localtapiola.css"
16
+ integrity="sha384-5JYmtSD7nykpUvSmTW1CHMoBDkBZUpUmG0vuh+NUVtZag3F75Kr7+/JU3J7JV6Wq"
17
+ crossorigin="anonymous"
18
+ />
19
+ <!--
20
+ manifest.json provides metadata used when your web app is installed on a
21
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
22
+ -->
23
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
24
+ <!--
25
+ Notice the use of %PUBLIC_URL% in the tags above.
26
+ It will be replaced with the URL of the `public` folder during the build.
27
+ Only files inside the `public` folder can be referenced from the HTML.
28
+
29
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
30
+ work correctly both with client-side routing and a non-root public URL.
31
+ Learn how to configure a non-root public URL by running `npm run build`.
32
+ -->
33
+ </head>
34
+ <body>
35
+ <noscript>You need to enable JavaScript to run this app.</noscript>
36
+ <div id="root"></div>
37
+ <!--
38
+ This HTML file is a template.
39
+ If you open it directly in the browser, you will see an empty page.
40
+
41
+ You can add webfonts, meta tags, or analytics to this file.
42
+ The build step will place the bundled scripts into the <body> tag.
43
+
44
+ To begin the development, run `npm start` or `yarn start`.
45
+ To create a production bundle, use `npm run build` or `yarn build`.
46
+ -->
47
+ </body>
48
+ </html>
@@ -0,0 +1,140 @@
1
+ import React from "react";
2
+ import { applyPolyfills, defineCustomElements } from '@duetds/components/lib/loader';
3
+ import Header from "./components/Header";
4
+ import InvestmentAmount from "./components/InvestmentAmount";
5
+ import InvestmentOrigin from "./components/InvestmentOrigin";
6
+ import Summary from "./components/Summary";
7
+ import Footer from "./components/Footer";
8
+
9
+ applyPolyfills().then(() => {
10
+ defineCustomElements();
11
+ });
12
+
13
+ const agreementOptions = {
14
+ 1: { label: "Vakuutus 1", price: 2500 },
15
+ 2: { label: "Vakuutus 2", price: 1000 }
16
+ }
17
+
18
+ const formatter = new Intl.NumberFormat("fi-FI", { style: "currency", currency: "EUR" })
19
+
20
+ function App() {
21
+ const [currentStep, setCurrentStep] = React.useState(0)
22
+ const [formData, setFormData] = React.useState({
23
+ investmentAmount: {
24
+ agreement: "",
25
+ additionalInvestment: 50
26
+ },
27
+ investmentOrigin: {
28
+ salary: false,
29
+ gift: false,
30
+ heritage: false,
31
+ entrepreneurialIncome: false,
32
+ assets: false,
33
+ otherIncome: false,
34
+ investment: false,
35
+ extras: ""
36
+ }
37
+ })
38
+ const [complete, setComplete] = React.useState(false)
39
+
40
+ function handleInvestmentAmountChange(investmentAmount) {
41
+ setFormData(data => ({
42
+ ...data,
43
+ investmentAmount
44
+ }))
45
+ }
46
+
47
+ function handleInvestmentOriginChange(investmentOrigin) {
48
+ setFormData(data => ({
49
+ ...data,
50
+ investmentOrigin
51
+ }))
52
+ }
53
+
54
+ function handleNextClick() {
55
+ setCurrentStep(step => step + 1)
56
+ }
57
+
58
+ React.useEffect(() => {
59
+ if (window.innerWidth > 992) {
60
+ window.scrollTo(0, 160)
61
+ } else {
62
+ window.scrollTo(0, 110)
63
+ }
64
+ }, [currentStep])
65
+
66
+ return (
67
+ <>
68
+ <Header />
69
+ <duet-layout center>
70
+ <div slot="top" role="region">
71
+ <duet-spacer breakpoint="large" size="x-large"/>
72
+ <duet-heading level="h1" visual-level="h2">
73
+ Pääotsikko
74
+ </duet-heading>
75
+ <duet-spacer/>
76
+ </div>
77
+ <div slot="main">
78
+ <duet-stepper selected={currentStep} onduetStepChange={e => setCurrentStep(e.detail.toStep)}>
79
+ <duet-step heading="Perustiedot">
80
+ <duet-paragraph>
81
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
82
+ incididunt ut labore
83
+ etdolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
84
+ laboris nisi ut
85
+ aliquip.
86
+ </duet-paragraph>
87
+ <InvestmentAmount
88
+ value={formData.investmentAmount}
89
+ onChange={handleInvestmentAmountChange}
90
+ agreementOptions={agreementOptions}
91
+ formatter={formatter}
92
+ />
93
+ <duet-spacer></duet-spacer>
94
+ <duet-button
95
+ id="step1"
96
+ disabled={!formData.investmentAmount.agreement}
97
+ margin="none"
98
+ variation="primary"
99
+ onClick={handleNextClick}
100
+ >
101
+ Seuraava
102
+ </duet-button>
103
+ </duet-step>
104
+ <duet-step heading="Tarkemmat tiedot">
105
+ <duet-paragraph>
106
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
107
+ incididunt ut labore
108
+ etdolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
109
+ laboris nisi ut
110
+ aliquip.
111
+ </duet-paragraph>
112
+ <InvestmentOrigin value={formData.investmentOrigin}
113
+ onChange={handleInvestmentOriginChange}/>
114
+ <duet-spacer></duet-spacer>
115
+ <duet-button id="step2" margin="none" variation="primary" onClick={handleNextClick}>
116
+ Seuraava
117
+ </duet-button>
118
+ </duet-step>
119
+ <duet-step heading="Yhteenveto">
120
+ <duet-spacer></duet-spacer>
121
+ <Summary agreement={agreementOptions[formData.investmentAmount.agreement]}
122
+ formatter={formatter}/>
123
+ <duet-spacer></duet-spacer>
124
+ <duet-button id="step3" margin="none" variation="primary" expand
125
+ onClick={() => setComplete(true)}>
126
+ Lähetä
127
+ </duet-button>
128
+ </duet-step>
129
+ </duet-stepper>
130
+ </div>
131
+ </duet-layout>
132
+ <Footer/>
133
+ <duet-modal heading="You entered the following data:" active={complete}>
134
+ <pre>{JSON.stringify(formData, null, " ")}</pre>
135
+ </duet-modal>
136
+ </>
137
+ )
138
+ }
139
+
140
+ export default App;
@@ -0,0 +1,23 @@
1
+ import React from "react"
2
+
3
+ const menu = [
4
+ {
5
+ label: "Turvallisuus ja käyttöehdot",
6
+ href: "#",
7
+ external: "true"
8
+ },
9
+ {
10
+ label: "Evästeet",
11
+ href: "#",
12
+ external: "true"
13
+ },
14
+ {
15
+ label: "Henkilötietojen käsittely",
16
+ href: "#",
17
+ external: "true"
18
+ }
19
+ ]
20
+
21
+ export default function Footer() {
22
+ return <duet-footer variation="simple" menu={menu}></duet-footer>
23
+ }
@@ -0,0 +1,6 @@
1
+ // @ts-check
2
+ import React from "react"
3
+
4
+ export default function Header() {
5
+ return <duet-header logoHref="" back={{ label: "Takaisin", href: "/" }} />
6
+ }
@@ -0,0 +1,129 @@
1
+ import React from "react"
2
+
3
+ function AgreementDetails({ agreement, formatter }) {
4
+ return (
5
+ <duet-table variation="plain" className="hidden">
6
+ <table>
7
+ <thead>
8
+ <tr>
9
+ <th>Sijoituskohde</th>
10
+ <th className="duet-text-right">Osuus</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <tr>
15
+ <td>
16
+ <duet-button
17
+ variation="plain"
18
+ margin="none"
19
+ padding="none"
20
+ url="https://www.duetds.com/assets/downloads/localtapiola-brand-guidelines.pdf"
21
+ external
22
+ >
23
+ Kohde 1<duet-spacer size="xx-small" direction="horizontal"></duet-spacer>
24
+ <duet-icon name="action-new-window-small" margin="none" size="xx-small"></duet-icon>
25
+ <duet-visually-hidden>, avautuu uuteen ikkunaan</duet-visually-hidden>
26
+ </duet-button>
27
+ </td>
28
+ <td className="duet-text-right">25%</td>
29
+ </tr>
30
+ <tr>
31
+ <td>
32
+ <duet-button
33
+ variation="plain"
34
+ margin="none"
35
+ padding="none"
36
+ url="https://www.duetds.com/assets/downloads/localtapiola-brand-guidelines.pdf"
37
+ external
38
+ >
39
+ Kohde 2<duet-spacer size="xx-small" direction="horizontal"></duet-spacer>
40
+ <duet-icon name="action-new-window-small" margin="none" size="xx-small"></duet-icon>
41
+ <duet-visually-hidden>, avautuu uuteen ikkunaan</duet-visually-hidden>
42
+ </duet-button>
43
+ </td>
44
+ <td className="duet-text-right">25%</td>
45
+ </tr>
46
+ <tr>
47
+ <td>
48
+ <duet-button
49
+ variation="plain"
50
+ margin="none"
51
+ padding="none"
52
+ url="https://www.duetds.com/assets/downloads/localtapiola-brand-guidelines.pdf"
53
+ external
54
+ >
55
+ Kohde 3<duet-spacer size="xx-small" direction="horizontal"></duet-spacer>
56
+ <duet-icon name="action-new-window-small" margin="none" size="xx-small"></duet-icon>
57
+ <duet-visually-hidden>, avautuu uuteen ikkunaan</duet-visually-hidden>
58
+ </duet-button>
59
+ </td>
60
+ <td className="duet-text-right">50%</td>
61
+ </tr>
62
+ </tbody>
63
+ <tfoot>
64
+ <tr>
65
+ <td className="duet-font-weight-semi-bold">Yhteisarvo</td>
66
+ <td className="duet-text-right duet-font-weight-semi-bold duet-font-size-large">
67
+ {formatter.format(agreement.price)}
68
+ </td>
69
+ </tr>
70
+ </tfoot>
71
+ </table>
72
+ </duet-table>
73
+ )
74
+ }
75
+
76
+ export default function InvestmentAmount({ value, onChange, agreementOptions, formatter }) {
77
+ function handleAdditionalInvestmentChange(e) {
78
+ const additionalInvestment = e.target.value === "" ? 0 : parseInt(e.target.value)
79
+ e.target.value = additionalInvestment
80
+
81
+ onChange({
82
+ ...value,
83
+ additionalInvestment
84
+ })
85
+ }
86
+
87
+ function handleAgreementChange(e) {
88
+ onChange({
89
+ ...value,
90
+ agreement: e.detail.value
91
+ })
92
+ }
93
+
94
+ const items = Object.entries(agreementOptions).map(([value, { label, price }]) => {
95
+ return {
96
+ value,
97
+ label: `${label} - ${formatter.format(price)}`
98
+ }
99
+ })
100
+
101
+ return (
102
+ <div>
103
+ <duet-select
104
+ value={value.agreement}
105
+ items={items}
106
+ onduetChange={handleAgreementChange}
107
+ expand
108
+ label="Valitse sopimus"
109
+ placeholder="Valitse…"
110
+ ></duet-select>
111
+
112
+ {value.agreement && <AgreementDetails agreement={agreementOptions[value.agreement]} formatter={formatter} />}
113
+ <duet-spacer></duet-spacer>
114
+
115
+ <duet-card variation="plain" background="gray-lighter">
116
+ <duet-input
117
+ value={value.additionalInvestment}
118
+ onduetChange={handleAdditionalInvestmentChange}
119
+ numericKeyboard
120
+ expand
121
+ label="Syötä summa"
122
+ placeholder="50"
123
+ icon="form-money"
124
+ type="number"
125
+ ></duet-input>
126
+ </duet-card>
127
+ </div>
128
+ )
129
+ }
@@ -0,0 +1,88 @@
1
+ import React from "react"
2
+
3
+ export default function InvestmentOrigin({ value, onChange }) {
4
+ const [hasExtras, setHasExtras] = React.useState(false)
5
+
6
+ function handleAssetOriginChange(e) {
7
+ onChange({
8
+ ...value,
9
+ [e.target.name]: e.detail.checked
10
+ })
11
+ }
12
+
13
+ function handleExtraDetailsChange(e) {
14
+ onChange({
15
+ ...value,
16
+ extras: e.detail.value
17
+ })
18
+ }
19
+
20
+ function handleExtrasChange(e) {
21
+ setHasExtras(e.target.checked)
22
+
23
+ if (!e.target.checked) {
24
+ onChange({
25
+ ...value,
26
+ extras: ""
27
+ })
28
+ }
29
+ }
30
+
31
+ return (
32
+ <div>
33
+ <duet-checkbox
34
+ name="salary"
35
+ checked={value.salary}
36
+ onduetChange={handleAssetOriginChange}
37
+ label="Valinta 1"
38
+ ></duet-checkbox>
39
+ <duet-checkbox
40
+ name="gift"
41
+ checked={value.gift}
42
+ onduetChange={handleAssetOriginChange}
43
+ label="Valinta 2"
44
+ ></duet-checkbox>
45
+ <duet-checkbox
46
+ name="heritage"
47
+ checked={value.heritage}
48
+ onduetChange={handleAssetOriginChange}
49
+ label="Valinta 3"
50
+ ></duet-checkbox>
51
+ <duet-checkbox
52
+ name="entrepreneurialIncome"
53
+ checked={value.entrepreneurialIncome}
54
+ onduetChange={handleAssetOriginChange}
55
+ label="Valinta 4"
56
+ ></duet-checkbox>
57
+ <duet-checkbox
58
+ name="assets"
59
+ checked={value.assets}
60
+ onduetChange={handleAssetOriginChange}
61
+ label="Valinta 5"
62
+ ></duet-checkbox>
63
+ <duet-checkbox
64
+ name="otherIncome"
65
+ checked={value.otherIncome}
66
+ onduetChange={handleAssetOriginChange}
67
+ label="Valinta 6"
68
+ ></duet-checkbox>
69
+
70
+ <duet-checkbox
71
+ name="extras"
72
+ checked={hasExtras}
73
+ onduetChange={handleExtrasChange}
74
+ label="Muu, mikä?"
75
+ ></duet-checkbox>
76
+ {hasExtras && (
77
+ <div>
78
+ <duet-input
79
+ value={value.extras}
80
+ onduetChange={handleExtraDetailsChange}
81
+ label="Kerro sijoitettavien varojen muu alkuperä"
82
+ labelHidden
83
+ ></duet-input>
84
+ </div>
85
+ )}
86
+ </div>
87
+ )
88
+ }
@@ -0,0 +1,87 @@
1
+ import React from "react"
2
+
3
+ export default function Summary({ agreement, formatter }) {
4
+ agreement = agreement || { label: "", price: 0 }
5
+
6
+ return (
7
+ <div>
8
+ <duet-input expand disabled label="Sopimus" value={agreement.label}></duet-input>
9
+ <duet-spacer></duet-spacer>
10
+ <duet-paragraph>Valitsemasi vaihtoehto jakautuu seuraavasti:</duet-paragraph>
11
+ <duet-table variation="plain">
12
+ <table>
13
+ <thead>
14
+ <tr>
15
+ <th>Sijoituskohde</th>
16
+ <th>Osuus</th>
17
+ <th className="duet-text-right">Summa</th>
18
+ </tr>
19
+ </thead>
20
+ <tbody>
21
+ <tr>
22
+ <td>
23
+ <duet-button
24
+ variation="plain"
25
+ margin="none"
26
+ padding="none"
27
+ url="https://www.duetds.com/assets/downloads/localtapiola-brand-guidelines.pdf"
28
+ external
29
+ >
30
+ Kohde 1<duet-spacer size="xx-small" direction="horizontal"></duet-spacer>
31
+ <duet-icon name="action-new-window-small" margin="none" size="xx-small"></duet-icon>
32
+ <duet-visually-hidden>, avautuu uuteen ikkunaan</duet-visually-hidden>
33
+ </duet-button>
34
+ </td>
35
+ <td>25%</td>
36
+ <td className="duet-text-right">{formatter.format(agreement.price * 0.25)}</td>
37
+ </tr>
38
+ <tr>
39
+ <td>
40
+ <duet-button
41
+ variation="plain"
42
+ margin="none"
43
+ padding="none"
44
+ url="https://www.duetds.com/assets/downloads/localtapiola-brand-guidelines.pdf"
45
+ external
46
+ >
47
+ Kohde 2<duet-spacer size="xx-small" direction="horizontal"></duet-spacer>
48
+ <duet-icon name="action-new-window-small" margin="none" size="xx-small"></duet-icon>
49
+ <duet-visually-hidden>, avautuu uuteen ikkunaan</duet-visually-hidden>
50
+ </duet-button>
51
+ </td>
52
+ <td>25%</td>
53
+ <td className="duet-text-right">{formatter.format(agreement.price * 0.25)}</td>
54
+ </tr>
55
+ <tr>
56
+ <td>
57
+ <duet-button
58
+ variation="plain"
59
+ margin="none"
60
+ padding="none"
61
+ url="https://www.duetds.com/assets/downloads/localtapiola-brand-guidelines.pdf"
62
+ external
63
+ >
64
+ Kohde 3<duet-spacer size="xx-small" direction="horizontal"></duet-spacer>
65
+ <duet-icon name="action-new-window-small" margin="none" size="xx-small"></duet-icon>
66
+ <duet-visually-hidden>, avautuu uuteen ikkunaan</duet-visually-hidden>
67
+ </duet-button>
68
+ </td>
69
+ <td>50%</td>
70
+ <td className="duet-text-right">{formatter.format(agreement.price * 0.5)}</td>
71
+ </tr>
72
+ </tbody>
73
+ <tfoot>
74
+ <tr>
75
+ <td colSpan="2" className="duet-font-weight-semi-bold">
76
+ Sijoitettava summa
77
+ </td>
78
+ <td className="duet-text-right duet-font-weight-semi-bold duet-font-size-large">
79
+ {formatter.format(agreement.price)}
80
+ </td>
81
+ </tr>
82
+ </tfoot>
83
+ </table>
84
+ </duet-table>
85
+ </div>
86
+ )
87
+ }
@@ -0,0 +1,17 @@
1
+ import React from "react"
2
+ import ReactDOM from "react-dom/client"
3
+ import "./index.scss"
4
+ import App from "./App"
5
+ import * as serviceWorker from "./serviceWorker"
6
+
7
+ const root = ReactDOM.createRoot(document.getElementById('root'));
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>
12
+ );
13
+
14
+ // If you want your app to work offline and load faster, you can change
15
+ // unregister() to register() below. Note this comes with some pitfalls.
16
+ // Learn more about service workers: https://bit.ly/CRA-PWA
17
+ serviceWorker.unregister()
@@ -0,0 +1,2 @@
1
+ @import "~@duetds/css/lib/duet.min.css";
2
+ @import "~@duetds/tokens/lib/tokens.scss";