🎨 Ajout de storybook + d'un Switch oui/non (#2014)

* Ajout de storybook

Ajout d'un Switch oui/non

* Fix lint

* Add react-router and fix type

* Fix lint

* Resolution du conflit de version de prettier avec storybook

* Fix storybook

* Reduce Storybook bundle size
Refacto css in QuickLinks
Remove useless comment
Add default theme to CSS prop

* Déploiement de Storybook

* Fix déploiement

* Fix déploiement storybook url

* Fix Switch style

* Remplace les oui/non radio bouton par un Switch

* Filter aria props + react props in Storybook controls
Sort props in Storybook
Add global style in Storybook decorator

* Update Storybook packages

* Ajout d'un debounce dans OuiNonInput

* Fix du Switch

* Refacto des alias

* Fix lint error avec Storybook

* Fix eslint error

* Refacto deploy for Storybook

* Ajout de type pour les yaml d'economie collaborative
Ajout de type sur les fonction du locale storage
+ Autre fix de type

* Deploy storybook in dist dir in prod

* Fix focus on Switch

* Fix cy test

*  Remplace l'alias ~ par @

*  Refacto du Switch

* Remplace la checkbox par un Switch dans ChiffreAffairesActivitéMixte

* Ajout des stories RadioGroup et ToggleGroup

* Remplace le Switch oui/non par un ToggleGroup

* Ajout d'un label dans le Switch
Ajout du mode light sur le Switch

* Fix autofocus

* Fix cypress test

* 🐛 Ajout du polyfill replaceAll
pull/2037/head^2
Jérémy Rialland 2022-03-03 10:49:35 +01:00 committed by GitHub
parent 63269f280c
commit e3d0883804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
221 changed files with 10112 additions and 1261 deletions

View File

@ -1,6 +1,4 @@
node_modules
dist
publicodes/example/
# TODO fix weird error in ./exoneration-covid/index.d.ts : Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
exoneration-covid/index.d.ts
storybook-static
*.yaml.d.ts

View File

@ -46,7 +46,11 @@ module.exports = {
ecmaFeatures: { jsx: true },
// eslint-disable-next-line no-undef
tsconfigRootDir: __dirname,
project: ['./site/tsconfig.json'],
project: [
'./site/tsconfig.json',
'./modele-social/tsconfig.json',
'./exoneration-covid/tsconfig.json',
],
},
extends: [
'eslint:recommended',

View File

@ -23,6 +23,7 @@ jobs:
env-name: ${{ steps.deploy-env.outputs.name }}
fr_url: ${{ steps.base-urls.outputs.fr }}
en_url: ${{ steps.base-urls.outputs.en }}
storybook_url: ${{ steps.base-urls.outputs.storybook }}
steps:
- id: deploy-env
run: echo "::set-output name=name::${{ github.event.number || '${GITHUB_REF#refs/*/}' }}"
@ -30,6 +31,7 @@ jobs:
run:
echo "::set-output name=fr::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise.urssaf.fr' || format('https://{0}--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
echo "::set-output name=en::${{ steps.deploy-env.outputs.name == 'master' && 'https://mycompanyinfrance.urssaf.fr' || format('https://{0}-en--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
echo "::set-output name=storybook::${{ steps.deploy-env.outputs.name == 'master' && 'https://storybook.mon-entreprise.urssaf.fr' || format('https://{0}-storybook--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
build:
needs: deploy-context
@ -83,6 +85,35 @@ jobs:
site/netlify.toml
if-no-files-found: error
build-storybook:
needs: deploy-context
env:
VITE_FR_BASE_URL: ${{ needs.deploy-context.outputs.fr_url }}
VITE_EN_BASE_URL: ${{ needs.deploy-context.outputs.en_url }}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v2
- run: yarn install --frozen-lockfile
env:
# Secrets of all kinds for fetching stats & releases
GITHUB_API_SECRET: ${{ secrets.GITHUB_TOKEN }}
ZAMMAD_API_SECRET_KEY: ${{ secrets.ZAMMAD_API_SECRET_KEY }}
ATINTERNET_API_SECRET_KEY: ${{ secrets.ATINTERNET_API_SECRET_KEY }}
ATINTERNET_API_ACCESS_KEY: ${{ secrets.ATINTERNET_API_ACCESS_KEY }}
- name: Build Storybook
run: yarn workspace site build:storybook
- uses: actions/upload-artifact@v2
with:
name: static-storybook
path: |
site/storybook-static/**
site/netlify.toml
if-no-files-found: error
deploy-preview:
needs: [build, deploy-context]
runs-on: ubuntu-18.04
@ -115,8 +146,36 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
deploy-storybook-preview:
needs: [build-storybook, deploy-context]
runs-on: ubuntu-18.04
if: needs.deploy-context.outputs.env-name != 'master'
steps:
- uses: actions/download-artifact@v2
with:
name: static-storybook
- id: deploy-storybook-to-netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './storybook-static'
netlify-config-path: ./netlify.toml
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-commit-status: true
enable-commit-comment: false
github-deployment-environment: ${{ needs.deploy-context.outputs.env-name }}
alias: ${{ needs.deploy-context.outputs.env-name }}-storybook
deploy-message: ${{ github.event.pull_request.title || needs.deploy-context.outputs.env-name }} Storybook
# Disabled because we create our own customized comment
enable-pull-request-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
deploy-prod:
needs: [build, deploy-context]
needs: [build, build-storybook, deploy-context]
runs-on: ubuntu-18.04
if: needs.deploy-context.outputs.env-name == 'master'
steps:
@ -124,6 +183,13 @@ jobs:
- uses: actions/download-artifact@v2
with:
name: static-site
- uses: actions/download-artifact@v2
with:
name: static-storybook
- name: Move Storybook to dist/dev
run: |
mkdir -p dist/dev
mv storybook-static dist/dev
- id: deploy-netlify
uses: nwtgck/actions-netlify@v1.1
with:
@ -163,6 +229,7 @@ jobs:
- mon-entreprise : ${{ needs.deploy-context.outputs.fr_url }}
- mycompanyinfrance : ${{ needs.deploy-context.outputs.en_url }}
- storybook : ${{ needs.deploy-context.outputs.storybook_url }}
e2e-test-preview:
env:

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ package-lock.json
node_modules/
.env
dist/
storybook-static/
# Local Netlify folder
.netlify

View File

@ -1,3 +1,5 @@
dist
storybook-static
site/source/locales/*.yaml
site/source/ATInternetTracking/smarttag.js
*.yaml.d.ts

View File

@ -32,6 +32,7 @@
"i18n:translate": "yarn workspace site i18n:translate"
},
"resolutions": {
"prettier": "^2.5.1",
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
}
}

63
site/.storybook/main.cjs Normal file
View File

@ -0,0 +1,63 @@
const { loadConfigFromFile, mergeConfig } = require('vite')
const reactPlugin = require('@vitejs/plugin-react')
const path = require('path')
module.exports = {
stories: [
'../source/**/*.stories.mdx',
'../source/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
framework: '@storybook/react',
core: {
builder: 'storybook-builder-vite',
},
features: {
// Auto title not supported when not using storyStoreV7
// See https://github.com/eirslett/storybook-builder-vite/issues/201
storyStoreV7: true,
},
typescript: (config) => ({
...config,
reactDocgenTypescriptOptions: {
...config.reactDocgenTypescriptOptions,
propFilter: (prop) => {
// Remove from controls aria-xxx props and props from react types
return (
!/aria-/.test(prop.name) &&
!/node_modules\/@types\/react/.test(prop.parent?.fileName)
)
},
},
}),
async viteFinal(config, { configType }) {
const { config: userConfig } = await loadConfigFromFile(
path.resolve(__dirname, '../vite.config.ts')
)
// Keep storybook plugins in storybookPlugins
const storybookPlugins = config.plugins
config.plugins = []
const conf = mergeConfig(config, {
...userConfig,
plugins: [
// Replace @vitejs/plugin-react from storybook by ours
...storybookPlugins.filter(
(plugin) =>
!(Array.isArray(plugin) && plugin[0].name === 'vite:react-babel')
),
reactPlugin({
babel: { plugins: ['babel-plugin-styled-components'] },
// Copied from https://github.com/eirslett/storybook-builder-vite/blob/917d8868943ec5f58c9c2c6900e196637f0d05e3/packages/storybook-builder-vite/vite-config.ts#L95
// Do not treat story files as HMR boundaries, storybook itself needs to handle them.
exclude: [/\.stories\.([tj])sx?$/, /node_modules/],
}),
],
})
return conf
},
}

View File

@ -0,0 +1,24 @@
import React from 'react'
import DesignSystemThemeProvider from '@/design-system/root'
import { GlobalStyle } from '@/design-system/index'
export const decorators = [
(Story) => (
<DesignSystemThemeProvider>
<GlobalStyle />
<Story />
</DesignSystemThemeProvider>
),
]
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
expanded: true,
sort: 'requiredFirst',
},
}

View File

@ -39,9 +39,12 @@
"i18n:rules:check": "node scripts/i18n/check-missing-rule-translation.js",
"i18n:rules:translate": "node scripts/i18n/translate-rules.js",
"i18n:ui:check": "i18next -c scripts/i18n/parser.config.cjs && node scripts/i18n/check-missing-UI-translation.js",
"i18n:ui:translate": "rm -rf source/locales/static-analysis-fr.json && i18next -c scripts/i18n/parser.config.cjs && node scripts/i18n/translate-ui.js"
"i18n:ui:translate": "rm -rf source/locales/static-analysis-fr.json && i18next -c scripts/i18n/parser.config.cjs && node scripts/i18n/translate-ui.js",
"storybook": "start-storybook -p 6006",
"build:storybook": "build-storybook"
},
"resolutions": {
"prettier": "^2.5.1",
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
},
"dependencies": {
@ -62,6 +65,7 @@
"@react-aria/searchfield": "^3.2.0",
"@react-aria/select": "^3.5.0",
"@react-aria/ssr": "^3.1.0",
"@react-aria/switch": "^3.1.5",
"@react-aria/textfield": "^3.4.0",
"@react-pdf/renderer": "^2.0.21",
"@react-stately/radio": "^3.3.2",
@ -85,7 +89,8 @@
"react-instantsearch": "^6.11.2",
"react-instantsearch-dom": "^6.11.2",
"react-redux": "^7.0.3",
"react-router-dom": "^5.1.1",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"react-signature-pad-wrapper": "^1.2.11",
"react-spring": "^9.3.1",
"react-use-measure": "^2.0.4",
@ -102,6 +107,12 @@
"@react-types/searchfield": "^3.1.2",
"@redux-devtools/extension": "^3.2.2",
"@rollup/plugin-yaml": "^3.1.0",
"@storybook/addon-actions": "^6.5.0-alpha.40",
"@storybook/addon-essentials": "^6.5.0-alpha.40",
"@storybook/addon-interactions": "^6.5.0-alpha.40",
"@storybook/addon-links": "^6.5.0-alpha.40",
"@storybook/react": "^6.5.0-alpha.40",
"@storybook/testing-library": "^0.0.9",
"@types/iframe-resizer": "^3.5.7",
"@types/ramda": "^0.26.43",
"@types/react": "^17.0.0",
@ -109,8 +120,8 @@
"@types/react-dom": "^17.0.9",
"@types/react-instantsearch-dom": "^6.10.1",
"@types/react-redux": "^7.1.11",
"@types/react-router": "^5.1.2",
"@types/react-router-dom": "^5.3.2",
"@types/react-router": "^5.1.18",
"@types/react-router-dom": "^5.3.3",
"@types/recharts": "^1.8.16",
"@types/serve-static": "^1.13.10",
"@types/styled-components": "^5.1.9",
@ -135,6 +146,8 @@
"rimraf": "^3.0.2",
"rollup-plugin-toml": "^1.0.0",
"serve-static": "^1.14.2",
"storybook-builder-vite": "^0.1.16",
"ts-morph": "^13.0.3",
"typescript": "^4.3.2",
"vite": "^2.7.13",
"vite-plugin-shim-react-pdf": "^1.0.4",

View File

@ -1,26 +1,26 @@
import Footer from 'Components/layout/Footer/Footer'
import Header from 'Components/layout/Header'
import Route404 from 'Components/Route404'
import { useIsEmbedded } from 'Components/utils/embeddedContext'
import rules from 'modele-social'
import { StrictMode, useContext, useMemo } from 'react'
import { Helmet } from 'react-helmet-async'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { Redirect, Route, Switch } from 'react-router-dom'
import styled, { css } from 'styled-components'
import Footer from '@/components/layout/Footer/Footer'
import Header from '@/components/layout/Header'
import Route404 from '@/components/Route404'
import { useIsEmbedded } from '@/components/utils/embeddedContext'
import {
engineFactory,
EngineProvider,
Rules,
SituationProvider,
} from 'Components/utils/EngineContext'
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import { Container, Spacing } from 'DesignSystem/layout'
import { StrictMode, useContext, useMemo } from 'react'
import { Helmet } from 'react-helmet-async'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import rules from 'modele-social'
import { Redirect, Route, Switch } from 'react-router-dom'
} from '@/components/utils/EngineContext'
import { SitePathsContext } from '@/components/utils/SitePathsContext'
import { Container, Spacing } from '@/design-system/layout'
import {
configSituationSelector,
situationSelector,
} from 'Selectors/simulationSelectors'
import styled, { css } from 'styled-components'
} from '@/selectors/simulationSelectors'
import Accessibilité from './pages/Accessibilité'
import Budget from './pages/Budget/Budget'
import Créer from './pages/Creer'

View File

@ -1,25 +1,28 @@
import { OverlayProvider } from '@react-aria/overlays'
import { ErrorBoundary } from '@sentry/react'
import { ThemeColorsProvider } from 'Components/utils/colors'
import { DisableAnimationOnPrintProvider } from 'Components/utils/DisableAnimationContext'
import { IsEmbeddedProvider } from 'Components/utils/embeddedContext'
import { SitePathProvider, SitePaths } from 'Components/utils/SitePathsContext'
import { GlobalStyle } from 'DesignSystem/global-style'
import { Container } from 'DesignSystem/layout'
import DesignSystemThemeProvider from 'DesignSystem/root'
import { H1 } from 'DesignSystem/typography/heading'
import { Link } from 'DesignSystem/typography/link'
import { Body, Intro } from 'DesignSystem/typography/paragraphs'
import { ThemeColorsProvider } from '@/components/utils/colors'
import { DisableAnimationOnPrintProvider } from '@/components/utils/DisableAnimationContext'
import { IsEmbeddedProvider } from '@/components/utils/embeddedContext'
import {
SitePathProvider,
SitePaths,
} from '@/components/utils/SitePathsContext'
import { GlobalStyle } from '@/design-system/global-style'
import { Container } from '@/design-system/layout'
import DesignSystemThemeProvider from '@/design-system/root'
import { H1 } from '@/design-system/typography/heading'
import { Link } from '@/design-system/typography/link'
import { Body, Intro } from '@/design-system/typography/paragraphs'
import { createBrowserHistory } from 'history'
import i18next from 'i18next'
import logo from 'Images/logo-monentreprise.svg'
import { useIframeResizer } from 'Hooks/useIframeResizer'
import logo from '@/images/logo-monentreprise.svg'
import { useIframeResizer } from '@/hooks/useIframeResizer'
import { createContext, ReactNode, useMemo } from 'react'
import { HelmetProvider } from 'react-helmet-async'
import { I18nextProvider } from 'react-i18next'
import { Provider as ReduxProvider } from 'react-redux'
import { Router } from 'react-router-dom'
import reducers, { RootState } from 'Reducers/rootReducer'
import reducers, { RootState } from '@/reducers/rootReducer'
import { composeWithDevToolsDevelopmentOnly } from '@redux-devtools/extension'
import {
applyMiddleware,

View File

@ -1,6 +1,6 @@
import { DottedName } from 'modele-social'
import Engine from 'publicodes'
import { SimulationConfig, Situation } from 'Reducers/rootReducer'
import { SimulationConfig, Situation } from '@/reducers/rootReducer'
import { CompanyCreationAction } from './companyCreationChecklistActions'
import { CompanyStatusAction } from './companyStatusActions'
import { ActionExistingCompany } from './existingCompanyActions'

View File

@ -1,4 +1,4 @@
import { LegalStatus } from 'Selectors/companyStatusSelectors'
import { LegalStatus } from '@/selectors/companyStatusSelectors'
export type CompanyCreationAction = ReturnType<
typeof initializeCompanyCreationChecklist | typeof checkCompanyCreationItem

View File

@ -1,10 +1,10 @@
import { FabriqueSocialEntreprise } from 'API/fabrique-social'
import { ApiCommuneJson } from 'Components/conversation/select/SelectCommune'
import { FabriqueSocialEntreprise } from '@/api/fabrique-social'
import { ApiCommuneJson } from '@/components/conversation/select/SelectCommune'
import { useEffect, useState } from 'react'
import { useDispatch } from 'react-redux'
import { useHistory } from 'react-router'
import { useNextQuestionUrl } from 'Selectors/companyStatusSelectors'
import { LegalStatusRequirements } from 'Types/companyTypes'
import { useNextQuestionUrl } from '@/selectors/companyStatusSelectors'
import { LegalStatusRequirements } from '@/types/companyTypes'
import { Action } from './actions'
import { addCommuneDetails, setCompany } from './existingCompanyActions'

View File

@ -1,5 +1,5 @@
import { FabriqueSocialEntreprise } from 'API/fabrique-social'
import { ApiCommuneJson } from 'Components/conversation/select/SelectCommune'
import { FabriqueSocialEntreprise } from '@/api/fabrique-social'
import { ApiCommuneJson } from '@/components/conversation/select/SelectCommune'
export type ActionExistingCompany = ReturnType<
| typeof specifyIfAutoEntrepreneur

View File

@ -1,7 +1,7 @@
import { Body } from 'DesignSystem/typography/paragraphs'
import { Body } from '@/design-system/typography/paragraphs'
import React from 'react'
import { useSelector } from 'react-redux'
import { firstStepCompletedSelector } from 'Selectors/simulationSelectors'
import { firstStepCompletedSelector } from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import { FadeIn } from './ui/animate'
import Emoji from './utils/Emoji'

View File

@ -1,6 +1,6 @@
import useDisplayOnIntersecting from 'Components/utils/useDisplayOnIntersecting'
import { Spacing } from 'DesignSystem/layout'
import { Body, SmallBody } from 'DesignSystem/typography/paragraphs'
import useDisplayOnIntersecting from '@/components/utils/useDisplayOnIntersecting'
import { Spacing } from '@/design-system/layout'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import { formatValue } from 'publicodes'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'

View File

@ -1,17 +1,17 @@
import { batchUpdateSituation } from 'Actions/actions'
import ButtonHelp from 'DesignSystem/buttons/ButtonHelp'
import { Checkbox } from 'DesignSystem/field'
import { batchUpdateSituation } from '@/actions/actions'
import ButtonHelp from '@/design-system/buttons/ButtonHelp'
import { DottedName } from 'modele-social'
import { serializeEvaluation } from 'publicodes'
import { useCallback } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { situationSelector } from 'Selectors/simulationSelectors'
import { situationSelector } from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import { Condition } from './EngineValue'
import { SimulationGoal } from './Simulation'
import { useEngine } from './utils/EngineContext'
import { Markdown } from './utils/markdown'
import { Switch } from '@/design-system/switch'
const proportions = {
'entreprise . activité . mixte . proportions . service BIC':
@ -122,12 +122,18 @@ function ActivitéMixte() {
},
[dispatch, situation]
)
return (
<StyledActivitéMixteContainer>
<Trans>
<Checkbox defaultSelected={defaultChecked} onChange={onMixteChecked}>
<Switch
size="XS"
defaultSelected={defaultChecked}
onChange={onMixteChecked}
light
>
Activité mixte
</Checkbox>
</Switch>
</Trans>
<ButtonHelp type="aide" title={rule.title} light>
<Markdown>{rule.rawNode.description ?? ''}</Markdown>
@ -137,10 +143,16 @@ function ActivitéMixte() {
}
const StyledActivitéMixteContainer = styled.div`
display: flex;
align-items: center;
@media (min-width: ${({ theme }) => theme.breakpointsWidth.sm}) {
text-align: right;
margin-top: -1.5rem;
position: relative;
z-index: 2;
display: flex;
justify-content: flex-end;
align-items: center;
}
`

View File

@ -1,10 +1,10 @@
import { FabriqueSocialEntreprise } from 'API/fabrique-social'
import { Strong } from 'DesignSystem/typography'
import { H3 } from 'DesignSystem/typography/heading'
import { Body } from 'DesignSystem/typography/paragraphs'
import { FabriqueSocialEntreprise } from '@/api/fabrique-social'
import { Strong } from '@/design-system/typography'
import { H3 } from '@/design-system/typography/heading'
import { Body } from '@/design-system/typography/paragraphs'
import { useMemo } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { Company } from 'Reducers/inFranceAppReducer'
import { Company } from '@/reducers/inFranceAppReducer'
import styled from 'styled-components'
export default function CompanyDetails({

View File

@ -3,11 +3,11 @@ import { useSearchFieldState } from '@react-stately/searchfield'
import {
FabriqueSocialEntreprise,
searchDenominationOrSiren,
} from 'API/fabrique-social'
import { Card } from 'DesignSystem/card'
import { SearchField } from 'DesignSystem/field'
import { Body, Intro } from 'DesignSystem/typography/paragraphs'
import useSearchCompany from 'Hooks/useSearchCompany'
} from '@/api/fabrique-social'
import { Card } from '@/design-system/card'
import { SearchField } from '@/design-system/field'
import { Body, Intro } from '@/design-system/typography/paragraphs'
import useSearchCompany from '@/hooks/useSearchCompany'
import { ReactNode, useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

View File

@ -1,9 +1,9 @@
import { EngineContext, useEngine } from 'Components/utils/EngineContext'
import { EngineContext, useEngine } from '@/components/utils/EngineContext'
import { DottedName } from 'modele-social'
import { max } from 'ramda'
import { useContext } from 'react'
import { useSelector } from 'react-redux'
import { targetUnitSelector } from 'Selectors/simulationSelectors'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
import BarChartBranch from './BarChart'
import './Distribution.css'
import './PaySlip'

View File

@ -1,4 +1,4 @@
import { ScrollToElement } from 'Components/utils/Scroll'
import { ScrollToElement } from '@/components/utils/Scroll'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocation } from 'react-router'

View File

@ -1,10 +1,10 @@
import Emoji from 'Components/utils/Emoji'
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import Popover from 'DesignSystem/Popover'
import { Strong } from 'DesignSystem/typography'
import { Link } from 'DesignSystem/typography/link'
import { Body, SmallBody } from 'DesignSystem/typography/paragraphs'
import Emoji from '@/components/utils/Emoji'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import Popover from '@/design-system/Popover'
import { Strong } from '@/design-system/typography'
import { Link } from '@/design-system/typography/link'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import React, { useCallback, useContext, useState } from 'react'
import { Trans } from 'react-i18next'
import { useLocation } from 'react-router-dom'

View File

@ -1,7 +1,7 @@
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import { H2 } from 'DesignSystem/typography/heading'
import { Link } from 'DesignSystem/typography/link'
import { Body } from 'DesignSystem/typography/paragraphs'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import { H2 } from '@/design-system/typography/heading'
import { Link } from '@/design-system/typography/link'
import { Body } from '@/design-system/typography/paragraphs'
import { Trans, useTranslation } from 'react-i18next'
export default function LegalNotice() {

View File

@ -1,5 +1,5 @@
import logoSvgFR from 'Images/logo-monentreprise.svg'
import logoSvgEN from 'Images/logo-mycompany.svg'
import logoSvgFR from '@/images/logo-monentreprise.svg'
import logoSvgEN from '@/images/logo-mycompany.svg'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

View File

@ -1,6 +1,6 @@
import { Grid } from '@mui/material'
import { SmallCard } from 'DesignSystem/card'
import { H2 } from 'DesignSystem/typography/heading'
import { SmallCard } from '@/design-system/card'
import { H2 } from '@/design-system/typography/heading'
import { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocation } from 'react-router-dom'

View File

@ -1,12 +1,12 @@
import { hideNotification } from 'Actions/actions'
import { useEngine, useInversionFail } from 'Components/utils/EngineContext'
import { Button } from 'DesignSystem/buttons'
import { GenericButtonOrLinkProps } from 'DesignSystem/typography/link'
import { hideNotification } from '@/actions/actions'
import { useEngine, useInversionFail } from '@/components/utils/EngineContext'
import { Button } from '@/design-system/buttons'
import { GenericButtonOrLinkProps } from '@/design-system/typography/link'
import { DottedName } from 'modele-social'
import Engine, { RuleNode } from 'publicodes'
import { Trans, useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { RootState } from 'Reducers/rootReducer'
import { RootState } from '@/reducers/rootReducer'
import styled from 'styled-components'
import RuleLink from './RuleLink'
import Emoji from './utils/Emoji'

View File

@ -1,5 +1,5 @@
import { Grid } from '@mui/material'
import { H1 } from 'DesignSystem/typography/heading'
import { H1 } from '@/design-system/typography/heading'
import { ReactNode } from 'react'
import styled from 'styled-components'

View File

@ -1,9 +1,9 @@
import Value from 'Components/EngineValue'
import RuleLink from 'Components/RuleLink'
import { EngineContext, useEngine } from 'Components/utils/EngineContext'
import { Strong } from 'DesignSystem/typography'
import { H4, H5 } from 'DesignSystem/typography/heading'
import { Body } from 'DesignSystem/typography/paragraphs'
import Value from '@/components/EngineValue'
import RuleLink from '@/components/RuleLink'
import { EngineContext, useEngine } from '@/components/utils/EngineContext'
import { Strong } from '@/design-system/typography'
import { H4, H5 } from '@/design-system/typography/heading'
import { Body } from '@/design-system/typography/paragraphs'
import { DottedName } from 'modele-social'
import {
ASTNode,

View File

@ -1,6 +1,6 @@
import Value, { Condition, ValueProps } from 'Components/EngineValue'
import RuleLink from 'Components/RuleLink'
import { H4 } from 'DesignSystem/typography/heading'
import Value, { Condition, ValueProps } from '@/components/EngineValue'
import RuleLink from '@/components/RuleLink'
import { H4 } from '@/design-system/typography/heading'
import { DottedName } from 'modele-social'
import { isNotApplicable, isNotYetDefined } from 'publicodes'
import { Trans, useTranslation } from 'react-i18next'

View File

@ -1,8 +1,8 @@
import { updateUnit } from 'Actions/actions'
import { Radio, ToggleGroup } from 'DesignSystem/field'
import { updateUnit } from '@/actions/actions'
import { Radio, ToggleGroup } from '@/design-system/field'
import { Trans, useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { targetUnitSelector } from 'Selectors/simulationSelectors'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
export default function PeriodSwitch() {
const dispatch = useDispatch()

View File

@ -1,9 +1,9 @@
import { loadPreviousSimulation } from 'Actions/actions'
import { Link } from 'DesignSystem/typography/link'
import { loadPreviousSimulation } from '@/actions/actions'
import { Link } from '@/design-system/typography/link'
import { Trans } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { RootState } from 'Reducers/rootReducer'
import { firstStepCompletedSelector } from 'Selectors/simulationSelectors'
import { RootState } from '@/reducers/rootReducer'
import { firstStepCompletedSelector } from '@/selectors/simulationSelectors'
import Banner from './Banner'
export default function PreviousSimulationBanner() {

View File

@ -1,17 +1,17 @@
import { goToQuestion } from 'Actions/actions'
import { Spacing } from 'DesignSystem/layout'
import { Link } from 'DesignSystem/typography/link'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
import { goToQuestion } from '@/actions/actions'
import { Spacing } from '@/design-system/layout'
import { Link } from '@/design-system/typography/link'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { DottedName } from 'modele-social'
import { contains, filter, pipe, reject, toPairs } from 'ramda'
import { Trans } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { RootState } from 'Reducers/rootReducer'
import { RootState } from '@/reducers/rootReducer'
import {
answeredQuestionsSelector,
currentQuestionSelector,
} from 'Selectors/simulationSelectors'
import styled, { css } from 'styled-components'
} from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import { useNextQuestions } from './utils/useNextQuestion'
export default function QuickLinks() {
@ -40,19 +40,13 @@ export default function QuickLinks() {
<StyledLinks>
<span>Aller à la question : </span>
{links.map(([label, dottedName]) => (
<Link
<StyledLink
key={dottedName}
css={
dottedName === currentQuestion
? css`
text-decoration: underline;
`
: ''
}
underline={dottedName === currentQuestion}
onPress={() => dispatch(goToQuestion(dottedName))}
>
<Trans i18nKey={'quicklinks.' + label}>{label}</Trans>
</Link>
</StyledLink>
))}
</StyledLinks>
)
@ -63,3 +57,7 @@ const StyledLinks = styled(SmallBody)`
flex-wrap: wrap;
gap: ${({ theme }) => theme.spacings.sm};
`
const StyledLink = styled(Link)<{ underline: boolean }>`
text-decoration: ${({ underline }) => (underline ? 'underline' : '')};
`

View File

@ -1,4 +1,4 @@
import image from 'Images/map-directions.png'
import image from '@/images/map-directions.png'
import { Trans } from 'react-i18next'
import { Link } from 'react-router-dom'
import Emoji from './utils/Emoji'

View File

@ -1,4 +1,4 @@
import { Link } from 'DesignSystem/typography/link'
import { Link } from '@/design-system/typography/link'
import { DottedName } from 'modele-social'
import { RuleLink as EngineRuleLink } from 'publicodes-react'
import React, { useContext } from 'react'

View File

@ -2,19 +2,19 @@ import {
defineDirectorStatus,
isAutoentrepreneur,
useDispatchAndGoToNextQuestion,
} from 'Actions/companyStatusActions'
import Value from 'Components/EngineValue'
import Simulation from 'Components/Simulation'
import InfoBulle from 'Components/ui/InfoBulle'
import AnswerGroup from 'DesignSystem/answer-group'
import { Button } from 'DesignSystem/buttons'
import { H2, H3 } from 'DesignSystem/typography/heading'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
import revenusSVG from 'Images/revenus.svg'
} from '@/actions/companyStatusActions'
import Value from '@/components/EngineValue'
import Simulation from '@/components/Simulation'
import InfoBulle from '@/components/ui/InfoBulle'
import AnswerGroup from '@/design-system/answer-group'
import { Button } from '@/design-system/buttons'
import { H2, H3 } from '@/design-system/typography/heading'
import { SmallBody } from '@/design-system/typography/paragraphs'
import revenusSVG from '@/images/revenus.svg'
import { useCallback, useMemo, useState } from 'react'
import { Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
import { situationSelector } from 'Selectors/simulationSelectors'
import { situationSelector } from '@/selectors/simulationSelectors'
import styled, { css } from 'styled-components'
import dirigeantComparaison from '../pages/Simulateurs/configs/rémunération-dirigeant.yaml'
import SeeAnswersButton from './conversation/SeeAnswersButton'

View File

@ -1,6 +1,6 @@
import { Button } from 'DesignSystem/buttons'
import { SROnly } from 'DesignSystem/global-style'
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import { Button } from '@/design-system/buttons'
import { SROnly } from '@/design-system/global-style'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import { Trans, useTranslation } from 'react-i18next'
import styled from 'styled-components'
import SearchRulesAndSimulators from './search/SearchRulesAndSimulators'

View File

@ -1,10 +1,10 @@
import { useContext } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useDispatch } from 'react-redux'
import { Link as DesignSystemLink } from 'DesignSystem/typography/link'
import { EngineContext } from 'Components/utils/EngineContext'
import Banner from 'Components/Banner'
import { updateSituation } from 'Actions/actions'
import { Link as DesignSystemLink } from '@/design-system/typography/link'
import { EngineContext } from '@/components/utils/EngineContext'
import Banner from '@/components/Banner'
import { updateSituation } from '@/actions/actions'
import styled from 'styled-components'
import { Evaluation } from 'publicodes'

View File

@ -1,8 +1,8 @@
import { Grid } from '@mui/material'
import { Button } from 'DesignSystem/buttons'
import { TextField } from 'DesignSystem/field'
import { Spacing } from 'DesignSystem/layout'
import { Body, SmallBody } from 'DesignSystem/typography/paragraphs'
import { Button } from '@/design-system/buttons'
import { TextField } from '@/design-system/field'
import { Spacing } from '@/design-system/layout'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import { useContext, useEffect, useRef, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { TrackingContext } from '../../ATInternetTracking'

View File

@ -1,13 +1,13 @@
import { Grid } from '@mui/material'
import Emoji from 'Components/utils/Emoji'
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import Emoji from '@/components/utils/Emoji'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import { CurrentSimulatorDataContext } from '../../pages/Simulateurs/metadata'
import { useContext } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { situationSelector } from 'Selectors/simulationSelectors'
import { situationSelector } from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import { TrackingContext } from '../../ATInternetTracking'
import { useParamsFromSituation } from '../utils/useSearchParamsSimulationSharing'

View File

@ -1,6 +1,6 @@
import Warning from 'Components/ui/WarningBlock'
import { Link } from 'DesignSystem/typography/link'
import { Li, Ul } from 'DesignSystem/typography/list'
import Warning from '@/components/ui/WarningBlock'
import { Link } from '@/design-system/typography/link'
import { Li, Ul } from '@/design-system/typography/list'
import { Evaluation } from 'publicodes'
import { useContext } from 'react'
import { Trans } from 'react-i18next'

View File

@ -1,8 +1,8 @@
import Conversation, {
ConversationProps,
} from 'Components/conversation/Conversation'
import Progress from 'Components/ui/Progress'
import { Body } from 'DesignSystem/typography/paragraphs'
} from '@/components/conversation/Conversation'
import Progress from '@/components/ui/Progress'
import { Body } from '@/design-system/typography/paragraphs'
import { Trans } from 'react-i18next'
import styled from 'styled-components'
import { useSimulationProgress } from './../utils/useNextQuestion'

View File

@ -1,6 +1,6 @@
import { Grid } from '@mui/material'
import { updateSituation } from 'Actions/actions'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
import { updateSituation } from '@/actions/actions'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { DottedName } from 'modele-social'
import { formatValue, UNSAFE_isNotApplicable } from 'publicodes'
import React, { useCallback, useState } from 'react'
@ -8,7 +8,7 @@ import { useDispatch, useSelector } from 'react-redux'
import {
situationSelector,
targetUnitSelector,
} from 'Selectors/simulationSelectors'
} from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import RuleInput, { InputProps } from '../conversation/RuleInput'
import RuleLink from '../RuleLink'

View File

@ -1,8 +1,8 @@
import { Grid } from '@mui/material'
import { Link } from 'DesignSystem/typography/link'
import { Link } from '@/design-system/typography/link'
import React from 'react'
import { useSelector } from 'react-redux'
import { firstStepCompletedSelector } from 'Selectors/simulationSelectors'
import { firstStepCompletedSelector } from '@/selectors/simulationSelectors'
import styled, { css, ThemeProvider } from 'styled-components'
import { Logo } from '../Logo'
import { useIsEmbedded } from '../utils/embeddedContext'

View File

@ -1,12 +1,12 @@
import { Grid, styled } from '@mui/material'
import { ConversationProps } from 'Components/conversation/Conversation'
import PageFeedback from 'Components/Feedback'
import ShareOrSaveSimulationBanner from 'Components/ShareSimulationBanner'
import { Spacing } from 'DesignSystem/layout'
import { ConversationProps } from '@/components/conversation/Conversation'
import PageFeedback from '@/components/Feedback'
import ShareOrSaveSimulationBanner from '@/components/ShareSimulationBanner'
import { Spacing } from '@/design-system/layout'
import React from 'react'
import { Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
import { firstStepCompletedSelector } from 'Selectors/simulationSelectors'
import { firstStepCompletedSelector } from '@/selectors/simulationSelectors'
import { TrackPage } from '../../ATInternetTracking'
import PreviousSimulationBanner from './../PreviousSimulationBanner'
import ExportRecover from './../simulationExplanation/ExportRecover'

View File

@ -1,12 +1,12 @@
import RuleLink from 'Components/RuleLink'
import useDisplayOnIntersecting from 'Components/utils/useDisplayOnIntersecting'
import { Names } from 'modele-social/dist/names'
import RuleLink from '@/components/RuleLink'
import useDisplayOnIntersecting from '@/components/utils/useDisplayOnIntersecting'
import { DottedName } from 'modele-social'
import { EvaluatedNode } from 'publicodes'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { animated, useSpring } from 'react-spring'
import { targetUnitSelector } from 'Selectors/simulationSelectors'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import { DisableAnimationContext } from './utils/DisableAnimationContext'
import { useEngine } from './utils/EngineContext'
@ -180,7 +180,7 @@ function InnerStackedBarChart({ data, precision }: InnerStackedBarChartProps) {
}
type StackedRulesChartProps = {
data: Array<{ color?: string; dottedName: Names; title?: string }>
data: Array<{ color?: string; dottedName: DottedName; title?: string }>
precision?: Precision
}

View File

@ -1,6 +1,6 @@
import { Strong } from 'DesignSystem/typography'
import { Li, Ul } from 'DesignSystem/typography/list'
import { Body } from 'DesignSystem/typography/paragraphs'
import { Strong } from '@/design-system/typography'
import { Li, Ul } from '@/design-system/typography/list'
import { Body } from '@/design-system/typography/paragraphs'
import { formatValue } from 'publicodes'
import {
Bar,

View File

@ -1,10 +1,10 @@
import { goToQuestion, resetSimulation } from 'Actions/actions'
import Emoji from 'Components/utils/Emoji'
import { useEngine } from 'Components/utils/EngineContext'
import { useNextQuestions } from 'Components/utils/useNextQuestion'
import { Button } from 'DesignSystem/buttons'
import { H2 } from 'DesignSystem/typography/heading'
import { Link } from 'DesignSystem/typography/link'
import { goToQuestion, resetSimulation } from '@/actions/actions'
import Emoji from '@/components/utils/Emoji'
import { useEngine } from '@/components/utils/EngineContext'
import { useNextQuestions } from '@/components/utils/useNextQuestion'
import { Button } from '@/design-system/buttons'
import { H2 } from '@/design-system/typography/heading'
import { Link } from '@/design-system/typography/link'
import { DottedName } from 'modele-social'
import { EvaluatedNode, formatValue } from 'publicodes'
import { useMemo } from 'react'
@ -13,7 +13,7 @@ import { useDispatch, useSelector } from 'react-redux'
import {
answeredQuestionsSelector,
situationSelector,
} from 'Selectors/simulationSelectors'
} from '@/selectors/simulationSelectors'
import styled from 'styled-components'
import './AnswerList.css'

View File

@ -1,10 +1,10 @@
import { useDebounce } from 'Components/utils'
import Emoji from 'Components/utils/Emoji'
import { Markdown } from 'Components/utils/markdown'
import ButtonHelp from 'DesignSystem/buttons/ButtonHelp'
import { Radio, RadioGroup } from 'DesignSystem/field'
import { Spacing } from 'DesignSystem/layout'
import { H4 } from 'DesignSystem/typography/heading'
import { useDebounce } from '@/components/utils'
import Emoji from '@/components/utils/Emoji'
import { Markdown } from '@/components/utils/markdown'
import ButtonHelp from '@/design-system/buttons/ButtonHelp'
import { Radio, RadioGroup, ToggleGroup } from '@/design-system/field'
import { Spacing } from '@/design-system/layout'
import { H4 } from '@/design-system/typography/heading'
import { DottedName } from 'modele-social'
import { EvaluatedNode, RuleNode, serializeEvaluation } from 'publicodes'
import {
@ -147,15 +147,16 @@ export function OuiNonInput(props: InputProps<DottedName>) {
// seront stockées ainsi dans le state :
// [parent object path]: dotted fieldName relative to parent
const { handleChange, defaultValue, currentSelection } = useSelection(props)
return (
<RadioGroup onChange={handleChange} value={currentSelection ?? undefined}>
<ToggleGroup onChange={handleChange} value={currentSelection ?? undefined}>
<Radio value="oui" autoFocus={props.autoFocus && defaultValue === 'oui'}>
<Trans>Oui</Trans>
</Radio>
<Radio value="non" autoFocus={props.autoFocus && defaultValue === 'non'}>
<Trans>Non</Trans>
</Radio>
</RadioGroup>
</ToggleGroup>
)
}

View File

@ -1,15 +1,15 @@
import { Grid } from '@mui/material'
import { goToQuestion, stepAction, updateSituation } from 'Actions/actions'
import RuleInput from 'Components/conversation/RuleInput'
import Notifications from 'Components/Notifications'
import QuickLinks from 'Components/QuickLinks'
import Emoji from 'Components/utils/Emoji'
import { EngineContext } from 'Components/utils/EngineContext'
import { useNextQuestions } from 'Components/utils/useNextQuestion'
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import { H3 } from 'DesignSystem/typography/heading'
import { Body } from 'DesignSystem/typography/paragraphs'
import { goToQuestion, stepAction, updateSituation } from '@/actions/actions'
import RuleInput from '@/components/conversation/RuleInput'
import Notifications from '@/components/Notifications'
import QuickLinks from '@/components/QuickLinks'
import Emoji from '@/components/utils/Emoji'
import { EngineContext } from '@/components/utils/EngineContext'
import { useNextQuestions } from '@/components/utils/useNextQuestion'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import { H3 } from '@/design-system/typography/heading'
import { Body } from '@/design-system/typography/paragraphs'
import { PublicodesExpression } from 'publicodes'
import React, { useContext, useEffect } from 'react'
import { Trans } from 'react-i18next'
@ -17,7 +17,7 @@ import { useDispatch, useSelector } from 'react-redux'
import {
answeredQuestionsSelector,
situationSelector,
} from 'Selectors/simulationSelectors'
} from '@/selectors/simulationSelectors'
import { TrackPage } from '../../ATInternetTracking'
import './conversation.css'
import { ExplicableRule } from './Explicable'

View File

@ -1,5 +1,5 @@
import { InputProps } from 'Components/conversation/RuleInput'
import { DateField } from 'DesignSystem/field'
import { InputProps } from '@/components/conversation/RuleInput'
import { DateField } from '@/design-system/field'
import { useCallback, useMemo } from 'react'
import InputSuggestions from './InputSuggestions'

View File

@ -1,6 +1,6 @@
import { EngineContext } from 'Components/utils/EngineContext'
import { Markdown } from 'Components/utils/markdown'
import ButtonHelp from 'DesignSystem/buttons/ButtonHelp'
import { EngineContext } from '@/components/utils/EngineContext'
import { Markdown } from '@/components/utils/markdown'
import ButtonHelp from '@/design-system/buttons/ButtonHelp'
import { DottedName } from 'modele-social'
import { useContext } from 'react'

View File

@ -1,5 +1,5 @@
import { Link } from 'DesignSystem/typography/link'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
import { Link } from '@/design-system/typography/link'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { ASTNode } from 'publicodes'
import { toPairs } from 'ramda'
import { useState } from 'react'

View File

@ -1,11 +1,11 @@
import { NumberFieldProps } from '@react-types/numberfield'
import { EngineContext } from 'Components/utils/EngineContext'
import { NumberField } from 'DesignSystem/field'
import { EngineContext } from '@/components/utils/EngineContext'
import { NumberField } from '@/design-system/field'
import { ASTNode, serializeUnit, Unit } from 'publicodes'
import { useCallback, useContext, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
import { debounce } from '../../utils'
import { debounce } from '@/utils'
import InputSuggestions from './InputSuggestions'
import { InputProps } from './RuleInput'

View File

@ -1,7 +1,7 @@
import NumberInput from 'Components/conversation/NumberInput'
import SelectCommune from 'Components/conversation/select/SelectCommune'
import SelectAtmp from 'Components/conversation/select/SelectTauxRisque'
import { EngineContext } from 'Components/utils/EngineContext'
import NumberInput from '@/components/conversation/NumberInput'
import SelectCommune from '@/components/conversation/select/SelectCommune'
import SelectAtmp from '@/components/conversation/select/SelectTauxRisque'
import { EngineContext } from '@/components/utils/EngineContext'
import { DottedName } from 'modele-social'
import Engine, {
ASTNode,

View File

@ -1,5 +1,5 @@
import { Button } from 'DesignSystem/buttons'
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import { Button } from '@/design-system/buttons'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import { Trans } from 'react-i18next'
import Answers from './AnswerList'
import './conversation.css'

View File

@ -1,4 +1,4 @@
import { TextField } from 'DesignSystem/field'
import { TextField } from '@/design-system/field'
import { Evaluation } from 'publicodes'
import { useCallback } from 'react'
import { debounce } from '../../utils'

View File

@ -1,9 +1,9 @@
import { TextField } from 'DesignSystem/field'
import { Body } from 'DesignSystem/typography/paragraphs'
import { TextField } from '@/design-system/field'
import { Body } from '@/design-system/typography/paragraphs'
import { KeyboardEvent, useCallback, useMemo, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'
import { debounce } from '../../../utils'
import { debounce } from '@/utils'
import { InputProps } from '../RuleInput'
export type ApiCommuneJson = {
@ -47,7 +47,7 @@ async function tauxVersementTransport(
codeCommune = '132' + commune.codePostal.slice(-2)
}
// 2. On récupère le versement transport associé
const json = (await import('Data/versement-mobilité.json')).default
const json = (await import('@/data/versement-mobilité.json')).default
return json[codeCommune as keyof typeof json] ?? 0
}

View File

@ -1,4 +1,4 @@
import { Item, Select } from 'DesignSystem/field/Select'
import { Item, Select } from '@/design-system/field/Select'
import { InputProps } from '../RuleInput'
const states = [

View File

@ -1,4 +1,4 @@
import { Item, Select } from 'DesignSystem/field/Select'
import { Item, Select } from '@/design-system/field/Select'
import { InputProps } from '../RuleInput'
const states = [

View File

@ -1,4 +1,4 @@
import TextField from 'DesignSystem/field/TextField'
import TextField from '@/design-system/field/TextField'
import { useEffect, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import Worker from './SelectTauxRisque.worker.js?worker'

View File

@ -1,4 +1,4 @@
import ContactImage from 'Images/contact.png'
import ContactImage from '@/images/contact.png'
const Contact = () => (
<div className="centeredMessage">
<p>

View File

@ -1,17 +1,17 @@
import PageFeedback from 'Components/Feedback'
import LegalNotice from 'Components/LegalNotice'
import Emoji from 'Components/utils/Emoji'
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import { FooterContainer } from 'DesignSystem/footer'
import { FooterColumn } from 'DesignSystem/footer/column'
import { Container } from 'DesignSystem/layout'
import { Link } from 'DesignSystem/typography/link'
import { Body } from 'DesignSystem/typography/paragraphs'
import PageFeedback from '@/components/Feedback'
import LegalNotice from '@/components/LegalNotice'
import Emoji from '@/components/utils/Emoji'
import { SitePathsContext } from '@/components/utils/SitePathsContext'
import { FooterContainer } from '@/design-system/footer'
import { FooterColumn } from '@/design-system/footer/column'
import { Container } from '@/design-system/layout'
import { Link } from '@/design-system/typography/link'
import { Body } from '@/design-system/typography/paragraphs'
import { useContext } from 'react'
import { Helmet } from 'react-helmet-async'
import { Trans, useTranslation } from 'react-i18next'
import { ThemeProvider } from 'styled-components'
import { hrefLangLink } from '../../../sitePaths'
import { hrefLangLink } from '@/sitePaths'
import InscriptionBetaTesteur from './InscriptionBetaTesteur'
import Privacy from './Privacy'
import { useShowFeedback } from './useShowFeedback'

View File

@ -1,8 +1,8 @@
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import { Link } from 'DesignSystem/typography/link'
import { Body, Intro } from 'DesignSystem/typography/paragraphs'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import { Link } from '@/design-system/typography/link'
import { Body, Intro } from '@/design-system/typography/paragraphs'
import FeedbackSvg from './feedback.svg'
export const INSCRIPTION_LINK =

View File

@ -1,7 +1,7 @@
import { Checkbox } from 'DesignSystem/field'
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import { Link } from 'DesignSystem/typography/link'
import { Body, SmallBody } from 'DesignSystem/typography/paragraphs'
import { Checkbox } from '@/design-system/field'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import { Link } from '@/design-system/typography/link'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import { useCallback, useContext, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { TrackingContext, TrackPage } from '../../../ATInternetTracking'

View File

@ -1,7 +1,7 @@
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import { SitePathsContext } from '@/components/utils/SitePathsContext'
import { useContext } from 'react'
import { useLocation } from 'react-router-dom'
import useSimulatorsData from '../../../pages/Simulateurs/metadata'
import useSimulatorsData from '@/pages/Simulateurs/metadata'
export const useShowFeedback = () => {
const currentPath = useLocation().pathname

View File

@ -1,9 +1,9 @@
import { Logo } from 'Components/Logo'
import SearchButton from 'Components/SearchButton'
import BrowserOnly from 'Components/utils/BrowserOnly'
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import { Container } from 'DesignSystem/layout'
import { Link } from 'DesignSystem/typography/link'
import { Logo } from '@/components/Logo'
import SearchButton from '@/components/SearchButton'
import BrowserOnly from '@/components/utils/BrowserOnly'
import { SitePathsContext } from '@/components/utils/SitePathsContext'
import { Container } from '@/design-system/layout'
import { Link } from '@/design-system/typography/link'
import { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

View File

@ -1,9 +1,9 @@
import { Appear } from 'Components/ui/animate'
import Emoji from 'Components/utils/Emoji'
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import lastRelease from 'Data/last-release.json'
import { Banner, HideButton, InnerBanner } from 'DesignSystem/banner'
import { Link } from 'DesignSystem/typography/link'
import { Appear } from '@/components/ui/animate'
import Emoji from '@/components/utils/Emoji'
import { SitePathsContext } from '@/components/utils/SitePathsContext'
import lastRelease from '@/data/last-release.json'
import { Banner, HideButton, InnerBanner } from '@/design-system/banner'
import { Link } from '@/design-system/typography/link'
import { useContext, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { getItem, setItem } from '../../storage/safeLocalStorage'

View File

@ -1,16 +1,16 @@
import { Button } from 'DesignSystem/buttons'
import { FocusStyle } from 'DesignSystem/global-style'
import { H3 } from 'DesignSystem/typography/heading'
import { Body, SmallBody } from 'DesignSystem/typography/paragraphs'
import { Button } from '@/design-system/buttons'
import { FocusStyle } from '@/design-system/global-style'
import { H3 } from '@/design-system/typography/heading'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import { Trans, useTranslation } from 'react-i18next'
import { Hit as AlgoliaHit } from 'react-instantsearch-core'
import { connectInfiniteHits, connectStats } from 'react-instantsearch-dom'
import styled from 'styled-components'
import { Names } from '../../../../../modele-social/dist/names'
import { DottedName } from 'modele-social'
import RuleLink from '../../RuleLink'
import { Highlight } from '../Hightlight'
type Hit = AlgoliaHit<{ objectID: Names; namespace?: string }>
type Hit = AlgoliaHit<{ objectID: DottedName; namespace?: string }>
const StyledRuleLink = styled(RuleLink)`
${SmallBody}, ${Body} {

View File

@ -1,4 +1,4 @@
import { SearchField } from 'DesignSystem/field'
import { SearchField } from '@/design-system/field'
import { useTranslation } from 'react-i18next'
import { connectSearchBox } from 'react-instantsearch-dom'

View File

@ -1,5 +1,5 @@
import algoliasearch from 'algoliasearch/lite'
import { H2 } from 'DesignSystem/typography/heading'
import { H2 } from '@/design-system/typography/heading'
import { Trans } from 'react-i18next'
import { RulesInfiniteHits } from './RulesInfiniteHits'
import { SearchBox } from './SearchBox'

View File

@ -1,5 +1,5 @@
import algoliasearch from 'algoliasearch/lite'
import { Spacing } from 'DesignSystem/layout'
import { Spacing } from '@/design-system/layout'
import { useEffect } from 'react'
import { Configure, Index } from 'react-instantsearch-dom'
import { useHistory } from 'react-router'

View File

@ -1,11 +1,11 @@
import { Grid } from '@mui/material'
import Emoji from 'Components/utils/Emoji'
import { SitePathsContext } from 'Components/utils/SitePathsContext'
import { SmallCard } from 'DesignSystem/card'
import InfoBulle from 'DesignSystem/InfoBulle'
import { H3 } from 'DesignSystem/typography/heading'
import { ExtractFromSimuData } from 'pages/Simulateurs/metadata'
import { MetadataSrc } from 'pages/Simulateurs/metadata-src'
import Emoji from '@/components/utils/Emoji'
import { SitePathsContext } from '@/components/utils/SitePathsContext'
import { SmallCard } from '@/design-system/card'
import InfoBulle from '@/design-system/InfoBulle'
import { H3 } from '@/design-system/typography/heading'
import { ExtractFromSimuData } from '@/pages/Simulateurs/metadata'
import { MetadataSrc } from '@/pages/Simulateurs/metadata-src'
import { path } from 'ramda'
import { useContext } from 'react'
import { Trans } from 'react-i18next'

View File

@ -1,5 +1,5 @@
import { useUrl } from 'Components/ShareSimulationBanner'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
import { useUrl } from '@/components/ShareSimulationBanner'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { Trans } from 'react-i18next'
export default function ExportRecover() {

View File

@ -1,11 +1,11 @@
import Value from 'Components/EngineValue'
import { FromBottom } from 'Components/ui/animate'
import { useEngine } from 'Components/utils/EngineContext'
import { Markdown } from 'Components/utils/markdown'
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import { H3 } from 'DesignSystem/typography/heading'
import { Intro } from 'DesignSystem/typography/paragraphs'
import Value from '@/components/EngineValue'
import { FromBottom } from '@/components/ui/animate'
import { useEngine } from '@/components/utils/EngineContext'
import { Markdown } from '@/components/utils/markdown'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import { H3 } from '@/design-system/typography/heading'
import { Intro } from '@/design-system/typography/paragraphs'
import { Trans } from 'react-i18next'
export default function CotisationsForfaitaires() {

View File

@ -1,9 +1,9 @@
import { FromBottom } from 'Components/ui/animate'
import { useEngine } from 'Components/utils/EngineContext'
import { Markdown } from 'Components/utils/markdown'
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import { H3 } from 'DesignSystem/typography/heading'
import { FromBottom } from '@/components/ui/animate'
import { useEngine } from '@/components/utils/EngineContext'
import { Markdown } from '@/components/utils/markdown'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import { H3 } from '@/design-system/typography/heading'
import { Trans } from 'react-i18next'
export default function CotisationsRégularisation() {

View File

@ -1,23 +1,23 @@
import BarChartBranch from 'Components/BarChart'
import 'Components/Distribution.css'
import BarChartBranch from '@/components/BarChart'
import '@/components/Distribution.css'
import Value, {
Condition,
WhenApplicable,
WhenNotApplicable,
} from 'Components/EngineValue'
import RuleLink from 'Components/RuleLink'
import StackedBarChart from 'Components/StackedBarChart'
import { useEngine } from 'Components/utils/EngineContext'
import { Strong } from 'DesignSystem/typography'
import { H3 } from 'DesignSystem/typography/heading'
import { Li, Ul } from 'DesignSystem/typography/list'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
} from '@/components/EngineValue'
import RuleLink from '@/components/RuleLink'
import StackedBarChart from '@/components/StackedBarChart'
import { useEngine } from '@/components/utils/EngineContext'
import { Strong } from '@/design-system/typography'
import { H3 } from '@/design-system/typography/heading'
import { Li, Ul } from '@/design-system/typography/list'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { DottedName } from 'modele-social'
import { max } from 'ramda'
import { useContext } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { targetUnitSelector } from 'Selectors/simulationSelectors'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
import { ThemeContext } from 'styled-components'
import CotisationsForfaitaires from './IndépendantCotisationsForfaitaires'
import CotisationsRégularisation from './IndépendantCotisationsRégularisation'

View File

@ -3,21 +3,21 @@ import Value, {
Condition,
WhenApplicable,
WhenNotApplicable,
} from 'Components/EngineValue'
import RuleLink from 'Components/RuleLink'
import { FromBottom } from 'Components/ui/animate'
import Emoji from 'Components/utils/Emoji'
import { useEngine } from 'Components/utils/EngineContext'
import { H2, H3 } from 'DesignSystem/typography/heading'
import { Body, SmallBody } from 'DesignSystem/typography/paragraphs'
import assuranceMaladieSrc from 'Images/assurance-maladie.svg'
import dgfipSrc from 'Images/logo-dgfip.svg'
import * as logosSrc from 'Images/logos-caisses-retraite'
import urssafSrc from 'Images/Urssaf.svg'
} from '@/components/EngineValue'
import RuleLink from '@/components/RuleLink'
import { FromBottom } from '@/components/ui/animate'
import Emoji from '@/components/utils/Emoji'
import { useEngine } from '@/components/utils/EngineContext'
import { H2, H3 } from '@/design-system/typography/heading'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import assuranceMaladieSrc from '@/images/assurance-maladie.svg'
import dgfipSrc from '@/images/logo-dgfip.svg'
import * as logosSrc from '@/images/logos-caisses-retraite'
import urssafSrc from '@/images/Urssaf.svg'
import { DottedName } from 'modele-social'
import { Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
import { targetUnitSelector } from 'Selectors/simulationSelectors'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
import styled from 'styled-components'
export default function InstitutionsPartenaires() {

View File

@ -1,14 +1,14 @@
import { Grid } from '@mui/material'
import Distribution from 'Components/Distribution'
import PaySlip from 'Components/PaySlip'
import StackedBarChart from 'Components/StackedBarChart'
import { FromTop } from 'Components/ui/animate'
import Emoji from 'Components/utils/Emoji'
import { useInversionFail } from 'Components/utils/EngineContext'
import { Container, Spacing } from 'DesignSystem/layout'
import { H2 } from 'DesignSystem/typography/heading'
import { Link } from 'DesignSystem/typography/link'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
import Distribution from '@/components/Distribution'
import PaySlip from '@/components/PaySlip'
import StackedBarChart from '@/components/StackedBarChart'
import { FromTop } from '@/components/ui/animate'
import Emoji from '@/components/utils/Emoji'
import { useInversionFail } from '@/components/utils/EngineContext'
import { Container, Spacing } from '@/design-system/layout'
import { H2 } from '@/design-system/typography/heading'
import { Link } from '@/design-system/typography/link'
import { SmallBody } from '@/design-system/typography/paragraphs'
import { useContext, useRef } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { ThemeContext } from 'styled-components'

View File

@ -2,7 +2,7 @@ import { formatValue } from 'publicodes'
import React, { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { targetUnitSelector } from 'Selectors/simulationSelectors'
import { targetUnitSelector } from '@/selectors/simulationSelectors'
import styled, { keyframes } from 'styled-components'
type AnimatedTargetValueProps = {

View File

@ -1,9 +1,9 @@
import { Grid } from '@mui/material'
import { Markdown } from 'Components/utils/markdown'
import { ScrollToElement } from 'Components/utils/Scroll'
import { Checkbox } from 'DesignSystem/field'
import { Spacing } from 'DesignSystem/layout'
import { Link } from 'DesignSystem/typography/link'
import { Markdown } from '@/components/utils/markdown'
import { ScrollToElement } from '@/components/utils/Scroll'
import { Checkbox } from '@/design-system/field'
import { Spacing } from '@/design-system/layout'
import { Link } from '@/design-system/typography/link'
import React, { useEffect, useState } from 'react'
import { Trans } from 'react-i18next'
import styled from 'styled-components'

View File

@ -1,9 +1,9 @@
import Emoji from 'Components/utils/Emoji'
import { usePersistingState } from 'Components/utils/persistState'
import { Button } from 'DesignSystem/buttons'
import { Spacing } from 'DesignSystem/layout'
import { Link } from 'DesignSystem/typography/link'
import { Intro } from 'DesignSystem/typography/paragraphs'
import Emoji from '@/components/utils/Emoji'
import { usePersistingState } from '@/components/utils/persistState'
import { Button } from '@/design-system/buttons'
import { Spacing } from '@/design-system/layout'
import { Link } from '@/design-system/typography/link'
import { Intro } from '@/design-system/typography/paragraphs'
import { ReactNode } from 'react'
import { Trans } from 'react-i18next'
import styled from 'styled-components'
@ -22,7 +22,8 @@ const WarningSection = styled.section`
`
export default function Warning({ localStorageKey, children }: WarningProps) {
const [folded, fold] = usePersistingState(localStorageKey, false)
const [folded, fold] = usePersistingState<boolean>(localStorageKey, false)
return (
<>
<WarningSection>

View File

@ -1,4 +1,4 @@
import { DisableAnimationContext } from 'Components/utils/DisableAnimationContext'
import { DisableAnimationContext } from '@/components/utils/DisableAnimationContext'
import React, { useContext } from 'react'
import {
animated,
@ -40,7 +40,6 @@ export function FromBottom({
<>
{trail.map((style, i) => (
<AnimatedDiv
// @ts-expect-error: bug when using babel-plugin-styled-components and react-spring
key={i}
style={{
...inheritedStyle,

View File

@ -1,4 +1,4 @@
import { Appear } from 'Components/ui/animate'
import { Appear } from '@/components/ui/animate'
import React from 'react'
// We add a animation for all coponents displayed on the client only but not on

View File

@ -1,8 +1,8 @@
import { Strong } from 'DesignSystem/typography'
import { H1, H2, H3, H4, H5, H6 } from 'DesignSystem/typography/heading'
import { Link } from 'DesignSystem/typography/link'
import { Li, Ul } from 'DesignSystem/typography/list'
import { Body } from 'DesignSystem/typography/paragraphs'
import { Strong } from '@/design-system/typography'
import { H1, H2, H3, H4, H5, H6 } from '@/design-system/typography/heading'
import { Link } from '@/design-system/typography/link'
import { Li, Ul } from '@/design-system/typography/list'
import { Body } from '@/design-system/typography/paragraphs'
import MarkdownToJsx, { MarkdownToJSX } from 'markdown-to-jsx'
import React, { useContext, useEffect } from 'react'
import { useLocation } from 'react-router-dom'

View File

@ -1,13 +1,15 @@
import { useEffect, useState } from 'react'
import * as safeLocalStorage from '../../storage/safeLocalStorage'
export const getInitialState = (key: string) => {
type Storage = Record<string, unknown> | boolean | number | null
export const getInitialState = <T extends Storage>(key: string): T | null => {
const value = safeLocalStorage.getItem(key)
if (value === 'undefined' || !value) {
return
return null
}
try {
return JSON.parse(value)
return JSON.parse(value) as T
} catch (e) {
// eslint-disable-next-line no-console
console.warn(e)
@ -15,7 +17,10 @@ export const getInitialState = (key: string) => {
}
}
export const useSafeLocaleStorage = (key: string, state: any) => {
export const useSafeLocaleStorage = <T extends Storage>(
key: string,
state: T
) => {
useEffect(() => {
if (key) {
safeLocalStorage.setItem(key, JSON.stringify(state))
@ -23,10 +28,13 @@ export const useSafeLocaleStorage = (key: string, state: any) => {
}, [key, state])
}
export const usePersistingState = <S>(key: string, defaultState?: any) => {
const persistedState = getInitialState(key)
export const usePersistingState = <T extends Storage>(
key: string,
defaultState: T
) => {
const persistedState = getInitialState<T>(key)
const initialState = persistedState != null ? persistedState : defaultState
const [state, setState] = useState<S>(initialState)
const [state, setState] = useState<T>(initialState)
useSafeLocaleStorage(key, state)
return [state, setState] as const
}

View File

@ -24,14 +24,14 @@ import {
} from 'ramda'
import { useContext, useMemo } from 'react'
import { useSelector } from 'react-redux'
import { Simulation, SimulationConfig } from 'Reducers/rootReducer'
import { Simulation, SimulationConfig } from '@/reducers/rootReducer'
import {
answeredQuestionsSelector,
configSelector,
currentQuestionSelector,
objectifsSelector,
situationSelector,
} from 'Selectors/simulationSelectors'
} from '@/selectors/simulationSelectors'
import { EngineContext } from './EngineContext'
type MissingVariables = Partial<Record<DottedName, number>>

View File

@ -1,14 +1,13 @@
import { useEffect, useMemo, useState } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { RootState, SimulationConfig, Situation } from 'Reducers/rootReducer'
import { RootState, SimulationConfig, Situation } from '@/reducers/rootReducer'
import { useHistory } from 'react-router'
import { useSearchParams } from 'Components/utils/useSearchParams'
import { useEngine } from 'Components/utils/EngineContext'
import { configSelector } from 'Selectors/simulationSelectors'
import { useSearchParams } from '@/components/utils/useSearchParams'
import { useEngine } from '@/components/utils/EngineContext'
import { configSelector } from '@/selectors/simulationSelectors'
import Engine, { ParsedRules, serializeEvaluation } from 'publicodes'
import { DottedName } from 'modele-social'
import { updateSituation, setActiveTarget } from 'Actions/actions'
import { Names } from 'modele-social/dist/names'
import { updateSituation, setActiveTarget } from '@/actions/actions'
type Objectifs = (string | { objectifs: string[] })[]
type ShortName = string
@ -149,7 +148,7 @@ export function getSituationFromSearchParams(
searchParams: URLSearchParams,
dottedNameParamName: [DottedName, ParamName][]
) {
const situation: { [key in Names]?: string } = {}
const situation: { [key in DottedName]?: string } = {}
const paramNameDottedName = dottedNameParamName.reduce(
(dottedNameBySearchParamName, [dottedName, paramName]) => ({

View File

@ -1,10 +1,10 @@
import { setSimulationConfig } from 'Actions/actions'
import { setSimulationConfig } from '@/actions/actions'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { useHistory } from 'react-router'
import { Company } from 'Reducers/inFranceAppReducer'
import { RootState, SimulationConfig, Situation } from 'Reducers/rootReducer'
import { configSelector } from 'Selectors/simulationSelectors'
import { Company } from '@/reducers/inFranceAppReducer'
import { RootState, SimulationConfig, Situation } from '@/reducers/rootReducer'
import { configSelector } from '@/selectors/simulationSelectors'
export default function useSimulationConfig(
config: SimulationConfig | undefined,

View File

@ -1,7 +1,7 @@
import { useOverlayTrigger } from '@react-aria/overlays'
import { useOverlayTriggerState } from '@react-stately/overlays'
import { AriaButtonProps } from '@react-types/button'
import { Button } from 'DesignSystem/buttons'
import { Button } from '@/design-system/buttons'
import React, { ReactElement, Ref, useEffect, useMemo, useRef } from 'react'
import { useLocation } from 'react-router'
import Popover from './Popover'

View File

@ -1,5 +1,5 @@
import { Button } from 'DesignSystem/buttons'
import { GenericButtonOrLinkProps } from 'DesignSystem/typography/link'
import { Button } from '@/design-system/buttons'
import { GenericButtonOrLinkProps } from '@/design-system/typography/link'
import styled from 'styled-components'
export const Banner = styled.div`

View File

@ -0,0 +1,29 @@
import { ComponentStory, ComponentMeta } from '@storybook/react'
import { Button } from '@/design-system/buttons'
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
component: Button,
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
argTypes: {
children: { type: 'string' },
},
} as ComponentMeta<typeof Button>
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
export const Primary = Template.bind({})
// More on args: https://storybook.js.org/docs/react/writing-stories/args
Primary.args = {
size: 'XL',
color: 'primary',
children: 'Primary XL button',
}
export const Secondary = Template.bind({})
Secondary.args = {
size: 'XS',
color: 'secondary',
children: 'Secondary XS button',
}

View File

@ -1,8 +1,8 @@
import { FocusStyle } from 'DesignSystem/global-style'
import { FocusStyle } from '@/design-system/global-style'
import {
GenericButtonOrLinkProps,
useButtonOrLink,
} from 'DesignSystem/typography/link'
} from '@/design-system/typography/link'
import React, { ForwardedRef, forwardRef } from 'react'
import styled, { css } from 'styled-components'

View File

@ -1,4 +1,4 @@
import PopoverWithTrigger from 'DesignSystem/PopoverWithTrigger'
import PopoverWithTrigger from '@/design-system/PopoverWithTrigger'
import React from 'react'
import { Trans } from 'react-i18next'
import styled from 'styled-components'

View File

@ -1,14 +1,14 @@
import { useButton } from '@react-aria/button'
import { FocusStyle } from 'DesignSystem/global-style'
import { Chevron } from 'DesignSystem/icons'
import { H4 } from 'DesignSystem/typography/heading'
import { FocusStyle } from '@/design-system/global-style'
import { Chevron } from '@/design-system/icons'
import { H4 } from '@/design-system/typography/heading'
import {
NewWindowLinkIcon,
StyledLink,
StyledLinkHover,
useExternalLinkProps,
} from 'DesignSystem/typography/link'
import { Body } from 'DesignSystem/typography/paragraphs'
} from '@/design-system/typography/link'
import { Body } from '@/design-system/typography/paragraphs'
import React, { useRef } from 'react'
import { Link as RouterLink } from 'react-router-dom'
import styled from 'styled-components'

View File

@ -1,13 +1,13 @@
import { StyledButton } from 'DesignSystem/buttons/Button'
import { FocusStyle } from 'DesignSystem/global-style'
import { H3, HeadingUnderline } from 'DesignSystem/typography/heading'
import { StyledButton } from '@/design-system/buttons/Button'
import { FocusStyle } from '@/design-system/global-style'
import { H3, HeadingUnderline } from '@/design-system/typography/heading'
import {
GenericButtonOrLinkProps,
NewWindowLinkIcon,
useButtonOrLink,
useExternalLinkProps,
} from 'DesignSystem/typography/link'
import { Body } from 'DesignSystem/typography/paragraphs'
} from '@/design-system/typography/link'
import { Body } from '@/design-system/typography/paragraphs'
import React, { ReactHTML, useRef } from 'react'
import styled, { css, ThemeProvider } from 'styled-components'

View File

@ -1,11 +1,11 @@
import { useButton } from '@react-aria/button'
import { FocusStyle } from 'DesignSystem/global-style'
import { H6 } from 'DesignSystem/typography/heading'
import { FocusStyle } from '@/design-system/global-style'
import { H6 } from '@/design-system/typography/heading'
import {
NewWindowLinkIcon,
useExternalLinkProps,
} from 'DesignSystem/typography/link'
import { SmallBody } from 'DesignSystem/typography/paragraphs'
} from '@/design-system/typography/link'
import { SmallBody } from '@/design-system/typography/paragraphs'
import React, { useRef } from 'react'
import { Link as RouterLink } from 'react-router-dom'
import styled from 'styled-components'

View File

@ -1,8 +1,8 @@
import { useCheckbox } from '@react-aria/checkbox'
import { useToggleState } from '@react-stately/toggle'
import { AriaCheckboxProps } from '@react-types/checkbox'
import { FocusStyle } from 'DesignSystem/global-style'
import { Body } from 'DesignSystem/typography/paragraphs'
import { FocusStyle } from '@/design-system/global-style'
import { Body } from '@/design-system/typography/paragraphs'
import { useRef } from 'react'
import styled from 'styled-components'

View File

@ -1,8 +1,8 @@
import { useRadio, useRadioGroup } from '@react-aria/radio'
import { RadioGroupState, useRadioGroupState } from '@react-stately/radio'
import { AriaRadioProps, RadioGroupProps } from '@react-types/radio'
import { FocusStyle } from 'DesignSystem/global-style'
import { Body } from 'DesignSystem/typography/paragraphs'
import { FocusStyle } from '@/design-system/global-style'
import { Body } from '@/design-system/typography/paragraphs'
import React, { createContext, useContext, useRef } from 'react'
import styled, { css } from 'styled-components'

View File

@ -0,0 +1,24 @@
import { ComponentStory, ComponentMeta } from '@storybook/react'
import { Radio, RadioGroup } from './Radio'
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
component: RadioGroup,
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
// argTypes: {
// },
} as ComponentMeta<typeof RadioGroup>
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof RadioGroup> = (args) => (
<RadioGroup {...args}>
<Radio value="valueA">Radio A</Radio>
<Radio value="valueB">Radio B</Radio>
<Radio value="valueC">Radio C</Radio>
</RadioGroup>
)
export const Basic = Template.bind({})
// More on args: https://storybook.js.org/docs/react/writing-stories/args
Basic.args = {}

Some files were not shown because too many files have changed in this diff Show More