@vonage/vivid 4.24.0 → 4.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +12314 -4711
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +112 -150
- package/index.js +37 -35
- package/lib/accordion-item/accordion-item.d.ts +6 -0
- package/lib/action-group/action-group.d.ts +6 -0
- package/lib/alert/alert.d.ts +20 -0
- package/lib/audio-player/audio-player.d.ts +6 -0
- package/lib/badge/badge.d.ts +9 -1
- package/lib/banner/banner.d.ts +25 -0
- package/lib/breadcrumb/breadcrumb.d.ts +6 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +63 -7
- package/lib/button/button.d.ts +732 -7
- package/lib/button/locale.d.ts +3 -0
- package/lib/calendar-event/calendar-event.d.ts +6 -0
- package/lib/card/card.d.ts +394 -2
- package/lib/card/card.template.d.ts +2 -1
- package/lib/checkbox/checkbox.d.ts +1822 -5
- package/lib/combobox/combobox.d.ts +1827 -20
- package/lib/data-grid/data-grid-cell.d.ts +339 -1
- package/lib/data-grid/locale.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +1676 -207
- package/lib/date-range-picker/date-range-picker.d.ts +840 -107
- package/lib/date-time-picker/date-time-picker.d.ts +1678 -209
- package/lib/dial-pad/dial-pad.d.ts +8 -0
- package/lib/dialog/dialog.d.ts +12 -0
- package/lib/divider/divider.d.ts +6 -0
- package/lib/fab/fab.d.ts +6 -0
- package/lib/file-picker/file-picker.d.ts +1508 -30
- package/lib/header/header.d.ts +6 -0
- package/lib/icon/icon.d.ts +1 -0
- package/lib/icon/icon.template.d.ts +2 -1
- package/lib/menu/menu.d.ts +16 -7
- package/lib/menu/name.d.ts +1 -0
- package/lib/menu-item/menu-item.d.ts +14 -2
- package/lib/nav/nav.d.ts +6 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +13 -0
- package/lib/nav-item/nav-item.d.ts +405 -3
- package/lib/note/note.d.ts +6 -0
- package/lib/number-field/number-field.d.ts +1857 -36
- package/lib/option/option.d.ts +12 -0
- package/lib/progress/progress.d.ts +6 -0
- package/lib/progress-ring/progress-ring.d.ts +6 -0
- package/lib/radio/radio.d.ts +1137 -4
- package/lib/radio-group/radio-group.d.ts +20 -2
- package/lib/range-slider/range-slider.d.ts +752 -5
- package/lib/rich-text-editor/definition.d.ts +2 -2
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +3 -1
- package/lib/rich-text-editor/locale.d.ts +1 -0
- package/lib/rich-text-editor/menubar/menubar.d.ts +6 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +352 -2
- package/lib/searchable-select/option-tag.d.ts +6 -0
- package/lib/searchable-select/searchable-select.d.ts +1857 -36
- package/lib/select/select.d.ts +1843 -28
- package/lib/selectable-box/selectable-box.d.ts +6 -0
- package/lib/slider/slider.d.ts +384 -2
- package/lib/split-button/split-button.d.ts +18 -0
- package/lib/switch/switch.d.ts +386 -3
- package/lib/tab/tab.d.ts +18 -1
- package/lib/tab-panel/tab-panel.d.ts +6 -0
- package/lib/tag/tag.d.ts +12 -0
- package/lib/tag-group/tag-group.d.ts +6 -0
- package/lib/text-area/text-area.d.ts +2174 -19
- package/lib/text-field/text-field.d.ts +2195 -31
- package/lib/time-picker/time-picker.d.ts +839 -106
- package/lib/toggletip/toggletip.d.ts +10 -4
- package/lib/tooltip/tooltip.d.ts +10 -4
- package/lib/tree-item/tree-item.d.ts +12 -0
- package/lib/tree-view/tree-view.d.ts +6 -0
- package/lib/video-player/video-player.d.ts +6 -0
- package/lib/visually-hidden/definition.d.ts +4 -0
- package/lib/visually-hidden/visually-hidden.d.ts +3 -0
- package/lib/visually-hidden/visually-hidden.template.d.ts +3 -0
- package/locales/de-DE.cjs +33 -1
- package/locales/de-DE.js +33 -1
- package/locales/en-GB.cjs +33 -1
- package/locales/en-GB.js +33 -1
- package/locales/en-US.cjs +33 -1
- package/locales/en-US.js +33 -1
- package/locales/ja-JP.cjs +33 -1
- package/locales/ja-JP.js +33 -1
- package/locales/zh-CN.cjs +33 -1
- package/locales/zh-CN.js +33 -1
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/affix.cjs +13 -7
- package/shared/affix.js +13 -8
- package/shared/aria/delegates-aria.d.ts +6 -0
- package/shared/aria/host-semantics.d.ts +6 -0
- package/shared/breadcrumb-item.cjs +2 -5
- package/shared/breadcrumb-item.js +2 -5
- package/shared/button.cjs +13 -11
- package/shared/button.js +13 -11
- package/shared/calendar-picker.template.cjs +3 -3
- package/shared/calendar-picker.template.js +1 -1
- package/shared/char-count.cjs +92 -0
- package/shared/char-count.js +90 -0
- package/shared/definition.js +1 -1
- package/shared/definition10.js +1 -1
- package/shared/definition11.cjs +27 -44
- package/shared/definition11.js +28 -45
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +1 -1
- package/shared/definition14.cjs +53 -22
- package/shared/definition14.js +54 -23
- package/shared/definition15.cjs +31 -36
- package/shared/definition15.js +30 -36
- package/shared/definition16.cjs +43 -63
- package/shared/definition16.js +42 -63
- package/shared/definition17.cjs +8 -4
- package/shared/definition17.js +8 -4
- package/shared/definition18.cjs +10 -14
- package/shared/definition18.js +9 -14
- package/shared/definition19.cjs +85 -100
- package/shared/definition19.js +75 -91
- package/shared/definition2.js +1 -1
- package/shared/definition20.cjs +15 -20
- package/shared/definition20.js +14 -20
- package/shared/definition21.cjs +22 -3
- package/shared/definition21.js +23 -4
- package/shared/definition22.cjs +4 -4
- package/shared/definition22.js +5 -5
- package/shared/definition23.cjs +5 -38
- package/shared/definition23.js +5 -37
- package/shared/definition24.cjs +2 -7
- package/shared/definition24.js +3 -8
- package/shared/definition25.js +1 -1
- package/shared/definition26.cjs +157 -171
- package/shared/definition26.js +156 -171
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +2 -2
- package/shared/definition28.cjs +32 -17
- package/shared/definition28.js +33 -18
- package/shared/definition29.js +1 -1
- package/shared/definition3.js +1 -1
- package/shared/definition30.cjs +96 -482
- package/shared/definition30.js +99 -482
- package/shared/definition31.cjs +334 -57
- package/shared/definition31.js +333 -56
- package/shared/definition32.cjs +104 -19
- package/shared/definition32.js +105 -20
- package/shared/definition33.cjs +67 -15
- package/shared/definition33.js +66 -14
- package/shared/definition34.cjs +15 -50
- package/shared/definition34.js +14 -49
- package/shared/definition35.cjs +28 -397
- package/shared/definition35.js +27 -397
- package/shared/definition36.cjs +404 -54
- package/shared/definition36.js +404 -55
- package/shared/definition37.cjs +57 -234
- package/shared/definition37.js +57 -233
- package/shared/definition38.cjs +221 -66
- package/shared/definition38.js +220 -65
- package/shared/definition39.cjs +52 -44
- package/shared/definition39.js +51 -43
- package/shared/definition4.cjs +31 -24
- package/shared/definition4.js +33 -26
- package/shared/definition40.cjs +56 -266
- package/shared/definition40.js +55 -265
- package/shared/definition41.cjs +285 -142
- package/shared/definition41.js +285 -142
- package/shared/definition42.cjs +156 -564
- package/shared/definition42.js +156 -565
- package/shared/definition43.cjs +554 -14378
- package/shared/definition43.js +553 -14377
- package/shared/definition44.cjs +14418 -1155
- package/shared/definition44.js +14417 -1156
- package/shared/definition45.cjs +1049 -677
- package/shared/definition45.js +1050 -678
- package/shared/definition46.cjs +848 -113
- package/shared/definition46.js +847 -112
- package/shared/definition47.cjs +125 -90
- package/shared/definition47.js +124 -89
- package/shared/definition48.cjs +88 -455
- package/shared/definition48.js +87 -454
- package/shared/definition49.cjs +466 -109
- package/shared/definition49.js +466 -109
- package/shared/definition5.cjs +8 -7
- package/shared/definition5.js +6 -5
- package/shared/definition50.cjs +106 -106
- package/shared/definition50.js +105 -105
- package/shared/definition51.cjs +136 -15
- package/shared/definition51.js +135 -14
- package/shared/definition52.cjs +16 -115
- package/shared/definition52.js +15 -114
- package/shared/definition53.cjs +78 -412
- package/shared/definition53.js +77 -410
- package/shared/definition54.cjs +445 -23
- package/shared/definition54.js +443 -22
- package/shared/definition55.cjs +22 -136
- package/shared/definition55.js +21 -135
- package/shared/definition56.cjs +95 -291
- package/shared/definition56.js +95 -292
- package/shared/definition57.cjs +192 -480
- package/shared/definition57.js +190 -479
- package/shared/definition58.cjs +411 -24
- package/shared/definition58.js +410 -24
- package/shared/definition59.cjs +27 -144
- package/shared/definition59.js +27 -143
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +83 -54
- package/shared/definition60.js +82 -53
- package/shared/definition61.cjs +78 -166
- package/shared/definition61.js +77 -164
- package/shared/definition62.cjs +143 -232
- package/shared/definition62.js +141 -231
- package/shared/definition63.cjs +234 -69417
- package/shared/definition63.js +233 -69416
- package/shared/definition64.cjs +69454 -28
- package/shared/definition64.js +69453 -27
- package/shared/definition65.cjs +28 -2168
- package/shared/definition65.js +27 -2166
- package/shared/definition66.cjs +27 -0
- package/shared/definition66.js +23 -0
- package/shared/definition67.cjs +2195 -0
- package/shared/definition67.js +2190 -0
- package/shared/definition7.cjs +11 -2
- package/shared/definition7.js +12 -3
- package/shared/definition8.cjs +24 -11
- package/shared/definition8.js +26 -13
- package/shared/definition9.cjs +1 -2
- package/shared/definition9.js +2 -3
- package/shared/delegates-aria.js +1 -1
- package/shared/deprecation/replaced-props.d.ts +20 -0
- package/shared/divider.cjs +41 -0
- package/shared/divider.js +38 -0
- package/shared/feedback/feedback-message.d.ts +345 -0
- package/shared/feedback/locale.d.ts +4 -0
- package/{lib/text-anchor/text-anchor.d.ts → shared/feedback/mixins.d.ts} +62 -39
- package/shared/form-associated.cjs +124 -100
- package/shared/form-associated.js +125 -101
- package/shared/form-element.cjs +84 -0
- package/shared/form-element.js +82 -0
- package/shared/foundation/button/button.d.ts +378 -2
- package/shared/foundation/form-associated/form-associated.d.ts +753 -49
- package/shared/foundation/listbox/listbox.d.ts +1 -1
- package/shared/foundation/vivid-element/vivid-element.d.ts +14 -0
- package/shared/host-semantics.js +1 -1
- package/shared/key-codes.js +1 -1
- package/shared/linkable.cjs +70 -0
- package/shared/linkable.js +68 -0
- package/shared/localization/Locale.d.ts +14 -0
- package/shared/mixins.cjs +306 -0
- package/shared/mixins.js +300 -0
- package/shared/patterns/affix.d.ts +16 -1
- package/shared/patterns/anchored.d.ts +20 -8
- package/shared/patterns/char-count/char-count.d.ts +351 -0
- package/shared/patterns/char-count/index.d.ts +1 -0
- package/shared/patterns/char-count/locale.d.ts +4 -0
- package/shared/patterns/form-elements/form-element.d.ts +744 -0
- package/shared/patterns/form-elements/index.d.ts +3 -1
- package/shared/patterns/form-elements/with-error-text.d.ts +1122 -0
- package/shared/patterns/form-elements/with-success-text.d.ts +341 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/patterns/linkable.d.ts +394 -0
- package/shared/patterns/localized.d.ts +6 -0
- package/shared/patterns/trapped-focus.d.ts +6 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +420 -52
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +420 -52
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +6 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +843 -107
- package/shared/picker-field/mixins/single-date-picker.d.ts +1259 -155
- package/shared/picker-field/mixins/single-value-picker.d.ts +417 -49
- package/shared/picker-field/mixins/time-selection-picker.d.ts +842 -106
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +839 -103
- package/shared/picker-field/picker-field.d.ts +1491 -15
- package/shared/picker-field.template.cjs +13 -22
- package/shared/picker-field.template.js +14 -23
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +1 -1
- package/shared/slider.template.js +1 -1
- package/shared/time-selection-picker.template.cjs +10 -15
- package/shared/time-selection-picker.template.js +10 -16
- package/shared/vivid-element.cjs +53 -4
- package/shared/vivid-element.js +53 -3
- package/shared/with-error-text.cjs +56 -0
- package/shared/with-error-text.js +54 -0
- package/shared/with-success-text.cjs +23 -0
- package/shared/with-success-text.js +21 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/visually-hidden/index.cjs +5 -0
- package/visually-hidden/index.js +3 -0
- package/vivid.api.json +744 -1490
- package/lib/checkbox/checkbox.form-associated.d.ts +0 -11
- package/lib/file-picker/file-picker.form-associated.d.ts +0 -11
- package/lib/number-field/number-field.form-associated.d.ts +0 -11
- package/lib/radio/radio.form-associated.d.ts +0 -13
- package/lib/range-slider/range-slider.form-associated.d.ts +0 -11
- package/lib/searchable-select/searchable-select.form-associated.d.ts +0 -11
- package/lib/select/select.form-associated.d.ts +0 -11
- package/lib/slider/slider.form-associated.d.ts +0 -11
- package/lib/switch/switch.form-associated.d.ts +0 -11
- package/lib/text-anchor/definition.d.ts +0 -2
- package/lib/text-anchor/text-anchor.template.d.ts +0 -3
- package/lib/text-area/text-area.form-associated.d.ts +0 -11
- package/lib/text-field/text-field.form-associated.d.ts +0 -11
- package/shared/anchor.cjs +0 -49
- package/shared/anchor.js +0 -47
- package/shared/apply-mixins.cjs +0 -23
- package/shared/apply-mixins.js +0 -21
- package/shared/applyMixinsWithObservables.cjs +0 -15
- package/shared/applyMixinsWithObservables.js +0 -13
- package/shared/direction.cjs +0 -17
- package/shared/direction.js +0 -15
- package/shared/form-elements.cjs +0 -209
- package/shared/form-elements.js +0 -202
- package/shared/foundation/anchor/anchor.d.ts +0 -11
- package/shared/foundation/utilities/apply-mixins.d.ts +0 -1
- package/shared/patterns/form-elements/form-elements.d.ts +0 -58
- package/shared/picker-field/picker-field.form-associated.d.ts +0 -11
- package/shared/text-anchor.cjs +0 -38
- package/shared/text-anchor.js +0 -36
- package/shared/text-anchor.template.cjs +0 -35
- package/shared/text-anchor.template.js +0 -33
- package/shared/utils/applyMixinsWithObservables.d.ts +0 -1
- package/text-anchor/index.cjs +0 -17
- package/text-anchor/index.js +0 -15
package/shared/definition26.cjs
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
const definition$1 = require('./definition28.cjs');
|
|
4
4
|
const definition = require('./definition11.cjs');
|
|
5
5
|
const vividElement = require('./vivid-element.cjs');
|
|
6
|
+
const mixins = require('./mixins.cjs');
|
|
6
7
|
const delegatesAria = require('./delegates-aria.cjs');
|
|
7
|
-
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
8
8
|
const formAssociated = require('./form-associated.cjs');
|
|
9
|
+
const withErrorText = require('./with-error-text.cjs');
|
|
10
|
+
const formElement = require('./form-element.cjs');
|
|
9
11
|
const localized = require('./localized.cjs');
|
|
10
|
-
const formElements = require('./form-elements.cjs');
|
|
11
12
|
const when = require('./when.cjs');
|
|
12
13
|
const ref = require('./ref.cjs');
|
|
13
14
|
const classNames = require('./class-names.cjs');
|
|
14
15
|
|
|
15
|
-
const styles = ":host{display:block;max-inline-size:400px}.base{display:flex;flex-direction:column;block-size:inherit;max-block-size:inherit}.control{display:flex;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;padding:16px;border:1px dashed var(--vvd-color-neutral-400);border-radius:8px;background-color:var(--vvd-color-cta-50);color:var(--vvd-color-neutral-600);cursor:pointer;font:var(--vvd-typography-base);gap:8px;inline-size:100%;min-block-size:52px;outline:none;transition:all .3s ease}.control:not(.size-expanded){min-block-size:52px}.control.size-expanded{min-block-size:120px}.control:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.control:hover,.control:active,.control:focus-visible{background-color:var(--vvd-color-cta-100)}.main{pointer-events:none}.dz-preview{display:grid;box-sizing:border-box;padding:8px;border:1px solid var(--vvd-color-neutral-300);border-radius:8px;background-color:var(--file-picker-list-item-background-color, var(--vvd-color-canvas));grid-template-columns:1fr auto;grid-template-rows:auto auto;inline-size:100%}.dz-preview .dz-details{display:flex;min-width:0;flex-direction:column;max-inline-size:100%}.dz-preview .dz-details .dz-filename{overflow:hidden;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);text-overflow:ellipsis;white-space:nowrap}.dz-preview .dz-details .dz-size{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base-condensed)}.dz-preview .dz-error-message{display:flex;align-items:center;color:var(--vvd-color-alert-600);font:var(--vvd-typography-base-condensed-bold);gap:4px;margin-block-start:4px}.dz-preview:not(.dz-error) .dz-error-message{display:none}.dz-preview.dz-error{border:1px solid var(--vvd-color-alert-500);background-color:var(--vvd-color-alert-50)}.dz-preview.dz-error .dz-details .dz-size,.dz-preview.dz-error .dz-progress{display:none}.dz-preview .remove-btn{display:inline;align-self:center;grid-column:2/-1;grid-row:1/-1}.
|
|
16
|
+
const styles = ":host{display:block;max-inline-size:400px}.base{display:flex;flex-direction:column;block-size:inherit;max-block-size:inherit;--_low-ink-color: var(--vvd-color-neutral-600)}.control-wrapper{display:flex;flex-direction:column;block-size:inherit;gap:4px;max-block-size:inherit}.control{display:flex;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;padding:16px;border:1px dashed var(--vvd-color-neutral-400);border-radius:8px;background-color:var(--vvd-color-cta-50);color:var(--vvd-color-neutral-600);cursor:pointer;font:var(--vvd-typography-base);gap:8px;inline-size:100%;min-block-size:52px;outline:none;transition:all .3s ease}.control:not(.size-expanded){min-block-size:52px}.control.size-expanded{min-block-size:120px}.control:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.control:hover,.control:active,.control:focus-visible{background-color:var(--vvd-color-cta-100)}.main{pointer-events:none}.dz-preview{display:grid;box-sizing:border-box;padding:8px;border:1px solid var(--vvd-color-neutral-300);border-radius:8px;background-color:var(--file-picker-list-item-background-color, var(--vvd-color-canvas));grid-template-columns:1fr auto;grid-template-rows:auto auto;inline-size:100%}.dz-preview .dz-details{display:flex;min-width:0;flex-direction:column;max-inline-size:100%}.dz-preview .dz-details .dz-filename{overflow:hidden;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base);text-overflow:ellipsis;white-space:nowrap}.dz-preview .dz-details .dz-size{color:var(--vvd-color-neutral-600);font:var(--vvd-typography-base-condensed)}.dz-preview .dz-error-message{display:flex;align-items:center;color:var(--vvd-color-alert-600);font:var(--vvd-typography-base-condensed-bold);gap:4px;margin-block-start:4px}.dz-preview:not(.dz-error) .dz-error-message{display:none}.dz-preview.dz-error{border:1px solid var(--vvd-color-alert-500);background-color:var(--vvd-color-alert-50)}.dz-preview.dz-error .dz-details .dz-size,.dz-preview.dz-error .dz-progress{display:none}.dz-preview .remove-btn{display:inline;align-self:center;grid-column:2/-1;grid-row:1/-1}.preview-list{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.preview-list{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.preview-list ::-webkit-scrollbar{width:4px}.preview-list ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.preview-list ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.preview-list{display:flex;flex-direction:column;gap:12px;margin-block-start:12px;overflow-y:auto}.preview-list:empty{display:none}";
|
|
16
17
|
|
|
17
18
|
var objectExtend = extend;
|
|
18
19
|
|
|
@@ -2140,34 +2141,15 @@ function $3ed269f2f0fb224b$var$__guardMethod__(obj, methodName, transform) {
|
|
|
2140
2141
|
else return undefined;
|
|
2141
2142
|
}
|
|
2142
2143
|
|
|
2143
|
-
class _FilePicker extends vividElement.VividElement {
|
|
2144
|
-
}
|
|
2145
|
-
class FormAssociatedFilePicker extends formAssociated.FormAssociated(_FilePicker) {
|
|
2146
|
-
constructor() {
|
|
2147
|
-
super(...arguments);
|
|
2148
|
-
this.proxy = document.createElement("input");
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
2144
|
var __defProp = Object.defineProperty;
|
|
2153
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2154
|
-
var __typeError = (msg) => {
|
|
2155
|
-
throw TypeError(msg);
|
|
2156
|
-
};
|
|
2157
2145
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
2158
|
-
var result =
|
|
2146
|
+
var result = void 0 ;
|
|
2159
2147
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2160
2148
|
if (decorator = decorators[i])
|
|
2161
|
-
result = (
|
|
2162
|
-
if (
|
|
2149
|
+
result = (decorator(target, key, result) ) || result;
|
|
2150
|
+
if (result) __defProp(target, key, result);
|
|
2163
2151
|
return result;
|
|
2164
2152
|
};
|
|
2165
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
2166
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2167
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2168
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
2169
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
2170
|
-
var _dropzone, _FilePicker_instances, syncSingleFileState_fn, _localizeErrorMessage, _localizeFileSizeNumberAndUnits, addRemoveButtonToFilesPreview_fn, chooseFile_fn, updateHiddenFileInput_fn, keepOnlyNewestFile_fn, handleFilesChanged_fn, updateFormValue_fn, setValueToAFakePathLikeNativeInput_fn, getCustomValidationError_fn, formatNumbersInMessage_fn;
|
|
2171
2153
|
const isFormAssociatedTryingToSetFormValueToFakePath = (value) => typeof value === "string";
|
|
2172
2154
|
const generateFilePreviewTemplate = (buttonTag, iconTag, locale) => {
|
|
2173
2155
|
return `<div class="dz-preview dz-file-preview">
|
|
@@ -2182,13 +2164,13 @@ const generateFilePreviewTemplate = (buttonTag, iconTag, locale) => {
|
|
|
2182
2164
|
<${buttonTag} class="remove-btn" icon="delete-line" appearance="ghost-light" size="condensed" aria-label="${locale.filePicker.removeFileLabel}"></${buttonTag}>
|
|
2183
2165
|
</div>`;
|
|
2184
2166
|
};
|
|
2185
|
-
|
|
2186
|
-
|
|
2167
|
+
class FilePicker extends mixins.WithFeedback(
|
|
2168
|
+
withErrorText.WithErrorText(
|
|
2169
|
+
formElement.FormElement(delegatesAria.DelegatesAria(localized.Localized(formAssociated.FormAssociated(vividElement.VividElement))))
|
|
2170
|
+
)
|
|
2187
2171
|
) {
|
|
2188
2172
|
constructor() {
|
|
2189
2173
|
super();
|
|
2190
|
-
__privateAdd(this, _FilePicker_instances);
|
|
2191
|
-
__privateAdd(this, _dropzone);
|
|
2192
2174
|
this.singleFile = false;
|
|
2193
2175
|
this.maxFileSize = 256;
|
|
2194
2176
|
/**
|
|
@@ -2208,7 +2190,7 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2208
2190
|
* Used internally to hold the tag that icon is registered at.
|
|
2209
2191
|
*/
|
|
2210
2192
|
this.iconTag = "vwc-icon";
|
|
2211
|
-
|
|
2193
|
+
this.#localizeErrorMessage = (file, message) => {
|
|
2212
2194
|
if (file.previewElement) {
|
|
2213
2195
|
file.previewElement.classList.add("dz-error");
|
|
2214
2196
|
if (typeof message !== "string" && message.error) {
|
|
@@ -2217,15 +2199,21 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2217
2199
|
for (const node of file.previewElement.querySelectorAll(
|
|
2218
2200
|
"[data-dz-errormessage]"
|
|
2219
2201
|
)) {
|
|
2220
|
-
node.textContent =
|
|
2202
|
+
node.textContent = this.#formatNumbersInMessage(message);
|
|
2221
2203
|
}
|
|
2222
2204
|
}
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
return
|
|
2205
|
+
};
|
|
2206
|
+
this.#localizeFileSizeNumberAndUnits = () => {
|
|
2207
|
+
this.#dropzone.filesize = (size) => {
|
|
2208
|
+
return this.#formatNumbersInMessage(
|
|
2209
|
+
$3ed269f2f0fb224b$export$2e2bcd8739ae039.prototype.filesize.call(this.#dropzone, size)
|
|
2210
|
+
);
|
|
2227
2211
|
};
|
|
2228
|
-
}
|
|
2212
|
+
};
|
|
2213
|
+
/**
|
|
2214
|
+
* @internal
|
|
2215
|
+
*/
|
|
2216
|
+
this.proxy = document.createElement("input");
|
|
2229
2217
|
this.setFormValue = (value, state) => {
|
|
2230
2218
|
if (isFormAssociatedTryingToSetFormValueToFakePath(value)) {
|
|
2231
2219
|
return;
|
|
@@ -2234,13 +2222,14 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2234
2222
|
};
|
|
2235
2223
|
$3ed269f2f0fb224b$export$2e2bcd8739ae039.autoDiscover = false;
|
|
2236
2224
|
}
|
|
2225
|
+
#dropzone;
|
|
2237
2226
|
/**
|
|
2238
2227
|
* Files that have been added to the file picker and passed validation.
|
|
2239
2228
|
*
|
|
2240
2229
|
* @public
|
|
2241
2230
|
*/
|
|
2242
2231
|
get files() {
|
|
2243
|
-
return
|
|
2232
|
+
return this.#dropzone?.getAcceptedFiles() ?? [];
|
|
2244
2233
|
}
|
|
2245
2234
|
/**
|
|
2246
2235
|
* Files that have been rejected by the file picker for failing validation.
|
|
@@ -2248,45 +2237,71 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2248
2237
|
* @public
|
|
2249
2238
|
*/
|
|
2250
2239
|
get rejectedFiles() {
|
|
2251
|
-
return
|
|
2240
|
+
return this.#dropzone?.getRejectedFiles() ?? [];
|
|
2241
|
+
}
|
|
2242
|
+
#syncSingleFileState() {
|
|
2243
|
+
if (this.singleFile) {
|
|
2244
|
+
this.#dropzone?.hiddenFileInput?.removeAttribute("multiple");
|
|
2245
|
+
} else {
|
|
2246
|
+
this.#dropzone?.hiddenFileInput?.setAttribute("multiple", "multiple");
|
|
2247
|
+
}
|
|
2252
2248
|
}
|
|
2253
2249
|
singleFileChanged() {
|
|
2254
|
-
|
|
2250
|
+
this.#syncSingleFileState();
|
|
2255
2251
|
}
|
|
2256
2252
|
maxFilesChanged(_oldValue, newValue) {
|
|
2257
|
-
if (!
|
|
2253
|
+
if (!this.#dropzone) {
|
|
2258
2254
|
return;
|
|
2259
2255
|
}
|
|
2260
|
-
|
|
2261
|
-
|
|
2256
|
+
this.#dropzone.options.maxFiles = newValue;
|
|
2257
|
+
this.#updateHiddenFileInput();
|
|
2262
2258
|
}
|
|
2263
2259
|
maxFileSizeChanged(_oldValue, newValue) {
|
|
2264
|
-
if (!
|
|
2260
|
+
if (!this.#dropzone) {
|
|
2265
2261
|
return;
|
|
2266
2262
|
}
|
|
2267
|
-
|
|
2263
|
+
this.#dropzone.options.maxFilesize = newValue;
|
|
2268
2264
|
}
|
|
2269
2265
|
acceptChanged(_oldValue, newValue) {
|
|
2270
|
-
if (!
|
|
2266
|
+
if (!this.#dropzone) {
|
|
2271
2267
|
return;
|
|
2272
2268
|
}
|
|
2273
|
-
|
|
2269
|
+
this.#dropzone.options.acceptedFiles = newValue;
|
|
2274
2270
|
}
|
|
2275
2271
|
invalidFileTypeErrorChanged(_oldValue, newValue) {
|
|
2276
|
-
if (
|
|
2277
|
-
|
|
2272
|
+
if (this.#dropzone)
|
|
2273
|
+
this.#dropzone.options.dictInvalidFileType = newValue || this.locale.filePicker.invalidFileTypeError;
|
|
2278
2274
|
}
|
|
2279
2275
|
maxFilesExceededErrorChanged(_oldValue, newValue) {
|
|
2280
|
-
if (
|
|
2281
|
-
|
|
2276
|
+
if (this.#dropzone)
|
|
2277
|
+
this.#dropzone.options.dictMaxFilesExceeded = newValue || this.locale.filePicker.maxFilesExceededError;
|
|
2282
2278
|
}
|
|
2283
2279
|
fileTooBigErrorChanged(_oldValue, newValue) {
|
|
2284
|
-
if (
|
|
2285
|
-
|
|
2280
|
+
if (this.#dropzone)
|
|
2281
|
+
this.#dropzone.options.dictFileTooBig = newValue || this.locale.filePicker.fileTooBigError;
|
|
2286
2282
|
}
|
|
2287
2283
|
nameChanged(previous, next) {
|
|
2288
2284
|
super.nameChanged(previous, next);
|
|
2289
|
-
|
|
2285
|
+
this.#updateFormValue();
|
|
2286
|
+
}
|
|
2287
|
+
#localizeErrorMessage;
|
|
2288
|
+
#localizeFileSizeNumberAndUnits;
|
|
2289
|
+
#addRemoveButtonToFilesPreview() {
|
|
2290
|
+
this.#dropzone.on("addedfiles", (files) => {
|
|
2291
|
+
for (const file of files) {
|
|
2292
|
+
if (file.previewElement) {
|
|
2293
|
+
const removeButton = file.previewElement.querySelector(
|
|
2294
|
+
".remove-btn"
|
|
2295
|
+
);
|
|
2296
|
+
removeButton.addEventListener("click", (e) => {
|
|
2297
|
+
e.preventDefault();
|
|
2298
|
+
e.stopPropagation();
|
|
2299
|
+
this.#dropzone.removeFile(file);
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
this.#handleFilesChanged();
|
|
2304
|
+
});
|
|
2290
2305
|
}
|
|
2291
2306
|
connectedCallback() {
|
|
2292
2307
|
super.connectedCallback();
|
|
@@ -2296,7 +2311,7 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2296
2311
|
const previewList = this.shadowRoot.querySelector(
|
|
2297
2312
|
".preview-list"
|
|
2298
2313
|
);
|
|
2299
|
-
|
|
2314
|
+
this.#dropzone = new $3ed269f2f0fb224b$export$2e2bcd8739ae039(control, {
|
|
2300
2315
|
url: "/",
|
|
2301
2316
|
// dummy url, we do not use dropzone's upload functionality
|
|
2302
2317
|
maxFiles: this.maxFiles ?? null,
|
|
@@ -2314,18 +2329,18 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2314
2329
|
dictInvalidFileType: this.invalidFileTypeError || this.locale.filePicker.invalidFileTypeError,
|
|
2315
2330
|
dictMaxFilesExceeded: this.maxFilesExceededError || this.locale.filePicker.maxFilesExceededError,
|
|
2316
2331
|
dictFileTooBig: this.fileTooBigError || this.locale.filePicker.fileTooBigError,
|
|
2317
|
-
error:
|
|
2318
|
-
}));
|
|
2319
|
-
__privateGet(this, _localizeFileSizeNumberAndUnits).call(this);
|
|
2320
|
-
__privateMethod(this, _FilePicker_instances, addRemoveButtonToFilesPreview_fn).call(this);
|
|
2321
|
-
__privateGet(this, _dropzone).on("removedfile", () => {
|
|
2322
|
-
__privateMethod(this, _FilePicker_instances, handleFilesChanged_fn).call(this);
|
|
2332
|
+
error: this.#localizeErrorMessage
|
|
2323
2333
|
});
|
|
2324
|
-
|
|
2334
|
+
this.#localizeFileSizeNumberAndUnits();
|
|
2335
|
+
this.#addRemoveButtonToFilesPreview();
|
|
2336
|
+
this.#dropzone.on("removedfile", () => {
|
|
2337
|
+
this.#handleFilesChanged();
|
|
2338
|
+
});
|
|
2339
|
+
this.#syncSingleFileState();
|
|
2325
2340
|
}
|
|
2326
2341
|
disconnectedCallback() {
|
|
2327
2342
|
super.disconnectedCallback();
|
|
2328
|
-
|
|
2343
|
+
this.#dropzone.destroy();
|
|
2329
2344
|
}
|
|
2330
2345
|
/**
|
|
2331
2346
|
* Used internally to set the button tag.
|
|
@@ -2346,137 +2361,104 @@ exports.FilePicker = class FilePicker extends delegatesAria.DelegatesAria(
|
|
|
2346
2361
|
*/
|
|
2347
2362
|
handleKeydown(e) {
|
|
2348
2363
|
if (e.key === "Enter" || e.key === " ") {
|
|
2349
|
-
|
|
2364
|
+
this.#chooseFile();
|
|
2350
2365
|
}
|
|
2351
2366
|
return true;
|
|
2352
2367
|
}
|
|
2368
|
+
#chooseFile() {
|
|
2369
|
+
if (this.#dropzone.hiddenFileInput) {
|
|
2370
|
+
this.#dropzone.hiddenFileInput.click();
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
#updateHiddenFileInput() {
|
|
2374
|
+
this.#dropzone.hiddenFileInput.dispatchEvent(
|
|
2375
|
+
new Event("change", { bubbles: false })
|
|
2376
|
+
);
|
|
2377
|
+
}
|
|
2378
|
+
#keepOnlyNewestFile() {
|
|
2379
|
+
for (let i = 0; i < this.files.length - 1; i++) {
|
|
2380
|
+
this.#dropzone.removeFile(this.files[i]);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
#handleFilesChanged() {
|
|
2384
|
+
if (this.singleFile && this.files.length >= 1) {
|
|
2385
|
+
this.#keepOnlyNewestFile();
|
|
2386
|
+
}
|
|
2387
|
+
this.$emit("change");
|
|
2388
|
+
this.#updateFormValue();
|
|
2389
|
+
this.validate();
|
|
2390
|
+
requestAnimationFrame(() => this.#syncSingleFileState());
|
|
2391
|
+
}
|
|
2392
|
+
#updateFormValue() {
|
|
2393
|
+
const files = this.files;
|
|
2394
|
+
if (!this.name) {
|
|
2395
|
+
this.setFormValue(null);
|
|
2396
|
+
} else {
|
|
2397
|
+
const formData = new FormData();
|
|
2398
|
+
for (const file of files) {
|
|
2399
|
+
formData.append(this.name, file);
|
|
2400
|
+
}
|
|
2401
|
+
this.setFormValue(formData);
|
|
2402
|
+
}
|
|
2403
|
+
this.#setValueToAFakePathLikeNativeInput();
|
|
2404
|
+
}
|
|
2405
|
+
#setValueToAFakePathLikeNativeInput() {
|
|
2406
|
+
this.value = this.files.length > 0 ? `C:\\fakepath\\${this.files[0].name}` : "";
|
|
2407
|
+
}
|
|
2408
|
+
#getCustomValidationError() {
|
|
2409
|
+
if (this.rejectedFiles.length > 0) {
|
|
2410
|
+
return this.locale.filePicker.invalidFilesError;
|
|
2411
|
+
}
|
|
2412
|
+
return null;
|
|
2413
|
+
}
|
|
2353
2414
|
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
2354
2415
|
validate() {
|
|
2355
2416
|
if (this.proxy) {
|
|
2356
|
-
this.proxy.setCustomValidity(
|
|
2417
|
+
this.proxy.setCustomValidity(this.#getCustomValidationError() ?? "");
|
|
2357
2418
|
}
|
|
2358
2419
|
super.validate(this.control);
|
|
2359
2420
|
}
|
|
2360
2421
|
formResetCallback() {
|
|
2361
2422
|
super.formResetCallback();
|
|
2362
|
-
|
|
2423
|
+
this.#dropzone.removeAllFiles();
|
|
2424
|
+
}
|
|
2425
|
+
#formatNumbersInMessage(message) {
|
|
2426
|
+
if (this.locale.common.useCommaAsDecimalSeparator) {
|
|
2427
|
+
return message.replace(/(\d+)\.(\d+)/g, "$1,$2");
|
|
2428
|
+
}
|
|
2429
|
+
return message;
|
|
2363
2430
|
}
|
|
2364
2431
|
/**
|
|
2365
2432
|
* Removes all files from the File Picker.
|
|
2366
2433
|
*/
|
|
2367
2434
|
removeAllFiles() {
|
|
2368
|
-
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
2371
|
-
_dropzone = new WeakMap();
|
|
2372
|
-
_FilePicker_instances = new WeakSet();
|
|
2373
|
-
syncSingleFileState_fn = function() {
|
|
2374
|
-
if (this.singleFile) {
|
|
2375
|
-
__privateGet(this, _dropzone)?.hiddenFileInput?.removeAttribute("multiple");
|
|
2376
|
-
} else {
|
|
2377
|
-
__privateGet(this, _dropzone)?.hiddenFileInput?.setAttribute("multiple", "multiple");
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
|
-
_localizeErrorMessage = new WeakMap();
|
|
2381
|
-
_localizeFileSizeNumberAndUnits = new WeakMap();
|
|
2382
|
-
addRemoveButtonToFilesPreview_fn = function() {
|
|
2383
|
-
__privateGet(this, _dropzone).on("addedfiles", (files) => {
|
|
2384
|
-
for (const file of files) {
|
|
2385
|
-
if (file.previewElement) {
|
|
2386
|
-
const removeButton = file.previewElement.querySelector(
|
|
2387
|
-
".remove-btn"
|
|
2388
|
-
);
|
|
2389
|
-
removeButton.addEventListener("click", (e) => {
|
|
2390
|
-
e.preventDefault();
|
|
2391
|
-
e.stopPropagation();
|
|
2392
|
-
__privateGet(this, _dropzone).removeFile(file);
|
|
2393
|
-
});
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
__privateMethod(this, _FilePicker_instances, handleFilesChanged_fn).call(this);
|
|
2397
|
-
});
|
|
2398
|
-
};
|
|
2399
|
-
chooseFile_fn = function() {
|
|
2400
|
-
if (__privateGet(this, _dropzone).hiddenFileInput) {
|
|
2401
|
-
__privateGet(this, _dropzone).hiddenFileInput.click();
|
|
2402
|
-
}
|
|
2403
|
-
};
|
|
2404
|
-
updateHiddenFileInput_fn = function() {
|
|
2405
|
-
__privateGet(this, _dropzone).hiddenFileInput.dispatchEvent(
|
|
2406
|
-
new Event("change", { bubbles: false })
|
|
2407
|
-
);
|
|
2408
|
-
};
|
|
2409
|
-
keepOnlyNewestFile_fn = function() {
|
|
2410
|
-
for (let i = 0; i < this.files.length - 1; i++) {
|
|
2411
|
-
__privateGet(this, _dropzone).removeFile(this.files[i]);
|
|
2412
|
-
}
|
|
2413
|
-
};
|
|
2414
|
-
handleFilesChanged_fn = function() {
|
|
2415
|
-
if (this.singleFile && this.files.length >= 1) {
|
|
2416
|
-
__privateMethod(this, _FilePicker_instances, keepOnlyNewestFile_fn).call(this);
|
|
2417
|
-
}
|
|
2418
|
-
this.$emit("change");
|
|
2419
|
-
__privateMethod(this, _FilePicker_instances, updateFormValue_fn).call(this);
|
|
2420
|
-
this.validate();
|
|
2421
|
-
requestAnimationFrame(() => __privateMethod(this, _FilePicker_instances, syncSingleFileState_fn).call(this));
|
|
2422
|
-
};
|
|
2423
|
-
updateFormValue_fn = function() {
|
|
2424
|
-
const files = this.files;
|
|
2425
|
-
if (!this.name) {
|
|
2426
|
-
this.setFormValue(null);
|
|
2427
|
-
} else {
|
|
2428
|
-
const formData = new FormData();
|
|
2429
|
-
for (const file of files) {
|
|
2430
|
-
formData.append(this.name, file);
|
|
2431
|
-
}
|
|
2432
|
-
this.setFormValue(formData);
|
|
2433
|
-
}
|
|
2434
|
-
__privateMethod(this, _FilePicker_instances, setValueToAFakePathLikeNativeInput_fn).call(this);
|
|
2435
|
-
};
|
|
2436
|
-
setValueToAFakePathLikeNativeInput_fn = function() {
|
|
2437
|
-
this.value = this.files.length > 0 ? `C:\\fakepath\\${this.files[0].name}` : "";
|
|
2438
|
-
};
|
|
2439
|
-
getCustomValidationError_fn = function() {
|
|
2440
|
-
if (this.rejectedFiles.length > 0) {
|
|
2441
|
-
return this.locale.filePicker.invalidFilesError;
|
|
2435
|
+
this.#dropzone?.removeAllFiles();
|
|
2442
2436
|
}
|
|
2443
|
-
|
|
2444
|
-
};
|
|
2445
|
-
formatNumbersInMessage_fn = function(message) {
|
|
2446
|
-
if (this.locale.common.useCommaAsDecimalSeparator) {
|
|
2447
|
-
return message.replace(/(\d+)\.(\d+)/g, "$1,$2");
|
|
2448
|
-
}
|
|
2449
|
-
return message;
|
|
2450
|
-
};
|
|
2437
|
+
}
|
|
2451
2438
|
__decorateClass([
|
|
2452
2439
|
vividElement.attr({ attribute: "single-file", mode: "boolean" })
|
|
2453
|
-
],
|
|
2440
|
+
], FilePicker.prototype, "singleFile");
|
|
2454
2441
|
__decorateClass([
|
|
2455
2442
|
vividElement.attr({ attribute: "max-files" })
|
|
2456
|
-
],
|
|
2443
|
+
], FilePicker.prototype, "maxFiles");
|
|
2457
2444
|
__decorateClass([
|
|
2458
2445
|
vividElement.attr({ mode: "fromView", attribute: "max-file-size" })
|
|
2459
|
-
],
|
|
2446
|
+
], FilePicker.prototype, "maxFileSize");
|
|
2460
2447
|
__decorateClass([
|
|
2461
2448
|
vividElement.attr
|
|
2462
|
-
],
|
|
2449
|
+
], FilePicker.prototype, "accept");
|
|
2463
2450
|
__decorateClass([
|
|
2464
2451
|
vividElement.attr
|
|
2465
|
-
],
|
|
2452
|
+
], FilePicker.prototype, "size");
|
|
2466
2453
|
__decorateClass([
|
|
2467
2454
|
vividElement.attr({ attribute: "invalid-file-type-error" })
|
|
2468
|
-
],
|
|
2455
|
+
], FilePicker.prototype, "invalidFileTypeError");
|
|
2469
2456
|
__decorateClass([
|
|
2470
2457
|
vividElement.attr({ attribute: "max-files-exceeded-error" })
|
|
2471
|
-
],
|
|
2458
|
+
], FilePicker.prototype, "maxFilesExceededError");
|
|
2472
2459
|
__decorateClass([
|
|
2473
2460
|
vividElement.attr({ attribute: "file-too-big-error" })
|
|
2474
|
-
],
|
|
2475
|
-
exports.FilePicker = __decorateClass([
|
|
2476
|
-
formElements.errorText,
|
|
2477
|
-
formElements.formElements
|
|
2478
|
-
], exports.FilePicker);
|
|
2479
|
-
applyMixinsWithObservables.applyMixinsWithObservables(exports.FilePicker, formElements.FormElementHelperText);
|
|
2461
|
+
], FilePicker.prototype, "fileTooBigError");
|
|
2480
2462
|
|
|
2481
2463
|
const getClasses = ({ size }) => classNames.classNames("control", "dz-default", "dz-message", [
|
|
2482
2464
|
`size-${size}`,
|
|
@@ -2493,18 +2475,21 @@ const FilePickerTemplate = (context) => {
|
|
|
2493
2475
|
(x) => x.label,
|
|
2494
2476
|
vividElement.html`<label>${(x) => x.label}</label>`
|
|
2495
2477
|
)}
|
|
2496
|
-
<div
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2478
|
+
<div class="control-wrapper">
|
|
2479
|
+
<div
|
|
2480
|
+
${ref.ref("control")}
|
|
2481
|
+
class="${getClasses}"
|
|
2482
|
+
tabindex="0"
|
|
2483
|
+
@keydown="${(x, c) => x.handleKeydown(c.event)}"
|
|
2484
|
+
aria-describedby="${(x) => x._feedbackDescribedBy}"
|
|
2485
|
+
${delegatesAria.delegateAria({
|
|
2502
2486
|
role: "button"
|
|
2503
2487
|
})}
|
|
2504
|
-
|
|
2505
|
-
|
|
2488
|
+
>
|
|
2489
|
+
<slot class="main"></slot>
|
|
2490
|
+
</div>
|
|
2491
|
+
${(x) => x._getFeedbackTemplate(context)}
|
|
2506
2492
|
</div>
|
|
2507
|
-
${formElements.getFeedbackTemplate(context)}
|
|
2508
2493
|
<div class="preview-list"></div>
|
|
2509
2494
|
</div>
|
|
2510
2495
|
`;
|
|
@@ -2512,9 +2497,9 @@ const FilePickerTemplate = (context) => {
|
|
|
2512
2497
|
|
|
2513
2498
|
const filePickerDefinition = vividElement.defineVividComponent(
|
|
2514
2499
|
"file-picker",
|
|
2515
|
-
|
|
2500
|
+
FilePicker,
|
|
2516
2501
|
FilePickerTemplate,
|
|
2517
|
-
[definition$1.iconDefinition, definition.buttonDefinition],
|
|
2502
|
+
[definition$1.iconDefinition, definition.buttonDefinition, mixins.feedbackMessageDefinition],
|
|
2518
2503
|
{
|
|
2519
2504
|
styles,
|
|
2520
2505
|
shadowOptions: {
|
|
@@ -2524,5 +2509,6 @@ const filePickerDefinition = vividElement.defineVividComponent(
|
|
|
2524
2509
|
);
|
|
2525
2510
|
const registerFilePicker = vividElement.createRegisterFunction(filePickerDefinition);
|
|
2526
2511
|
|
|
2512
|
+
exports.FilePicker = FilePicker;
|
|
2527
2513
|
exports.filePickerDefinition = filePickerDefinition;
|
|
2528
2514
|
exports.registerFilePicker = registerFilePicker;
|