@transferwise/components 0.0.0-experimental-42a295b → 0.0.0-experimental-dea7e2e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/common/panel/Panel.js +1 -2
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +1 -2
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/main.css +215 -162
- package/build/select/Select.js +39 -123
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +39 -119
- package/build/select/Select.mjs.map +1 -1
- package/build/styles/main.css +215 -162
- package/build/styles/uploadInput/UploadInput.css +84 -33
- package/build/styles/uploadInput/uploadButton/UploadButton.css +31 -62
- package/build/styles/uploadInput/uploadItem/UploadItem.css +109 -76
- package/build/types/button/Button.d.ts +2 -2
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/select/Select.d.ts +64 -94
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/select/index.d.ts +2 -2
- package/build/types/select/index.d.ts.map +1 -1
- package/build/types/select/option/index.d.ts +1 -1
- package/build/types/select/option/index.d.ts.map +1 -1
- package/build/types/select/searchBox/index.d.ts +1 -1
- package/build/types/select/searchBox/index.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/uploadInput/UploadInput.js +16 -24
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +16 -24
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +31 -23
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +31 -23
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +38 -31
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +39 -32
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +1 -2
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs +1 -2
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
- package/package.json +4 -6
- package/src/button/Button.tsx +2 -2
- package/src/index.ts +6 -0
- package/src/main.css +215 -162
- package/src/select/{Select.spec.js → Select.spec.tsx} +8 -6
- package/src/select/{Select.js → Select.tsx} +135 -153
- package/src/select/index.ts +7 -0
- package/src/uploadInput/UploadInput.css +84 -33
- package/src/uploadInput/UploadInput.less +75 -25
- package/src/uploadInput/UploadInput.tsx +28 -32
- package/src/uploadInput/uploadButton/UploadButton.css +31 -62
- package/src/uploadInput/uploadButton/UploadButton.less +38 -61
- package/src/uploadInput/uploadButton/UploadButton.tsx +25 -22
- package/src/uploadInput/uploadItem/UploadItem.css +109 -76
- package/src/uploadInput/uploadItem/UploadItem.less +127 -77
- package/src/uploadInput/uploadItem/UploadItem.tsx +28 -28
- package/src/uploadInput/uploadItem/UploadItemLink.tsx +3 -3
- package/build/select/index.js +0 -8
- package/build/select/index.js.map +0 -1
- package/build/select/index.mjs +0 -6
- package/build/select/index.mjs.map +0 -1
- package/src/select/index.js +0 -3
- /package/src/select/option/{index.js → index.ts} +0 -0
- /package/src/select/searchBox/{SearchBox.spec.js → SearchBox.spec.tsx} +0 -0
- /package/src/select/searchBox/{index.js → index.ts} +0 -0
package/README.md
CHANGED
|
@@ -40,14 +40,6 @@ export default function Hello() {
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
### TypeScript | Type Declarations
|
|
44
|
-
|
|
45
|
-
This package exposes [type declarations](https://www.typescriptlang.org/docs/handbook/2/type-declarations.html) for all components.
|
|
46
|
-
|
|
47
|
-
Note: types for some of components are not 100% accurate (some of them will be just [`any`](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)), this is due to fact that many of components written on JavaScript and types generated by [react-to-typescript-definitions](https://www.npmjs.com/package/react-to-typescript-definitions) based of components `PropTypes` and unfortunatly the library doesn't resolve all `PropTypes` features and use cases (e.g custom validators, `PropTypes.objectOf`, etc). But bear with us as eventually it would be fully on TypeScript.
|
|
48
|
-
|
|
49
|
-
Please follow [rules for JS components](https://github.com/transferwise/neptune-web/blob/main/packages/components/CONTRIBUTING.md#js-component-rules) in order to generate accurate types for them.
|
|
50
|
-
|
|
51
43
|
### Mocks for testing
|
|
52
44
|
|
|
53
45
|
We expose reusable mocks for Jest and Vitest under an isolated entry point. They can be applied by passing the testing framework as the parameter:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n React.ComponentPropsWithRef<'a'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n },\n {\n disabled: disabled || loading,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled: disabled || loading,\n type: htmlType,\n };\n } else {\n props = { ...rest } as AnchorProps;\n }\n\n return (\n <Element\n ref={reference}\n className={classes}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && <ProcessIndicator size={processIndicatorSize()} className=\"btn-loader\" />}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;QAC3BC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;AACG,CAAA,EACRC,SAAS,KACP;AACF,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;AAEtB;AACAC,EAAAA,iCAAqB,CAAC;UAAEV,MAAI;AAAEG,IAAAA,IAAAA;AAAI,GAAE,CAAC,CAAA;AAErC;AACA,EAAA,MAAMQ,OAAO,GAAGC,4BAAgB,CAACT,IAAI,CAAC,CAAA;AACtC;AACA,EAAA,MAAMU,WAAW,GAAGC,gCAAoB,CAACjB,QAAQ,EAAEM,IAAI,CAAC,CAAA;EAExD,MAAMY,OAAO,GAAGC,SAAI,CAClB,CAAA,QAAA,EAAWhB,MAAI,CAAA,CAAE,EACjB,CAAA,cAAA,EAAiBA,MAAI,CAAA,CAAE,EACvB;AACE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,CAACC,gBAAgB,EAAA;MAAC/B,IAAI,EAAEmB,oBAAoB,EAAG;AAACzB,MAAAA,SAAS,EAAC,YAAA;AAAY,MAAG,CAAA;AAAA,GAC9E,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n React.ComponentPropsWithRef<'a'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n },\n {\n disabled: disabled || loading,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled: disabled || loading,\n type: htmlType,\n };\n } else {\n props = { ...rest } as AnchorProps;\n }\n\n return (\n <Element\n ref={reference}\n className={classes}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && <ProcessIndicator size={processIndicatorSize()} className=\"btn-loader\" />}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","_jsxs","ref","formatMess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;AAEA,EAAA,MAAMqB,OAAO,GAAI9B,SAAyB,IAAI,QAAQ,CAAA;AACtD,EAAA,IAAI+B,KAAK,CAAA;EAET,IAAID,OAAO,KAAK,QAAQ,EAAE;IACxB,MAAM;AAAEE,MAAAA,QAAQ,GAAG,QAAQ;MAAE,GAAGC,SAAAA;AAAS,KAAE,GAAGlB,IAAmB,CAAA;AACjEgB,IAAAA,KAAK,GAAG;AACN,MAAA,GAAGE,SAAS;MACZ7B,QAAQ,EAAEA,QAAQ,IAAIC,OAAO;AAC7BO,MAAAA,IAAI,EAAEoB,QAAAA;KACP,CAAA;AACH,GAAC,MAAM;AACLD,IAAAA,KAAK,GAAG;MAAE,GAAGhB,IAAAA;KAAqB,CAAA;AACpC,GAAA;EAEA,oBACEmB,eAAA,CAACJ,OAAO,EAAA;AACNK,IAAAA,GAAG,EAAEnB,SAAU;AACfb,IAAAA,SAAS,EAAEqB,OAAQ;AAAA,IAAA,GACfO,KAAK;AACT,IAAA,WAAA,EAAW1B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,YAAA,EAAYA,OAAO,GAAGY,IAAI,CAACmB,aAAa,CAACC,eAAQ,CAACC,gBAAgB,CAAC,GAAGvB,IAAI,CAAC,YAAY,CAAE;AAAAb,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBAAIkC,cAAA,CAACC,gBAAgB,EAAA;MAAC/B,IAAI,EAAEmB,oBAAoB,EAAG;AAACzB,MAAAA,SAAS,EAAC,YAAA;AAAY,MAAG,CAAA;AAAA,GAC9E,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n React.ComponentPropsWithRef<'a'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n },\n {\n disabled: disabled || loading,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled: disabled || loading,\n type: htmlType,\n };\n } else {\n props = { ...rest } as AnchorProps;\n }\n\n return (\n <Element\n ref={reference}\n className={classes}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && <ProcessIndicator size={processIndicatorSize()} className=\"btn-loader\" />}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,WAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;A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AC,MAAM;AACLD,IAAAA,KAAK,GAAG;MAAE,GAAGhB,IAAAA;KAAqB,CAAA;AACpC,GAAA;EAEA,oBACEmB,IAAA,CAACJ,OAAO,EAAA;AACNK,IAAAA,GAAG,EAAEnB,SAAU;AACfb,IAAAA,SAAS,EAAEqB,OAAQ;AAAA,IAAA,GACfO,KAAK;AACT,IAAA,WAAA,EAAW1B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,YAAA,EAAYA,OAAO,GAAGY,IAAI,CAACmB,aAAa,CAACC,QAAQ,CAACC,gBAAgB,CAAC,GAAGvB,IAAI,CAAC,YAAY,CAAE;AAAAb,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBAAIkC,GAAA,CAACC,gBAAgB,EAAA;MAAC/B,IAAI,EAAEmB,oBAAoB,EAAG;AAACzB,MAAAA,SAAS,EAAC,YAAA;AAAY,MAAG,CAAA;AAAA,GAC9E,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n React.ComponentPropsWithRef<'a'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n },\n {\n disabled: disabled || loading,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled: disabled || loading,\n type: htmlType,\n };\n } else {\n props = { ...rest } as AnchorProps;\n }\n\n return (\n <Element\n ref={reference}\n className={classes}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && <ProcessIndicator size={processIndicatorSize()} className=\"btn-loader\" />}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,WAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;AACG,CAAA,EACRC,SAAS,KACP;AACF,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE,CAAA;AAEtB;AACAC,EAAAA,qBAAqB,CAAC;IAAEV,IAAI;AAAEG,IAAAA,IAAAA;AAAI,GAAE,CAAC,CAAA;AAErC;AACA,EAAA,MAAMQ,OAAO,GAAGC,gBAAgB,CAACT,IAAI,CAAC,CAAA;AACtC;AACA,EAAA,MAAMU,WAAW,GAAGC,oBAAoB,CAACjB,QAAQ,EAAEM,IAAI,CAAC,CAAA;EAExD,MAAMY,OAAO,GAAGC,IAAI,CAClB,CAAA,QAAA,EAAWhB,IAAI,CAAA,CA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b,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBAAIkC,GAAA,CAACC,gBAAgB,EAAA;MAAC/B,IAAI,EAAEmB,oBAAoB,EAAG;AAACzB,MAAAA,SAAS,EAAC,YAAA;AAAY,MAAG,CAAA;AAAA,GAC9E,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.js","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n id={overlayId}\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={clsx('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={clsx('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","role","style","popper","className","clsx","_jsxs"],"mappings":";;;;;;;;;;AAkBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,iBAAQ,CAACC,GAAG,GAAG,CAACD,iBAAQ,CAACE,MAAM,EAAEF,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACE,MAAM,GAAG,CAACF,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACI,IAAI,GAAG,CAACJ,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,iBAAQ,CAACG,KAAK,GAAG,CAACH,iBAAQ,CAACI,IAAI,EAAEJ,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAA;CAChE,CAAA;AAcD,MAAMG,KAAK,gBAAGC,gBAAU,CAA6B,SAASD,KAAKA,CACjE;AACEE,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;AACXC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,EAAEC,SAAI,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAE7C,IAAAA;AAAI,OAAE,EAAEK,IAAI,CAACuC,SAAS,CAAE;AAAA7C,MAAAA,QAAA,eAExE+C,eAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAElC,SAAAA;AACL;AACAoC,QAAAA,KAAK,EAAEf,YAAa;AACpBiB,QAAAA,SAAS,EAAEC,SAAI,CAAC,mBAAmB,CAAE;AAAA9C,QAAAA,QAAA,EAEpCA,CAAAA,QAAQ,EAERH,KAAK,iBACJsC,cAAA,CAAA,KAAA,EAAA;AACEM,UAAAA,GAAG,EAAEhC,eAAgB;UACrBoC,SAAS,EAAEC,SAAI,CAAC,iBAAiB,CAAA;AACjC;AAAA;UACAH,KAAK,EAAEtB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC
|
|
1
|
+
{"version":3,"file":"Panel.js","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n id={overlayId}\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={clsx('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={clsx('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","role","style","popper","className","clsx","_jsxs"],"mappings":";;;;;;;;;;AAkBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,iBAAQ,CAACC,GAAG,GAAG,CAACD,iBAAQ,CAACE,MAAM,EAAEF,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACE,MAAM,GAAG,CAACF,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACI,IA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BAAiB,EAAA,IAAA;AAACrC,IAAAA,OAAO,EAAEA,OAAQ;AAAAF,IAAAA,QAAA,eACpFmC,cAAA,CAAA,KAAA,EAAA;AACEK,MAAAA,EAAE,EAAER,SAAU;AAAA,MAAA,GACV1B,IAAI;AACRmC,MAAAA,GAAG,EAAE7B,gBAAiB;AACtB8B,MAAAA,IAAI,EAAC,QAAA;AACL;AAAA;AACAC,MAAAA,KAAK,EAAE;AAAE,QAAA,GAAGtB,MAAM,CAACuB,MAAAA;OAAS;MAAA,GACxBtB,UAAU,CAACsB,MAAM;AACrBC,MAAAA,SAAS,EAAEC,SAAI,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAE7C,IAAAA;AAAI,OAAE,EAAEK,IAAI,CAACuC,SAAS,CAAE;AAAA7C,MAAAA,QAAA,eAExE+C,eAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAElC,SAAAA;AACL;AACAoC,QAAAA,KAAK,EAAEf,YAAa;AACpBiB,QAAAA,SAAS,EAAEC,SAAI,CAAC,mBAAmB,CAAE;AAAA9C,QAAAA,QAAA,EAEpCA,CAAAA,QAAQ,EAERH,KAAK,iBACJsC,cAAA,CAAA,KAAA,EAAA;AACEM,UAAAA,GAAG,EAAEhC,eAAgB;UACrBoC,SAAS,EAAEC,SAAI,CAAC,iBAAiB,CAAA;AACjC;AAAA;UACAH,KAAK,EAAEtB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.mjs","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n id={overlayId}\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={clsx('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={clsx('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","role","style","popper","className","clsx","_jsxs"],"mappings":";;;;;;;;AAkBA,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AAK,EAAEtB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC
|
|
1
|
+
{"version":3,"file":"Panel.mjs","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n id={overlayId}\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={clsx('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={clsx('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","role","style","popper","className","clsx","_jsxs"],"mappings":";;;;;;;;AAkBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,QAAQ,CAACC,GAAG,GAAG,CAACD,QAAQ,CAACE,MAAM,EAAEF,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACE,MAAM,GAAG,CAACF,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACI,IAAI,GAAG,CAACJ,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,QAAQ,CAACG,KAAK,GAAG,CAACH,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACE,MAAM,CAAA;CAChE,CAAA;AAcD,MAAMG,KAAK,gBAAGC,UAAU,CAA6B,SAASD,KAAKA,CACjE;AACEE,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ;AACRC,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ,GAAGb,QAAQ,CAACE,MAAM;EAC1BY,SAAS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+C,IAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAElC,SAAAA;AACL;AACAoC,QAAAA,KAAK,EAAEf,YAAa;AACpBiB,QAAAA,SAAS,EAAEC,IAAI,CAAC,mBAAmB,CAAE;AAAA9C,QAAAA,QAAA,EAEpCA,CAAAA,QAAQ,EAERH,KAAK,iBACJsC,GAAA,CAAA,KAAA,EAAA;AACEM,UAAAA,GAAG,EAAEhC,eAAgB;UACrBoC,SAAS,EAAEC,IAAI,CAAC,iBAAiB,CAAA;AACjC;AAAA;UACAH,KAAK,EAAEtB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC;;;;"}
|
package/build/main.css
CHANGED
|
@@ -5450,145 +5450,144 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5450
5450
|
.upload-error-message .alert {
|
|
5451
5451
|
min-width: 100px;
|
|
5452
5452
|
}
|
|
5453
|
-
.np-upload-
|
|
5454
|
-
|
|
5455
|
-
padding: 16px;
|
|
5456
|
-
padding: var(--size-16);
|
|
5457
|
-
display: flex;
|
|
5458
|
-
align-items: center;
|
|
5459
|
-
margin: 0;
|
|
5460
|
-
border-radius: inherit;
|
|
5453
|
+
.np-upload-button-container {
|
|
5454
|
+
border-style: solid;
|
|
5461
5455
|
}
|
|
5462
|
-
.np-upload-
|
|
5463
|
-
|
|
5464
|
-
-webkit-text-decoration: underline;
|
|
5465
|
-
text-decoration: underline;
|
|
5466
|
-
text-underline-offset: 0.3em;
|
|
5456
|
+
.np-upload-button-container .droppable-card-content {
|
|
5457
|
+
display: flex;
|
|
5467
5458
|
}
|
|
5468
|
-
.np-upload-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
line-height: 22px;
|
|
5459
|
+
.np-upload-button-container.droppable-dropping {
|
|
5460
|
+
border-color: #c9cbce !important;
|
|
5461
|
+
border-color: var(--color-interactive-secondary) !important;
|
|
5472
5462
|
}
|
|
5473
|
-
.np-upload-
|
|
5474
|
-
|
|
5475
|
-
padding-right: var(--size-16);
|
|
5476
|
-
color: var(--color-interactive-primary);
|
|
5463
|
+
.np-upload-button-container.droppable-dropping:before {
|
|
5464
|
+
z-index: 2;
|
|
5477
5465
|
}
|
|
5478
|
-
.np-upload-
|
|
5479
|
-
|
|
5466
|
+
.np-upload-button-container input[type="file"] {
|
|
5467
|
+
opacity: 0;
|
|
5468
|
+
z-index: -1;
|
|
5480
5469
|
position: absolute;
|
|
5481
|
-
height: 1px;
|
|
5482
|
-
background-color: rgba(0,0,0,0.10196);
|
|
5483
|
-
background-color: var(--color-border-neutral);
|
|
5484
|
-
content: " ";
|
|
5485
|
-
left: 16px;
|
|
5486
|
-
left: var(--size-16);
|
|
5487
|
-
width: calc(100% - 2 * 16px);
|
|
5488
|
-
width: calc(100% - 2 * var(--size-16));
|
|
5489
|
-
top: 0;
|
|
5490
5470
|
}
|
|
5491
|
-
.np-upload-
|
|
5492
|
-
|
|
5493
|
-
display: none;
|
|
5494
|
-
}
|
|
5495
|
-
.np-upload-input__upload-button.is-dropping,
|
|
5496
|
-
.np-upload-input__upload-button:hover,
|
|
5497
|
-
.np-upload-input__upload-button:active {
|
|
5498
|
-
background: rgba(134,167,189,0.10196);
|
|
5499
|
-
background: var(--color-background-neutral);
|
|
5471
|
+
.np-upload-button-container .np-upload-button {
|
|
5472
|
+
border: none;
|
|
5500
5473
|
}
|
|
5501
|
-
.np-upload-
|
|
5502
|
-
.np-upload-input__upload-button:hover::before,
|
|
5503
|
-
.np-upload-input__upload-button:active::before {
|
|
5474
|
+
.np-upload-button {
|
|
5504
5475
|
width: 100%;
|
|
5505
|
-
|
|
5476
|
+
border-top: 1px solid transparent;
|
|
5477
|
+
padding: 16px;
|
|
5478
|
+
padding: var(--padding-small);
|
|
5479
|
+
border-radius: 0;
|
|
5506
5480
|
}
|
|
5507
|
-
.np-upload-
|
|
5508
|
-
.np-upload-
|
|
5509
|
-
|
|
5510
|
-
outline-offset: -3px;
|
|
5481
|
+
label.np-upload-button:not(.disabled):hover,
|
|
5482
|
+
label.np-upload-button:not(.disabled):active {
|
|
5483
|
+
background-color: var(--color-background-screen-hover);
|
|
5511
5484
|
}
|
|
5512
|
-
.np-upload-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
z-index: -1;
|
|
5485
|
+
.disabled label.np-upload-button:not(.disabled):hover,
|
|
5486
|
+
.disabled label.np-upload-button:not(.disabled):active {
|
|
5487
|
+
background-color: transparent;
|
|
5516
5488
|
}
|
|
5517
|
-
.np-upload-
|
|
5518
|
-
|
|
5489
|
+
.np-upload-button .media {
|
|
5490
|
+
align-items: flex-start;
|
|
5519
5491
|
}
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
background-color: transparent;
|
|
5525
|
-
transition: transform 0.3s ease;
|
|
5526
|
-
position: relative;
|
|
5492
|
+
@media (max-width: 320px) {
|
|
5493
|
+
.np-upload-icon {
|
|
5494
|
+
padding-left: 0;
|
|
5495
|
+
}
|
|
5527
5496
|
}
|
|
5528
|
-
.np-upload-input {
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
border-radius: var(--radius-small);
|
|
5497
|
+
.np-upload-input.form-control {
|
|
5498
|
+
height: auto;
|
|
5499
|
+
padding: 0;
|
|
5500
|
+
padding: initial;
|
|
5533
5501
|
}
|
|
5534
|
-
.np-upload-input
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
border-radius:
|
|
5502
|
+
.np-upload-input > div:first-child,
|
|
5503
|
+
.np-upload-input > div:first-child .np-upload-item--single-file,
|
|
5504
|
+
.np-upload-input > div:first-child .np-upload-item--link {
|
|
5505
|
+
border-top-left-radius: 10px;
|
|
5506
|
+
border-top-left-radius: var(--radius-small);
|
|
5507
|
+
border-top-right-radius: 10px;
|
|
5508
|
+
border-top-right-radius: var(--radius-small);
|
|
5538
5509
|
}
|
|
5539
|
-
.np-upload-input
|
|
5540
|
-
|
|
5541
|
-
border-radius:
|
|
5542
|
-
border-radius:
|
|
5510
|
+
.np-upload-input > div:last-child {
|
|
5511
|
+
border-bottom-left-radius: 10px;
|
|
5512
|
+
border-bottom-left-radius: var(--radius-small);
|
|
5513
|
+
border-bottom-right-radius: 10px;
|
|
5514
|
+
border-bottom-right-radius: var(--radius-small);
|
|
5543
5515
|
}
|
|
5544
|
-
.np-
|
|
5545
|
-
|
|
5546
|
-
.np-upload-input .np-upload-input__items:first-child:not(:empty) + .np-upload-input__items:last-child .np-upload-input__upload-button,
|
|
5547
|
-
.np-upload-input .np-upload-input__items:first-child:not(:empty) .np-upload-input__item:first-child + .np-upload-input__items:last-child .np-upload-input__upload-button {
|
|
5548
|
-
border-radius: 0 0 10px 10px;
|
|
5549
|
-
border-radius: 0 0 var(--radius-small) var(--radius-small);
|
|
5516
|
+
.np-theme-personal .np-upload-input.disabled .btn {
|
|
5517
|
+
cursor: inherit;
|
|
5550
5518
|
}
|
|
5551
|
-
.np-upload-input .np-upload-
|
|
5552
|
-
|
|
5553
|
-
margin: 0;
|
|
5519
|
+
.np-theme-personal .np-upload-input .np-upload-icon {
|
|
5520
|
+
color: var(--color-interactive-primary);
|
|
5554
5521
|
}
|
|
5555
|
-
.np-
|
|
5556
|
-
|
|
5522
|
+
.np-theme-personal .np-upload-input .media-body {
|
|
5523
|
+
padding-right: 32px;
|
|
5524
|
+
padding-right: var(--size-32);
|
|
5525
|
+
color: var(--color-content-link);
|
|
5526
|
+
white-space: break-spaces;
|
|
5557
5527
|
}
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5528
|
+
@media (max-width: 320px) {
|
|
5529
|
+
.np-theme-personal .np-upload-input .media-body {
|
|
5530
|
+
padding-right: 64px;
|
|
5531
|
+
padding-right: var(--size-64);
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
.np-theme-personal .np-upload-input .media-body .np-text-body-large-bold {
|
|
5535
|
+
-webkit-text-decoration: underline;
|
|
5536
|
+
text-decoration: underline;
|
|
5537
|
+
text-underline-offset: 0.3em;
|
|
5538
|
+
}
|
|
5539
|
+
.np-theme-personal .np-upload-input .media-body .np-text-body-default,
|
|
5540
|
+
.np-theme-personal .np-upload-input .media-body .np-upload-description,
|
|
5541
|
+
.np-theme-personal .np-upload-input .media-body .text-positive {
|
|
5542
|
+
color: #5d7079 !important;
|
|
5543
|
+
color: var(--color-content-secondary) !important;
|
|
5544
|
+
}
|
|
5545
|
+
.np-theme-personal .np-upload-input .media-body .text-negative {
|
|
5546
|
+
color: var(--color-sentiment-negative) !important;
|
|
5547
|
+
}
|
|
5548
|
+
.np-theme-personal .np-upload-input-errors {
|
|
5549
|
+
list-style: none;
|
|
5550
|
+
padding-left: 0;
|
|
5562
5551
|
}
|
|
5563
|
-
.np-upload-
|
|
5552
|
+
.np-theme-personal .np-upload-input-errors li {
|
|
5564
5553
|
position: relative;
|
|
5565
|
-
padding: 16px;
|
|
5566
|
-
padding: var(--size-16);
|
|
5567
|
-
display: flex;
|
|
5568
|
-
align-items: flex-start;
|
|
5554
|
+
padding-left: 16px;
|
|
5555
|
+
padding-left: var(--size-16);
|
|
5569
5556
|
}
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5557
|
+
@media (max-width: 320px) {
|
|
5558
|
+
.np-theme-personal .np-upload-input-errors li {
|
|
5559
|
+
padding-left: 32px;
|
|
5560
|
+
padding-left: var(--size-32);
|
|
5561
|
+
}
|
|
5573
5562
|
}
|
|
5574
|
-
.np-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
color: #5d7079;
|
|
5580
|
-
color: var(--color-content-secondary);
|
|
5563
|
+
.np-theme-personal .np-upload-input-errors li:before {
|
|
5564
|
+
content: '•';
|
|
5565
|
+
position: absolute;
|
|
5566
|
+
display: block;
|
|
5567
|
+
left: 0;
|
|
5581
5568
|
}
|
|
5582
|
-
.np-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5569
|
+
.np-theme-personal .np-upload-input .status-circle {
|
|
5570
|
+
width: 24px;
|
|
5571
|
+
width: var(--size-x-small);
|
|
5572
|
+
height: 24px;
|
|
5573
|
+
height: var(--size-x-small);
|
|
5586
5574
|
}
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5575
|
+
@media (max-width: 320px) {
|
|
5576
|
+
.np-theme-personal .np-upload-input .status-circle {
|
|
5577
|
+
width: 48px;
|
|
5578
|
+
width: var(--size-large);
|
|
5579
|
+
height: 48px;
|
|
5580
|
+
height: var(--size-large);
|
|
5581
|
+
}
|
|
5590
5582
|
}
|
|
5591
|
-
.np-upload-
|
|
5583
|
+
.np-upload-item {
|
|
5584
|
+
border: 1px solid #c9cbce;
|
|
5585
|
+
border: 1px solid var(--color-interactive-secondary);
|
|
5586
|
+
position: relative;
|
|
5587
|
+
}
|
|
5588
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
|
|
5589
|
+
.np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
|
|
5590
|
+
.np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
|
|
5592
5591
|
display: block;
|
|
5593
5592
|
position: absolute;
|
|
5594
5593
|
height: 1px;
|
|
@@ -5599,77 +5598,131 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5599
5598
|
left: var(--size-16);
|
|
5600
5599
|
width: calc(100% - 2 * 16px);
|
|
5601
5600
|
width: calc(100% - 2 * var(--size-16));
|
|
5601
|
+
}
|
|
5602
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
|
|
5603
|
+
.np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
|
|
5602
5604
|
top: 0;
|
|
5603
5605
|
}
|
|
5604
|
-
.np-upload-
|
|
5605
|
-
|
|
5606
|
-
|
|
5606
|
+
.np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
|
|
5607
|
+
bottom: -1px;
|
|
5608
|
+
}
|
|
5609
|
+
.np-upload-item:first-child ~ div {
|
|
5610
|
+
border-top: 1px;
|
|
5611
|
+
}
|
|
5612
|
+
.np-upload-item:not(:first-child) .np-upload-item__link:hover {
|
|
5613
|
+
border-top-color: rgba(0,0,0,0.10196);
|
|
5614
|
+
border-top-color: var(--color-border-neutral);
|
|
5615
|
+
}
|
|
5616
|
+
.np-upload-item:not(:last-child) {
|
|
5617
|
+
border-bottom: 0;
|
|
5618
|
+
}
|
|
5619
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
|
|
5620
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
|
|
5621
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
|
|
5622
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
|
|
5623
|
+
display: none;
|
|
5624
|
+
}
|
|
5625
|
+
.np-upload-button-container:hover:before,
|
|
5626
|
+
.np-upload-button-container.droppable-dropping:before {
|
|
5627
|
+
left: 0 !important;
|
|
5628
|
+
width: 100% !important;
|
|
5629
|
+
}
|
|
5630
|
+
.np-upload-button-container:has(:focus-visible) {
|
|
5631
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
5632
|
+
outline-offset: var(--ring-outline-offset);
|
|
5633
|
+
border-color: transparent;
|
|
5634
|
+
outline-offset: -3px;
|
|
5635
|
+
}
|
|
5636
|
+
.np-upload-item--single-file:focus-visible,
|
|
5637
|
+
.np-upload-item__link:focus-visible,
|
|
5638
|
+
.np-upload-button-container:has(:focus-visible) {
|
|
5639
|
+
outline-width: 3px;
|
|
5640
|
+
}
|
|
5641
|
+
.np-upload-item--link a {
|
|
5642
|
+
flex: 1;
|
|
5643
|
+
-webkit-text-decoration: none;
|
|
5644
|
+
text-decoration: none;
|
|
5645
|
+
border-top: 1px solid transparent;
|
|
5646
|
+
border-radius: inherit;
|
|
5647
|
+
}
|
|
5648
|
+
.np-upload-item--link a:focus-visible {
|
|
5649
|
+
outline-offset: -2px;
|
|
5650
|
+
}
|
|
5651
|
+
.np-upload-item--link a:hover:before {
|
|
5652
|
+
display: none !important;
|
|
5653
|
+
}
|
|
5654
|
+
.np-upload-item--link a:hover:after {
|
|
5655
|
+
left: 0 !important;
|
|
5656
|
+
width: 100% !important;
|
|
5657
|
+
}
|
|
5658
|
+
.np-upload-item--link a:hover,
|
|
5659
|
+
.np-upload-item--link a:active {
|
|
5660
|
+
-webkit-text-decoration: none;
|
|
5661
|
+
text-decoration: none;
|
|
5662
|
+
}
|
|
5663
|
+
.np-upload-item--link a:hover .np-upload-button,
|
|
5664
|
+
.np-upload-item--link a:active .np-upload-button {
|
|
5665
|
+
background-color: rgba(134,167,189,0.10196);
|
|
5666
|
+
background-color: var(--color-background-neutral);
|
|
5667
|
+
border-radius: inherit;
|
|
5668
|
+
}
|
|
5669
|
+
.np-upload-item--link:first-of-type a {
|
|
5670
|
+
border-top: 0;
|
|
5671
|
+
}
|
|
5672
|
+
.np-upload-item__body {
|
|
5607
5673
|
display: flex;
|
|
5608
|
-
|
|
5674
|
+
align-items: center;
|
|
5675
|
+
justify-content: space-between;
|
|
5676
|
+
position: relative;
|
|
5677
|
+
border-radius: inherit;
|
|
5609
5678
|
}
|
|
5610
|
-
.np-upload-
|
|
5679
|
+
.np-upload-item__remove-button {
|
|
5680
|
+
display: flex;
|
|
5681
|
+
align-items: center;
|
|
5682
|
+
justify-content: center;
|
|
5683
|
+
align-self: flex-start;
|
|
5611
5684
|
position: absolute;
|
|
5612
|
-
top: 18px;
|
|
5613
|
-
right: 16px;
|
|
5614
|
-
right: var(--size-16);
|
|
5615
|
-
}
|
|
5616
|
-
.np-upload-input__item .np-upload-input__item-action .np-upload-input__item-button {
|
|
5617
|
-
-webkit-appearance: none;
|
|
5618
|
-
-moz-appearance: none;
|
|
5619
|
-
appearance: none;
|
|
5620
5685
|
height: 24px;
|
|
5621
5686
|
height: var(--size-24);
|
|
5687
|
+
min-height: 0;
|
|
5622
5688
|
width: 24px;
|
|
5623
5689
|
width: var(--size-24);
|
|
5624
|
-
padding: 0
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
border: 0;
|
|
5690
|
+
padding: 0;
|
|
5691
|
+
border-radius: 50% !important;
|
|
5692
|
+
outline-offset: 0 !important;
|
|
5628
5693
|
background-color: rgba(134,167,189,0.10196);
|
|
5629
5694
|
background-color: var(--color-background-neutral);
|
|
5695
|
+
border: none;
|
|
5630
5696
|
color: var(--color-interactive-primary);
|
|
5697
|
+
right: 16px;
|
|
5698
|
+
right: var(--size-16);
|
|
5699
|
+
top: 16px;
|
|
5700
|
+
top: var(--size-16);
|
|
5631
5701
|
transition: color, background-color 0.15s ease-in-out;
|
|
5632
5702
|
}
|
|
5633
5703
|
@media (max-width: 320px) {
|
|
5634
|
-
.np-upload-
|
|
5704
|
+
.np-upload-item__remove-button {
|
|
5705
|
+
top: 16px;
|
|
5706
|
+
top: var(--size-16);
|
|
5707
|
+
right: 16px;
|
|
5708
|
+
right: var(--size-16);
|
|
5635
5709
|
height: 48px;
|
|
5636
5710
|
height: var(--size-48);
|
|
5637
5711
|
width: 48px;
|
|
5638
5712
|
width: var(--size-48);
|
|
5639
5713
|
}
|
|
5640
5714
|
}
|
|
5641
|
-
.np-upload-
|
|
5642
|
-
background-color: var(--color-
|
|
5643
|
-
|
|
5644
|
-
.np-upload-input__item .np-upload-input__item-action .np-upload-input__item-button:active {
|
|
5645
|
-
background-color: var(--color-background-neutral-active);
|
|
5646
|
-
}
|
|
5647
|
-
.np-upload-input__item.is-interactive {
|
|
5648
|
-
padding: 0;
|
|
5649
|
-
}
|
|
5650
|
-
.np-upload-input__item.is-interactive:hover + .np-upload-input__item::before,
|
|
5651
|
-
.np-upload-input__item.is-interactive:hover::before {
|
|
5652
|
-
width: 100%;
|
|
5653
|
-
left: 0;
|
|
5654
|
-
}
|
|
5655
|
-
.np-upload-input__item.is-interactive:hover + .np-upload-input__item::before {
|
|
5656
|
-
top: -1px;
|
|
5657
|
-
}
|
|
5658
|
-
.np-upload-input__item.is-interactive .np-upload-input__item-link {
|
|
5659
|
-
padding: 16px;
|
|
5660
|
-
padding: var(--size-16);
|
|
5661
|
-
-webkit-text-decoration: none;
|
|
5662
|
-
text-decoration: none;
|
|
5663
|
-
border-radius: inherit;
|
|
5664
|
-
}
|
|
5665
|
-
.np-upload-input__item.is-interactive .np-upload-input__item-link:focus-visible {
|
|
5666
|
-
outline-offset: -3px;
|
|
5667
|
-
outline-width: 3px;
|
|
5715
|
+
.np-upload-item__remove-button:hover {
|
|
5716
|
+
background-color: var(--color-sentiment-negative);
|
|
5717
|
+
color: var(--color-contrast-overlay) !important;
|
|
5668
5718
|
}
|
|
5669
|
-
.np-upload-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5719
|
+
.np-upload-item__remove-button:before {
|
|
5720
|
+
display: block;
|
|
5721
|
+
width: 44px;
|
|
5722
|
+
height: 44px;
|
|
5723
|
+
content: '';
|
|
5724
|
+
border-radius: 50%;
|
|
5725
|
+
position: absolute;
|
|
5673
5726
|
}
|
|
5674
5727
|
.np-progress {
|
|
5675
5728
|
border-radius: 10px;
|