@osrd-project/ui-core 0.0.18

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 (47) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +7 -0
  3. package/dist/components/inputs/Input.d.ts +23 -0
  4. package/dist/components/inputs/PasswordInput.d.ts +4 -0
  5. package/dist/components/inputs/TokenInput.d.ts +7 -0
  6. package/dist/components/inputs/checkbox.d.ts +6 -0
  7. package/dist/components/inputs/hooks/useKeyPress.d.ts +1 -0
  8. package/dist/index.d.ts +5 -0
  9. package/dist/index.esm.js +2 -0
  10. package/dist/index.esm.js.map +1 -0
  11. package/dist/stories/Input.stories.d.ts +20 -0
  12. package/dist/stories/PasswordInput.stories.d.ts +7 -0
  13. package/dist/stories/TokenInput.stories.d.ts +7 -0
  14. package/dist/theme.css +956 -0
  15. package/dist/theme.css.map +1 -0
  16. package/fonts/IBMPlexMono-Italic.ttf +0 -0
  17. package/fonts/IBMPlexMono-Regular.ttf +0 -0
  18. package/fonts/IBMPlexMono-SemiBold.ttf +0 -0
  19. package/fonts/IBMPlexMono-SemiBoldItalic.ttf +0 -0
  20. package/fonts/IBMPlexSans-Bold.ttf +0 -0
  21. package/fonts/IBMPlexSans-BoldItalic.ttf +0 -0
  22. package/fonts/IBMPlexSans-Italic.ttf +0 -0
  23. package/fonts/IBMPlexSans-Regular.ttf +0 -0
  24. package/fonts/IBMPlexSans-SemiBold.ttf +0 -0
  25. package/fonts/IBMPlexSans-SemiBoldItalic.ttf +0 -0
  26. package/fonts/IBMPlexSerif-Italic.ttf +0 -0
  27. package/fonts/IBMPlexSerif-Regular.ttf +0 -0
  28. package/fonts/IBMPlexSerif-SemiBold.ttf +0 -0
  29. package/fonts/IBMPlexSerif-SemiBoldItalic.ttf +0 -0
  30. package/package.json +49 -0
  31. package/postcss.config.cjs +12 -0
  32. package/rollup.config.js +35 -0
  33. package/src/components/inputs/Input.tsx +148 -0
  34. package/src/components/inputs/PasswordInput.tsx +23 -0
  35. package/src/components/inputs/TokenInput.tsx +61 -0
  36. package/src/components/inputs/checkbox.tsx +25 -0
  37. package/src/components/inputs/hooks/useKeyPress.tsx +19 -0
  38. package/src/index.ts +6 -0
  39. package/src/stories/Input.stories.tsx +160 -0
  40. package/src/stories/PasswordInput.stories.tsx +19 -0
  41. package/src/stories/TokenInput.stories.tsx +19 -0
  42. package/src/styles/inputs/input.css +339 -0
  43. package/src/styles/inputs/passwordInput.css +8 -0
  44. package/src/styles/inputs/tokenInput.css +77 -0
  45. package/src/styles/main.css +52 -0
  46. package/tailwind.config.js +102 -0
  47. package/tsconfig.json +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/tailwindcss/base.css","../../../node_modules/tailwindcss/utilities.css","inputs/input.css","inputs/passwordInput.css","inputs/tokenInput.css","main.css"],"names":[],"mappings":"AAAA;;CAAc,CAAd;;;CAAc;;AAAd;;;EAAA,sBAAc,EAAd,MAAc;EAAd,eAAc,EAAd,MAAc;EAAd,mBAAc,EAAd,MAAc;EAAd,qBAAc,EAAd,MAAc;AAAA;;AAAd;;EAAA,gBAAc;AAAA;;AAAd;;;;;;;;CAAc;;AAAd;;EAAA,gBAAc,EAAd,MAAc;EAAd,8BAAc,EAAd,MAAc;EAAd,gBAAc,EAAd,MAAc;EAAd,cAAc;KAAd,WAAc,EAAd,MAAc;EAAd,sCAAc,EAAd,MAAc;EAAd,6BAAc,EAAd,MAAc;EAAd,+BAAc,EAAd,MAAc;EAAd,wCAAc,EAAd,MAAc;AAAA;;AAAd;;;CAAc;;AAAd;EAAA,SAAc,EAAd,MAAc;EAAd,oBAAc,EAAd,MAAc;AAAA;;AAAd;;;;CAAc;;AAAd;EAAA,SAAc,EAAd,MAAc;EAAd,cAAc,EAAd,MAAc;EAAd,qBAAc,EAAd,MAAc;AAAA;;AAAd;;CAAc;;AAAd;EAAA,0BAAc;EAAd,yCAAc;UAAd,iCAAc;AAAA;;AAAd;;CAAc;;AAA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C;AAFI;EAAA;AAAoB;AAIxB;QACE,kDAAkD;QAClD,+BAAoB;MAKtB;AAFI;EAAA,oBAAqB;EAArB,uBAAqB;EAArB;AAAqB;AAK3B;MACE,aAAa;MACb,WAAW;MACX,gBAAgB;MAChB,OAAO;MACP,6BAAqB;IACvB;ACnEJ,YAAY;AAEZ;EACE,4BAA4B;EAC5B,g5pOAAiE;EACjE,gBAAgB;AAClB;AAEA;EACE,4BAA4B;EAC5B,g4tOAAkE;EAClE,gBAAgB;AAClB;AAEA;EACE,4BAA4B;EAC5B,g2pOAA8D;EAC9D,gBAAgB;AAClB;AAEA,UAAU;AAEV;EACE,oCAAoC;EACpC,gyhNAAkE;EAClE,gBAAgB;AAClB;AACA;EACE,oCAAoC;EACpC,gilNAAmE;EACnE,gBAAgB;AAClB;AAEA,cAAc;AAEd;EACE,uCAAuC;EACvC,4q8KAAiE;EACjE,gBAAgB;AAClB;AACA;EACE,uCAAuC;EACvC,ouoLAAgE;EAChE,gBAAgB;AAClB","file":"theme.css","sourcesContent":["@tailwind base;\n","@tailwind utilities;\n",".feed-back {\n border-radius: 8px;\n width: max-content;\n position: relative;\n padding: 10px 0 16px 16px;\n\n &.info {\n @apply bg-info-5;\n }\n\n &.warning {\n @apply bg-warning-5;\n }\n\n &.error {\n @apply bg-error-5;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n width: max-content;\n\n .label-wrapper {\n display: flex;\n align-items: center;\n\n &.has-hint {\n margin-bottom: 0;\n }\n\n .required {\n position: absolute;\n left: -8px;\n border-radius: 0.5px;\n @apply text-info-30;\n }\n\n .label {\n display: inline-block;\n height: 24px;\n line-height: 24px;\n letter-spacing: 0;\n text-align: left;\n vertical-align: top;\n @apply text-grey-80 font-sans font-semibold;\n\n &.disabled {\n @apply text-grey-30;\n }\n }\n }\n\n .hint {\n height: 20px;\n margin-bottom: 4px;\n font-size: 14px;\n line-height: 20px;\n @apply text-grey-50;\n }\n\n .input-wrapper-and-status-icon {\n display: flex;\n align-items: center;\n margin-right: 13px;\n\n .input-wrapper {\n display: flex;\n align-items: center;\n padding: 3px;\n margin-left: -2px;\n width: max-content;\n\n &.focused {\n box-shadow: 0 0 0 1px rgba(37, 106, 250, 1) inset;\n }\n\n .leading-content-wrapper {\n height: 40px;\n padding: 9px 16px 11px 16px;\n border-radius: 4px 0 0 4px;\n box-shadow: 0px 0px 0px 1px rgba(148, 145, 142, 1) inset;\n margin-right: -1px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n .leading-content {\n line-height: 20px;\n font-size: 14px;\n text-align: center;\n @apply text-grey-80;\n }\n }\n\n .input {\n height: 40px;\n line-height: 24px;\n text-align: left;\n vertical-align: top;\n letter-spacing: 0px;\n padding: 8px 12px;\n border-radius: 4px;\n box-shadow:\n 0px 0px 0px 1px rgba(148, 145, 142, 1) inset,\n 0px 1px 3px rgba(0, 0, 0, 0.5) inset;\n @apply bg-black-1 text-black-100;\n\n &.with-leading-only {\n border-radius: 0px 4px 4px 0px;\n }\n\n &.with-trailing-only {\n border-radius: 4px 0 0 4px;\n }\n\n &.with-leading-and-trailing {\n border-radius: 0;\n }\n\n &.with-leading-only,\n &.with-trailing-only,\n &.with-leading-and-trailing {\n width: 96px;\n }\n\n &:focus {\n outline: none;\n }\n\n &:read-only {\n box-shadow:\n 0px 0px 0px 1px rgba(211, 209, 207, 1) inset,\n 0px 0px 0px 3px rgba(255, 255, 255, 1) inset;\n @apply text-grey-50 bg-black-2;\n }\n\n &:disabled {\n box-shadow: 0px 0px 0px 1px rgba(235, 235, 234, 1) inset;\n @apply text-grey-30 bg-black-2;\n }\n\n &.success {\n box-shadow:\n 0px 0px 0px 1px rgba(11, 114, 60, 1) inset,\n 0px 0px 0px 4px rgba(230, 247, 238, 1) inset;\n background-color: rgba(255, 255, 255, 0.5);\n }\n\n &.info {\n border: 1.5px solid rgba(112, 193, 229, 1);\n box-shadow:\n 0px 1px 3px rgba(0, 0, 0, 0.5) inset,\n 0px 0px 0px 0.5px rgba(0, 0, 0, 1) inset;\n background-color: rgba(255, 255, 255, 1);\n }\n\n &.warning {\n border: 1.5px solid rgba(234, 167, 43, 1);\n box-shadow:\n 0px 1px 3px rgba(0, 0, 0, 0.5) inset,\n 0px 0px 0px 0.5px rgba(0, 0, 0, 1) inset;\n background-color: rgba(255, 255, 255, 1);\n }\n\n &.error {\n border: 1.5px solid rgba(255, 104, 104, 1);\n box-shadow:\n 0px 1px 3px rgba(0, 0, 0, 0.5) inset,\n 0px 0px 0px 0.5px rgba(0, 0, 0, 1) inset;\n background-color: rgba(255, 255, 255, 1);\n }\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n &[type='number'] {\n appearance: none;\n -moz-appearance: textfield;\n }\n }\n\n .trailing-content-wrapper {\n height: 40px;\n padding: 9px 16px 11px;\n border-radius: 0 4px 4px 0;\n box-shadow: 0px 0px 0px 1px rgba(148, 145, 142, 1) inset;\n margin-left: -1px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n .trailing-content {\n line-height: 20px;\n font-size: 14px;\n text-align: center;\n @apply text-grey-80;\n }\n }\n }\n .status-icon {\n margin-left: 9px;\n\n &.loading {\n animation: spin 3s linear infinite;\n @apply text-info-30;\n }\n\n &.info {\n @apply text-info-30;\n }\n\n &.success {\n @apply text-success-30;\n }\n\n &.warning {\n @apply text-warning-30;\n }\n\n &.error {\n @apply text-error-60;\n }\n\n &.small {\n margin: 5px 0 5px 8px;\n }\n }\n }\n\n .status-message {\n letter-spacing: 0px;\n text-align: left;\n line-height: 24px;\n margin-top: 11px;\n margin-bottom: 2px;\n @apply font-semibold;\n\n &.info {\n @apply text-info-60;\n }\n\n &.success {\n @apply text-success-60;\n }\n\n &.warning {\n @apply text-warning-60;\n }\n\n &.error {\n @apply text-error-60;\n }\n }\n }\n\n &.small {\n .custom-input {\n .label-wrapper {\n .label {\n height: 20px;\n font-size: 14px;\n line-height: 20px;\n }\n }\n\n .hint {\n margin-bottom: 3px;\n }\n\n .input-wrapper-and-status-icon {\n .input-wrapper {\n height: 34px;\n\n .leading-content-wrapper {\n height: 28px;\n border-radius: 3px 0px 0px 3px;\n .leading-content {\n font-size: 12px;\n line-height: 8px; /* à check avec thibaut*/\n }\n }\n\n .input {\n height: 28px;\n line-height: 20px;\n font-size: 14px;\n padding: 3px 8px 3px 7px;\n border-radius: 3px;\n\n &.with-leading-only {\n border-radius: 0px 4px 4px 0px;\n }\n\n &.with-trailing-only {\n border-radius: 4px 0 0 4px;\n }\n\n &.with-leading-and-trailing {\n border-radius: 0;\n }\n\n &.with-leading-only,\n &.with-trailing-only,\n &.with-leading-and-trailing {\n width: 96px;\n }\n }\n\n .trailing-content-wrapper {\n height: 28px;\n border-radius: 0 3px 3px 0;\n\n .trailing-content {\n font-size: 12px;\n line-height: 8px;\n }\n }\n }\n\n .status-icon {\n margin: 5px 0 5px 8px;\n }\n }\n }\n }\n}\n\n@keyframes spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n",".password-input {\n .input {\n width: 235px !important;\n }\n .trailing-content {\n @apply text-primary-60 !important;\n }\n}\n",".token-input-wrapper {\n .input-label {\n font-size: 16px;\n letter-spacing: 0px;\n text-align: left;\n line-height: 24px;\n @apply text-grey-80 font-sans font-semibold;\n }\n\n .tokens-wrapper {\n display: flex;\n flex-wrap: wrap;\n min-height: 40px;\n padding: 4px;\n width: 344px;\n border-radius: 4px;\n box-shadow:\n 0px 1px 3px rgba(0, 0, 0, 0.5) inset,\n 0px 0px 0px 1px rgba(148, 145, 142, 1) inset;\n @apply bg-black-1;\n\n .token-item-wrapper {\n display: flex;\n margin: 4px;\n align-items: center;\n justify-content: center;\n border-radius: 3px;\n box-shadow:\n 0px 0px 0px 2px rgba(255, 255, 255, 0.5) inset,\n 0px 0px 0px 1px rgba(196, 218, 245, 1) inset;\n background-color: rgba(227, 237, 252, 1);\n\n .token-label {\n margin: 2px 6px 2px 8px;\n font-size: 14px;\n letter-spacing: 0px;\n text-align: left;\n line-height: 20px;\n @apply text-black-100;\n }\n\n .token-close-btn {\n margin: 4px 4px 4px 0;\n @apply text-black-25;\n }\n\n &:hover {\n cursor: pointer;\n box-shadow:\n 0px 0px 0px 2px rgba(255, 255, 255, 0.5) inset,\n 0px 0px 0px 1px rgb(152, 192, 245) inset;\n background-color: rgba(255, 255, 255, 0.75);\n\n .token-close-btn {\n @apply text-black-75;\n }\n }\n\n &:active {\n box-shadow: 0px 0px 0px 1px rgb(32, 30, 222) inset;\n @apply text-white-50;\n\n .token-close-btn {\n @apply text-black-100;\n }\n }\n }\n\n .token-input {\n outline: none;\n margin: 4px;\n min-width: 100px;\n flex: 1;\n @apply bg-transparent;\n }\n }\n}\n","@import 'tailwindcss/base';\n@import 'tailwindcss/components';\n@import 'tailwindcss/utilities';\n@import './inputs/input.css';\n@import './inputs/passwordInput.css';\n@import './inputs/tokenInput.css';\n\n/* REGULAR */\n\n@font-face {\n font-family: 'IBM Plex Sans';\n src: inline('./fonts/IBMPlexSans-Regular.ttf') format('truetype');\n font-weight: 400;\n}\n\n@font-face {\n font-family: 'IBM Plex Sans';\n src: inline('./fonts/IBMPlexSans-SemiBold.ttf') format('truetype');\n font-weight: 600;\n}\n\n@font-face {\n font-family: 'IBM Plex Sans';\n src: inline('./fonts/IBMPlexSans-Bold.ttf') format('truetype');\n font-weight: 900;\n}\n\n/* SERIF */\n\n@font-face {\n font-family: 'IBM Plex Serif', serif;\n src: inline('./fonts/IBMPlexSerif-Regular.ttf') format('truetype');\n font-weight: 400;\n}\n@font-face {\n font-family: 'IBM Plex Serif', serif;\n src: inline('./fonts/IBMPlexSerif-SemiBold.ttf') format('truetype');\n font-weight: 600;\n}\n\n/* MONOSPACE */\n\n@font-face {\n font-family: 'IBM Plex Mono', monospace;\n src: inline('./fonts/IBMPlexMono-Regular.ttf') format('truetype');\n font-weight: 400;\n}\n@font-face {\n font-family: 'IBM Plex Mono', monospace;\n src: inline('fonts/IBMPlexMono-SemiBold.ttf') format('truetype');\n font-weight: 600;\n}\n"]}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@osrd-project/ui-core",
3
+ "version": "0.0.18",
4
+ "bugs": "https://github.com/osrd-project/osrd-ui/issues",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/osrd-project/osrd-ui.git",
8
+ "directory": "ui-core"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "type": "module",
14
+ "module": "dist/index.esm.js",
15
+ "types": "dist/index.d.ts",
16
+ "main": "dist/index.esm.js",
17
+ "style": "dist/theme.css",
18
+ "exports": {
19
+ "./dist/theme.css": "./dist/theme.css",
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.esm.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "rollup": "rollup -c",
27
+ "clean": "rimraf dist",
28
+ "build": "npm run rollup",
29
+ "watch": "NODE_ENV=development rollup -c -w"
30
+ },
31
+ "peerDependencies": {
32
+ "react": ">=18.0"
33
+ },
34
+ "dependencies": {
35
+ "classnames": "^2.5.1",
36
+ "tailwindcss": "^3.4.1"
37
+ },
38
+ "devDependencies": {
39
+ "autoprefixer": "^10.4.17",
40
+ "postcss": "^8.4.37",
41
+ "postcss-assets": "^6.0.0",
42
+ "postcss-import": "^16.0.0",
43
+ "postcss-preset-env": "^9.5.2",
44
+ "rollup-plugin-livereload": "^2.0.5",
45
+ "rollup-plugin-postcss": "^4.0.2",
46
+ "rollup-plugin-serve": "^1.1.1"
47
+ },
48
+ "gitHead": "7be19ae9f0739e9745495a5ac4760d41e6669f17"
49
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ plugins: {
3
+ 'postcss-import': {},
4
+ 'postcss-assets': {},
5
+ 'tailwindcss/nesting': {},
6
+ tailwindcss: { config: './tailwind.config.js' },
7
+ autoprefixer: {},
8
+ 'postcss-preset-env': {
9
+ features: { 'nesting-rules': false },
10
+ },
11
+ },
12
+ };
@@ -0,0 +1,35 @@
1
+ import eslint from '@rollup/plugin-eslint';
2
+ import terser from '@rollup/plugin-terser';
3
+ import typescript from '@rollup/plugin-typescript';
4
+ import livereload from 'rollup-plugin-livereload';
5
+ import postcss from 'rollup-plugin-postcss';
6
+ import process from 'process';
7
+
8
+ const formats = ['esm'];
9
+ const isDev = process.env.NODE_ENV === 'development';
10
+
11
+ /** @type {import("rollup").RollupOptions} */
12
+ export default {
13
+ input: 'src/index.ts',
14
+ output: formats.map((format) => ({
15
+ file: `dist/index.${format}.js`,
16
+ format,
17
+ name: 'osrdcore',
18
+ sourcemap: true,
19
+ })),
20
+ plugins: [
21
+ eslint(),
22
+ typescript(),
23
+ postcss({
24
+ extract: 'theme.css',
25
+ sourceMap: true,
26
+ plugins: [],
27
+ }),
28
+ terser(),
29
+ isDev &&
30
+ livereload({
31
+ watch: 'dist',
32
+ }),
33
+ ],
34
+ external: ['react'],
35
+ };
@@ -0,0 +1,148 @@
1
+ import React, { useState } from 'react';
2
+ import { Gear, RequiredInput, CheckCircle, Info, Alert, Blocked } from '@osrd-project/ui-icons';
3
+ import cx from 'classnames';
4
+
5
+ import useKeyPress from './hooks/useKeyPress';
6
+
7
+ type InputAffixProps = {
8
+ value: InputAffixContent | InputAffixContentWithCallback;
9
+ type: 'leading' | 'trailing';
10
+ };
11
+
12
+ const InputAffix: React.FC<InputAffixProps> = ({ value, type }) => {
13
+ const isContentWithCallback =
14
+ typeof value === 'object' && value !== null && 'onClickCallback' in value;
15
+ const spanContent = isContentWithCallback
16
+ ? (value as InputAffixContentWithCallback).content
17
+ : (value as InputAffixContent);
18
+ const wrapperProps = isContentWithCallback
19
+ ? { onClick: (value as InputAffixContentWithCallback).onClickCallback }
20
+ : {};
21
+
22
+ return (
23
+ <div className={`${type}-content-wrapper`} {...wrapperProps}>
24
+ <span className={`${type}-content`}>{spanContent}</span>
25
+ </div>
26
+ );
27
+ };
28
+
29
+ type status = 'success' | 'info' | 'error' | 'warning' | 'loading';
30
+
31
+ type InputStatusIconProps = {
32
+ status: status;
33
+ small?: boolean;
34
+ };
35
+
36
+ const InputStatusIcon: React.FC<InputStatusIconProps> = ({ status, small }) => {
37
+ return (
38
+ <span className={cx('status-icon', status)}>
39
+ {status === 'loading' && <Gear size={small ? 'sm' : 'lg'} />}
40
+ {status === 'info' && <Info size={small ? 'sm' : 'lg'} />}
41
+ {status === 'success' && <CheckCircle variant="fill" size={small ? 'sm' : 'lg'} />}
42
+ {status === 'warning' && <Alert variant="fill" size={small ? 'sm' : 'lg'} />}
43
+ {status === 'error' && <Blocked variant="fill" size={small ? 'sm' : 'lg'} />}
44
+ </span>
45
+ );
46
+ };
47
+
48
+ type statusWithMessage = {
49
+ status: status;
50
+ message?: string;
51
+ };
52
+
53
+ type InputAffixContent = string | React.ReactNode;
54
+
55
+ type InputAffixContentWithCallback = {
56
+ content: string | React.ReactNode;
57
+ onClickCallback: () => void;
58
+ };
59
+
60
+ export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
61
+ id: string;
62
+ label: string;
63
+ hint?: string;
64
+ leadingContent?: InputAffixContent | InputAffixContentWithCallback;
65
+ trailingContent?: InputAffixContent | InputAffixContentWithCallback;
66
+ small?: boolean;
67
+ statusWithMessage?: statusWithMessage;
68
+ inputWrapperClassname?: string;
69
+ };
70
+
71
+ export const Input: React.FC<InputProps> = ({
72
+ id,
73
+ label,
74
+ type,
75
+ value: initialValue,
76
+ hint,
77
+ leadingContent,
78
+ trailingContent,
79
+ required,
80
+ disabled,
81
+ readOnly,
82
+ statusWithMessage,
83
+ inputWrapperClassname,
84
+ small = false,
85
+ }) => {
86
+ const [value, setValue] = useState(initialValue);
87
+ const [focusViaKeyboard, setFocusViaKeyboard] = useState(false);
88
+ useKeyPress('Tab', async () => setFocusViaKeyboard(true));
89
+
90
+ const statusClassname = {
91
+ ...(statusWithMessage ? { [statusWithMessage.status]: statusWithMessage.status } : {}),
92
+ };
93
+
94
+ return (
95
+ <div className={cx('feed-back', statusClassname, { small: small })}>
96
+ <div className="custom-input">
97
+ {/* LABEL */}
98
+ <div className={cx('label-wrapper', { 'has-hint': hint })}>
99
+ {required && (
100
+ <span className="required">
101
+ {' '}
102
+ <RequiredInput />{' '}
103
+ </span>
104
+ )}
105
+ <label className={cx('label', { disabled: disabled })} htmlFor={id}>
106
+ {label}
107
+ </label>
108
+ </div>
109
+
110
+ {/* HINT */}
111
+ {hint && <span className="hint">{hint}</span>}
112
+
113
+ {/* INPUT WRAPPER AND STATUS ICON */}
114
+ <div className="input-wrapper-and-status-icon">
115
+ <div
116
+ className={cx('input-wrapper', inputWrapperClassname, { focused: focusViaKeyboard })}
117
+ >
118
+ {leadingContent && <InputAffix value={leadingContent} type="leading" />}
119
+ <input
120
+ className={cx('input', {
121
+ 'with-leading-only': leadingContent && !trailingContent,
122
+ 'with-trailing-only': trailingContent && !leadingContent,
123
+ 'with-leading-and-trailing': leadingContent && trailingContent,
124
+ ...statusClassname,
125
+ })}
126
+ id={id}
127
+ type={type}
128
+ value={value}
129
+ onChange={(e) => setValue(e.target.value)}
130
+ disabled={disabled}
131
+ readOnly={readOnly}
132
+ onBlur={() => setFocusViaKeyboard(false)}
133
+ />
134
+ {trailingContent && <InputAffix value={trailingContent} type="trailing" />}
135
+ </div>
136
+ {statusWithMessage && <InputStatusIcon status={statusWithMessage.status} small={small} />}
137
+ </div>
138
+
139
+ {/* STATUS MESSAGE */}
140
+ {statusWithMessage?.message && (
141
+ <span className={cx('status-message', statusClassname)}>{statusWithMessage.message}</span>
142
+ )}
143
+ </div>
144
+ </div>
145
+ );
146
+ };
147
+
148
+ export default Input;
@@ -0,0 +1,23 @@
1
+ import React, { useState } from 'react';
2
+ import { Eye, EyeClosed } from '@osrd-project/ui-icons';
3
+
4
+ import Input, { type InputProps } from './Input';
5
+
6
+ const PasswordInput: React.FC<InputProps> = (props) => {
7
+ const [isVisible, toggleVisibility] = useState(false);
8
+
9
+ return (
10
+ <Input
11
+ {...props}
12
+ type={isVisible ? 'text' : 'password'}
13
+ trailingContent={{
14
+ content: isVisible ? <EyeClosed /> : <Eye />,
15
+ onClickCallback: () => toggleVisibility(!isVisible),
16
+ }}
17
+ inputWrapperClassname="password-input"
18
+ small={false}
19
+ />
20
+ );
21
+ };
22
+
23
+ export default PasswordInput;
@@ -0,0 +1,61 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import cx from 'classnames';
3
+ import { X } from '@osrd-project/ui-icons';
4
+
5
+ type TokenInputProps = {
6
+ label: string;
7
+ tokens: string[];
8
+ };
9
+
10
+ const TokenInput: React.FC<TokenInputProps> = ({ label, tokens: initialTokens }) => {
11
+ const [tokens, setTokens] = useState(initialTokens);
12
+ const [newToken, setNewToken] = useState('');
13
+ const [selectedToken, setSelectedToken] = useState<number | null>(null);
14
+ const inputRef = useRef<HTMLInputElement>(null);
15
+
16
+ const addToken = (e: React.KeyboardEvent<HTMLInputElement>) => {
17
+ if (e.key === 'Enter' && newToken.trim() !== '') {
18
+ setTokens((oldTokens) => [...oldTokens, newToken]);
19
+ setNewToken('');
20
+ }
21
+ };
22
+
23
+ const focusInput = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
24
+ if (e.target === e.currentTarget) {
25
+ inputRef.current?.focus();
26
+ }
27
+ };
28
+
29
+ return (
30
+ <div className="token-input-wrapper">
31
+ <label className="input-label">{label}</label>
32
+ <div className="tokens-wrapper" onClick={focusInput}>
33
+ {tokens.map((token, index) => (
34
+ <div
35
+ key={`${token}-${index}`}
36
+ onClick={() => setSelectedToken(index)}
37
+ className={cx('token-item-wrapper', { selected: selectedToken === index })}
38
+ >
39
+ <span className="token-label">{token}</span>
40
+ <span
41
+ className="token-close-btn"
42
+ onClick={() => setTokens((oldTokens) => oldTokens.filter((_t, i) => i !== index))}
43
+ >
44
+ <X />
45
+ </span>
46
+ </div>
47
+ ))}
48
+ <input
49
+ type="text"
50
+ value={newToken}
51
+ onChange={(e) => setNewToken(e.target.value)}
52
+ onKeyDown={addToken}
53
+ className="token-input"
54
+ ref={inputRef}
55
+ />
56
+ </div>
57
+ </div>
58
+ );
59
+ };
60
+
61
+ export default TokenInput;
@@ -0,0 +1,25 @@
1
+ import React, { useState } from 'react';
2
+
3
+ interface CheckboxProps {
4
+ label: string;
5
+ }
6
+
7
+ const Checkbox: React.FC<CheckboxProps> = ({ label }) => {
8
+ const [isChecked, setIsChecked] = useState(false);
9
+
10
+ const handleCheckboxChange = () => {
11
+ setIsChecked(!isChecked);
12
+ };
13
+
14
+ return (
15
+ <div>
16
+ <label>
17
+ <input type="checkbox" checked={isChecked} onChange={handleCheckboxChange} />
18
+ <span className="custom-checkbox"></span>
19
+ {label}
20
+ </label>
21
+ </div>
22
+ );
23
+ };
24
+
25
+ export default Checkbox;
@@ -0,0 +1,19 @@
1
+ import { useEffect } from 'react';
2
+
3
+ export default function useKeyPress(
4
+ key: KeyboardEvent['key'],
5
+ onKeyPressed: (e: KeyboardEvent) => void
6
+ ) {
7
+ useEffect(() => {
8
+ const handleKeyDown = (e: KeyboardEvent) => {
9
+ if (e.key === key) onKeyPressed(e);
10
+ };
11
+ window.addEventListener('keydown', handleKeyDown);
12
+
13
+ return () => {
14
+ window.removeEventListener('keydown', handleKeyDown);
15
+ };
16
+ }, [key, onKeyPressed]);
17
+
18
+ return {};
19
+ }
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import './styles/main.css';
2
+
3
+ export { default as Checkbox } from './components/inputs/checkbox';
4
+ export { default as Input } from './components/inputs/Input';
5
+ export { default as TokenInput } from './components/inputs/TokenInput';
6
+ export { default as PasswordInput } from './components/inputs/PasswordInput';
@@ -0,0 +1,160 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import '@osrd-project/ui-core/dist/theme.css';
3
+
4
+ import Input from '../components/inputs/Input';
5
+
6
+ const meta: Meta<typeof Input> = {
7
+ component: Input,
8
+ args: {
9
+ small: false,
10
+ disabled: false,
11
+ readOnly: false,
12
+ },
13
+ };
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof Input>;
17
+
18
+ export const Default: Story = {
19
+ args: {
20
+ label: 'Your name',
21
+ type: 'text',
22
+ },
23
+ };
24
+
25
+ export const Value: Story = {
26
+ args: {
27
+ label: 'Your name',
28
+ type: 'text',
29
+ value: 'Manuel',
30
+ },
31
+ };
32
+
33
+ export const Hint: Story = {
34
+ args: {
35
+ label: 'Your name',
36
+ type: 'text',
37
+ value: 'Manuel',
38
+ hint: "It doesn't have to be real",
39
+ },
40
+ };
41
+
42
+ export const LeadingContent: Story = {
43
+ args: {
44
+ label: 'Price',
45
+ type: 'number',
46
+ leadingContent: '£',
47
+ },
48
+ };
49
+
50
+ export const TrainlingContent: Story = {
51
+ args: {
52
+ label: 'Price',
53
+ type: 'number',
54
+ trailingContent: '€',
55
+ },
56
+ };
57
+
58
+ export const LeadingAndTrainlingContent: Story = {
59
+ args: {
60
+ label: 'Price',
61
+ type: 'number',
62
+ leadingContent: 'Minimum',
63
+ trailingContent: 'Km/h',
64
+ },
65
+ };
66
+
67
+ export const RequiredInput: Story = {
68
+ args: {
69
+ label: 'Your name',
70
+ type: 'text',
71
+ required: true,
72
+ },
73
+ };
74
+
75
+ export const LoadingInput: Story = {
76
+ args: {
77
+ label: 'Name',
78
+ type: 'text',
79
+ required: true,
80
+ value: 'Manuel',
81
+ statusWithMessage: {
82
+ status: 'loading',
83
+ },
84
+ },
85
+ };
86
+
87
+ export const SuccessInput: Story = {
88
+ args: {
89
+ label: 'Your name',
90
+ type: 'text',
91
+ required: true,
92
+ value: 'jean-michel.halleurt@exemple.fr',
93
+ statusWithMessage: {
94
+ status: 'success',
95
+ },
96
+ },
97
+ };
98
+
99
+ export const InformationInput: Story = {
100
+ args: {
101
+ label: 'Name',
102
+ type: 'text',
103
+ required: true,
104
+ value: 'Jean-Michel Halleurt',
105
+ statusWithMessage: {
106
+ status: 'info',
107
+ message: 'You won’t be able to change it',
108
+ },
109
+ },
110
+ };
111
+
112
+ export const WarningInput: Story = {
113
+ args: {
114
+ label: 'Your name',
115
+ type: 'text',
116
+ required: true,
117
+ value: 'Jean-Michel Halleurt',
118
+ statusWithMessage: {
119
+ status: 'warning',
120
+ message: 'Don’t be a troll, please',
121
+ },
122
+ },
123
+ };
124
+
125
+ export const WarningWithoutMessageInput: Story = {
126
+ args: {
127
+ label: 'Your name',
128
+ type: 'text',
129
+ required: true,
130
+ value: 'Jean-Michel Halleurt',
131
+ statusWithMessage: {
132
+ status: 'warning',
133
+ },
134
+ },
135
+ };
136
+
137
+ export const ErrorInput: Story = {
138
+ args: {
139
+ label: 'Name',
140
+ type: 'text',
141
+ required: true,
142
+ value: 'Michel Sardou',
143
+ statusWithMessage: {
144
+ status: 'error',
145
+ message: '“Michel Sardou” can’t be used',
146
+ },
147
+ },
148
+ };
149
+
150
+ export const ErrorWithoutMessageInput: Story = {
151
+ args: {
152
+ label: 'Name',
153
+ type: 'text',
154
+ required: true,
155
+ value: 'Michel Sardou',
156
+ statusWithMessage: {
157
+ status: 'error',
158
+ },
159
+ },
160
+ };
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import '@osrd-project/ui-core/dist/theme.css';
3
+
4
+ import PasswordInput from '../components/inputs/PasswordInput';
5
+
6
+ const meta: Meta<typeof PasswordInput> = {
7
+ component: PasswordInput,
8
+ args: {
9
+ label: 'Password',
10
+ hint: 'You can uses spaces',
11
+ },
12
+ };
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof PasswordInput>;
16
+
17
+ export const Default: Story = {
18
+ args: {},
19
+ };
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import '@osrd-project/ui-core/dist/theme.css';
3
+
4
+ import TokenInput from '../components/inputs/TokenInput';
5
+
6
+ const meta: Meta<typeof TokenInput> = {
7
+ component: TokenInput,
8
+ args: {
9
+ label: 'Favorite colors',
10
+ tokens: ['Yellow', 'Orange', 'Red', 'Black'],
11
+ },
12
+ };
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof TokenInput>;
16
+
17
+ export const Default: Story = {
18
+ args: {},
19
+ };