@cloudscape-design/components 3.0.805 → 3.0.807
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/app-layout/drawer/index.d.ts.map +1 -1
- package/app-layout/drawer/index.js +3 -2
- package/app-layout/drawer/index.js.map +1 -1
- package/app-layout/test-classes/styles.css.js +23 -22
- package/app-layout/test-classes/styles.scoped.css +23 -85
- package/app-layout/test-classes/styles.selectors.js +23 -22
- package/app-layout/toggles/index.d.ts.map +1 -1
- package/app-layout/toggles/index.js +4 -1
- package/app-layout/toggles/index.js.map +1 -1
- package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh/drawers.js +8 -2
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh/navigation.d.ts.map +1 -1
- package/app-layout/visual-refresh/navigation.js +3 -3
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/tools.js +1 -1
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +4 -2
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/styles.css.js +15 -13
- package/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +19 -15
- package/app-layout/visual-refresh-toolbar/toolbar/styles.selectors.js +15 -13
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +1 -0
- package/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
- package/file-upload/internal.d.ts.map +1 -1
- package/file-upload/internal.js +3 -3
- package/file-upload/internal.js.map +1 -1
- package/internal/base-component/styles.scoped.css +21 -15
- package/internal/components/file-dropzone/index.d.ts +6 -0
- package/internal/components/file-dropzone/index.d.ts.map +1 -0
- package/internal/components/file-dropzone/index.js +33 -0
- package/internal/components/file-dropzone/index.js.map +1 -0
- package/internal/components/file-dropzone/interfaces.d.ts +20 -0
- package/internal/components/file-dropzone/interfaces.d.ts.map +1 -0
- package/internal/components/file-dropzone/interfaces.js +2 -0
- package/internal/components/file-dropzone/interfaces.js.map +1 -0
- package/internal/components/file-dropzone/styles.css.js +8 -0
- package/{file-upload/dropzone → internal/components/file-dropzone}/styles.scoped.css +6 -2
- package/{file-upload/dropzone → internal/components/file-dropzone}/styles.selectors.js +3 -2
- package/internal/components/file-dropzone/use-files-dragging.d.ts +10 -0
- package/internal/components/file-dropzone/use-files-dragging.d.ts.map +1 -0
- package/{file-upload/dropzone/index.js → internal/components/file-dropzone/use-files-dragging.js} +16 -38
- package/internal/components/file-dropzone/use-files-dragging.js.map +1 -0
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.js +3 -3
- package/internal/generated/theming/index.cjs +41 -41
- package/internal/generated/theming/index.js +41 -41
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/breadcrumbs.d.ts +5 -4
- package/internal/plugins/controllers/breadcrumbs.d.ts.map +1 -1
- package/internal/plugins/controllers/breadcrumbs.js +2 -4
- package/internal/plugins/controllers/breadcrumbs.js.map +1 -1
- package/internal/plugins/helpers/use-global-breadcrumbs.d.ts.map +1 -1
- package/internal/plugins/helpers/use-global-breadcrumbs.js +1 -1
- package/internal/plugins/helpers/use-global-breadcrumbs.js.map +1 -1
- package/package.json +1 -1
- package/test-utils/dom/app-layout/index.d.ts +12 -1
- package/test-utils/dom/app-layout/index.js +28 -2
- package/test-utils/dom/app-layout/index.js.map +1 -1
- package/test-utils/dom/internal/file-dropzone.d.ts +5 -0
- package/test-utils/dom/internal/file-dropzone.js +14 -0
- package/test-utils/dom/internal/file-dropzone.js.map +1 -0
- package/test-utils/selectors/app-layout/index.d.ts +12 -1
- package/test-utils/selectors/app-layout/index.js +28 -2
- package/test-utils/selectors/app-layout/index.js.map +1 -1
- package/test-utils/selectors/internal/file-dropzone.d.ts +5 -0
- package/test-utils/selectors/internal/file-dropzone.js +14 -0
- package/test-utils/selectors/internal/file-dropzone.js.map +1 -0
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/file-upload/dropzone/index.d.ts +0 -9
- package/file-upload/dropzone/index.d.ts.map +0 -1
- package/file-upload/dropzone/index.js.map +0 -1
- package/file-upload/dropzone/styles.css.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAA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oB,gBAC1C,CAAC;gBAEb,oBAAC,UAAU,IAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,CACtE,CACI,CACf,CAAC,CAAC,CAAC,IAAI;QAEP,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC9B,oBAAC,WAAW;YACV,oBAAC,SAAS,IACR,SAAS,EAAC,UAAU,EACpB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAC/B,oBAAC,KAAK,IACJ,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACxD,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,EACxC,SAAS,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,SAAS,CAAC,EAClC,WAAW,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,SAAS,CAAC,EACtC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,EAClD,oBAAoB,EAAE,WAAW,CAAC,oBAAoB,gBAC1C,SAAS;oBAErB,oBAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,CAClE,CACT,EACD,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE;oBACX,cAAc,EAAE,WAAW,CAAC,cAAc;oBAC1C,aAAa,EAAE,WAAW,CAAC,aAAa;iBACzC,GACD,CACU,CACf,CAAC,CAAC,CAAC,IAAI,CACa,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ForwardedRef, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport TokenList from '../internal/components/token-list';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { Token } from '../token-group/token';\nimport { Dropzone, useDropzoneVisible } from './dropzone';\nimport FileInput from './file-input';\nimport { FileOption } from './file-option';\nimport { FileUploadProps } from './interfaces';\n\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport fileInputStyles from './file-input/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalFileUploadProps = FileUploadProps & InternalBaseComponentProps;\n\nexport default React.forwardRef(InternalFileUpload);\n\nfunction InternalFileUpload(\n {\n accept,\n ariaRequired,\n multiple = false,\n onChange,\n value,\n tokenLimit,\n showFileSize,\n showFileLastModified,\n showFileThumbnail,\n i18nStrings,\n __internalRootRef = null,\n constraintText,\n errorText,\n warningText,\n fileErrors,\n fileWarnings,\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\n) {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: target => {\n target.focus();\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n fallbackSelector: `.${fileInputStyles['upload-input']}`,\n });\n\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const warningId = useUniqueId('warning-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\n\n checkControlled('FileUpload', 'value', value, 'onChange', onChange);\n\n if (!multiple && value.length > 1) {\n warnOnce('FileUpload', 'Value must be an array of size 0 or 1 when `multiple=false`.');\n }\n\n const handleFilesChange = (newFiles: File[]) => {\n const newValue = multiple ? [...value, ...newFiles] : newFiles[0] ? newFiles.slice(0, 1) : [...value];\n fireNonCancelableEvent(onChange, { value: newValue });\n };\n\n const onFileRemove = (removeFileIndex: number) => {\n const newValue = value.filter((_, fileIndex) => fileIndex !== removeFileIndex);\n fireNonCancelableEvent(onChange, { value: newValue });\n setNextFocusIndex(removeFileIndex);\n };\n\n const isDropzoneVisible = useDropzoneVisible(multiple);\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n showWarning ? warningId : undefined,\n constraintText ? constraintTextId : undefined\n );\n\n const hasError = Boolean(errorText || fileErrors?.filter(Boolean).length);\n const invalid = restProps.invalid || formFieldContext.invalid || hasError;\n\n return (\n <InternalSpaceBetween\n {...baseProps}\n size=\"xs\"\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n ref={tokenListRef}\n >\n <InternalBox>\n {isDropzoneVisible ? (\n <Dropzone onChange={handleFilesChange}>{i18nStrings.dropzoneText(multiple)}</Dropzone>\n ) : (\n <FileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={handleFilesChange}\n value={value}\n {...restProps}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18nStrings.uploadButtonText(multiple)}\n </FileInput>\n )}\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={warningId} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {!multiple && value.length > 0 ? (\n <InternalBox>\n <Token\n ariaLabel={value[0].name}\n dismissLabel={i18nStrings.removeFileAriaLabel(0)}\n onDismiss={() => onFileRemove(0)}\n errorText={fileErrors?.[0]}\n warningText={fileWarnings?.[0]}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n warningIconAriaLabel={i18nStrings.warningIconAriaLabel}\n data-index={0}\n >\n <FileOption file={value[0]} metadata={metadata} i18nStrings={i18nStrings} />\n </Token>\n </InternalBox>\n ) : null}\n\n {multiple && value.length > 0 ? (\n <InternalBox>\n <TokenList\n alignment=\"vertical\"\n items={value}\n renderItem={(file, fileIndex) => (\n <Token\n ariaLabel={file.name}\n dismissLabel={i18nStrings.removeFileAriaLabel(fileIndex)}\n onDismiss={() => onFileRemove(fileIndex)}\n errorText={fileErrors?.[fileIndex]}\n warningText={fileWarnings?.[fileIndex]}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n warningIconAriaLabel={i18nStrings.warningIconAriaLabel}\n data-index={fileIndex}\n >\n <FileOption file={file} metadata={metadata} i18nStrings={i18nStrings} />\n </Token>\n )}\n limit={tokenLimit}\n i18nStrings={{\n limitShowFewer: i18nStrings.limitShowFewer,\n limitShowMore: i18nStrings.limitShowMore,\n }}\n />\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n );\n}\n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AAC,CAAC,CAAC,CAC9B,oBAAC,WAAW;YACV,oBAAC,SAAS,IACR,SAAS,EAAC,UAAU,EACpB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAC/B,oBAAC,KAAK,IACJ,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACxD,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,EACxC,SAAS,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,SAAS,CAAC,EAClC,WAAW,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,SAAS,CAAC,EACtC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,EAClD,oBAAoB,EAAE,WAAW,CAAC,oBAAoB,gBAC1C,SAAS;oBAErB,oBAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,CAClE,CACT,EACD,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE;oBACX,cAAc,EAAE,WAAW,CAAC,cAAc;oBAC1C,aAAa,EAAE,WAAW,CAAC,aAAa;iBACzC,GACD,CACU,CACf,CAAC,CAAC,CAAC,IAAI,CACa,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ForwardedRef, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalFileDropzone, { useFilesDragging } from '../internal/components/file-dropzone';\nimport TokenList from '../internal/components/token-list';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { Token } from '../token-group/token';\nimport FileInput from './file-input';\nimport { FileOption } from './file-option';\nimport { FileUploadProps } from './interfaces';\n\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport fileInputStyles from './file-input/styles.css.js';\nimport styles from './styles.css.js';\n\ntype InternalFileUploadProps = FileUploadProps & InternalBaseComponentProps;\n\nexport default React.forwardRef(InternalFileUpload);\n\nfunction InternalFileUpload(\n {\n accept,\n ariaRequired,\n multiple = false,\n onChange,\n value,\n tokenLimit,\n showFileSize,\n showFileLastModified,\n showFileThumbnail,\n i18nStrings,\n __internalRootRef = null,\n constraintText,\n errorText,\n warningText,\n fileErrors,\n fileWarnings,\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\n) {\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: target => {\n target.focus();\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n fallbackSelector: `.${fileInputStyles['upload-input']}`,\n });\n\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const warningId = useUniqueId('warning-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\n\n checkControlled('FileUpload', 'value', value, 'onChange', onChange);\n\n if (!multiple && value.length > 1) {\n warnOnce('FileUpload', 'Value must be an array of size 0 or 1 when `multiple=false`.');\n }\n\n const handleFilesChange = (newFiles: File[]) => {\n const newValue = multiple ? [...value, ...newFiles] : newFiles[0] ? newFiles.slice(0, 1) : [...value];\n fireNonCancelableEvent(onChange, { value: newValue });\n };\n\n const onFileRemove = (removeFileIndex: number) => {\n const newValue = value.filter((_, fileIndex) => fileIndex !== removeFileIndex);\n fireNonCancelableEvent(onChange, { value: newValue });\n setNextFocusIndex(removeFileIndex);\n };\n\n const { areFilesDragging } = useFilesDragging();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n showWarning ? warningId : undefined,\n constraintText ? constraintTextId : undefined\n );\n\n const hasError = Boolean(errorText || fileErrors?.filter(Boolean).length);\n const invalid = restProps.invalid || formFieldContext.invalid || hasError;\n\n return (\n <InternalSpaceBetween\n {...baseProps}\n size=\"xs\"\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n ref={tokenListRef}\n >\n <InternalBox>\n {areFilesDragging ? (\n <InternalFileDropzone onChange={event => handleFilesChange(event.detail.value)}>\n {i18nStrings.dropzoneText(multiple)}\n </InternalFileDropzone>\n ) : (\n <FileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={handleFilesChange}\n value={value}\n {...restProps}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18nStrings.uploadButtonText(multiple)}\n </FileInput>\n )}\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={warningId} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {!multiple && value.length > 0 ? (\n <InternalBox>\n <Token\n ariaLabel={value[0].name}\n dismissLabel={i18nStrings.removeFileAriaLabel(0)}\n onDismiss={() => onFileRemove(0)}\n errorText={fileErrors?.[0]}\n warningText={fileWarnings?.[0]}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n warningIconAriaLabel={i18nStrings.warningIconAriaLabel}\n data-index={0}\n >\n <FileOption file={value[0]} metadata={metadata} i18nStrings={i18nStrings} />\n </Token>\n </InternalBox>\n ) : null}\n\n {multiple && value.length > 0 ? (\n <InternalBox>\n <TokenList\n alignment=\"vertical\"\n items={value}\n renderItem={(file, fileIndex) => (\n <Token\n ariaLabel={file.name}\n dismissLabel={i18nStrings.removeFileAriaLabel(fileIndex)}\n onDismiss={() => onFileRemove(fileIndex)}\n errorText={fileErrors?.[fileIndex]}\n warningText={fileWarnings?.[fileIndex]}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n warningIconAriaLabel={i18nStrings.warningIconAriaLabel}\n data-index={fileIndex}\n >\n <FileOption file={file} metadata={metadata} i18nStrings={i18nStrings} />\n </Token>\n )}\n limit={tokenLimit}\n i18nStrings={{\n limitShowFewer: i18nStrings.limitShowFewer,\n limitShowMore: i18nStrings.limitShowMore,\n }}\n />\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n );\n}\n"]}
|
|
@@ -243,9 +243,9 @@
|
|
|
243
243
|
--color-text-avatar-jddpvm:#ffffff;
|
|
244
244
|
--color-background-loading-bar-gen-ai-7qfi9s:linear-gradient(90deg, #99f7ff 0%, #0096fa 10%, #bf80ff 24%, #7300e5 50%, #bf80ff 76%, #0096fa 90%, #99f7ff 100%);
|
|
245
245
|
--color-background-chat-bubble-outgoing-pfqan2:transparent;
|
|
246
|
-
--color-background-chat-bubble-incoming-
|
|
247
|
-
--color-text-chat-bubble-outgoing-
|
|
248
|
-
--color-text-chat-bubble-incoming-
|
|
246
|
+
--color-background-chat-bubble-incoming-ljtp6c:#f3f3f7;
|
|
247
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#0f141a;
|
|
248
|
+
--color-text-chat-bubble-incoming-x2kig8:#0f141a;
|
|
249
249
|
--color-border-button-normal-active-mn0ayd:#002b66;
|
|
250
250
|
--color-border-button-normal-default-uzqi0v:#006ce0;
|
|
251
251
|
--color-border-toggle-button-normal-pressed-lylxt2:#006ce0;
|
|
@@ -874,9 +874,9 @@
|
|
|
874
874
|
--color-background-tiles-disabled-ozblza:#1b232d;
|
|
875
875
|
--color-background-toggle-checked-disabled-wk1i1j:#002b66;
|
|
876
876
|
--color-background-toggle-default-ywflhx:#8c8c94;
|
|
877
|
-
--color-background-chat-bubble-incoming-
|
|
878
|
-
--color-text-chat-bubble-outgoing-
|
|
879
|
-
--color-text-chat-bubble-incoming-
|
|
877
|
+
--color-background-chat-bubble-incoming-ljtp6c:#0f141a;
|
|
878
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#c6c6cd;
|
|
879
|
+
--color-text-chat-bubble-incoming-x2kig8:#c6c6cd;
|
|
880
880
|
--color-border-button-normal-active-mn0ayd:#75cfff;
|
|
881
881
|
--color-border-button-normal-default-uzqi0v:#42b4ff;
|
|
882
882
|
--color-border-toggle-button-normal-pressed-lylxt2:#42b4ff;
|
|
@@ -1186,9 +1186,9 @@
|
|
|
1186
1186
|
--color-background-tiles-disabled-ozblza:#1b232d;
|
|
1187
1187
|
--color-background-toggle-checked-disabled-wk1i1j:#002b66;
|
|
1188
1188
|
--color-background-toggle-default-ywflhx:#8c8c94;
|
|
1189
|
-
--color-background-chat-bubble-incoming-
|
|
1190
|
-
--color-text-chat-bubble-outgoing-
|
|
1191
|
-
--color-text-chat-bubble-incoming-
|
|
1189
|
+
--color-background-chat-bubble-incoming-ljtp6c:#0f141a;
|
|
1190
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#c6c6cd;
|
|
1191
|
+
--color-text-chat-bubble-incoming-x2kig8:#c6c6cd;
|
|
1192
1192
|
--color-border-button-normal-active-mn0ayd:#75cfff;
|
|
1193
1193
|
--color-border-button-normal-default-uzqi0v:#42b4ff;
|
|
1194
1194
|
--color-border-toggle-button-normal-pressed-lylxt2:#42b4ff;
|
|
@@ -1392,9 +1392,9 @@
|
|
|
1392
1392
|
--color-background-tiles-disabled-ozblza:#1b232d;
|
|
1393
1393
|
--color-background-toggle-checked-disabled-wk1i1j:#002b66;
|
|
1394
1394
|
--color-background-toggle-default-ywflhx:#8c8c94;
|
|
1395
|
-
--color-background-chat-bubble-incoming-
|
|
1396
|
-
--color-text-chat-bubble-outgoing-
|
|
1397
|
-
--color-text-chat-bubble-incoming-
|
|
1395
|
+
--color-background-chat-bubble-incoming-ljtp6c:#0f141a;
|
|
1396
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#c6c6cd;
|
|
1397
|
+
--color-text-chat-bubble-incoming-x2kig8:#c6c6cd;
|
|
1398
1398
|
--color-border-button-normal-active-mn0ayd:#75cfff;
|
|
1399
1399
|
--color-border-button-normal-default-uzqi0v:#42b4ff;
|
|
1400
1400
|
--color-border-toggle-button-normal-pressed-lylxt2:#42b4ff;
|
|
@@ -1556,6 +1556,8 @@
|
|
|
1556
1556
|
--color-background-button-primary-hover-0qidjj:#ffffff;
|
|
1557
1557
|
--color-background-segment-default-voaiuw:transparent;
|
|
1558
1558
|
--color-background-segment-hover-jbzuvp:transparent;
|
|
1559
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#f9f9fa;
|
|
1560
|
+
--color-text-chat-bubble-incoming-x2kig8:#f9f9fa;
|
|
1559
1561
|
--color-border-button-normal-active-mn0ayd:#ffffff;
|
|
1560
1562
|
--color-border-button-normal-default-uzqi0v:#f9f9fa;
|
|
1561
1563
|
--color-border-button-normal-hover-2d2g0m:#ffffff;
|
|
@@ -1698,9 +1700,9 @@
|
|
|
1698
1700
|
--color-background-tiles-disabled-ozblza:#1b232d;
|
|
1699
1701
|
--color-background-toggle-checked-disabled-wk1i1j:#002b66;
|
|
1700
1702
|
--color-background-toggle-default-ywflhx:#8c8c94;
|
|
1701
|
-
--color-background-chat-bubble-incoming-
|
|
1702
|
-
--color-text-chat-bubble-outgoing-
|
|
1703
|
-
--color-text-chat-bubble-incoming-
|
|
1703
|
+
--color-background-chat-bubble-incoming-ljtp6c:#0f141a;
|
|
1704
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#c6c6cd;
|
|
1705
|
+
--color-text-chat-bubble-incoming-x2kig8:#c6c6cd;
|
|
1704
1706
|
--color-border-button-normal-active-mn0ayd:#ffffff;
|
|
1705
1707
|
--color-border-button-normal-default-uzqi0v:#dedee3;
|
|
1706
1708
|
--color-border-toggle-button-normal-pressed-lylxt2:#42b4ff;
|
|
@@ -1844,12 +1846,16 @@
|
|
|
1844
1846
|
|
|
1845
1847
|
@media not print {
|
|
1846
1848
|
.awsui-dark-mode .awsui-context-flashbar-warning:not(#\9) {
|
|
1849
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#0f141a;
|
|
1850
|
+
--color-text-chat-bubble-incoming-x2kig8:#0f141a;
|
|
1847
1851
|
--color-text-body-default-7v1jfn:#0f141a;
|
|
1848
1852
|
--color-text-expandable-section-default-7w1jwq:#0f141a;
|
|
1849
1853
|
}
|
|
1850
1854
|
}
|
|
1851
1855
|
@media not print {
|
|
1852
1856
|
.awsui-context-flashbar-warning.awsui-dark-mode:not(#\9) {
|
|
1857
|
+
--color-text-chat-bubble-outgoing-bvbr0v:#0f141a;
|
|
1858
|
+
--color-text-chat-bubble-incoming-x2kig8:#0f141a;
|
|
1853
1859
|
--color-text-body-default-7v1jfn:#0f141a;
|
|
1854
1860
|
--color-text-expandable-section-default-7w1jwq:#0f141a;
|
|
1855
1861
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FileDropzoneProps } from './interfaces';
|
|
3
|
+
import { useFilesDragging } from './use-files-dragging';
|
|
4
|
+
export { FileDropzoneProps, useFilesDragging };
|
|
5
|
+
export default function InternalFileDropzone({ onChange, children }: FileDropzoneProps): JSX.Element;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/file-dropzone/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AAE/C,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,iBAAiB,eAqCrF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { fireNonCancelableEvent } from '../../events';
|
|
6
|
+
import { useFilesDragging } from './use-files-dragging';
|
|
7
|
+
import styles from './styles.css.js';
|
|
8
|
+
export { useFilesDragging };
|
|
9
|
+
export default function InternalFileDropzone({ onChange, children }) {
|
|
10
|
+
const [isDropzoneHovered, setDropzoneHovered] = useState(false);
|
|
11
|
+
const onDragOver = (event) => {
|
|
12
|
+
event.preventDefault();
|
|
13
|
+
if (event.dataTransfer) {
|
|
14
|
+
setDropzoneHovered(true);
|
|
15
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const onDragLeave = (event) => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
setDropzoneHovered(false);
|
|
21
|
+
if (event.dataTransfer) {
|
|
22
|
+
event.dataTransfer.dropEffect = 'none';
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const onDrop = (event) => {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
setDropzoneHovered(false);
|
|
28
|
+
fireNonCancelableEvent(onChange, { value: Array.from(event.dataTransfer.files) });
|
|
29
|
+
};
|
|
30
|
+
return (React.createElement("div", { className: clsx(styles.root, isDropzoneHovered && styles.hovered), onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop },
|
|
31
|
+
React.createElement("div", { className: styles.content }, children)));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/file-dropzone/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAqB,gBAAgB,EAAE,CAAC;AAE/C,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAqB;IACpF,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhE,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;QAC5C,KAAK,CAAC,cAAc,EAAE,CAAC;QAEvB,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,kBAAkB,CAAC,IAAI,CAAC,CAAC;YACzB,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;SACxC;IACH,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;QAC7C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;SACxC;IACH,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,KAAsB,EAAE,EAAE;QACxC,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAE1B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IAEF,OAAO,CACL,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,iBAAiB,IAAI,MAAM,CAAC,OAAO,CAAC,EACjE,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM;QAEd,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CAC5C,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { fireNonCancelableEvent } from '../../events';\nimport { FileDropzoneProps } from './interfaces';\nimport { useFilesDragging } from './use-files-dragging';\n\nimport styles from './styles.css.js';\n\nexport { FileDropzoneProps, useFilesDragging };\n\nexport default function InternalFileDropzone({ onChange, children }: FileDropzoneProps) {\n const [isDropzoneHovered, setDropzoneHovered] = useState(false);\n\n const onDragOver = (event: React.DragEvent) => {\n event.preventDefault();\n\n if (event.dataTransfer) {\n setDropzoneHovered(true);\n event.dataTransfer.dropEffect = 'copy';\n }\n };\n\n const onDragLeave = (event: React.DragEvent) => {\n event.preventDefault();\n setDropzoneHovered(false);\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = 'none';\n }\n };\n\n const onDrop = (event: React.DragEvent) => {\n event.preventDefault();\n setDropzoneHovered(false);\n\n fireNonCancelableEvent(onChange, { value: Array.from(event.dataTransfer.files) });\n };\n\n return (\n <div\n className={clsx(styles.root, isDropzoneHovered && styles.hovered)}\n onDragOver={onDragOver}\n onDragLeave={onDragLeave}\n onDrop={onDrop}\n >\n <div className={styles.content}>{children}</div>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseComponentProps } from '../../base-component';
|
|
3
|
+
import { NonCancelableEventHandler } from '../../events';
|
|
4
|
+
export interface FileDropzoneProps extends BaseComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* Called when the user selects new file(s), or removes a file.
|
|
7
|
+
* The event `detail` contains the current value of the component.
|
|
8
|
+
*/
|
|
9
|
+
onChange: NonCancelableEventHandler<FileDropzoneProps.ChangeDetail>;
|
|
10
|
+
/**
|
|
11
|
+
* Children of the Dropzone.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare namespace FileDropzoneProps {
|
|
16
|
+
interface ChangeDetail {
|
|
17
|
+
value: File[];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/file-dropzone/interfaces.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;;OAGG;IACH,QAAQ,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACpE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,YAAY;QAC3B,KAAK,EAAE,IAAI,EAAE,CAAC;KACf;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/file-dropzone/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../../base-component';\nimport { NonCancelableEventHandler } from '../../events';\n\nexport interface FileDropzoneProps extends BaseComponentProps {\n /**\n * Called when the user selects new file(s), or removes a file.\n * The event `detail` contains the current value of the component.\n */\n onChange: NonCancelableEventHandler<FileDropzoneProps.ChangeDetail>;\n /**\n * Children of the Dropzone.\n */\n children: React.ReactNode;\n}\n\nexport namespace FileDropzoneProps {\n export interface ChangeDetail {\n value: File[];\n }\n}\n"]}
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
*/
|
|
175
175
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
176
176
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
177
|
-
.
|
|
177
|
+
.awsui_root_1tk3k_uajxe_177:not(#\9) {
|
|
178
178
|
display: flex;
|
|
179
179
|
flex-direction: column;
|
|
180
180
|
align-items: center;
|
|
@@ -190,7 +190,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
190
190
|
background-color: var(--color-dropzone-background-active-xjesd4, #ebebf0);
|
|
191
191
|
font-weight: 700;
|
|
192
192
|
}
|
|
193
|
-
.
|
|
193
|
+
.awsui_root_1tk3k_uajxe_177.awsui_hovered_1tk3k_uajxe_193:not(#\9) {
|
|
194
194
|
color: var(--color-dropzone-text-hover-xjyyuz, #002b66);
|
|
195
195
|
background-color: var(--color-dropzone-background-hover-elxayo, #d1f1ff);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.awsui_content_1tk3k_uajxe_198:not(#\9) {
|
|
199
|
+
/* used in test-utils */
|
|
196
200
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"root": "awsui_root_1tk3k_uajxe_177",
|
|
6
|
+
"hovered": "awsui_hovered_1tk3k_uajxe_193",
|
|
7
|
+
"content": "awsui_content_1tk3k_uajxe_198"
|
|
7
8
|
};
|
|
8
9
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A utility to determine whether or not a file is being currently dragged into the window.
|
|
3
|
+
*
|
|
4
|
+
* @returns An object with the following arguments:
|
|
5
|
+
* `areFilesDragging`: True if a file is being dragged over the current window, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFilesDragging(): {
|
|
8
|
+
areFilesDragging: boolean;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-files-dragging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-files-dragging.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/file-dropzone/use-files-dragging.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,gBAAgB;;EAoD/B"}
|
package/{file-upload/dropzone/index.js → internal/components/file-dropzone/use-files-dragging.js}
RENAMED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* A utility to determine whether or not a file is being currently dragged into the window.
|
|
6
|
+
*
|
|
7
|
+
* @returns An object with the following arguments:
|
|
8
|
+
* `areFilesDragging`: True if a file is being dragged over the current window, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export function useFilesDragging() {
|
|
11
|
+
const [areFilesDragging, setFilesDragging] = useState(false);
|
|
9
12
|
// Registering global drag events listeners.
|
|
10
13
|
useEffect(() => {
|
|
11
14
|
// The timer helps avoiding dropzone blinking.
|
|
@@ -20,20 +23,20 @@ export function useDropzoneVisible(multiple) {
|
|
|
20
23
|
files++;
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
|
-
if (files > 0
|
|
24
|
-
|
|
26
|
+
if (files > 0) {
|
|
27
|
+
setFilesDragging(true);
|
|
25
28
|
dragTimer && clearTimeout(dragTimer);
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
31
|
// When the files are no longer dragged over the browser the state must be reset.
|
|
29
32
|
const onDocumentDragLeave = (event) => {
|
|
30
33
|
event.preventDefault();
|
|
31
|
-
dragTimer = setTimeout(() =>
|
|
34
|
+
dragTimer = setTimeout(() => setFilesDragging(false), 25);
|
|
32
35
|
};
|
|
33
36
|
// If the files were dropped the state must be reset.
|
|
34
37
|
const onDocumentDrop = (event) => {
|
|
35
38
|
event.preventDefault();
|
|
36
|
-
dragTimer = setTimeout(() =>
|
|
39
|
+
dragTimer = setTimeout(() => setFilesDragging(false), 25);
|
|
37
40
|
};
|
|
38
41
|
document.addEventListener('dragover', onDocumentDragOver, false);
|
|
39
42
|
document.addEventListener('dragleave', onDocumentDragLeave, false);
|
|
@@ -44,32 +47,7 @@ export function useDropzoneVisible(multiple) {
|
|
|
44
47
|
document.removeEventListener('dragleave', onDocumentDragLeave);
|
|
45
48
|
document.removeEventListener('drop', onDocumentDrop);
|
|
46
49
|
};
|
|
47
|
-
}, [
|
|
48
|
-
return
|
|
50
|
+
}, []);
|
|
51
|
+
return { areFilesDragging };
|
|
49
52
|
}
|
|
50
|
-
|
|
51
|
-
const [isDropzoneHovered, setDropzoneHovered] = useState(false);
|
|
52
|
-
const onDragOver = (event) => {
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
if (event.dataTransfer) {
|
|
55
|
-
setDropzoneHovered(true);
|
|
56
|
-
event.dataTransfer.dropEffect = 'copy';
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const onDragLeave = (event) => {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
setDropzoneHovered(false);
|
|
62
|
-
if (event.dataTransfer) {
|
|
63
|
-
event.dataTransfer.dropEffect = 'none';
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const onDrop = (event) => {
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
setDropzoneHovered(false);
|
|
69
|
-
onChange(Array.from(event.dataTransfer.files));
|
|
70
|
-
};
|
|
71
|
-
return (React.createElement("div", { className: clsx(styles.dropzone, isDropzoneHovered && styles['dropzone-hovered']), onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop },
|
|
72
|
-
React.createElement(InternalIcon, { name: "upload" }),
|
|
73
|
-
React.createElement("span", null, children)));
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=index.js.map
|
|
53
|
+
//# sourceMappingURL=use-files-dragging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-files-dragging.js","sourceRoot":"","sources":["../../../../../src/internal/components/file-dropzone/use-files-dragging.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,QAA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Q,CAAC,gBAAgB,CAAC,WAAW,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACnE,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;QAEzD,OAAO,GAAG,EAAE;YACV,SAAS,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC;YACrC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YAC7D,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;YAC/D,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useState } from 'react';\n\n/**\n * A utility to determine whether or not a file is being currently dragged into the window.\n *\n * @returns An object with the following arguments:\n * `areFilesDragging`: True if a file is being dragged over the current window, false otherwise.\n */\nexport function useFilesDragging() {\n const [areFilesDragging, setFilesDragging] = useState(false);\n\n // Registering global drag events listeners.\n useEffect(() => {\n // The timer helps avoiding dropzone blinking.\n let dragTimer: null | ReturnType<typeof setTimeout> = null;\n\n // The file-upload dropzone is shown when the user drags files over to the browser.\n const onDocumentDragOver = (event: DragEvent) => {\n event.preventDefault();\n\n let files = 0;\n for (let item = 0; item < (event.dataTransfer?.types.length || 0); item++) {\n if (event.dataTransfer?.types[item] === 'Files') {\n files++;\n }\n }\n\n if (files > 0) {\n setFilesDragging(true);\n dragTimer && clearTimeout(dragTimer);\n }\n };\n\n // When the files are no longer dragged over the browser the state must be reset.\n const onDocumentDragLeave = (event: DragEvent) => {\n event.preventDefault();\n\n dragTimer = setTimeout(() => setFilesDragging(false), 25);\n };\n\n // If the files were dropped the state must be reset.\n const onDocumentDrop = (event: DragEvent) => {\n event.preventDefault();\n\n dragTimer = setTimeout(() => setFilesDragging(false), 25);\n };\n\n document.addEventListener('dragover', onDocumentDragOver, false);\n document.addEventListener('dragleave', onDocumentDragLeave, false);\n document.addEventListener('drop', onDocumentDrop, false);\n\n return () => {\n dragTimer && clearTimeout(dragTimer);\n document.removeEventListener('dragover', onDocumentDragOver);\n document.removeEventListener('dragleave', onDocumentDragLeave);\n document.removeEventListener('drop', onDocumentDrop);\n };\n }, []);\n\n return { areFilesDragging };\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -297,9 +297,9 @@ export var colorBackgroundAvatarDefault = "var(--color-background-avatar-default
|
|
|
297
297
|
export var colorTextAvatar = "var(--color-text-avatar-jddpvm, #ffffff)";
|
|
298
298
|
export var colorBackgroundLoadingBarGenAi = "var(--color-background-loading-bar-gen-ai-7qfi9s, linear-gradient(90deg, #99f7ff 0%, #0096fa 10%, #bf80ff 24%, #7300e5 50%, #bf80ff 76%, #0096fa 90%, #99f7ff 100%))";
|
|
299
299
|
export var colorBackgroundChatBubbleOutgoing = "var(--color-background-chat-bubble-outgoing-pfqan2, transparent)";
|
|
300
|
-
export var colorBackgroundChatBubbleIncoming = "var(--color-background-chat-bubble-incoming-
|
|
301
|
-
export var colorTextChatBubbleOutgoing = "var(--color-text-chat-bubble-outgoing-
|
|
302
|
-
export var colorTextChatBubbleIncoming = "var(--color-text-chat-bubble-incoming-
|
|
300
|
+
export var colorBackgroundChatBubbleIncoming = "var(--color-background-chat-bubble-incoming-ljtp6c, #f3f3f7)";
|
|
301
|
+
export var colorTextChatBubbleOutgoing = "var(--color-text-chat-bubble-outgoing-bvbr0v, #0f141a)";
|
|
302
|
+
export var colorTextChatBubbleIncoming = "var(--color-text-chat-bubble-incoming-x2kig8, #0f141a)";
|
|
303
303
|
export var colorBorderButtonNormalActive = "var(--color-border-button-normal-active-mn0ayd, #002b66)";
|
|
304
304
|
export var colorBorderButtonNormalDefault = "var(--color-border-button-normal-default-uzqi0v, #006ce0)";
|
|
305
305
|
export var colorBorderToggleButtonNormalPressed = "var(--color-border-toggle-button-normal-pressed-lylxt2, #006ce0)";
|
|
@@ -1075,15 +1075,15 @@ module.exports.preset = {
|
|
|
1075
1075
|
},
|
|
1076
1076
|
"colorBackgroundChatBubbleIncoming": {
|
|
1077
1077
|
"light": "{colorGrey150}",
|
|
1078
|
-
"dark": "{
|
|
1078
|
+
"dark": "{colorGrey900}"
|
|
1079
1079
|
},
|
|
1080
1080
|
"colorTextChatBubbleOutgoing": {
|
|
1081
|
-
"light": "{
|
|
1082
|
-
"dark": "{
|
|
1081
|
+
"light": "{colorTextBodyDefault}",
|
|
1082
|
+
"dark": "{colorTextBodyDefault}"
|
|
1083
1083
|
},
|
|
1084
1084
|
"colorTextChatBubbleIncoming": {
|
|
1085
|
-
"light": "{
|
|
1086
|
-
"dark": "{
|
|
1085
|
+
"light": "{colorTextBodyDefault}",
|
|
1086
|
+
"dark": "{colorTextBodyDefault}"
|
|
1087
1087
|
},
|
|
1088
1088
|
"colorBorderButtonNormalActive": {
|
|
1089
1089
|
"light": "{colorBlue800}",
|
|
@@ -3309,16 +3309,16 @@ module.exports.preset = {
|
|
|
3309
3309
|
"dark": "transparent"
|
|
3310
3310
|
},
|
|
3311
3311
|
"colorBackgroundChatBubbleIncoming": {
|
|
3312
|
-
"light": "{
|
|
3313
|
-
"dark": "{
|
|
3312
|
+
"light": "{colorGrey900}",
|
|
3313
|
+
"dark": "{colorGrey900}"
|
|
3314
3314
|
},
|
|
3315
3315
|
"colorTextChatBubbleOutgoing": {
|
|
3316
|
-
"light": "{
|
|
3317
|
-
"dark": "{
|
|
3316
|
+
"light": "{colorTextBodyDefault}",
|
|
3317
|
+
"dark": "{colorTextBodyDefault}"
|
|
3318
3318
|
},
|
|
3319
3319
|
"colorTextChatBubbleIncoming": {
|
|
3320
|
-
"light": "{
|
|
3321
|
-
"dark": "{
|
|
3320
|
+
"light": "{colorTextBodyDefault}",
|
|
3321
|
+
"dark": "{colorTextBodyDefault}"
|
|
3322
3322
|
},
|
|
3323
3323
|
"colorBorderButtonNormalActive": {
|
|
3324
3324
|
"light": "{colorBlue400}",
|
|
@@ -4463,16 +4463,16 @@ module.exports.preset = {
|
|
|
4463
4463
|
"dark": "transparent"
|
|
4464
4464
|
},
|
|
4465
4465
|
"colorBackgroundChatBubbleIncoming": {
|
|
4466
|
-
"light": "{
|
|
4467
|
-
"dark": "{
|
|
4466
|
+
"light": "{colorGrey900}",
|
|
4467
|
+
"dark": "{colorGrey900}"
|
|
4468
4468
|
},
|
|
4469
4469
|
"colorTextChatBubbleOutgoing": {
|
|
4470
|
-
"light": "{
|
|
4471
|
-
"dark": "{
|
|
4470
|
+
"light": "{colorTextBodyDefault}",
|
|
4471
|
+
"dark": "{colorTextBodyDefault}"
|
|
4472
4472
|
},
|
|
4473
4473
|
"colorTextChatBubbleIncoming": {
|
|
4474
|
-
"light": "{
|
|
4475
|
-
"dark": "{
|
|
4474
|
+
"light": "{colorTextBodyDefault}",
|
|
4475
|
+
"dark": "{colorTextBodyDefault}"
|
|
4476
4476
|
},
|
|
4477
4477
|
"colorBorderButtonNormalActive": {
|
|
4478
4478
|
"light": "{colorBlue400}",
|
|
@@ -5550,15 +5550,15 @@ module.exports.preset = {
|
|
|
5550
5550
|
},
|
|
5551
5551
|
"colorBackgroundChatBubbleIncoming": {
|
|
5552
5552
|
"light": "{colorGrey150}",
|
|
5553
|
-
"dark": "{
|
|
5553
|
+
"dark": "{colorGrey900}"
|
|
5554
5554
|
},
|
|
5555
5555
|
"colorTextChatBubbleOutgoing": {
|
|
5556
|
-
"light": "{
|
|
5557
|
-
"dark": "{
|
|
5556
|
+
"light": "{colorTextBodyDefault}",
|
|
5557
|
+
"dark": "{colorTextBodyDefault}"
|
|
5558
5558
|
},
|
|
5559
5559
|
"colorTextChatBubbleIncoming": {
|
|
5560
|
-
"light": "{
|
|
5561
|
-
"dark": "{
|
|
5560
|
+
"light": "{colorTextBodyDefault}",
|
|
5561
|
+
"dark": "{colorTextBodyDefault}"
|
|
5562
5562
|
},
|
|
5563
5563
|
"colorBorderButtonNormalActive": {
|
|
5564
5564
|
"light": "{colorWhite}",
|
|
@@ -6636,15 +6636,15 @@ module.exports.preset = {
|
|
|
6636
6636
|
},
|
|
6637
6637
|
"colorBackgroundChatBubbleIncoming": {
|
|
6638
6638
|
"light": "{colorGrey150}",
|
|
6639
|
-
"dark": "{
|
|
6639
|
+
"dark": "{colorGrey900}"
|
|
6640
6640
|
},
|
|
6641
6641
|
"colorTextChatBubbleOutgoing": {
|
|
6642
|
-
"light": "{
|
|
6643
|
-
"dark": "{
|
|
6642
|
+
"light": "{colorTextBodyDefault}",
|
|
6643
|
+
"dark": "{colorTextBodyDefault}"
|
|
6644
6644
|
},
|
|
6645
6645
|
"colorTextChatBubbleIncoming": {
|
|
6646
|
-
"light": "{
|
|
6647
|
-
"dark": "{
|
|
6646
|
+
"light": "{colorTextBodyDefault}",
|
|
6647
|
+
"dark": "{colorTextBodyDefault}"
|
|
6648
6648
|
},
|
|
6649
6649
|
"colorBorderButtonNormalActive": {
|
|
6650
6650
|
"light": "{colorTextButtonNormalHover}",
|
|
@@ -7722,15 +7722,15 @@ module.exports.preset = {
|
|
|
7722
7722
|
},
|
|
7723
7723
|
"colorBackgroundChatBubbleIncoming": {
|
|
7724
7724
|
"light": "{colorGrey150}",
|
|
7725
|
-
"dark": "{
|
|
7725
|
+
"dark": "{colorGrey900}"
|
|
7726
7726
|
},
|
|
7727
7727
|
"colorTextChatBubbleOutgoing": {
|
|
7728
|
-
"light": "{
|
|
7729
|
-
"dark": "{
|
|
7728
|
+
"light": "{colorTextBodyDefault}",
|
|
7729
|
+
"dark": "{colorTextBodyDefault}"
|
|
7730
7730
|
},
|
|
7731
7731
|
"colorTextChatBubbleIncoming": {
|
|
7732
|
-
"light": "{
|
|
7733
|
-
"dark": "{
|
|
7732
|
+
"light": "{colorTextBodyDefault}",
|
|
7733
|
+
"dark": "{colorTextBodyDefault}"
|
|
7734
7734
|
},
|
|
7735
7735
|
"colorBorderButtonNormalActive": {
|
|
7736
7736
|
"light": "{colorTextButtonNormalHover}",
|
|
@@ -8809,16 +8809,16 @@ module.exports.preset = {
|
|
|
8809
8809
|
"dark": "transparent"
|
|
8810
8810
|
},
|
|
8811
8811
|
"colorBackgroundChatBubbleIncoming": {
|
|
8812
|
-
"light": "{
|
|
8813
|
-
"dark": "{
|
|
8812
|
+
"light": "{colorGrey900}",
|
|
8813
|
+
"dark": "{colorGrey900}"
|
|
8814
8814
|
},
|
|
8815
8815
|
"colorTextChatBubbleOutgoing": {
|
|
8816
|
-
"light": "{
|
|
8817
|
-
"dark": "{
|
|
8816
|
+
"light": "{colorTextBodyDefault}",
|
|
8817
|
+
"dark": "{colorTextBodyDefault}"
|
|
8818
8818
|
},
|
|
8819
8819
|
"colorTextChatBubbleIncoming": {
|
|
8820
|
-
"light": "{
|
|
8821
|
-
"dark": "{
|
|
8820
|
+
"light": "{colorTextBodyDefault}",
|
|
8821
|
+
"dark": "{colorTextBodyDefault}"
|
|
8822
8822
|
},
|
|
8823
8823
|
"colorBorderButtonNormalActive": {
|
|
8824
8824
|
"light": "{colorTextButtonNormalHover}",
|
|
@@ -11752,9 +11752,9 @@ module.exports.preset = {
|
|
|
11752
11752
|
"colorTextAvatar": "--color-text-avatar-jddpvm",
|
|
11753
11753
|
"colorBackgroundLoadingBarGenAi": "--color-background-loading-bar-gen-ai-7qfi9s",
|
|
11754
11754
|
"colorBackgroundChatBubbleOutgoing": "--color-background-chat-bubble-outgoing-pfqan2",
|
|
11755
|
-
"colorBackgroundChatBubbleIncoming": "--color-background-chat-bubble-incoming-
|
|
11756
|
-
"colorTextChatBubbleOutgoing": "--color-text-chat-bubble-outgoing-
|
|
11757
|
-
"colorTextChatBubbleIncoming": "--color-text-chat-bubble-incoming-
|
|
11755
|
+
"colorBackgroundChatBubbleIncoming": "--color-background-chat-bubble-incoming-ljtp6c",
|
|
11756
|
+
"colorTextChatBubbleOutgoing": "--color-text-chat-bubble-outgoing-bvbr0v",
|
|
11757
|
+
"colorTextChatBubbleIncoming": "--color-text-chat-bubble-incoming-x2kig8",
|
|
11758
11758
|
"colorBorderButtonNormalActive": "--color-border-button-normal-active-mn0ayd",
|
|
11759
11759
|
"colorBorderButtonNormalDefault": "--color-border-button-normal-default-uzqi0v",
|
|
11760
11760
|
"colorBorderToggleButtonNormalPressed": "--color-border-toggle-button-normal-pressed-lylxt2",
|